|
| 1 | +module.exports = { |
| 2 | + env: { |
| 3 | + node: true, |
| 4 | + es6: true |
| 5 | + }, |
| 6 | + extends: [ |
| 7 | + 'eslint:recommended', |
| 8 | + 'plugin:@typescript-eslint/recommended' |
| 9 | + ], |
| 10 | + parser: '@typescript-eslint/parser', |
| 11 | + parserOptions: { |
| 12 | + ecmaVersion: 2020, |
| 13 | + sourceType: 'module' |
| 14 | + }, |
| 15 | + rules: { |
| 16 | + // Bad Practices |
| 17 | + '@typescript-eslint/camelcase': 'on', |
| 18 | + '@typescript-eslint/no-explicit-any': 'off', |
| 19 | + 'curly': 'error', |
| 20 | + 'no-await-in-loop': 'error', |
| 21 | + 'no-eval': 'error', |
| 22 | + 'no-implicit-globals': 'error', |
| 23 | + 'no-lone-blocks': 'error', |
| 24 | + 'no-return-await': 'error', |
| 25 | + 'no-self-compare': 'error', |
| 26 | + 'no-sequences': 'error', |
| 27 | + 'no-throw-literal': 'error', |
| 28 | + 'no-with': 'error', |
| 29 | + 'prefer-arrow-callback': [ 'error', { allowNamedFunctions: true } ], |
| 30 | + 'prefer-promise-reject-errors': 'error', |
| 31 | + 'prefer-rest-params': 'warn', |
| 32 | + 'no-label-var': 'error', |
| 33 | + 'no-undefined': 'off', |
| 34 | + 'no-use-before-define': 'error', |
| 35 | + 'no-array-constructor': 'error', |
| 36 | + 'no-new-object': 'error', |
| 37 | + 'no-continue': 'error', |
| 38 | + 'no-unneeded-ternary': 'error', |
| 39 | + 'complexity': [ 'error', 70 ], |
| 40 | + 'require-atomic-updates': 'off', |
| 41 | + |
| 42 | + // Common Mistakes |
| 43 | + '@typescript-eslint/no-unused-vars': [ 'warn', { ignoreRestSiblings: true, argsIgnorePattern: '^_' } ], |
| 44 | + 'no-extra-bind': 'warn', |
| 45 | + 'no-floating-decimal': 'warn', |
| 46 | + 'no-multi-spaces': 'warn', |
| 47 | + 'no-useless-call': 'warn', |
| 48 | + 'no-useless-return': 'warn', |
| 49 | + 'require-await': 'off', |
| 50 | + 'no-mixed-operators': 'warn', |
| 51 | + 'no-shadow': 'warn', |
| 52 | + |
| 53 | + // Style |
| 54 | + '@typescript-eslint/type-annotation-spacing': [ 'warn', { before: true, after: true } ], |
| 55 | + '@typescript-eslint/explicit-function-return-type': [ 'warn', { allowExpressions: true } ], |
| 56 | + 'array-bracket-newline': [ 'warn', 'consistent' ], |
| 57 | + 'array-bracket-spacing': [ 'warn', 'always' ], |
| 58 | + 'array-element-newline': [ 'warn', 'consistent' ], |
| 59 | + 'arrow-parens': [ 'warn', 'always' ], |
| 60 | + 'arrow-spacing': 'warn', |
| 61 | + 'block-spacing': 'warn', |
| 62 | + 'brace-style': [ 'warn', 'allman', { allowSingleLine: true } ], |
| 63 | + 'camelcase': 'off', |
| 64 | + 'comma-dangle': [ 'warn', 'never' ], |
| 65 | + 'comma-spacing': [ 'warn', { before: false, after: true } ], |
| 66 | + 'comma-style': [ 'warn', 'last' ], |
| 67 | + 'computed-property-spacing': [ 'warn', 'never' ], |
| 68 | + 'consistent-this': [ 'warn', 'self' ], |
| 69 | + 'eol-last': [ 'warn', 'always' ], |
| 70 | + 'func-call-spacing': [ 'warn', 'never' ], |
| 71 | + 'func-style': [ 'warn', 'declaration', { allowArrowFunctions: true } ], |
| 72 | + 'function-paren-newline': [ 'warn', 'multiline' ], |
| 73 | + 'generator-star-spacing': [ 'warn', { before: true, after: false } ], |
| 74 | + 'id-length': [ 'warn', { min: 2, exceptions: [ '$', '_', 'i', 'x', 'y', 'z' ] } ], |
| 75 | + 'indent': [ |
| 76 | + 'warn', |
| 77 | + 4, |
| 78 | + { |
| 79 | + SwitchCase: 1, |
| 80 | + VariableDeclarator: 1, |
| 81 | + outerIIFEBody: 1, |
| 82 | + MemberExpression: 1, |
| 83 | + FunctionDeclaration: { |
| 84 | + parameters: 1, |
| 85 | + body: 1 |
| 86 | + }, |
| 87 | + FunctionExpression: { |
| 88 | + parameters: 1, |
| 89 | + body: 1 |
| 90 | + }, |
| 91 | + CallExpression: { |
| 92 | + arguments: 1 |
| 93 | + }, |
| 94 | + ArrayExpression: 1, |
| 95 | + ObjectExpression: 1, |
| 96 | + ImportDeclaration: 1, |
| 97 | + flatTernaryExpressions: false |
| 98 | + } |
| 99 | + ], |
| 100 | + 'key-spacing': [ 'warn', { beforeColon: false, afterColon: true } ], |
| 101 | + 'keyword-spacing': [ |
| 102 | + 'warn', |
| 103 | + { |
| 104 | + overrides: { |
| 105 | + if: { after: false }, |
| 106 | + for: { after: false }, |
| 107 | + while: { after: false } |
| 108 | + } |
| 109 | + } |
| 110 | + ], |
| 111 | + 'lines-between-class-members': [ 'warn', 'always', { exceptAfterSingleLine: true } ], |
| 112 | + 'new-parens': 'warn', |
| 113 | + 'newline-per-chained-call': [ 'warn', { ignoreChainWithDepth: 2 } ], |
| 114 | + 'no-confusing-arrow': [ 'warn', { allowParens: false } ], |
| 115 | + 'no-duplicate-imports': 'warn', |
| 116 | + 'no-lonely-if': 'warn', |
| 117 | + 'no-multi-assign': 'warn', |
| 118 | + 'no-multiple-empty-lines': [ 'warn', { max: 1, maxBOF: 0, maxEOF: 1 } ], |
| 119 | + 'no-useless-computed-key': 'warn', |
| 120 | + 'no-useless-rename': [ |
| 121 | + 'error', |
| 122 | + { |
| 123 | + ignoreDestructuring: false, |
| 124 | + ignoreImport: false, |
| 125 | + ignoreExport: false |
| 126 | + } |
| 127 | + ], |
| 128 | + 'no-var': 'warn', |
| 129 | + 'no-whitespace-before-property': 'warn', |
| 130 | + 'object-curly-spacing': [ 'warn', 'always' ], |
| 131 | + 'object-property-newline': [ 'warn', { allowAllPropertiesOnSameLine: true } ], |
| 132 | + 'object-shorthand': [ 'warn', 'always' ], |
| 133 | + 'one-var': [ 'warn', 'never' ], |
| 134 | + 'operator-linebreak': [ 'warn', 'before' ], |
| 135 | + 'padded-blocks': [ 'warn', 'never' ], |
| 136 | + 'prefer-const': 'warn', |
| 137 | + 'prefer-object-spread': 'warn', |
| 138 | + 'prefer-template': 'warn', |
| 139 | + 'quote-props': [ 'warn', 'consistent-as-needed' ], |
| 140 | + 'quotes': [ 'warn', 'single', { avoidEscape: true, allowTemplateLiterals: true } ], |
| 141 | + 'semi': [ 'error', 'always' ], |
| 142 | + 'semi-spacing': [ 'warn', { before: false, after: true } ], |
| 143 | + 'space-before-blocks': 'warn', |
| 144 | + 'space-before-function-paren': 'off', |
| 145 | + 'space-in-parens': [ 'warn', 'never' ], |
| 146 | + 'space-infix-ops': 'warn', |
| 147 | + 'space-unary-ops': 'warn', |
| 148 | + 'spaced-comment': [ |
| 149 | + 'warn', |
| 150 | + 'always', |
| 151 | + { |
| 152 | + line: { |
| 153 | + markers: [ '/' ], |
| 154 | + exceptions: [ '-', '+' ] |
| 155 | + }, |
| 156 | + block: { |
| 157 | + markers: [ '!' ], |
| 158 | + exceptions: [ '*' ], |
| 159 | + balanced: true |
| 160 | + } |
| 161 | + } |
| 162 | + ], |
| 163 | + 'switch-colon-spacing': 'warn', |
| 164 | + 'template-curly-spacing': [ 'warn', 'always' ], |
| 165 | + 'template-tag-spacing': 'warn', |
| 166 | + 'yield-star-spacing': [ 'warn', 'before' ], |
| 167 | + 'yoda': [ 'warn', 'never', { exceptRange: true } ] |
| 168 | + }, |
| 169 | + overrides: [ |
| 170 | + { |
| 171 | + files: [ '*.ts', '*.tsx' ], |
| 172 | + rules: { |
| 173 | + 'no-dupe-class-members': 'off', |
| 174 | + 'jsdoc/require-param-type': 'off', |
| 175 | + 'jsdoc/require-returns-type': 'off' |
| 176 | + } |
| 177 | + }, |
| 178 | + { |
| 179 | + files: [ '*.js', '*.jsx', '*.vue' ], |
| 180 | + rules: { |
| 181 | + '@typescript-eslint/no-var-requires': 'off', |
| 182 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 183 | + '@typescript-eslint/explicit-module-boundary-types': 'off' |
| 184 | + } |
| 185 | + } |
| 186 | + ] |
| 187 | +}; |
0 commit comments