eslint-config-novacredit
Version:
Nova Credit's configuration for style
77 lines (76 loc) • 2.61 kB
JavaScript
;
const path = require('path');
module.exports = {
extends: ['eslint-config-airbnb'],
rules: {
'key-spacing': ['error', { beforeColon: false, afterColon: true, mode: 'minimum' }],
'dot-notation': 0,
indent: [2, 'tab', { SwitchCase: 1, MemberExpression: 'off' }],
'no-else-return': 0,
'no-tabs': 0,
'no-plusplus': 0,
'no-bitwise': 0,
'no-prototype-builtins': 0,
'no-mixed-operators': 0,
'class-methods-use-this': 0,
'import/prefer-default-export': 0,
'import/no-named-as-default': 0,
'import/no-named-as-default-member': 0,
'import/no-extraneous-dependencies': 0,
'arrow-body-style': 0,
'no-underscore-dangle': 0,
'no-console': 2,
'no-confusing-arrow': ['error', { allowParens: true }],
'no-multi-spaces': [
'error',
{
exceptions: {
VariableDeclarator: true,
ImportDeclaration: true,
AssignmentExpression: true,
},
},
],
'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
'arrow-parens': ['warn', 'as-needed', { requireForBlockBody: false }],
'wrap-iife': ['warn', 'any'],
'object-curly-newline': ['error', { consistent: true }],
'operator-linebreak': 0,
'function-paren-newline': ['error', 'consistent'],
'implicit-arrow-linebreak': 0,
camelcase: ['error', { ignoreDestructuring: true, properties: 'never' }],
'prefer-object-spread': 0,
'no-restricted-syntax': [
'error',
{
selector: "BinaryExpression[operator='in']",
message: 'Avoid using the `in operator` because it includes properties inherited from the prototype chain and does not work as expected with arrays.',
},
// Below are the rules from AirBnB config (which we want to extend while adding the above rule).
{
selector: 'ForInStatement',
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
selector: 'ForOfStatement',
message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
},
{
selector: 'LabeledStatement',
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
selector: 'WithStatement',
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],
'max-params': ['error', { max: 3 }],
},
settings: {
'import/resolver': {
node: {
paths: ['src'],
}
}
}
};