scode-eslint-config/index.js

275 lines
13 KiB
JavaScript
Raw Normal View History

2019-12-13 12:25:10 +01:00
module.exports = {
globals: {},
extends: 'eslint:recommended',
2019-12-13 12:25:10 +01:00
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',
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',
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',
'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',
'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',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal-escape': 'error',
'no-param-reassign': 'error',
2019-12-15 19:37:10 +01:00
'no-proto': 'error',
'no-restricted-properties': 'error',
2019-12-19 12:20:41 +01:00
'no-return-assign': ['error', 'except-parens'],
2019-12-15 19:37:10 +01:00
'no-return-await': 'error',
2019-12-19 12:20:41 +01:00
'no-script-url': 'error',
2019-12-15 19:37:10 +01:00
'no-self-compare': 'error',
2019-12-19 12:20:41 +01:00
'no-sequences': 'error',
'no-throw-literal': 'error',
'no-unmodified-loop-condition': 'error',
2019-12-15 19:37:10 +01:00
'no-unused-expressions': 'error',
2019-12-19 12:20:41 +01:00
'no-useless-call': 'error',
2019-12-15 19:37:10 +01:00
'no-useless-concat': 'error',
'no-useless-return': 'error',
2019-12-19 12:20:41 +01:00
'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'],
2019-12-15 19:37:10 +01:00
'require-await': 'error',
2019-12-19 12:20:41 +01:00
'require-unicode-regexp': 'error',
2019-12-15 19:37:10 +01:00
'vars-on-top': 'error',
2019-12-19 12:20:41 +01:00
'wrap-iife': ['error', 'inside'],
yoda: ['error', 'always', { exceptRange: true }],
// Strict Mode https://eslint.org/docs/rules/#strict-mode
2019-12-13 12:25:10 +01:00
strict: ['error', 'safe'],
2019-12-19 12:20:41 +01:00
// 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
2019-12-19 13:40:28 +01:00
'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',
2019-12-19 13:45:07 +01:00
'eol-last': 'error',
2019-12-19 14:38:35 +01:00
'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'],
2019-12-19 14:58:57 +01:00
'id-match': ['error', '^([nsoa]([A-Z][a-z]+)+|[a-z])$'],
'implicit-arrow-linebreak': ['error', 'beside'],
2019-12-13 12:25:10 +01:00
indent: ['error', 2],
2019-12-19 14:58:57 +01:00
'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 }
],
2019-12-20 10:17:57 +01:00
'max-depth': ['error', 4],
'max-len': ['error', { code: 80, tabWidth: 4 }],
2019-12-19 15:09:34 +01:00
'max-lines': [
2019-12-20 10:17:57 +01:00
'error',
2019-12-19 15:09:34 +01:00
{
max: 300,
skipBlankLines: true,
ignoreComments: true
}
],
2019-12-20 09:38:16 +01:00
'max-lines-per-function': [
2019-12-20 10:17:57 +01:00
'error',
2019-12-20 09:38:16 +01:00
{
max: 50,
skipBlankLines: true,
skipComments: true,
IIFEs: true
}],
2019-12-20 10:17:57 +01:00
'max-nested-callbacks': ['error', 3],
'max-params': ['error', 3],
'max-statements': ['error', 20],
'max-statements-per-line': 'error',
'multiline-comment-style': ['error', 'starred-block'],
2019-12-20 11:01:13 +01:00
'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',
2019-12-19 13:45:07 +01:00
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1, maxBOF: 0 }],
2019-12-20 11:01:13 +01:00
'no-negated-condition': 'error',
'no-nested-ternary': 'error',
'no-new-object': 'error',
'no-tabs': 'error',
2019-12-19 13:45:07 +01:00
'no-trailing-spaces': 'error',
2019-12-20 11:01:13 +01:00
'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'],
2019-12-13 12:25:10 +01:00
quotes: ['error', 'single'],
semi: ['error', 'always'],
2019-12-20 11:01:13 +01:00
'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
2019-12-19 12:20:41 +01:00
// 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
2019-12-13 12:25:10 +01:00
'yield-star-spacing': '' // require or disallow spacing around the `*` in `yield*` expressions
}
}