scode-eslint-config/index.js
2019-12-19 14:38:35 +01:00

236 lines
18 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
'accessor-pairs': 'off',
'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-labels': 'off',
'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-restricted-globals': 'off',
'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-restricted-modules': 'off',
'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',
'capitalized-comments': 'off',
'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-blacklist': 'off',
'id-length': null, // https://eslint.org/docs/rules/id-length // enforce minimum and maximum identifier lengths
'id-match': null, // https://eslint.org/docs/rules/id-match // require identifiers to match a specified regular expression
'implicit-arrow-linebreak': null, // https://eslint.org/docs/rules/implicit-arrow-linebreak // enforce the location of arrow function bodies
indent: ['error', 2],
'jsx-quotes': null, // https://eslint.org/docs/rules/jsx-quotes // enforce the consistent use of either double or single quotes in JSX attributes
'key-spacing': null, // https://eslint.org/docs/rules/key-spacing // enforce consistent spacing between keys and values in object literal properties
'keyword-spacing': null, // https://eslint.org/docs/rules/keyword-spacing // enforce consistent spacing before and after keywords
'line-comment-position': null, // https://eslint.org/docs/rules/line-comment-position // enforce position of line comments
'linebreak-style': null, // https://eslint.org/docs/rules/linebreak-style // enforce consistent linebreak style
'lines-around-comment': null, // https://eslint.org/docs/rules/lines-around-comment // require empty lines around comments
'lines-between-class-members': null, // https://eslint.org/docs/rules/lines-between-class-members // require or disallow an empty line between class members
'max-depth': null, // https://eslint.org/docs/rules/max-depth // enforce a maximum depth that blocks can be nested
'max-len': null, // https://eslint.org/docs/rules/max-len // enforce a maximum line length
'max-lines': null, // https://eslint.org/docs/rules/max-lines // enforce a maximum number of lines per file
'max-lines-per-function': null, // https://eslint.org/docs/rules/max-lines-per-function // enforce a maximum number of line of code in a function
'max-nested-callbacks': null, // https://eslint.org/docs/rules/max-nested-callbacks // enforce a maximum depth that callbacks can be nested
'max-params': null, // https://eslint.org/docs/rules/max-params // enforce a maximum number of parameters in function definitions
'max-statements': null, // https://eslint.org/docs/rules/max-statements // enforce a maximum number of statements allowed in function blocks
'max-statements-per-line': null, // https://eslint.org/docs/rules/max-statements-per-line // enforce a maximum number of statements allowed per line
'multiline-comment-style': null, // https://eslint.org/docs/rules/multiline-comment-style // enforce a particular style for multiline comments
'multiline-ternary': null, // https://eslint.org/docs/rules/multiline-ternary // enforce newlines between operands of ternary expressions
'new-cap': null, // https://eslint.org/docs/rules/new-cap // require constructor names to begin with a capital letter
'new-parens': null, // https://eslint.org/docs/rules/new-parens // enforce or disallow parentheses when invoking a constructor with no arguments
'newline-per-chained-call': null, // https://eslint.org/docs/rules/newline-per-chained-call // require a newline after each call in a method chain
'no-array-constructor': null, // https://eslint.org/docs/rules/no-array-constructor // disallow `Array` constructors
'no-bitwise': null, // https://eslint.org/docs/rules/no-bitwise // disallow bitwise operators
'no-continue': null, // https://eslint.org/docs/rules/no-continue // disallow `continue` statements
'no-inline-comments': null, // https://eslint.org/docs/rules/no-inline-comments // disallow inline comments after code
'no-lonely-if': null, // https://eslint.org/docs/rules/no-lonely-if // disallow `if` statements as the only statement in `else` blocks
'no-mixed-operators': null, // https://eslint.org/docs/rules/no-mixed-operators // disallow mixed binary operators
'no-multi-assign': null, // https://eslint.org/docs/rules/no-multi-assign // disallow use of chained assignment expressions
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1, maxBOF: 0 }],
'no-negated-condition': null, // https://eslint.org/docs/rules/no-negated-condition // disallow negated conditions
'no-nested-ternary': null, // https://eslint.org/docs/rules/no-nested-ternary // disallow nested ternary expressions
'no-new-object': null, // https://eslint.org/docs/rules/no-new-object // disallow `Object` constructors
'no-plusplus': null, // https://eslint.org/docs/rules/no-plusplus // disallow the unary operators `++` and `--`
'no-restricted-syntax': null, // https://eslint.org/docs/rules/no-restricted-syntax // disallow specified syntax
'no-tabs': null, // https://eslint.org/docs/rules/no-tabs // disallow all tabs
'no-ternary': null, // https://eslint.org/docs/rules/no-ternary // disallow ternary operators
'no-trailing-spaces': 'error',
'no-underscore-dangle': null, // https://eslint.org/docs/rules/no-underscore-dangle // disallow dangling underscores in identifiers
'no-unneeded-ternary': null, // https://eslint.org/docs/rules/no-unneeded-ternary // disallow ternary operators when simpler alternatives exist
'no-whitespace-before-property': null, // https://eslint.org/docs/rules/no-whitespace-before-property // disallow whitespace before properties
'nonblock-statement-body-position': null, // https://eslint.org/docs/rules/nonblock-statement-body-position // enforce the location of single-line statements
'object-curly-newline': null, // https://eslint.org/docs/rules/object-curly-newline // enforce consistent line breaks inside braces
'object-curly-spacing': null, // https://eslint.org/docs/rules/object-curly-spacing // enforce consistent spacing inside braces
'object-property-newline': null, // https://eslint.org/docs/rules/object-property-newline // enforce placing object properties on separate lines
'one-var': null, // https://eslint.org/docs/rules/one-var // enforce variables to be declared either together or separately in functions
'one-var-declaration-per-line': null, // https://eslint.org/docs/rules/one-var-declaration-per-line // require or disallow newlines around variable declarations
'operator-assignment': null, // https://eslint.org/docs/rules/operator-assignment // require or disallow assignment operator shorthand where possible
'operator-linebreak': null, // https://eslint.org/docs/rules/operator-linebreak // enforce consistent linebreak style for operators
'padded-blocks': null, // https://eslint.org/docs/rules/padded-blocks // require or disallow padding within blocks
'padding-line-between-statements': null, // https://eslint.org/docs/rules/padding-line-between-statements // require or disallow padding lines between statements
'prefer-exponentiation-operator': null, // https://eslint.org/docs/rules/prefer-exponentiation-operator // disallow the use of `Math.pow` in favor of the `**` operator
'prefer-object-spread': null, // https://eslint.org/docs/rules/prefer-object-spread // disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.
'quote-props': null, // https://eslint.org/docs/rules/quote-props // require quotes around object literal property names
quotes: ['error', 'single'],
semi: ['error', 'always'],
'semi-spacing': null, // https://eslint.org/docs/rules/semi-spacing // enforce consistent spacing before and after semicolons
'semi-style': null, // https://eslint.org/docs/rules/semi-style // enforce location of semicolons
'sort-keys': null, // https://eslint.org/docs/rules/sort-keys // require object keys to be sorted
'sort-vars': null, // https://eslint.org/docs/rules/sort-vars // require variables within the same declaration block to be sorted
'space-before-blocks': null, // https://eslint.org/docs/rules/space-before-blocks // enforce consistent spacing before blocks
'space-before-function-paren': null, // https://eslint.org/docs/rules/space-before-function-paren // enforce consistent spacing before `function` definition opening parenthesis
'space-in-parens': null, // https://eslint.org/docs/rules/space-in-parens // enforce consistent spacing inside parentheses
'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
}
}