scode-eslint-config/index.js

286 lines
18 KiB
JavaScript
Raw Normal View History

2019-12-13 12:25:10 +01:00
module.exports = {
globals: {},
rules: {
// Possible Errors https://eslint.org/docs/rules/#possible-errors
'for-direction': 'error',
'getter-return': ['error', { allowImplicit: false }],
'no-async-promise-executor': 'error',
'no-await-in-loop': 'warn',
'no-compare-neg-zero': 'error',
'no-cond-assign': ['error', 'except-parens'],
'no-console': 'warn',
'no-constant-condition': ['error', { checkLoops: false }],
'no-control-regex': 'error',
'no-debugger': 'warn',
'no-dupe-args': 'error',
'no-dupe-else-if': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'error',
'no-empty-character-class': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-extra-parens': ['error', { conditionalAssign: false }],
'no-extra-semi': 'error',
'no-func-assign': 'error',
'no-import-assign': 'error',
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-misleading-character-class': 'error',
'no-obj-calls': 'error',
'no-prototype-builtins': 'error',
'no-regex-spaces': 'error',
'no-setter-return': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-unexpected-multiline': 'error',
'no-unreachable': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'require-atomic-updates': 'error',
'use-isnan': '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-case-declarations': 'error',
2019-12-15 19:37:10 +01:00
'no-constructor-return': 'error',
2019-12-15 20:06:15 +01:00
'no-div-regex': 'error',
'no-else-return': ['error', { allowElseIf: false }],
2019-12-15 19:37:10 +01:00
'no-empty-function': 'error',
'no-empty-pattern': 'error',
2019-12-15 20:06:15 +01:00
'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',
2019-12-15 19:37:10 +01:00
'no-global-assign': 'error',
2019-12-15 20:06:15 +01:00
'no-implicit-coercion': 'error',
'no-implicit-globals': 'error',
2019-12-15 19:37:10 +01:00
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-iterator': 'error',
2019-12-15 20:06:15 +01:00
'no-labels': 'off',
2019-12-15 19:37:10 +01:00
'no-lone-blocks': 'error',
'no-loop-func': 'error',
2019-12-15 20:06:15 +01:00
'no-magic-numbers': ['error', { enforceConst: true, ignoreArrayIndexes: true, detectObjects: false }],
'no-multi-spaces': 'error',
2019-12-15 19:37:10 +01:00
'no-multi-str': 'error',
'no-new': 'error',
2019-12-13 12:25:10 +01:00
'no-new-func': '', // disallow `new` operators with the `Function` object
'no-new-wrappers': '', // disallow `new` operators with the `String`, `Number`, and `Boolean` objects
'no-octal': '', // disallow octal literals
'no-octal-escape': '', // disallow octal escape sequences in string literals
'no-param-reassign': '', // disallow reassigning `function` parameters
2019-12-15 19:37:10 +01:00
'no-proto': 'error',
'no-redeclare': 'error',
2019-12-13 12:25:10 +01:00
'no-restricted-properties': '', // disallow certain properties on certain objects
'no-return-assign': '', // disallow assignment operators in `return` statements
2019-12-15 19:37:10 +01:00
'no-return-await': 'error',
2019-12-13 12:25:10 +01:00
'no-script-url': '', // disallow `javascript:` urls
2019-12-15 19:37:10 +01:00
'no-self-assign': 'error',
'no-self-compare': 'error',
2019-12-13 12:25:10 +01:00
'no-sequences': '', // disallow comma operators
'no-throw-literal': '', // disallow throwing literals as exceptions
'no-unmodified-loop-condition': '', // disallow unmodified loop conditions
2019-12-15 19:37:10 +01:00
'no-unused-expressions': 'error',
2019-12-13 12:25:10 +01:00
'no-unused-labels': '', // disallow unused labels
'no-useless-call': '', // disallow unnecessary calls to `.call()` and `.apply()`
'no-useless-catch': '', // disallow unnecessary `catch` clauses
2019-12-15 19:37:10 +01:00
'no-useless-concat': 'error',
'no-useless-escape': 'error',
'no-useless-return': 'error',
2019-12-13 12:25:10 +01:00
'no-void': '', // disallow `void` operators
'no-warning-comments': '', // disallow specified warning terms in comments
'no-with': '', // disallow `with` statements
'prefer-named-capture-group': '', // enforce using named capture group in regular expression
'prefer-promise-reject-errors': '', // require using Error objects as Promise rejection reasons
'prefer-regex-literals': '', // disallow use of the `RegExp` constructor in favor of regular expression literals
radix: '', // enforce the consistent use of the radix argument when using `parseInt()`
2019-12-15 19:37:10 +01:00
'require-await': 'error',
2019-12-13 12:25:10 +01:00
'require-unicode-regexp': '', // enforce the use of `u` flag on RegExp
2019-12-15 19:37:10 +01:00
'vars-on-top': 'error',
2019-12-13 12:25:10 +01:00
'wrap-iife': '', // require parentheses around immediate `function` invocations
yoda: '', // require or disallow "Yoda" conditions
// ## Strict Mode
// These rules relate to strict mode directives:
strict: ['error', 'safe'],
// ## Variables
// These rules relate to variable declarations:
'init-declarations': '', // require or disallow initialization in variable declarations
'no-delete-var': '', // disallow deleting variables
'no-label-var': '', // disallow labels that share a name with a variable
'no-restricted-globals': '', // disallow specified global variables
'no-shadow': '', // disallow variable declarations from shadowing variables declared in the outer scope
'no-shadow-restricted-names': '', // disallow identifiers from shadowing restricted names
'no-undef': '', // disallow the use of undeclared variables unless mentioned in `/*global */` comments
'no-undef-init': '', // disallow initializing variables to `undefined`
'no-undefined': '', // disallow the use of `undefined` as an identifier
'no-unused-vars': '', // disallow unused variables
'no-use-before-define': '', // disallow the use of variables before they are defined
// ## Node.js and CommonJS
// These rules relate to code running in Node.js, or in browsers with CommonJS:
'callback-return': '', // require `return` statements after callbacks
'global-require': '', // require `require()` calls to be placed at top-level module scope
'handle-callback-err': '', // require error handling in callbacks
'no-buffer-constructor': '', // disallow use of the `Buffer()` constructor
'no-mixed-requires': '', // disallow `require` calls to be mixed with regular variable declarations
'no-new-require': '', // disallow `new` operators with calls to `require`
'no-path-concat': '', // disallow string concatenation with `__dirname` and `__filename`
'no-process-env': '', // disallow the use of `process.env`
'no-process-exit': '', // disallow the use of `process.exit()`
'no-restricted-modules': '', // disallow specified modules when loaded by `require`
'no-sync': '', // disallow synchronous methods
// ## Stylistic Issues
// These rules relate to style guidelines, and are therefore quite subjective:
'array-bracket-newline': '', // enforce linebreaks after opening and before closing array brackets
'array-bracket-spacing': '', // enforce consistent spacing inside array brackets
'array-element-newline': '', // enforce line breaks after each array element
'block-spacing': '', // disallow or enforce spaces inside of blocks after opening block and before closing block
'brace-style': '', // enforce consistent brace style for blocks
camelcase: '', // enforce camelcase naming convention
'capitalized-comments': '', // enforce or disallow capitalization of the first letter of a comment
'comma-dangle': '', // require or disallow trailing commas
'comma-spacing': '', // enforce consistent spacing before and after commas
'comma-style': '', // enforce consistent comma style
'computed-property-spacing': '', // enforce consistent spacing inside computed property brackets
'consistent-this': '', // enforce consistent naming when capturing the current execution context
'eol-last': '', // require or disallow newline at the end of files
'func-call-spacing': '', // require or disallow spacing between function identifiers and their invocations
'func-name-matching': '', // require function names to match the name of the variable or property to which they are assigned
'func-names': '', // require or disallow named `function` expressions
'func-style': '', // enforce the consistent use of either `function` declarations or expressions
'function-call-argument-newline': '', // enforce line breaks between arguments of a function call
'function-paren-newline': '', // enforce consistent line breaks inside function parentheses
'id-blacklist': '', // disallow specified identifiers
'id-length': '', // enforce minimum and maximum identifier lengths
'id-match': '', // require identifiers to match a specified regular expression
'implicit-arrow-linebreak': '', // enforce the location of arrow function bodies
indent: ['error', 2],
'jsx-quotes': '', // enforce the consistent use of either double or single quotes in JSX attributes
'key-spacing': '', // enforce consistent spacing between keys and values in object literal properties
'keyword-spacing': '', // enforce consistent spacing before and after keywords
'line-comment-position': '', // enforce position of line comments
'linebreak-style': '', // enforce consistent linebreak style
'lines-around-comment': '', // require empty lines around comments
'lines-between-class-members': '', // require or disallow an empty line between class members
'max-depth': '', // enforce a maximum depth that blocks can be nested
'max-len': '', // enforce a maximum line length
'max-lines': '', // enforce a maximum number of lines per file
'max-lines-per-function': '', // enforce a maximum number of line of code in a function
'max-nested-callbacks': '', // enforce a maximum depth that callbacks can be nested
'max-params': '', // enforce a maximum number of parameters in function definitions
'max-statements': '', // enforce a maximum number of statements allowed in function blocks
'max-statements-per-line': '', // enforce a maximum number of statements allowed per line
'multiline-comment-style': '', // enforce a particular style for multiline comments
'multiline-ternary': '', // enforce newlines between operands of ternary expressions
'new-cap': '', // require constructor names to begin with a capital letter
'new-parens': '', // enforce or disallow parentheses when invoking a constructor with no arguments
'newline-per-chained-call': '', // require a newline after each call in a method chain
'no-array-constructor': '', // disallow `Array` constructors
'no-bitwise': '', // disallow bitwise operators
'no-continue': '', // disallow `continue` statements
'no-inline-comments': '', // disallow inline comments after code
'no-lonely-if': '', // disallow `if` statements as the only statement in `else` blocks
'no-mixed-operators': '', // disallow mixed binary operators
'no-mixed-spaces-and-tabs': '', // disallow mixed spaces and tabs for indentation
'no-multi-assign': '', // disallow use of chained assignment expressions
'no-multiple-empty-lines': '', // disallow multiple empty lines
'no-negated-condition': '', // disallow negated conditions
'no-nested-ternary': '', // disallow nested ternary expressions
'no-new-object': '', // disallow `Object` constructors
'no-plusplus': '', // disallow the unary operators `++` and `--`
'no-restricted-syntax': '', // disallow specified syntax
'no-tabs': '', // disallow all tabs
'no-ternary': '', // disallow ternary operators
'no-trailing-spaces': '', // disallow trailing whitespace at the end of lines
'no-underscore-dangle': '', // disallow dangling underscores in identifiers
'no-unneeded-ternary': '', // disallow ternary operators when simpler alternatives exist
'no-whitespace-before-property': '', // disallow whitespace before properties
'nonblock-statement-body-position': '', // enforce the location of single-line statements
'object-curly-newline': '', // enforce consistent line breaks inside braces
'object-curly-spacing': '', // enforce consistent spacing inside braces
'object-property-newline': '', // enforce placing object properties on separate lines
'one-var': '', // enforce variables to be declared either together or separately in functions
'one-var-declaration-per-line': '', // require or disallow newlines around variable declarations
'operator-assignment': '', // require or disallow assignment operator shorthand where possible
'operator-linebreak': '', // enforce consistent linebreak style for operators
'padded-blocks': '', // require or disallow padding within blocks
'padding-line-between-statements': '', // require or disallow padding lines between statements
'prefer-exponentiation-operator': '', // disallow the use of `Math.pow` in favor of the `**` operator
'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': '', // require quotes around object literal property names
quotes: ['error', 'single'],
semi: ['error', 'always'],
'semi-spacing': '', // enforce consistent spacing before and after semicolons
'semi-style': '', // enforce location of semicolons
'sort-keys': '', // require object keys to be sorted
'sort-vars': '', // require variables within the same declaration block to be sorted
'space-before-blocks': '', // enforce consistent spacing before blocks
'space-before-function-paren': '', // enforce consistent spacing before `function` definition opening parenthesis
'space-in-parens': '', // enforce consistent spacing inside parentheses
'space-infix-ops': '', // require spacing around infix operators
'space-unary-ops': '', // enforce consistent spacing before or after unary operators
'spaced-comment': '', // enforce consistent spacing after the `//` or `/*` in a comment
'switch-colon-spacing': '', // enforce spacing around colons of switch statements
'template-tag-spacing': '', // require or disallow spacing between template tags and their literals
'unicode-bom': '', // require or disallow Unicode byte order mark (BOM)
'wrap-regex': '', // require parenthesis around regex literals
// ## ECMAScript 6
// These rules relate to ES6, also known as ES2015:
'arrow-body-style': '', // require braces around arrow function bodies
'arrow-parens': '', // require parentheses around arrow function arguments
'arrow-spacing': '', // enforce consistent spacing before and after the arrow in arrow functions
'constructor-super': '', // require `super()` calls in constructors
'generator-star-spacing': '', // enforce consistent spacing around `*` operators in generator functions
'no-class-assign': '', // disallow reassigning class members
'no-confusing-arrow': '', // disallow arrow functions where they could be confused with comparisons
'no-const-assign': '', // disallow reassigning `const` variables
'no-dupe-class-members': '', // disallow duplicate class members
'no-duplicate-imports': '', // disallow duplicate module imports
'no-new-symbol': '', // disallow `new` operators with the `Symbol` object
'no-restricted-imports': '', // disallow specified modules when loaded by `import`
'no-this-before-super': '', // disallow `this`/`super` before calling `super()` in constructors
'no-useless-computed-key': '', // disallow unnecessary computed property keys in objects and classes
'no-useless-constructor': '', // disallow unnecessary constructors
'no-useless-rename': '', // disallow renaming import, export, and destructured assignments to the same name
'no-var': '', // require `let` or `const` instead of `var`
'object-shorthand': '', // require or disallow method and property shorthand syntax for object literals
'prefer-arrow-callback': '', // require using arrow functions for callbacks
'prefer-const': '', // require `const` declarations for variables that are never reassigned after declared
'prefer-destructuring': '', // require destructuring from arrays and/or objects
'prefer-numeric-literals': '', // disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals
'prefer-rest-params': '', // require rest parameters instead of `arguments`
'prefer-spread': '', // require spread operators instead of `.apply()`
'prefer-template': '', // require template literals instead of string concatenation
'require-yield': '', // require generator functions to contain `yield`
'rest-spread-spacing': '', // enforce spacing between rest and spread operators and their expressions
'sort-imports': '', // enforce sorted import declarations within modules
'symbol-description': '', // require symbol descriptions
'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
}
}