eslint-config-airbnb-extended 1.0.10 → 2.0.0-beta-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/@types/legacy.d.ts +12 -0
  2. package/dist/helpers/getDevDepsList.js +1 -0
  3. package/dist/legacy/configs/base/config.js +24 -0
  4. package/dist/legacy/configs/base/index.js +18 -0
  5. package/dist/legacy/configs/base/legacy.js +46 -0
  6. package/dist/legacy/configs/base/recommended.js +21 -0
  7. package/dist/legacy/configs/base/typescript.js +8 -0
  8. package/dist/legacy/configs/index.js +15 -0
  9. package/dist/legacy/configs/react/base.js +8 -0
  10. package/dist/legacy/configs/react/config.js +14 -0
  11. package/dist/legacy/configs/react/hooks.js +8 -0
  12. package/dist/legacy/configs/react/index.js +24 -0
  13. package/dist/legacy/configs/react/legacy.js +8 -0
  14. package/dist/legacy/configs/react/recommended.js +13 -0
  15. package/dist/legacy/configs/react/typescript.js +35 -0
  16. package/dist/legacy/configs/typescript/config.js +12 -0
  17. package/dist/legacy/rules/best-practices.js +433 -0
  18. package/dist/legacy/rules/errors.js +167 -0
  19. package/dist/legacy/rules/es6.js +206 -0
  20. package/dist/legacy/rules/imports.js +280 -0
  21. package/dist/legacy/rules/index.js +18 -0
  22. package/dist/legacy/rules/node.js +35 -0
  23. package/dist/legacy/rules/react/react.js +663 -0
  24. package/dist/legacy/rules/react/reactHooks.js +30 -0
  25. package/dist/legacy/rules/react/reactJsxA11y.js +276 -0
  26. package/dist/legacy/rules/strict.js +12 -0
  27. package/dist/legacy/rules/style.js +655 -0
  28. package/dist/legacy/rules/typescript/typescript.js +251 -0
  29. package/dist/legacy/rules/typescript/typescriptOverrides.js +36 -0
  30. package/dist/legacy/rules/variables.js +68 -0
  31. package/dist/legacy.js +14 -0
  32. package/dist/rules/typescript/typescriptEslint.js +3 -0
  33. package/package.json +25 -10
@@ -0,0 +1,433 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../utils");
4
+ const legacyBestPracticesRules = {
5
+ name: 'airbnb/config/best-practices/legacy',
6
+ files: utils_1.allFiles,
7
+ rules: {
8
+ // enforces getter/setter pairs in objects
9
+ // https://eslint.org/docs/rules/accessor-pairs
10
+ 'accessor-pairs': 'off',
11
+ // enforces return statements in callbacks of array's methods
12
+ // https://eslint.org/docs/rules/array-callback-return
13
+ 'array-callback-return': [
14
+ 'error',
15
+ {
16
+ allowImplicit: true,
17
+ },
18
+ ],
19
+ // treat var statements as if they were block scoped
20
+ // https://eslint.org/docs/rules/block-scoped-var
21
+ 'block-scoped-var': 'error',
22
+ // specify the maximum cyclomatic complexity allowed in a program
23
+ // https://eslint.org/docs/rules/complexity
24
+ complexity: ['off', 20],
25
+ // enforce that class methods use "this"
26
+ // https://eslint.org/docs/rules/class-methods-use-this
27
+ 'class-methods-use-this': [
28
+ 'error',
29
+ {
30
+ exceptMethods: [],
31
+ },
32
+ ],
33
+ // require return statements to either always or never specify values
34
+ // https://eslint.org/docs/rules/consistent-return
35
+ 'consistent-return': 'error',
36
+ // specify curly brace conventions for all control statements
37
+ // https://eslint.org/docs/rules/curly
38
+ curly: ['error', 'multi-line'], // multiline
39
+ // require default case in switch statements
40
+ // https://eslint.org/docs/rules/default-case
41
+ 'default-case': [
42
+ 'error',
43
+ {
44
+ commentPattern: '^no default$',
45
+ },
46
+ ],
47
+ // Enforce default clauses in switch statements to be last
48
+ // https://eslint.org/docs/rules/default-case-last
49
+ 'default-case-last': 'error',
50
+ // https://eslint.org/docs/rules/default-param-last
51
+ 'default-param-last': 'error',
52
+ // encourages use of dot notation whenever possible
53
+ // https://eslint.org/docs/rules/dot-notation
54
+ 'dot-notation': [
55
+ 'error',
56
+ {
57
+ allowKeywords: true,
58
+ },
59
+ ],
60
+ // enforces consistent newlines before or after dots
61
+ // https://eslint.org/docs/rules/dot-location
62
+ 'dot-location': ['error', 'property'],
63
+ // require the use of === and !==
64
+ // https://eslint.org/docs/rules/eqeqeq
65
+ eqeqeq: [
66
+ 'error',
67
+ 'always',
68
+ {
69
+ null: 'ignore',
70
+ },
71
+ ],
72
+ // Require grouped accessor pairs in object literals and classes
73
+ // https://eslint.org/docs/rules/grouped-accessor-pairs
74
+ 'grouped-accessor-pairs': 'error',
75
+ // make sure for-in loops have an if statement
76
+ // https://eslint.org/docs/rules/guard-for-in
77
+ 'guard-for-in': 'error',
78
+ // enforce a maximum number of classes per file
79
+ // https://eslint.org/docs/rules/max-classes-per-file
80
+ 'max-classes-per-file': ['error', 1],
81
+ // disallow the use of alert, confirm, and prompt
82
+ // https://eslint.org/docs/rules/no-alert
83
+ 'no-alert': 'warn',
84
+ // disallow use of arguments.caller or arguments.callee
85
+ // https://eslint.org/docs/rules/no-caller
86
+ 'no-caller': 'error',
87
+ // disallow lexical declarations in case/default clauses
88
+ // https://eslint.org/docs/rules/no-case-declarations
89
+ 'no-case-declarations': 'error',
90
+ // Disallow returning value in constructor
91
+ // https://eslint.org/docs/rules/no-constructor-return
92
+ 'no-constructor-return': 'error',
93
+ // disallow division operators explicitly at beginning of regular expression
94
+ // https://eslint.org/docs/rules/no-div-regex
95
+ 'no-div-regex': 'off',
96
+ // disallow else after a return in an if
97
+ // https://eslint.org/docs/rules/no-else-return
98
+ 'no-else-return': [
99
+ 'error',
100
+ {
101
+ allowElseIf: false,
102
+ },
103
+ ],
104
+ // disallow empty functions, except for standalone funcs/arrows
105
+ // https://eslint.org/docs/rules/no-empty-function
106
+ 'no-empty-function': [
107
+ 'error',
108
+ {
109
+ allow: ['arrowFunctions', 'functions', 'methods'],
110
+ },
111
+ ],
112
+ // disallow empty destructuring patterns
113
+ // https://eslint.org/docs/rules/no-empty-pattern
114
+ 'no-empty-pattern': 'error',
115
+ // Disallow empty static blocks
116
+ // https://eslint.org/docs/latest/rules/no-empty-static-block
117
+ 'no-empty-static-block': 'off',
118
+ // disallow comparisons to null without a type-checking operator
119
+ // https://eslint.org/docs/rules/no-eq-null
120
+ 'no-eq-null': 'off',
121
+ // disallow use of eval()
122
+ // https://eslint.org/docs/rules/no-eval
123
+ 'no-eval': 'error',
124
+ // disallow adding to native types
125
+ // https://eslint.org/docs/rules/no-extend-native
126
+ 'no-extend-native': 'error',
127
+ // disallow unnecessary function binding
128
+ // https://eslint.org/docs/rules/no-extra-bind
129
+ 'no-extra-bind': 'error',
130
+ // disallow Unnecessary Labels
131
+ // https://eslint.org/docs/rules/no-extra-label
132
+ 'no-extra-label': 'error',
133
+ // disallow fallthrough of case statements
134
+ // https://eslint.org/docs/rules/no-fallthrough
135
+ 'no-fallthrough': 'error',
136
+ // disallow the use of leading or trailing decimal points in numeric literals
137
+ // https://eslint.org/docs/rules/no-floating-decimal
138
+ 'no-floating-decimal': 'error',
139
+ // disallow reassignments of native objects or read-only globals
140
+ // https://eslint.org/docs/rules/no-global-assign
141
+ 'no-global-assign': [
142
+ 'error',
143
+ {
144
+ exceptions: [],
145
+ },
146
+ ],
147
+ // deprecated in favor of no-global-assign
148
+ // https://eslint.org/docs/rules/no-native-reassign
149
+ 'no-native-reassign': 'off',
150
+ // disallow implicit type conversions
151
+ // https://eslint.org/docs/rules/no-implicit-coercion
152
+ 'no-implicit-coercion': [
153
+ 'off',
154
+ {
155
+ boolean: false,
156
+ number: true,
157
+ string: true,
158
+ allow: [],
159
+ },
160
+ ],
161
+ // disallow var and named functions in global scope
162
+ // https://eslint.org/docs/rules/no-implicit-globals
163
+ 'no-implicit-globals': 'off',
164
+ // disallow use of eval()-like methods
165
+ // https://eslint.org/docs/rules/no-implied-eval
166
+ 'no-implied-eval': 'error',
167
+ // disallow this keywords outside of classes or class-like objects
168
+ // https://eslint.org/docs/rules/no-invalid-this
169
+ 'no-invalid-this': 'off',
170
+ // disallow usage of __iterator__ property
171
+ // https://eslint.org/docs/rules/no-iterator
172
+ 'no-iterator': 'error',
173
+ // disallow use of labels for anything other than loops and switches
174
+ // https://eslint.org/docs/rules/no-labels
175
+ 'no-labels': [
176
+ 'error',
177
+ {
178
+ allowLoop: false,
179
+ allowSwitch: false,
180
+ },
181
+ ],
182
+ // disallow unnecessary nested blocks
183
+ // https://eslint.org/docs/rules/no-lone-blocks
184
+ 'no-lone-blocks': 'error',
185
+ // disallow creation of functions within loops
186
+ // https://eslint.org/docs/rules/no-loop-func
187
+ 'no-loop-func': 'error',
188
+ // disallow magic numbers
189
+ // https://eslint.org/docs/rules/no-magic-numbers
190
+ 'no-magic-numbers': [
191
+ 'off',
192
+ {
193
+ ignore: [],
194
+ ignoreArrayIndexes: true,
195
+ enforceConst: true,
196
+ detectObjects: false,
197
+ },
198
+ ],
199
+ // disallow use of multiple spaces
200
+ // https://eslint.org/docs/rules/no-multi-spaces
201
+ 'no-multi-spaces': [
202
+ 'error',
203
+ {
204
+ ignoreEOLComments: false,
205
+ },
206
+ ],
207
+ // disallow use of multiline strings
208
+ // https://eslint.org/docs/rules/no-multi-str
209
+ 'no-multi-str': 'error',
210
+ // disallow use of new operator when not part of the assignment or comparison
211
+ // https://eslint.org/docs/rules/no-new
212
+ 'no-new': 'error',
213
+ // disallow use of new operator for Function object
214
+ // https://eslint.org/docs/rules/no-new-func
215
+ 'no-new-func': 'error',
216
+ // disallows creating new instances of String, Number, and Boolean
217
+ // https://eslint.org/docs/rules/no-new-wrappers
218
+ 'no-new-wrappers': 'error',
219
+ // Disallow \8 and \9 escape sequences in string literals
220
+ // https://eslint.org/docs/rules/no-nonoctal-decimal-escape
221
+ 'no-nonoctal-decimal-escape': 'error',
222
+ // Disallow calls to the Object constructor without an argument
223
+ // https://eslint.org/docs/latest/rules/no-object-constructor
224
+ 'no-object-constructor': 'off',
225
+ // disallow use of (old style) octal literals
226
+ // https://eslint.org/docs/rules/no-octal
227
+ 'no-octal': 'error',
228
+ // disallow use of octal escape sequences in string literals, such as
229
+ // var foo = 'Copyright \251';
230
+ // https://eslint.org/docs/rules/no-octal-escape
231
+ 'no-octal-escape': 'error',
232
+ // disallow reassignment of function parameters
233
+ // disallow parameter object manipulation except for specific exclusions
234
+ // rule: https://eslint.org/docs/rules/no-param-reassign.html
235
+ 'no-param-reassign': [
236
+ 'error',
237
+ {
238
+ props: true,
239
+ ignorePropertyModificationsFor: [
240
+ 'acc', // for reduce accumulators
241
+ 'accumulator', // for reduce accumulators
242
+ 'e', // for e.returnvalue
243
+ 'ctx', // for Koa routing
244
+ 'context', // for Koa routing
245
+ 'req', // for Express requests
246
+ 'request', // for Express requests
247
+ 'res', // for Express responses
248
+ 'response', // for Express responses
249
+ '$scope', // for Angular 1 scopes
250
+ 'staticContext', // for ReactRouter context
251
+ ],
252
+ },
253
+ ],
254
+ // disallow usage of __proto__ property
255
+ // https://eslint.org/docs/rules/no-proto
256
+ 'no-proto': 'error',
257
+ // disallow declaring the same variable more than once
258
+ // https://eslint.org/docs/rules/no-redeclare
259
+ 'no-redeclare': 'error',
260
+ // disallow certain object properties
261
+ // https://eslint.org/docs/rules/no-restricted-properties
262
+ 'no-restricted-properties': [
263
+ 'error',
264
+ {
265
+ object: 'arguments',
266
+ property: 'callee',
267
+ message: 'arguments.callee is deprecated',
268
+ },
269
+ {
270
+ object: 'global',
271
+ property: 'isFinite',
272
+ message: 'Please use Number.isFinite instead',
273
+ },
274
+ {
275
+ object: 'self',
276
+ property: 'isFinite',
277
+ message: 'Please use Number.isFinite instead',
278
+ },
279
+ {
280
+ object: 'window',
281
+ property: 'isFinite',
282
+ message: 'Please use Number.isFinite instead',
283
+ },
284
+ {
285
+ object: 'global',
286
+ property: 'isNaN',
287
+ message: 'Please use Number.isNaN instead',
288
+ },
289
+ {
290
+ object: 'self',
291
+ property: 'isNaN',
292
+ message: 'Please use Number.isNaN instead',
293
+ },
294
+ {
295
+ object: 'window',
296
+ property: 'isNaN',
297
+ message: 'Please use Number.isNaN instead',
298
+ },
299
+ {
300
+ property: '__defineGetter__',
301
+ message: 'Please use Object.defineProperty instead.',
302
+ },
303
+ {
304
+ property: '__defineSetter__',
305
+ message: 'Please use Object.defineProperty instead.',
306
+ },
307
+ {
308
+ object: 'Math',
309
+ property: 'pow',
310
+ message: 'Use the exponentiation operator (**) instead.',
311
+ },
312
+ ],
313
+ // disallow use of assignment in return statement
314
+ // https://eslint.org/docs/rules/no-return-assign
315
+ 'no-return-assign': ['error', 'always'],
316
+ // disallow redundant `return await`
317
+ // https://eslint.org/docs/rules/no-return-await
318
+ 'no-return-await': 'error',
319
+ // disallow use of `javascript:` urls.
320
+ // https://eslint.org/docs/rules/no-script-url
321
+ 'no-script-url': 'error',
322
+ // disallow self assignment
323
+ // https://eslint.org/docs/rules/no-self-assign
324
+ 'no-self-assign': [
325
+ 'error',
326
+ {
327
+ props: true,
328
+ },
329
+ ],
330
+ // disallow comparisons where both sides are exactly the same
331
+ // https://eslint.org/docs/rules/no-self-compare
332
+ 'no-self-compare': 'error',
333
+ // disallow use of comma operator
334
+ // https://eslint.org/docs/rules/no-sequences
335
+ 'no-sequences': 'error',
336
+ // restrict what can be thrown as an exception
337
+ // https://eslint.org/docs/rules/no-throw-literal
338
+ 'no-throw-literal': 'error',
339
+ // disallow unmodified conditions of loops
340
+ // https://eslint.org/docs/rules/no-unmodified-loop-condition
341
+ 'no-unmodified-loop-condition': 'off',
342
+ // disallow usage of expressions in statement position
343
+ // https://eslint.org/docs/rules/no-unused-expressions
344
+ 'no-unused-expressions': [
345
+ 'error',
346
+ {
347
+ allowShortCircuit: false,
348
+ allowTernary: false,
349
+ allowTaggedTemplates: false,
350
+ },
351
+ ],
352
+ // disallow unused labels
353
+ // https://eslint.org/docs/rules/no-unused-labels
354
+ 'no-unused-labels': 'error',
355
+ // disallow unnecessary .call() and .apply()
356
+ // https://eslint.org/docs/rules/no-useless-call
357
+ 'no-useless-call': 'off',
358
+ // Disallow unnecessary catch clauses
359
+ // https://eslint.org/docs/rules/no-useless-catch
360
+ 'no-useless-catch': 'error',
361
+ // disallow useless string concatenation
362
+ // https://eslint.org/docs/rules/no-useless-concat
363
+ 'no-useless-concat': 'error',
364
+ // disallow unnecessary string escaping
365
+ // https://eslint.org/docs/rules/no-useless-escape
366
+ 'no-useless-escape': 'error',
367
+ // disallow redundant return; keywords
368
+ // https://eslint.org/docs/rules/no-useless-return
369
+ 'no-useless-return': 'error',
370
+ // disallow use of void operator
371
+ // https://eslint.org/docs/rules/no-void
372
+ 'no-void': 'error',
373
+ // disallow usage of configurable warning terms in comments: e.g. todo
374
+ // https://eslint.org/docs/rules/no-warning-comments
375
+ 'no-warning-comments': [
376
+ 'off',
377
+ {
378
+ terms: ['todo', 'fixme', 'xxx'],
379
+ location: 'start',
380
+ },
381
+ ],
382
+ // disallow use of the with statement
383
+ // https://eslint.org/docs/rules/no-with
384
+ 'no-with': 'error',
385
+ // require using Error objects as Promise rejection reasons
386
+ // https://eslint.org/docs/rules/prefer-promise-reject-errors
387
+ 'prefer-promise-reject-errors': [
388
+ 'error',
389
+ {
390
+ allowEmptyReject: true,
391
+ },
392
+ ],
393
+ // Suggest using named capture group in regular expression
394
+ // https://eslint.org/docs/rules/prefer-named-capture-group
395
+ 'prefer-named-capture-group': 'off',
396
+ // Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
397
+ // https://eslint.org/docs/rules/prefer-object-has-own
398
+ // TODO: semver-major: enable thus rule, once eslint v8.5.0 is required
399
+ 'prefer-object-has-own': 'off',
400
+ // https://eslint.org/docs/rules/prefer-regex-literals
401
+ 'prefer-regex-literals': [
402
+ 'error',
403
+ {
404
+ disallowRedundantWrapping: true,
405
+ },
406
+ ],
407
+ // require use of the second argument for parseInt()
408
+ // https://eslint.org/docs/rules/radix
409
+ radix: 'error',
410
+ // require `await` in `async function` (note: this is a horrible rule that should never be used)
411
+ // https://eslint.org/docs/rules/require-await
412
+ 'require-await': 'off',
413
+ // Enforce the use of u flag on RegExp
414
+ // https://eslint.org/docs/rules/require-unicode-regexp
415
+ 'require-unicode-regexp': 'off',
416
+ // requires to declare all vars on top of their containing scope
417
+ // https://eslint.org/docs/rules/vars-on-top
418
+ 'vars-on-top': 'error',
419
+ // require immediate function invocation to be wrapped in parentheses
420
+ // https://eslint.org/docs/rules/wrap-iife.html
421
+ 'wrap-iife': [
422
+ 'error',
423
+ 'outside',
424
+ {
425
+ functionPrototypeMethods: false,
426
+ },
427
+ ],
428
+ // require or disallow Yoda conditions
429
+ // https://eslint.org/docs/rules/yoda
430
+ yoda: 'error',
431
+ },
432
+ };
433
+ exports.default = legacyBestPracticesRules;
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../utils");
4
+ const legacyErrorsRules = {
5
+ name: 'airbnb/config/errors/legacy',
6
+ files: utils_1.allFiles,
7
+ rules: {
8
+ // Enforce “for” loop update clause moving the counter in the right direction
9
+ // https://eslint.org/docs/rules/for-direction
10
+ 'for-direction': 'error',
11
+ // Enforces that a return statement is present in property getters
12
+ // https://eslint.org/docs/rules/getter-return
13
+ 'getter-return': [
14
+ 'error',
15
+ {
16
+ allowImplicit: true,
17
+ },
18
+ ],
19
+ // disallow using an async function as a Promise executor
20
+ // https://eslint.org/docs/rules/no-async-promise-executor
21
+ 'no-async-promise-executor': 'error',
22
+ // Disallow await inside of loops
23
+ // https://eslint.org/docs/rules/no-await-in-loop
24
+ 'no-await-in-loop': 'error',
25
+ // Disallow comparisons to negative zero
26
+ // https://eslint.org/docs/rules/no-compare-neg-zero
27
+ 'no-compare-neg-zero': 'error',
28
+ // disallow assignment in conditional expressions
29
+ 'no-cond-assign': ['error', 'always'],
30
+ // disallow use of console
31
+ 'no-console': 'warn',
32
+ // Disallows expressions where the operation doesn't affect the value
33
+ // https://eslint.org/docs/rules/no-constant-binary-expression
34
+ 'no-constant-binary-expression': 'off',
35
+ // disallow use of constant expressions in conditions
36
+ 'no-constant-condition': 'warn',
37
+ // disallow control characters in regular expressions
38
+ 'no-control-regex': 'error',
39
+ // disallow use of debugger
40
+ 'no-debugger': 'error',
41
+ // disallow duplicate arguments in functions
42
+ 'no-dupe-args': 'error',
43
+ // Disallow duplicate conditions in if-else-if chains
44
+ // https://eslint.org/docs/rules/no-dupe-else-if
45
+ 'no-dupe-else-if': 'error',
46
+ // disallow duplicate keys when creating object literals
47
+ 'no-dupe-keys': 'error',
48
+ // disallow a duplicate case label.
49
+ 'no-duplicate-case': 'error',
50
+ // disallow empty statements
51
+ 'no-empty': 'error',
52
+ // disallow the use of empty character classes in regular expressions
53
+ 'no-empty-character-class': 'error',
54
+ // disallow assigning to the exception in a catch block
55
+ 'no-ex-assign': 'error',
56
+ // disallow double-negation boolean casts in a boolean context
57
+ // https://eslint.org/docs/rules/no-extra-boolean-cast
58
+ 'no-extra-boolean-cast': 'error',
59
+ // disallow unnecessary parentheses
60
+ // https://eslint.org/docs/rules/no-extra-parens
61
+ 'no-extra-parens': [
62
+ 'off',
63
+ 'all',
64
+ {
65
+ conditionalAssign: true,
66
+ nestedBinaryExpressions: false,
67
+ returnAssign: false,
68
+ ignoreJSX: 'all', // delegate to eslint-plugin-react
69
+ enforceForArrowConditionals: false,
70
+ },
71
+ ],
72
+ // disallow unnecessary semicolons
73
+ 'no-extra-semi': 'error',
74
+ // disallow overwriting functions written as function declarations
75
+ 'no-func-assign': 'error',
76
+ // https://eslint.org/docs/rules/no-import-assign
77
+ 'no-import-assign': 'error',
78
+ // disallow function or variable declarations in nested blocks
79
+ 'no-inner-declarations': 'error',
80
+ // disallow invalid regular expression strings in the RegExp constructor
81
+ 'no-invalid-regexp': 'error',
82
+ // disallow irregular whitespace outside of strings and comments
83
+ 'no-irregular-whitespace': 'error',
84
+ // Disallow Number Literals That Lose Precision
85
+ // https://eslint.org/docs/rules/no-loss-of-precision
86
+ 'no-loss-of-precision': 'error',
87
+ // Disallow characters which are made with multiple code points in character class syntax
88
+ // https://eslint.org/docs/rules/no-misleading-character-class
89
+ 'no-misleading-character-class': 'error',
90
+ // disallow the use of object properties of the global object (Math and JSON) as functions
91
+ 'no-obj-calls': 'error',
92
+ // Disallow new operators with global non-constructor functions
93
+ // https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
94
+ // TODO: semver-major, enable
95
+ 'no-new-native-nonconstructor': 'off',
96
+ // Disallow returning values from Promise executor functions
97
+ // https://eslint.org/docs/rules/no-promise-executor-return
98
+ 'no-promise-executor-return': 'error',
99
+ // disallow use of Object.prototypes builtins directly
100
+ // https://eslint.org/docs/rules/no-prototype-builtins
101
+ 'no-prototype-builtins': 'error',
102
+ // disallow multiple spaces in a regular expression literal
103
+ 'no-regex-spaces': 'error',
104
+ // Disallow returning values from setters
105
+ // https://eslint.org/docs/rules/no-setter-return
106
+ 'no-setter-return': 'error',
107
+ // disallow sparse arrays
108
+ 'no-sparse-arrays': 'error',
109
+ // Disallow template literal placeholder syntax in regular strings
110
+ // https://eslint.org/docs/rules/no-template-curly-in-string
111
+ 'no-template-curly-in-string': 'error',
112
+ // Avoid code that looks like two expressions but is actually one
113
+ // https://eslint.org/docs/rules/no-unexpected-multiline
114
+ 'no-unexpected-multiline': 'error',
115
+ // disallow unreachable statements after a return, throw, continue, or break statement
116
+ 'no-unreachable': 'error',
117
+ // Disallow loops with a body that allows only one iteration
118
+ // https://eslint.org/docs/rules/no-unreachable-loop
119
+ 'no-unreachable-loop': [
120
+ 'error',
121
+ {
122
+ ignore: [], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
123
+ },
124
+ ],
125
+ // disallow return/throw/break/continue inside finally blocks
126
+ // https://eslint.org/docs/rules/no-unsafe-finally
127
+ 'no-unsafe-finally': 'error',
128
+ // disallow negating the left operand of relational operators
129
+ // https://eslint.org/docs/rules/no-unsafe-negation
130
+ 'no-unsafe-negation': 'error',
131
+ // disallow use of optional chaining in contexts where the undefined value is not allowed
132
+ // https://eslint.org/docs/rules/no-unsafe-optional-chaining
133
+ 'no-unsafe-optional-chaining': [
134
+ 'error',
135
+ {
136
+ disallowArithmeticOperators: true,
137
+ },
138
+ ],
139
+ // Disallow Unused Private Class Members
140
+ // https://eslint.org/docs/rules/no-unused-private-class-members
141
+ 'no-unused-private-class-members': 'off',
142
+ // Disallow useless backreferences in regular expressions
143
+ // https://eslint.org/docs/rules/no-useless-backreference
144
+ 'no-useless-backreference': 'error',
145
+ // disallow negation of the left operand of an in expression
146
+ // deprecated in favor of no-unsafe-negation
147
+ 'no-negated-in-lhs': 'off',
148
+ // Disallow assignments that can lead to race conditions due to usage of await or yield
149
+ // https://eslint.org/docs/rules/require-atomic-updates
150
+ // note: not enabled because it is very buggy
151
+ 'require-atomic-updates': 'off',
152
+ // disallow comparisons with the value NaN
153
+ 'use-isnan': 'error',
154
+ // ensure JSDoc comments are valid
155
+ // https://eslint.org/docs/rules/valid-jsdoc
156
+ 'valid-jsdoc': 'off',
157
+ // ensure that the results of typeof are compared against a valid string
158
+ // https://eslint.org/docs/rules/valid-typeof
159
+ 'valid-typeof': [
160
+ 'error',
161
+ {
162
+ requireStringLiterals: true,
163
+ },
164
+ ],
165
+ },
166
+ };
167
+ exports.default = legacyErrorsRules;