275 lines
13 KiB
JavaScript
275 lines
13 KiB
JavaScript
module.exports = {
|
|
|
|
globals: {},
|
|
|
|
extends: 'eslint:recommended',
|
|
|
|
rules: {
|
|
// Possible Errors https://eslint.org/docs/rules/#possible-errors
|
|
'no-await-in-loop': 'warn',
|
|
'no-console': 'warn',
|
|
'no-constant-condition': ['error', { checkLoops: false }],
|
|
'no-dupe-else-if': 'error',
|
|
'no-extra-parens': ['error', { conditionalAssign: false }],
|
|
'no-import-assign': 'error',
|
|
'no-setter-return': 'error',
|
|
'no-template-curly-in-string': 'error',
|
|
'valid-typeof': ['error', { requireStringLiterals: true }],
|
|
|
|
// Best Practices https://eslint.org/docs/rules/#best-practices
|
|
'array-callback-return': ['error', { allowImplicit: false }],
|
|
'block-scoped-var': 'error',
|
|
'class-methods-use-this': 'error',
|
|
complexity: ['warn', { max: 5 }],
|
|
'consistent-return': ['error', { treatUndefinedAsUnspecified: false }],
|
|
curly: ['error', 'multi'],
|
|
'default-case': ['error', { commentPattern: '^no\\sdefault' }],
|
|
'default-param-last': 'error',
|
|
'dot-location': ['error', 'property'],
|
|
'dot-notation': ['error', { allowKeywords: true }],
|
|
eqeqeq: ['error', 'always'],
|
|
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
|
|
'guard-for-in': 'error',
|
|
'max-classes-per-file': ['error', 1],
|
|
'no-alert': 'error',
|
|
'no-caller': 'error',
|
|
'no-constructor-return': 'error',
|
|
'no-div-regex': 'error',
|
|
'no-else-return': ['error', { allowElseIf: false }],
|
|
'no-empty-function': 'error',
|
|
'no-eq-null': 'error',
|
|
'no-eval': ['error', { allowIndirect: false }],
|
|
'no-extend-native': 'error',
|
|
'no-extra-bind': 'error',
|
|
'no-extra-label': 'error',
|
|
'no-fallthrough': ['error', { commentPattern: 'break[\\s\\w]*omitted' }],
|
|
'no-floating-decimal': 'error',
|
|
'no-implicit-coercion': 'error',
|
|
'no-implicit-globals': 'error',
|
|
'no-implied-eval': 'error',
|
|
'no-invalid-this': 'error',
|
|
'no-iterator': 'error',
|
|
'no-lone-blocks': 'error',
|
|
'no-loop-func': 'error',
|
|
'no-magic-numbers': ['error', { enforceConst: true, ignoreArrayIndexes: true, detectObjects: false }],
|
|
'no-multi-spaces': 'error',
|
|
'no-multi-str': 'error',
|
|
'no-new': 'error',
|
|
'no-new-func': 'error',
|
|
'no-new-wrappers': 'error',
|
|
'no-octal-escape': 'error',
|
|
'no-param-reassign': 'error',
|
|
'no-proto': 'error',
|
|
'no-restricted-properties': 'error',
|
|
'no-return-assign': ['error', 'except-parens'],
|
|
'no-return-await': 'error',
|
|
'no-script-url': 'error',
|
|
'no-self-compare': 'error',
|
|
'no-sequences': 'error',
|
|
'no-throw-literal': 'error',
|
|
'no-unmodified-loop-condition': 'error',
|
|
'no-unused-expressions': 'error',
|
|
'no-useless-call': 'error',
|
|
'no-useless-concat': 'error',
|
|
'no-useless-return': 'error',
|
|
'no-void': 'error',
|
|
'no-warning-comments': 'warn',
|
|
'prefer-named-capture-group': 'warn',
|
|
'prefer-promise-reject-errors': 'error',
|
|
'prefer-regex-literals': 'error',
|
|
radix: ['error', 'as-needed'],
|
|
'require-await': 'error',
|
|
'require-unicode-regexp': 'error',
|
|
'vars-on-top': 'error',
|
|
'wrap-iife': ['error', 'inside'],
|
|
yoda: ['error', 'always', { exceptRange: true }],
|
|
|
|
// Strict Mode https://eslint.org/docs/rules/#strict-mode
|
|
strict: ['error', 'safe'],
|
|
|
|
// Variables https://eslint.org/docs/rules/#variables
|
|
'init-declarations': ['error', 'always'],
|
|
'no-label-var': 'error',
|
|
'no-shadow': ['error', { builtinGlobals: true, hoist: 'all' }],
|
|
'no-undef-init': 'error',
|
|
'no-undefined': 'error',
|
|
'no-use-before-define': 'error',
|
|
|
|
// Node.js and CommonJS https://eslint.org/docs/rules/#node-js-and-commonjs
|
|
'callback-return': 'error',
|
|
'global-require': 'error',
|
|
'handle-callback-err': 'error',
|
|
'no-buffer-constructor': 'error',
|
|
'no-mixed-requires': 'error',
|
|
'no-new-require': 'error',
|
|
'no-path-concat': 'error',
|
|
'no-process-env': 'warn',
|
|
'no-process-exit': 'warn',
|
|
'no-sync': ['error', { allowAtRootLevel: true }],
|
|
|
|
// Stylistic Issues https://eslint.org/docs/rules/#stylistic-issues
|
|
'array-bracket-newline': ['error', { multiline: true, minItems: 2 }],
|
|
'array-bracket-spacing': ['error', 'always'],
|
|
'array-element-newline': ['error', { multiline: true, minItems: 2 }],
|
|
'block-spacing': ['error', 'always'],
|
|
'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
|
|
camelcase: 'error',
|
|
'comma-dangle': ['error', 'never'],
|
|
'comma-spacing': 'error',
|
|
'comma-style': 'error',
|
|
'computed-property-spacing': ['error', 'never'],
|
|
'consistent-this': 'error',
|
|
'eol-last': 'error',
|
|
'func-call-spacing': ['error', 'always'],
|
|
'func-name-matching': ['error', 'always'],
|
|
'func-names': ['error', 'always'],
|
|
'func-style': ['error', 'declaration', { allowArrowFunctions: false }],
|
|
'function-call-argument-newline': ['error', 'consistent'],
|
|
'function-paren-newline': ['error', 'multiline-arguments'],
|
|
'id-match': ['error', '^([nsoa]([A-Z][a-z]+)+|[a-z])$'],
|
|
'implicit-arrow-linebreak': ['error', 'beside'],
|
|
indent: ['error', 2],
|
|
'jsx-quotes': 'error',
|
|
'key-spacing': [
|
|
'error',
|
|
{
|
|
singleLine: {
|
|
beforeColon: false,
|
|
afterColon: true,
|
|
mode: 'strict'
|
|
},
|
|
align: {
|
|
align: 'value',
|
|
beforeColon: false,
|
|
afterColon: true,
|
|
mode: 'minimum'
|
|
},
|
|
multiline: {
|
|
beforeColon: false,
|
|
afterColon: true,
|
|
mode: 'strict'
|
|
}
|
|
}
|
|
],
|
|
'keyword-spacing': 'error',
|
|
'line-comment-position': 'error',
|
|
'linebreak-style': ['error', 'unix'],
|
|
'lines-around-comment': [
|
|
'error',
|
|
{
|
|
beforeBlockComment: true,
|
|
beforeLineComment: true
|
|
}
|
|
],
|
|
'lines-between-class-members': [
|
|
'error',
|
|
'always',
|
|
{ exceptAftersingleLine: true }
|
|
],
|
|
'max-depth': ['error', 4],
|
|
'max-len': ['error', { code: 80, tabWidth: 4 }],
|
|
'max-lines': [
|
|
'error',
|
|
{
|
|
max: 300,
|
|
skipBlankLines: true,
|
|
ignoreComments: true
|
|
}
|
|
],
|
|
'max-lines-per-function': [
|
|
'error',
|
|
{
|
|
max: 50,
|
|
skipBlankLines: true,
|
|
skipComments: true,
|
|
IIFEs: true
|
|
}],
|
|
'max-nested-callbacks': ['error', 3],
|
|
'max-params': ['error', 3],
|
|
'max-statements': ['error', 20],
|
|
'max-statements-per-line': 'error',
|
|
'multiline-comment-style': ['error', 'starred-block'],
|
|
'multiline-ternary': ['error', 'always-multiline'],
|
|
'new-cap': 'error',
|
|
'new-parens': ['error', 'never'],
|
|
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 1 }],
|
|
'no-array-constructor': 'error',
|
|
'no-bitwise': 'warn',
|
|
'no-inline-comments': 'error',
|
|
'no-lonely-if': 'error',
|
|
'no-mixed-operators': 'error',
|
|
'no-multi-assign': 'error',
|
|
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1, maxBOF: 0 }],
|
|
'no-negated-condition': 'error',
|
|
'no-nested-ternary': 'error',
|
|
'no-new-object': 'error',
|
|
'no-tabs': 'error',
|
|
'no-trailing-spaces': 'error',
|
|
'no-underscore-dangle': 'error',
|
|
'no-unneeded-ternary': 'error',
|
|
'no-whitespace-before-property': 'error',
|
|
'nonblock-statement-body-position': ['error', 'below'],
|
|
'object-curly-newline': ['error', 'multiline'],
|
|
'object-curly-spacing': ['error', 'always'],
|
|
'object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
|
|
'one-var': ['error', 'never'],
|
|
'one-var-declaration-per-line': ['error', 'always'],
|
|
'operator-assignment': ['error', 'always'],
|
|
'operator-linebreak': ['error', 'before'],
|
|
'padded-blocks': ['error', 'never'],
|
|
'prefer-exponentiation-operator': 'error',
|
|
'prefer-object-spread': 'error',
|
|
'quote-props': ['error', 'as-needed'],
|
|
quotes: ['error', 'single'],
|
|
semi: ['error', 'always'],
|
|
'semi-spacing': 'error',
|
|
'semi-style': 'error',
|
|
'sort-keys': [
|
|
'warn',
|
|
'asc',
|
|
{
|
|
minKeys: 10,
|
|
natural: true,
|
|
caseSensitive: true
|
|
}
|
|
],
|
|
'space-before-blocks': ['error', 'always'],
|
|
'space-before-function-paren': ['error', 'always'],
|
|
'space-in-parens': ['error', 'never'],
|
|
'space-infix-ops': null, // https://eslint.org/docs/rules/space-infix-ops // require spacing around infix operators
|
|
'space-unary-ops': null, // https://eslint.org/docs/rules/space-unary-ops // enforce consistent spacing before or after unary operators
|
|
'spaced-comment': null, // https://eslint.org/docs/rules/spaced-comment // enforce consistent spacing after the `//` or `/*` in a comment
|
|
'switch-colon-spacing': null, // https://eslint.org/docs/rules/switch-colon-spacing // enforce spacing around colons of switch statements
|
|
'template-tag-spacing': null, // https://eslint.org/docs/rules/template-tag-spacing // require or disallow spacing between template tags and their literals
|
|
'unicode-bom': null, // https://eslint.org/docs/rules/unicode-bom // require or disallow Unicode byte order mark (BOM)
|
|
'wrap-regex': null, // https://eslint.org/docs/rules/wrap-regex // require parenthesis around regex literals
|
|
|
|
// ECMAScript 6 https://eslint.org/docs/rules/#ecmascript-6
|
|
'arrow-body-style': null, // https://eslint.org/docs/rules/arrow-body-style // require braces around arrow function bodies
|
|
'arrow-parens': null, // https://eslint.org/docs/rules/arrow-parens // require parentheses around arrow function arguments
|
|
'arrow-spacing': null, // https://eslint.org/docs/rules/arrow-spacing // enforce consistent spacing before and after the arrow in arrow functions
|
|
'generator-star-spacing': null, // https://eslint.org/docs/rules/generator-star-spacing // enforce consistent spacing around `*` operators in generator functions
|
|
'no-confusing-arrow': null, // https://eslint.org/docs/rules/no-confusing-arrow // disallow arrow functions where they could be confused with comparisons
|
|
'no-duplicate-imports': null, // https://eslint.org/docs/rules/no-duplicate-imports // disallow duplicate module imports
|
|
'no-restricted-imports': null, // https://eslint.org/docs/rules/no-restricted-imports // disallow specified modules when loaded by `import`
|
|
'no-useless-computed-key': null, // https://eslint.org/docs/rules/no-useless-computed-key // disallow unnecessary computed property keys in objects and classes
|
|
'no-useless-constructor': null, // https://eslint.org/docs/rules/no-useless-constructor // disallow unnecessary constructors
|
|
'no-useless-rename': null, // https://eslint.org/docs/rules/no-useless-rename // disallow renaming import, export, and destructured assignments to the same name
|
|
'no-var': null, // https://eslint.org/docs/rules/no-var // require `let` or `const` instead of `var`
|
|
'object-shorthand': null, // https://eslint.org/docs/rules/object-shorthand // require or disallow method and property shorthand syntax for object literals
|
|
'prefer-arrow-callback': null, // https://eslint.org/docs/rules/prefer-arrow-callback // require using arrow functions for callbacks
|
|
'prefer-const': null, // https://eslint.org/docs/rules/prefer-const // require `const` declarations for variables that are never reassigned after declared
|
|
'prefer-destructuring': null, // https://eslint.org/docs/rules/prefer-destructuring // require destructuring from arrays and/or objects
|
|
'prefer-numeric-literals': null, // https://eslint.org/docs/rules/prefer-numeric-literals // disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals
|
|
'prefer-rest-params': null, // https://eslint.org/docs/rules/prefer-rest-params // require rest parameters instead of `arguments`
|
|
'prefer-spread': null, // https://eslint.org/docs/rules/prefer-spread // require spread operators instead of `.apply()`
|
|
'prefer-template': null, // https://eslint.org/docs/rules/prefer-template // require template literals instead of string concatenation
|
|
'rest-spread-spacing': null, // https://eslint.org/docs/rules/rest-spread-spacing // enforce spacing between rest and spread operators and their expressions
|
|
'sort-imports': null, // https://eslint.org/docs/rules/sort-imports // enforce sorted import declarations within modules
|
|
'symbol-description': null, // https://eslint.org/docs/rules/symbol-description // require symbol descriptions
|
|
'template-curly-spacing': null, // https://eslint.org/docs/rules/template-curly-spacing // require or disallow spacing around embedded expressions of template strings
|
|
'yield-star-spacing': '' // require or disallow spacing around the `*` in `yield*` expressions
|
|
}
|
|
|
|
}
|