|
|
@ -1,26 +1,33 @@ |
|
|
|
module.exports = { |
|
|
|
ecmaVersion: 2017, |
|
|
|
const Neutrino = require('./packages/neutrino'); |
|
|
|
const airbnb = require('./packages/neutrino-preset-airbnb-base'); |
|
|
|
|
|
|
|
// http://eslint.org/docs/user-guide/configuring#specifying-parser-options
|
|
|
|
ecmaFeatures: { |
|
|
|
modules: true, |
|
|
|
decorators: true, |
|
|
|
experimentalObjectRestSpread: true, |
|
|
|
}, |
|
|
|
const api = new Neutrino(); |
|
|
|
|
|
|
|
env: { |
|
|
|
api.use(airbnb, { |
|
|
|
eslint: { |
|
|
|
node: true, |
|
|
|
browser: true, |
|
|
|
es6: true, |
|
|
|
worker: true, |
|
|
|
serviceworker: true, |
|
|
|
}, |
|
|
|
plugins: ['eslint-plugin-prettier'], |
|
|
|
rules: { |
|
|
|
// Disable necessitating return after a callback
|
|
|
|
'callback-return': 'off', |
|
|
|
|
|
|
|
plugins: [ |
|
|
|
'eslint-plugin-prettier', |
|
|
|
], |
|
|
|
// Allow using class methods with static/non-instance functionality
|
|
|
|
// React lifecycle methods commonly do not use an instance context for anything
|
|
|
|
'class-methods-use-this': 'off', |
|
|
|
|
|
|
|
// Disallow trailing commas on arrays, objects, functions, et al
|
|
|
|
'comma-dangle': ['error', 'never'], |
|
|
|
|
|
|
|
// Require all requires be top-level
|
|
|
|
// http://eslint.org/docs/rules/global-require
|
|
|
|
'global-require': 'error', |
|
|
|
|
|
|
|
// Enforces error handling in callbacks (node environment)
|
|
|
|
'handle-callback-err': 'off', |
|
|
|
|
|
|
|
// Allow dynamic requires
|
|
|
|
'import/no-dynamic-require': 'off', |
|
|
|
|
|
|
|
rules: { |
|
|
|
// Specify the maximum length of a line in your program
|
|
|
|
// JSX can get lengthy, so this helps alleviate that a bit
|
|
|
|
// http://eslint.org/docs/rules/max-len
|
|
|
@ -31,20 +38,41 @@ module.exports = { |
|
|
|
ignoreTemplateLiterals: true |
|
|
|
}], |
|
|
|
|
|
|
|
// Allow using class methods with static/non-instance functionality
|
|
|
|
// React lifecycle methods commonly do not use an instance context for anything
|
|
|
|
'class-methods-use-this': 'off', |
|
|
|
|
|
|
|
// Disallow trailing commas on arrays, objects, functions, et al
|
|
|
|
'comma-dangle': ['error', 'never'], |
|
|
|
|
|
|
|
// Allow console during development, otherwise throw an error
|
|
|
|
'no-console': 'warn', |
|
|
|
|
|
|
|
// Allow extra parentheses since multiline JSX being wrapped in parens is considered idiomatic
|
|
|
|
'no-extra-parens': 'off', |
|
|
|
|
|
|
|
// Disallow mixing regular variable and require declarations
|
|
|
|
'no-mixed-requires': ['off', false], |
|
|
|
|
|
|
|
// Disallow use of new operator with the require function
|
|
|
|
'no-new-require': 'error', |
|
|
|
|
|
|
|
// Disallow string concatenation with __dirname and __filename
|
|
|
|
// http://eslint.org/docs/rules/no-path-concat
|
|
|
|
'no-path-concat': 'error', |
|
|
|
|
|
|
|
// Allow use of process.env
|
|
|
|
'no-process-env': 'off', |
|
|
|
|
|
|
|
// Allow process.exit()
|
|
|
|
'no-process-exit': 'off', |
|
|
|
|
|
|
|
// Restrict usage of specified node modules
|
|
|
|
'no-restricted-modules': 'off', |
|
|
|
|
|
|
|
// Allowing shadowing variable that share the same context as the outer scope
|
|
|
|
'no-shadow': 'off', |
|
|
|
|
|
|
|
// Allow use of synchronous methods (off by default)
|
|
|
|
'no-sync': 'off', |
|
|
|
|
|
|
|
// Our frontend strives to adopt functional programming practices, so we prefer const over let
|
|
|
|
'prefer-const': 'error', |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
module.exports = api.eslintrc(); |
|
|
|