improve eslint

This commit is contained in:
Pooya Parsa 2018-03-16 23:22:03 +03:30
parent efd7c1b4d1
commit 46216e6548
2 changed files with 32 additions and 7 deletions

View File

@ -8,20 +8,44 @@ module.exports = {
browser: true, browser: true,
node: true node: true
}, },
extends: ['standard', 'standard-jsx'], extends: [
'standard',
'standard-jsx',
'plugin:import/errors',
'plugin:import/warnings'
],
// required to lint *.vue files // required to lint *.vue files
plugins: [ plugins: [
'html' 'html'
], ],
// add your custom rules here settings: {
'import/resolver': {
node: { extensions: ['.js', '.mjs'] }
}
},
rules: { rules: {
// allow paren-less arrow functions // Enforce import order
'import/order': 2,
// Imports should come first
'import/first': 2,
// Other import rules
"import/no-mutable-exports": 2,
// Allow unresolved imports
'import/no-unresolved': 0,
// Allow paren-less arrow functions
'arrow-parens': 0, 'arrow-parens': 0,
// allow async-await
// Allow async-await
'generator-star-spacing': 0, 'generator-star-spacing': 0,
// allow debugger during development
// Allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
// do not allow console.logs etc...
// Do not allow console.logs etc...
'no-console': 2, 'no-console': 2,
'space-before-function-paren': [ 'space-before-function-paren': [
2, 2,
@ -31,5 +55,6 @@ module.exports = {
} }
], ],
}, },
globals: {} globals: {}
} }

View File

@ -49,7 +49,7 @@
"test": "npm run lint && nyc ava --verbose test/ -- && nyc report --reporter=html", "test": "npm run lint && nyc ava --verbose test/ -- && nyc report --reporter=html",
"test-appveyor": "npm run lint && nyc ava --serial test/ -- && nyc report --reporter=html", "test-appveyor": "npm run lint && nyc ava --serial test/ -- && nyc report --reporter=html",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"lint": "eslint --ext .js,.vue bin/* build/ lib/ test/ examples/", "lint": "eslint --ext .js,.mjs,.vue bin/* build/ lib/ test/ examples/",
"precommit": "npm run lint", "precommit": "npm run lint",
"postinstall": "opencollective postinstall || exit 0" "postinstall": "opencollective postinstall || exit 0"
}, },