Skip to content

Commit

Permalink
🆕 chore(.eslintignore): add ignore rules for /dist and /node_modules …
Browse files Browse the repository at this point in the history
…directories, add .eslintrc.js and babel.config.js files

🆕 chore(.eslintrc.js): add custom eslint rules
The .eslintignore file now includes the /dist and /node_modules directories, as well as the .eslintrc.js and babel.config.js files. The .eslintrc.js file now includes custom eslint rules, such as enforcing semicolons, spaces before function parentheses, and curly braces. Additionally, the file includes rules for importing named, namespace, default, and exported modules.

🐛 fix(rollup.config.js): add semicolons to import statements
✨ feat(rollup.config.js): enable terser plugin
The import statements in the rollup.config.js file were missing semicolons, which could cause issues in some environments. The terser plugin was also enabled to minify the output code.
  • Loading branch information
jofftiquez committed May 11, 2023
1 parent 1d3e8e7 commit 6f2cef4
Show file tree
Hide file tree
Showing 4 changed files with 1,495 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/dist
/node_modules
.eslintrc.js
babel.config.js
60 changes: 60 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module.exports = {
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
// This option interrupts the configuration hierarchy at this file
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
root: true,

env: {
browser: true,
'vue/setup-compiler-macros': true
},

// Rules order is important, please avoid shuffling them
extends: [
// Base ESLint recommended rules
'eslint:recommended',
// See https://eslint.vuejs.org/rules/#available-rules
'plugin:vue/vue3-essential',
'standard'
],

plugins: [
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
// required to lint *.vue files
'vue',
],

globals: {
terser: 'readonly',
},

// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow paren-less arrow functions
'arrow-parens': 'off',
'one-var': 'off',

'import/first': 'off',
'import/named': 'error',
'import/namespace': 'error',
'import/default': 'error',
'import/export': 'error',
'import/extensions': 'off',
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': 'off',
'prefer-promise-reject-errors': 'off',

// custom
'semi': [2, 'always'],
'space-before-function-paren': [2, 'always'],
'keyword-spacing': [2, { before: true, after: true }],
'space-before-blocks': [2, 'always'],
'comma-dangle': [2, 'always-multiline'],
'no-console': 'off',
'no-multi-str': 'off',
'curly': 1,
'vue/multi-word-component-names': 'off'
}
}
18 changes: 9 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const terser = require('@rollup/plugin-terser')
const babel = require('@rollup/plugin-babel')
const commonjs = require('@rollup/plugin-commonjs')
const terser = require('@rollup/plugin-terser');
const babel = require('@rollup/plugin-babel');
const commonjs = require('@rollup/plugin-commonjs');

module.exports = {
input: 'src/index.js',
Expand All @@ -9,13 +9,13 @@ module.exports = {
format: 'cjs',
},
plugins: [
// terser(),
terser(),
commonjs(),
babel.getBabelOutputPlugin({
presets: ['@babel/preset-env'],
plugins: [
['@babel/plugin-proposal-optional-chaining']
]
})
]
}
['@babel/plugin-proposal-optional-chaining'],
],
}),
],
};
Loading

0 comments on commit 6f2cef4

Please sign in to comment.