|
| 1 | +module.exports = { |
| 2 | + root: true, |
| 3 | + env: { |
| 4 | + browser: false, |
| 5 | + node: true, |
| 6 | + es2022: true |
| 7 | + }, |
| 8 | + parserOptions: { |
| 9 | + ecmaVersion: 'latest', |
| 10 | + sourceType: 'module', |
| 11 | + ecmaFeatures: { |
| 12 | + impliedStrict: true |
| 13 | + } |
| 14 | + }, |
| 15 | + extends: ['eslint:recommended'], |
| 16 | + globals: { |
| 17 | + }, |
| 18 | + rules: { |
| 19 | + |
| 20 | + // ERRORS |
| 21 | + 'for-direction': 'error', |
| 22 | + 'getter-return': 'error', |
| 23 | + 'no-await-in-loop': 'error', |
| 24 | + 'no-extra-parens': 'error', |
| 25 | + 'no-prototype-builtins': 'error', |
| 26 | + 'no-template-curly-in-string': 'error', |
| 27 | + |
| 28 | + // BEST PRACTICES |
| 29 | + 'accessor-pairs': 'error', |
| 30 | + 'array-callback-return': 'error', |
| 31 | + 'class-methods-use-this': 'error', |
| 32 | + 'complexity': ['error', 10], |
| 33 | + 'consistent-return': 'error', |
| 34 | + 'curly': 'error', |
| 35 | + 'default-case': 'error', |
| 36 | + 'dot-location': ['error', 'property'], |
| 37 | + 'dot-notation': 'error', |
| 38 | + 'eqeqeq': 'error', |
| 39 | + 'guard-for-in': 'error', |
| 40 | + 'no-alert': 'error', |
| 41 | + 'no-caller': 'error', |
| 42 | + 'no-div-regex': 'error', |
| 43 | + 'no-else-return': 'error', |
| 44 | + 'no-empty-function': 'error', |
| 45 | + 'no-eq-null': 'error', |
| 46 | + 'no-eval': 'error', |
| 47 | + 'no-extend-native': 'error', |
| 48 | + 'no-extra-bind': 'error', |
| 49 | + 'no-extra-label': 'error', |
| 50 | + 'no-floating-decimal': 'error', |
| 51 | + 'no-implicit-coercion': 'error', |
| 52 | + 'no-implicit-globals': 'error', |
| 53 | + 'no-implied-eval': 'error', |
| 54 | + 'no-iterator': 'error', |
| 55 | + 'no-labels': 'error', |
| 56 | + 'no-lone-blocks': 'error', |
| 57 | + 'no-loop-func': 'error', |
| 58 | + 'no-multi-spaces': 'error', |
| 59 | + 'no-multi-str': 'error', |
| 60 | + 'no-new': 'error', |
| 61 | + 'no-new-func': 'error', |
| 62 | + 'no-new-wrappers': 'error', |
| 63 | + 'no-octal-escape': 'error', |
| 64 | + 'no-param-reassign': 'error', |
| 65 | + 'no-proto': 'error', |
| 66 | + 'no-return-assign': 'error', |
| 67 | + 'no-return-await': 'error', |
| 68 | + 'no-script-url': 'error', |
| 69 | + 'no-self-compare': 'error', |
| 70 | + 'no-sequences': 'error', |
| 71 | + 'no-throw-literal': 'error', |
| 72 | + 'no-unmodified-loop-condition': 'error', |
| 73 | + 'no-unused-expressions': 'error', |
| 74 | + 'no-useless-call': 'error', |
| 75 | + 'no-useless-concat': 'error', |
| 76 | + 'no-useless-return': 'error', |
| 77 | + 'no-void': 'error', |
| 78 | + 'no-warning-comments': ['warn', { 'terms': ['fix', 'fixme', 'todo', 'to do', 'hack'], 'location': 'anywhere' }], |
| 79 | + 'no-with': 'error', |
| 80 | + 'prefer-promise-reject-errors': ['error', { 'allowEmptyReject': true }], |
| 81 | + 'require-await': 'error', |
| 82 | + 'vars-on-top': 'error', |
| 83 | + 'wrap-iife': 'error', |
| 84 | + 'yoda': 'error', |
| 85 | + |
| 86 | + // VARIABLES |
| 87 | + 'no-shadow': 'error', |
| 88 | + 'no-shadow-restricted-names': 'error', |
| 89 | + 'no-undef-init': 'error', |
| 90 | + 'no-undefined': 'error', |
| 91 | + 'no-use-before-define': ['error', { 'functions': false }], |
| 92 | + |
| 93 | + // NODE |
| 94 | + 'callback-return': 'error', |
| 95 | + 'global-require': 'error', |
| 96 | + 'handle-callback-err': 'error', |
| 97 | + 'no-buffer-constructor': 'error', |
| 98 | + 'no-mixed-requires': 'error', |
| 99 | + 'no-new-require': 'error', |
| 100 | + 'no-path-concat': 'error', |
| 101 | + 'no-process-env': 'error', |
| 102 | + 'no-process-exit': 'error', |
| 103 | + |
| 104 | + // STYLE |
| 105 | + 'array-bracket-newline': ['error', { 'multiline': true }], |
| 106 | + 'array-bracket-spacing': 'error', |
| 107 | + 'block-spacing': 'error', |
| 108 | + 'brace-style': ['error', 'stroustrup', { 'allowSingleLine': true }], |
| 109 | + 'camelcase': 'error', |
| 110 | + 'comma-spacing': 'error', |
| 111 | + 'comma-style': 'error', |
| 112 | + 'computed-property-spacing': 'error', |
| 113 | + 'consistent-this': ['error', 'self'], |
| 114 | + 'eol-last': 'error', |
| 115 | + 'func-call-spacing': 'error', |
| 116 | + 'func-name-matching': 'error', |
| 117 | + 'func-names': ['error', 'never'], |
| 118 | + 'func-style': ['error', 'declaration', { 'allowArrowFunctions': true }], |
| 119 | + 'indent': ['error', 2, { 'SwitchCase': 1 }], |
| 120 | + 'key-spacing': 'error', |
| 121 | + 'keyword-spacing': 'error', |
| 122 | + 'linebreak-style': 'error', |
| 123 | + 'lines-around-comment': 'error', |
| 124 | + 'max-depth': 'error', |
| 125 | + 'max-lines': 'error', |
| 126 | + 'max-nested-callbacks': ['error', 4], |
| 127 | + 'max-params': ['error', 6], |
| 128 | + 'max-statements': ['error', 99], |
| 129 | + 'max-statements-per-line': ['error', { 'max': 2 }], |
| 130 | + 'multiline-ternary': ['error', 'always-multiline'], |
| 131 | + 'new-cap': 'error', |
| 132 | + 'new-parens': 'error', |
| 133 | + 'no-array-constructor': 'error', |
| 134 | + 'no-bitwise': 'error', |
| 135 | + 'no-continue': 'error', |
| 136 | + 'no-lonely-if': 'error', |
| 137 | + 'no-mixed-operators': 'error', |
| 138 | + 'no-multi-assign': 'error', |
| 139 | + 'no-multiple-empty-lines': ['error', { 'max': 1, 'maxEOF': 1, 'maxBOF': 0 }], |
| 140 | + 'no-negated-condition': 'error', |
| 141 | + 'no-nested-ternary': 'error', |
| 142 | + 'no-new-object': 'error', |
| 143 | + 'no-plusplus': ['error', { 'allowForLoopAfterthoughts': true }], |
| 144 | + 'no-tabs': 'error', |
| 145 | + 'no-trailing-spaces': 'error', |
| 146 | + 'no-underscore-dangle': 'error', |
| 147 | + 'no-unneeded-ternary': 'error', |
| 148 | + 'no-whitespace-before-property': 'error', |
| 149 | + 'object-curly-newline': ['error', { 'consistent': true }], |
| 150 | + 'object-curly-spacing': ['error', 'always'], |
| 151 | + 'object-property-newline': ['error', { 'allowMultiplePropertiesPerLine': true }], |
| 152 | + 'one-var': ['error', { 'initialized': 'never', 'uninitialized': 'always' }], |
| 153 | + 'operator-assignment': 'error', |
| 154 | + 'operator-linebreak': ['error', 'after'], |
| 155 | + 'padding-line-between-statements': [ |
| 156 | + 'error', |
| 157 | + { 'blankLine': 'always', 'prev': 'import', 'next': '*' }, |
| 158 | + { 'blankLine': 'never', 'prev': 'import', 'next': 'import' }, |
| 159 | + { 'blankLine': 'always', 'prev': 'class', 'next': '*' }, |
| 160 | + { 'blankLine': 'always', 'prev': '*', 'next': 'class' }, |
| 161 | + { 'blankLine': 'always', 'prev': 'block', 'next': '*' }, |
| 162 | + { 'blankLine': 'always', 'prev': '*', 'next': 'block' }, |
| 163 | + { 'blankLine': 'always', 'prev': 'block-like', 'next': '*' }, |
| 164 | + { 'blankLine': 'always', 'prev': '*', 'next': 'block-like' }, |
| 165 | + { 'blankLine': 'always', 'prev': 'cjs-export', 'next': '*' }, |
| 166 | + { 'blankLine': 'always', 'prev': '*', 'next': 'cjs-export' }, |
| 167 | + { 'blankLine': 'always', 'prev': 'cjs-import', 'next': '*' }, |
| 168 | + { 'blankLine': 'never', 'prev': 'cjs-import', 'next': 'cjs-import' }, |
| 169 | + { 'blankLine': 'always', 'prev': 'let', 'next': 'const' }, |
| 170 | + { 'blankLine': 'always', 'prev': 'const', 'next': 'let' }, |
| 171 | + { 'blankLine': 'never', 'prev': 'let', 'next': 'let' } |
| 172 | + ], |
| 173 | + 'quotes': ['error', 'single', { 'allowTemplateLiterals': true }], |
| 174 | + 'semi': 'error', |
| 175 | + 'semi-spacing': 'error', |
| 176 | + 'semi-style': 'error', |
| 177 | + 'space-before-blocks': 'error', |
| 178 | + 'space-before-function-paren': ['error', 'never'], |
| 179 | + 'space-in-parens': 'error', |
| 180 | + 'space-infix-ops': 'error', |
| 181 | + 'space-unary-ops': 'error', |
| 182 | + 'spaced-comment': ['error', 'always', { 'block': { 'balanced': true } }], |
| 183 | + 'switch-colon-spacing': 'error', |
| 184 | + 'template-tag-spacing': 'error', |
| 185 | + 'unicode-bom': 'error', |
| 186 | + 'wrap-regex': 'error', |
| 187 | + |
| 188 | + // ECMASCRIPT 6 |
| 189 | + 'arrow-body-style': ['error', 'always'], |
| 190 | + 'arrow-parens': ['error', 'as-needed'], |
| 191 | + 'arrow-spacing': 'error', |
| 192 | + 'generator-star-spacing': 'error', |
| 193 | + 'no-confusing-arrow': 'error', |
| 194 | + 'no-duplicate-imports': 'error', |
| 195 | + 'no-useless-computed-key': 'error', |
| 196 | + 'no-useless-constructor': 'error', |
| 197 | + 'no-useless-rename': 'error', |
| 198 | + 'no-var': 'error', |
| 199 | + 'object-shorthand': 'error', |
| 200 | + 'prefer-arrow-callback': 'error', |
| 201 | + 'prefer-const': 'error', |
| 202 | + 'prefer-destructuring': 'error', |
| 203 | + 'prefer-numeric-literals': 'error', |
| 204 | + 'prefer-rest-params': 'error', |
| 205 | + 'prefer-spread': 'error', |
| 206 | + 'prefer-template': 'error', |
| 207 | + 'rest-spread-spacing': 'error', |
| 208 | + 'symbol-description': 'error', |
| 209 | + 'template-curly-spacing': 'error', |
| 210 | + 'yield-star-spacing': 'error', |
| 211 | + |
| 212 | + } |
| 213 | +}; |
0 commit comments