|
1 | | -import neostandard from 'neostandard' |
| 1 | +import stylistic from '@stylistic/eslint-plugin' |
| 2 | +import n from 'eslint-plugin-n' |
| 3 | +import promise from 'eslint-plugin-promise' |
| 4 | +import globals from 'globals' |
| 5 | + |
| 6 | +const rules = { |
| 7 | + 'no-var': ['warn'], |
| 8 | + 'object-shorthand': ['warn', 'properties'], |
| 9 | + 'accessor-pairs': ['error', { |
| 10 | + enforceForTSTypes: false, |
| 11 | + enforceForClassMembers: true, |
| 12 | + getWithoutSet: false, |
| 13 | + setWithoutGet: true |
| 14 | + }], |
| 15 | + 'array-callback-return': ['error', { |
| 16 | + allowImplicit: false, |
| 17 | + checkForEach: false, |
| 18 | + allowVoid: false |
| 19 | + }], |
| 20 | + camelcase: ['error', { |
| 21 | + allow: ['^UNSAFE_'], |
| 22 | + ignoreDestructuring: false, |
| 23 | + ignoreGlobals: true, |
| 24 | + ignoreImports: false, |
| 25 | + properties: 'never' |
| 26 | + }], |
| 27 | + 'constructor-super': ['error'], |
| 28 | + curly: ['error', 'multi-line'], |
| 29 | + 'default-case-last': ['error'], |
| 30 | + 'dot-notation': ['off', { |
| 31 | + allowKeywords: true, |
| 32 | + allowPattern: '' |
| 33 | + }], |
| 34 | + eqeqeq: ['error', 'always', { null: 'ignore' }], |
| 35 | + 'new-cap': ['error', { |
| 36 | + capIsNew: false, |
| 37 | + capIsNewExceptions: ['Array', 'Boolean', 'Date', 'Error', 'Function', 'Number', 'Object', 'RegExp', 'String', 'Symbol', 'BigInt'], |
| 38 | + newIsCap: true, |
| 39 | + newIsCapExceptions: [], |
| 40 | + properties: true |
| 41 | + }], |
| 42 | + 'no-array-constructor': ['error'], |
| 43 | + 'no-async-promise-executor': ['error'], |
| 44 | + 'no-caller': ['error'], |
| 45 | + 'no-case-declarations': ['error'], |
| 46 | + 'no-class-assign': ['error'], |
| 47 | + 'no-compare-neg-zero': ['error'], |
| 48 | + 'no-cond-assign': ['error', 'except-parens'], |
| 49 | + 'no-const-assign': ['error'], |
| 50 | + 'no-constant-condition': ['error', { checkLoops: false }], |
| 51 | + 'no-control-regex': ['error'], |
| 52 | + 'no-debugger': ['error'], |
| 53 | + 'no-delete-var': ['error'], |
| 54 | + 'no-dupe-args': ['error'], |
| 55 | + 'no-dupe-class-members': ['error'], |
| 56 | + 'no-dupe-keys': ['error'], |
| 57 | + 'no-duplicate-case': ['error'], |
| 58 | + 'no-useless-backreference': ['error'], |
| 59 | + 'no-empty': ['error', { allowEmptyCatch: true }], |
| 60 | + 'no-empty-character-class': ['error'], |
| 61 | + 'no-empty-pattern': ['error', { allowObjectPatternsAsParameters: false }], |
| 62 | + 'no-eval': ['error', { allowIndirect: false }], |
| 63 | + 'no-ex-assign': ['error'], |
| 64 | + 'no-extend-native': ['error', { exceptions: [] }], |
| 65 | + 'no-extra-bind': ['error'], |
| 66 | + 'no-extra-boolean-cast': ['error', {}], |
| 67 | + 'no-fallthrough': ['error', { |
| 68 | + allowEmptyCase: false, |
| 69 | + reportUnusedFallthroughComment: false |
| 70 | + }], |
| 71 | + 'no-func-assign': ['error'], |
| 72 | + 'no-global-assign': ['error', { exceptions: [] }], |
| 73 | + 'no-implied-eval': ['error'], |
| 74 | + 'no-import-assign': ['error'], |
| 75 | + 'no-invalid-regexp': ['error', {}], |
| 76 | + 'no-irregular-whitespace': ['error', { |
| 77 | + skipComments: false, |
| 78 | + skipJSXText: false, |
| 79 | + skipRegExps: false, |
| 80 | + skipStrings: true, |
| 81 | + skipTemplates: false |
| 82 | + }], |
| 83 | + 'no-iterator': ['error'], |
| 84 | + 'no-labels': ['error', { |
| 85 | + allowLoop: false, |
| 86 | + allowSwitch: false |
| 87 | + }], |
| 88 | + 'no-lone-blocks': ['error'], |
| 89 | + 'no-loss-of-precision': ['error'], |
| 90 | + 'no-misleading-character-class': ['error', { allowEscape: false }], |
| 91 | + 'no-prototype-builtins': ['error'], |
| 92 | + 'no-useless-catch': ['error'], |
| 93 | + 'no-multi-str': ['error'], |
| 94 | + 'no-new': ['error'], |
| 95 | + 'no-new-func': ['error'], |
| 96 | + 'no-object-constructor': ['error'], |
| 97 | + 'no-new-native-nonconstructor': ['error'], |
| 98 | + 'no-new-wrappers': ['error'], |
| 99 | + 'no-obj-calls': ['error'], |
| 100 | + 'no-octal': ['error'], |
| 101 | + 'no-octal-escape': ['error'], |
| 102 | + 'no-proto': ['error'], |
| 103 | + 'no-redeclare': ['error', { builtinGlobals: false }], |
| 104 | + 'no-regex-spaces': ['error'], |
| 105 | + 'no-return-assign': ['error', 'except-parens'], |
| 106 | + 'no-self-assign': ['error', { props: true }], |
| 107 | + 'no-self-compare': ['error'], |
| 108 | + 'no-sequences': ['error', { allowInParentheses: true }], |
| 109 | + 'no-shadow-restricted-names': ['error', { reportGlobalThis: false }], |
| 110 | + 'no-sparse-arrays': ['error'], |
| 111 | + 'no-template-curly-in-string': ['error'], |
| 112 | + 'no-this-before-super': ['error'], |
| 113 | + 'no-throw-literal': ['error'], |
| 114 | + 'no-undef': ['error', { typeof: false }], |
| 115 | + 'no-undef-init': ['error'], |
| 116 | + 'no-unexpected-multiline': ['error'], |
| 117 | + 'no-unmodified-loop-condition': ['error'], |
| 118 | + 'no-unneeded-ternary': ['error', { defaultAssignment: false }], |
| 119 | + 'no-unreachable': ['error'], |
| 120 | + 'no-unreachable-loop': ['error', { ignore: [] }], |
| 121 | + 'no-unsafe-finally': ['error'], |
| 122 | + 'no-unsafe-negation': ['error', { enforceForOrderingRelations: false }], |
| 123 | + 'no-unused-expressions': ['error', { |
| 124 | + allowShortCircuit: true, |
| 125 | + allowTernary: true, |
| 126 | + allowTaggedTemplates: true, |
| 127 | + enforceForJSX: false, |
| 128 | + ignoreDirectives: false |
| 129 | + }], |
| 130 | + 'no-unused-vars': ['error', { |
| 131 | + args: 'none', |
| 132 | + caughtErrors: 'none', |
| 133 | + ignoreRestSiblings: true, |
| 134 | + vars: 'all' |
| 135 | + }], |
| 136 | + 'no-use-before-define': ['error', { |
| 137 | + classes: false, |
| 138 | + functions: false, |
| 139 | + variables: false, |
| 140 | + allowNamedExports: false, |
| 141 | + enums: true, |
| 142 | + typedefs: true, |
| 143 | + ignoreTypeReferences: true |
| 144 | + }], |
| 145 | + 'no-useless-call': ['error'], |
| 146 | + 'no-useless-computed-key': ['error', { enforceForClassMembers: true }], |
| 147 | + 'no-useless-constructor': ['error'], |
| 148 | + 'no-useless-escape': ['error', { allowRegexCharacters: [] }], |
| 149 | + 'no-useless-rename': ['error', { |
| 150 | + ignoreDestructuring: false, |
| 151 | + ignoreImport: false, |
| 152 | + ignoreExport: false |
| 153 | + }], |
| 154 | + 'no-useless-return': ['error'], |
| 155 | + 'no-void': ['error', { allowAsStatement: false }], |
| 156 | + 'no-with': ['error'], |
| 157 | + 'one-var': ['error', { initialized: 'never' }], |
| 158 | + 'prefer-const': ['error', { |
| 159 | + destructuring: 'all', |
| 160 | + ignoreReadBeforeAssign: false |
| 161 | + }], |
| 162 | + 'prefer-promise-reject-errors': ['error', { allowEmptyReject: false }], |
| 163 | + 'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }], |
| 164 | + 'symbol-description': ['error'], |
| 165 | + 'unicode-bom': ['error', 'never'], |
| 166 | + 'use-isnan': ['error', { |
| 167 | + enforceForIndexOf: true, |
| 168 | + enforceForSwitchCase: true |
| 169 | + }], |
| 170 | + 'valid-typeof': ['error', { requireStringLiterals: true }], |
| 171 | + yoda: ['error', 'never', { |
| 172 | + exceptRange: false, |
| 173 | + onlyEquality: false |
| 174 | + }], |
| 175 | + 'n/handle-callback-err': ['error', '^(err|error)$'], |
| 176 | + 'n/no-callback-literal': ['error'], |
| 177 | + 'n/no-deprecated-api': ['warn'], |
| 178 | + 'n/no-exports-assign': ['error'], |
| 179 | + 'n/no-new-require': ['error'], |
| 180 | + 'n/no-path-concat': ['error'], |
| 181 | + 'n/process-exit-as-throw': ['error'], |
| 182 | + 'promise/param-names': ['error'], |
| 183 | + '@stylistic/array-bracket-spacing': ['error', 'never'], |
| 184 | + '@stylistic/arrow-spacing': ['error', { |
| 185 | + before: true, |
| 186 | + after: true |
| 187 | + }], |
| 188 | + '@stylistic/block-spacing': ['error', 'always'], |
| 189 | + '@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }], |
| 190 | + '@stylistic/comma-dangle': ['warn', { |
| 191 | + arrays: 'ignore', |
| 192 | + enums: 'ignore', |
| 193 | + exports: 'ignore', |
| 194 | + imports: 'ignore', |
| 195 | + objects: 'ignore' |
| 196 | + }], |
| 197 | + '@stylistic/comma-spacing': ['error', { |
| 198 | + before: false, |
| 199 | + after: true |
| 200 | + }], |
| 201 | + '@stylistic/comma-style': ['error', 'last'], |
| 202 | + '@stylistic/computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }], |
| 203 | + '@stylistic/dot-location': ['error', 'property'], |
| 204 | + '@stylistic/eol-last': ['error'], |
| 205 | + '@stylistic/function-call-spacing': ['error', 'never'], |
| 206 | + '@stylistic/generator-star-spacing': ['error', { |
| 207 | + before: true, |
| 208 | + after: true |
| 209 | + }], |
| 210 | + '@stylistic/indent': ['error', 2, { |
| 211 | + SwitchCase: 1, |
| 212 | + VariableDeclarator: 1, |
| 213 | + outerIIFEBody: 1, |
| 214 | + MemberExpression: 1, |
| 215 | + FunctionDeclaration: { |
| 216 | + parameters: 1, |
| 217 | + body: 1 |
| 218 | + }, |
| 219 | + FunctionExpression: { |
| 220 | + parameters: 1, |
| 221 | + body: 1 |
| 222 | + }, |
| 223 | + CallExpression: { arguments: 1 }, |
| 224 | + ArrayExpression: 1, |
| 225 | + ObjectExpression: 1, |
| 226 | + ImportDeclaration: 1, |
| 227 | + flatTernaryExpressions: false, |
| 228 | + ignoreComments: false, |
| 229 | + ignoredNodes: ['TemplateLiteral *', 'JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXFragment', 'JSXOpeningFragment', 'JSXClosingFragment', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'], |
| 230 | + offsetTernaryExpressions: true, |
| 231 | + tabLength: 4 |
| 232 | + }], |
| 233 | + '@stylistic/key-spacing': ['error', { |
| 234 | + beforeColon: false, |
| 235 | + afterColon: true |
| 236 | + }], |
| 237 | + '@stylistic/keyword-spacing': ['error', { |
| 238 | + before: true, |
| 239 | + after: true |
| 240 | + }], |
| 241 | + '@stylistic/lines-between-class-members': ['error', 'always', { |
| 242 | + exceptAfterSingleLine: true, |
| 243 | + exceptAfterOverload: true |
| 244 | + }], |
| 245 | + '@stylistic/multiline-ternary': ['error', 'always-multiline'], |
| 246 | + '@stylistic/new-parens': ['error'], |
| 247 | + '@stylistic/no-extra-parens': ['error', 'functions'], |
| 248 | + '@stylistic/no-floating-decimal': ['error'], |
| 249 | + '@stylistic/no-mixed-operators': ['error', { |
| 250 | + groups: [['==', '!=', '===', '!==', '>', '>=', '<', '<='], ['&&', '||'], ['in', 'instanceof']], |
| 251 | + allowSamePrecedence: true |
| 252 | + }], |
| 253 | + '@stylistic/no-mixed-spaces-and-tabs': ['error'], |
| 254 | + '@stylistic/no-multi-spaces': ['error', { |
| 255 | + ignoreEOLComments: true, |
| 256 | + includeTabs: true |
| 257 | + }], |
| 258 | + '@stylistic/no-multiple-empty-lines': ['error', { |
| 259 | + max: 1, |
| 260 | + maxBOF: 0, |
| 261 | + maxEOF: 0 |
| 262 | + }], |
| 263 | + '@stylistic/no-tabs': ['error'], |
| 264 | + '@stylistic/no-trailing-spaces': ['error'], |
| 265 | + '@stylistic/no-whitespace-before-property': ['error'], |
| 266 | + '@stylistic/object-curly-newline': ['error', { |
| 267 | + multiline: true, |
| 268 | + consistent: true |
| 269 | + }], |
| 270 | + '@stylistic/object-curly-spacing': ['error', 'always'], |
| 271 | + '@stylistic/object-property-newline': ['error', { allowAllPropertiesOnSameLine: false }], |
| 272 | + '@stylistic/operator-linebreak': ['error', 'after', { |
| 273 | + overrides: { |
| 274 | + '?': 'before', |
| 275 | + ':': 'before', |
| 276 | + '|>': 'before' |
| 277 | + } |
| 278 | + }], |
| 279 | + '@stylistic/padded-blocks': ['error', { |
| 280 | + blocks: 'never', |
| 281 | + switches: 'never', |
| 282 | + classes: 'never' |
| 283 | + }], |
| 284 | + '@stylistic/quote-props': ['error', 'as-needed'], |
| 285 | + '@stylistic/quotes': ['error', 'single', { |
| 286 | + avoidEscape: true, |
| 287 | + allowTemplateLiterals: 'never' |
| 288 | + }], |
| 289 | + '@stylistic/rest-spread-spacing': ['error', 'never'], |
| 290 | + '@stylistic/semi': ['error', 'never'], |
| 291 | + '@stylistic/semi-spacing': ['error', { |
| 292 | + before: false, |
| 293 | + after: true |
| 294 | + }], |
| 295 | + '@stylistic/space-before-blocks': ['error', 'always'], |
| 296 | + '@stylistic/space-before-function-paren': ['error', 'always'], |
| 297 | + '@stylistic/space-in-parens': ['error', 'never'], |
| 298 | + '@stylistic/space-infix-ops': ['error'], |
| 299 | + '@stylistic/space-unary-ops': ['error', { |
| 300 | + words: true, |
| 301 | + nonwords: false |
| 302 | + }], |
| 303 | + '@stylistic/spaced-comment': ['error', 'always', { |
| 304 | + line: { markers: ['*package', '!', '/', ',', '='] }, |
| 305 | + block: { |
| 306 | + balanced: true, |
| 307 | + markers: ['*package', '!', ',', ':', '::', 'flow-include'], |
| 308 | + exceptions: ['*'] |
| 309 | + } |
| 310 | + }], |
| 311 | + '@stylistic/template-curly-spacing': ['error', 'never'], |
| 312 | + '@stylistic/template-tag-spacing': ['error', 'never'], |
| 313 | + '@stylistic/wrap-iife': ['error', 'any', { functionPrototypeMethods: true }], |
| 314 | + '@stylistic/yield-star-spacing': ['error', 'both'], |
| 315 | +} |
2 | 316 |
|
3 | 317 | export default [ |
4 | 318 | { ignores: ['dist/**'] }, |
5 | | - ...neostandard({}), |
| 319 | + { |
| 320 | + files: ['**/*.{js,mjs,cjs}'], |
| 321 | + linterOptions: { |
| 322 | + reportUnusedDisableDirectives: 'warn', |
| 323 | + }, |
| 324 | + languageOptions: { |
| 325 | + ecmaVersion: 2022, |
| 326 | + sourceType: 'module', |
| 327 | + globals: { |
| 328 | + ...globals.es2021, |
| 329 | + ...globals.node, |
| 330 | + ...globals.browser, |
| 331 | + }, |
| 332 | + }, |
| 333 | + plugins: { |
| 334 | + '@stylistic': stylistic, |
| 335 | + n, |
| 336 | + promise, |
| 337 | + }, |
| 338 | + rules, |
| 339 | + }, |
6 | 340 | ] |
0 commit comments