@egs33/eslint-config 2.2.1 → 3.0.0

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