@prowise/eslint-config-linting-rules 2.4.7 → 3.0.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.
@@ -10,365 +10,12 @@ export default {
10
10
  */
11
11
 
12
12
  rules: {
13
- // ========================= Possible problems ==========================
14
-
15
13
  /**
16
14
  * Enforces return statements in callbacks of array"s methods
17
15
  * https://eslint.org/docs/latest/rules/array-callback-return.
18
16
  */
19
17
  "array-callback-return": ["error", { allowImplicit: true }],
20
18
 
21
- /**
22
- * Verify super() callings in constructors ✅
23
- * https://eslint.org/docs/latest/rules/constructor-super.
24
- */
25
- "constructor-super": "error",
26
-
27
- /**
28
- * Enforce “for” loop update clause moving the counter in the right direction ✅
29
- * https://eslint.org/docs/latest/rules/for-direction.
30
- */
31
- "for-direction": "error",
32
-
33
- /**
34
- * Enforces that a return statement is present in property getters ✅
35
- * https://eslint.org/docs/latest/rules/getter-return.
36
- */
37
- "getter-return": ["error", { allowImplicit: true }],
38
-
39
- /**
40
- * Disallow using an async function as a Promise executor ✅
41
- * https://eslint.org/docs/latest/rules/no-async-promise-executor.
42
- */
43
- "no-async-promise-executor": "error",
44
-
45
- /**
46
- * Disallow await inside of loops
47
- * https://eslint.org/docs/latest/rules/no-await-in-loop.
48
- */
49
- "no-await-in-loop": "off",
50
-
51
- /**
52
- * Disallow modifying variables of class declarations ✅
53
- * https://eslint.org/docs/latest/rules/no-class-assign.
54
- */
55
- "no-class-assign": "error",
56
-
57
- /**
58
- * Disallow comparisons to negative zero ✅
59
- * https://eslint.org/docs/latest/rules/no-compare-neg-zero.
60
- */
61
- "no-compare-neg-zero": "error",
62
-
63
- /**
64
- * Disallow assignment in conditional expressions ✅
65
- * https://eslint.org/docs/latest/rules/no-cond-assign.
66
- */
67
- "no-cond-assign": ["error", "except-parens"],
68
-
69
- /**
70
- * Disallow modifying variables that are declared using const ✅
71
- * https://eslint.org/docs/latest/rules/no-const-assign.
72
- */
73
- "no-const-assign": "error",
74
-
75
- /**
76
- * Disallow expressions where the operation doesn"t affect the value
77
- * https://eslint.org/docs/latest/rules/no-constant-binary-expression.
78
- */
79
- "no-constant-binary-expression": "error",
80
-
81
- /**
82
- * Disallow use of constant expressions in conditions ✅
83
- * https://eslint.org/docs/latest/rules/no-constant-condition.
84
- */
85
- "no-constant-condition": "error",
86
-
87
- /**
88
- * Disallow returning value in constructor
89
- * https://eslint.org/docs/latest/rules/no-constructor-return.
90
- */
91
- "no-constructor-return": "error",
92
-
93
- /**
94
- * Disallow control characters in regular expressions ✅
95
- * https://eslint.org/docs/latest/rules/no-control-regex.
96
- */
97
- "no-control-regex": "error",
98
-
99
- /**
100
- * Disallow use of debugger ✅
101
- * https://eslint.org/docs/latest/rules/no-debugger.
102
- */
103
- "no-debugger": "error",
104
-
105
- /**
106
- * Disallow duplicate arguments in functions ✅
107
- * https://eslint.org/docs/latest/rules/no-dupe-args.
108
- */
109
- "no-dupe-args": "error",
110
-
111
- /**
112
- * Disallow duplicate class members ✅
113
- * https://eslint.org/docs/latest/rules/no-dupe-class-members.
114
- */
115
- "no-dupe-class-members": "error",
116
-
117
- /**
118
- * Disallow duplicate conditions in if-else-if chains ✅
119
- * https://eslint.org/docs/latest/rules/no-dupe-else-if.
120
- */
121
- "no-dupe-else-if": "error",
122
-
123
- /**
124
- * Disallow duplicate keys when creating object literals ✅
125
- * https://eslint.org/docs/latest/rules/no-dupe-keys.
126
- */
127
- "no-dupe-keys": "error",
128
-
129
- /**
130
- * Disallow a duplicate case label. ✅
131
- * https://eslint.org/docs/latest/rules/no-duplicate-case.
132
- */
133
- "no-duplicate-case": "error",
134
-
135
- /**
136
- * Disallow importing from the same path more than once
137
- * https://eslint.org/docs/latest/rules/no-duplicate-imports.
138
- */
139
- "no-duplicate-imports": "error",
140
-
141
- /**
142
- * Disallow the use of empty character classes in regular expressions ✅
143
- * https://eslint.org/docs/latest/rules/no-empty-character-class.
144
- */
145
- "no-empty-character-class": "error",
146
-
147
- /**
148
- * Disallow empty destructuring patterns ✅
149
- * https://eslint.org/docs/latest/rules/no-empty-pattern.
150
- */
151
- "no-empty-pattern": "error",
152
-
153
- /**
154
- * Disallow empty destructuring patterns ✅
155
- * https://eslint.org/docs/latest/rules/no-empty-pattern.
156
- */
157
- // "no-empty-static-block": "off",
158
-
159
- /**
160
- * Disallow assigning to the exception in a catch block ✅
161
- * https://eslint.org/docs/latest/rules/no-ex-assign.
162
- */
163
- "no-ex-assign": "error",
164
-
165
- /**
166
- * Disallow fallthrough of case statements ✅
167
- * https://eslint.org/docs/latest/rules/no-fallthrough.
168
- */
169
- // "no-fallthrough": "off",
170
-
171
- /**
172
- * Disallow overwriting functions written as function declarations ✅
173
- * https://eslint.org/docs/latest/rules/no-func-assign.
174
- */
175
- "no-func-assign": "error",
176
-
177
- /**
178
- * Disallow import assignment ✅
179
- * https://eslint.org/docs/latest/rules/no-import-assign.
180
- */
181
- "no-import-assign": "error",
182
-
183
- /**
184
- * Disallow function or variable declarations in nested blocks ✅
185
- * https://eslint.org/docs/latest/rules/no-inner-declarations.
186
- */
187
- "no-inner-declarations": "error",
188
-
189
- /**
190
- * Disallow invalid regular expression strings in the RegExp constructor ✅
191
- * https://eslint.org/docs/latest/rules/no-invalid-regexp.
192
- */
193
- "no-invalid-regexp": "error",
194
-
195
- /**
196
- * Disallow irregular whitespace outside of strings and comments ✅
197
- * https://eslint.org/docs/latest/rules/no-irregular-whitespace.
198
- */
199
- "no-irregular-whitespace": "error",
200
-
201
- /**
202
- * Disallow number literals that lose precision ✅
203
- * https://eslint.org/docs/latest/rules/no-loss-of-precision.
204
- */
205
- "no-loss-of-precision": "error",
206
-
207
- /**
208
- * Disallow characters which are made with multiple code points in character class syntax ✅ 💡
209
- * https://eslint.org/docs/latest/rules/no-misleading-character-class.
210
- */
211
- "no-misleading-character-class": "error",
212
-
213
- /**
214
- * Disallow symbol constructor ✅
215
- * https://eslint.org/docs/latest/rules/no-new-native-nonconstructor.
216
- */
217
- "no-new-native-nonconstructor": "error",
218
-
219
- /**
220
- * Disallow the use of object properties of the global object (Math and JSON) as functions ✅
221
- * https://eslint.org/docs/latest/rules/no-obj-calls.
222
- */
223
- "no-obj-calls": "error",
224
-
225
- /**
226
- * Disallow returning values from promise executor functions
227
- * https://eslint.org/docs/latest/rules/no-promise-executor-return.
228
- */
229
- "no-promise-executor-return": "error",
230
-
231
- /**
232
- * Disallow calling Object prototypes ✅
233
- * https://eslint.org/docs/latest/rules/no-prototype-builtins.
234
- */
235
- "no-prototype-builtins": "warn",
236
-
237
- /**
238
- * Disallow self assignment ✅
239
- * https://eslint.org/docs/latest/rules/no-self-assign.
240
- */
241
- "no-self-assign": ["error", { props: true }],
242
-
243
- /**
244
- * Disallow comparisons where both sides are exactly the same
245
- * https://eslint.org/docs/latest/rules/no-self-compare.
246
- */
247
- "no-self-compare": "error",
248
-
249
- /**
250
- * Disallow returning values from setters ✅
251
- * https://eslint.org/docs/latest/rules/no-setter-return.
252
- */
253
- "no-setter-return": "error",
254
-
255
- /**
256
- * Disallow sparse arrays ✅
257
- * https://eslint.org/docs/latest/rules/no-sparse-arrays.
258
- */
259
- "no-sparse-arrays": "error",
260
-
261
- /**
262
- * Disallow template literal placeholder syntax in regular strings
263
- * https://eslint.org/docs/latest/rules/no-template-curly-in-string.
264
- */
265
- "no-template-curly-in-string": "error",
266
-
267
- /**
268
- * Disallow to use this/super before super() calling in constructors. ✅
269
- * https://eslint.org/docs/latest/rules/no-this-before-super.
270
- */
271
- "no-this-before-super": "error",
272
-
273
- /**
274
- * Disallow use of undeclared variables unless mentioned in a /global/ block ✅
275
- * https://eslint.org/docs/latest/rules/no-undef.
276
- */
277
- "no-undef": "error",
278
-
279
- /**
280
- * Avoid code that looks like two expressions but is actually one ✅
281
- * https://eslint.org/docs/latest/rules/no-unexpected-multiline.
282
- */
283
- "no-unexpected-multiline": "error",
284
-
285
- /**
286
- * Disallow unmodified conditions of loops
287
- * https://eslint.org/docs/latest/rules/no-unmodified-loop-condition.
288
- */
289
- // "no-unmodified-loop-condition": "off",
290
-
291
- /**
292
- * Disallow unreachable statements after a return, throw, continue, or break statement ✅
293
- * https://eslint.org/docs/latest/rules/no-unreachable.
294
- */
295
- "no-unreachable": "error",
296
-
297
- /**
298
- * Disallow loops with a body that allows only one iteration
299
- * https://eslint.org/docs/latest/rules/no-unreachable-loop.
300
- */
301
- "no-unreachable-loop": ["error", { ignore: [] }], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
302
-
303
- /**
304
- * Disallow return/throw/break/continue inside finally blocks ✅
305
- * https://eslint.org/docs/latest/rules/no-unsafe-finally.
306
- */
307
- "no-unsafe-finally": "error",
308
-
309
- /**
310
- * Disallow negating the left operand of relational operators ✅ 💡
311
- * https://eslint.org/docs/latest/rules/no-unsafe-negation.
312
- */
313
- "no-unsafe-negation": "error",
314
-
315
- /**
316
- * Disallow use of optional chaining in contexts where the undefined value is not allowed ✅
317
- * https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining.
318
- */
319
- "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
320
-
321
- /**
322
- * Disallow unused private class members
323
- * https://eslint.org/docs/latest/rules/no-unused-private-class-members.
324
- */
325
- "no-unused-private-class-members": "error",
326
-
327
- /**
328
- * Disallow declaration of variables that are not used in the code ✅
329
- * https://eslint.org/docs/latest/rules/no-unused-vars.
330
- */
331
- "no-unused-vars": ["error", { vars: "all", args: "after-used", caughtErrors: "none", ignoreRestSiblings: true, argsIgnorePattern: "^_" }],
332
-
333
- /**
334
- * Disallow use of variables before they are defined
335
- * https://eslint.org/docs/latest/rules/no-use-before-define.
336
- */
337
- "no-use-before-define": ["error", { functions: true, classes: true, variables: true, allowNamedExports: true }],
338
-
339
- /**
340
- * Disallow useless backreferences in regular expressions ✅
341
- * https://eslint.org/docs/latest/rules/no-useless-backreference.
342
- */
343
- "no-useless-backreference": "error",
344
-
345
- /**
346
- * Disallow assignments that can lead to race conditions due to usage of await or yield
347
- * note: not enabled because it is very buggy
348
- * https://eslint.org/docs/latest/rules/require-atomic-updates.
349
- */
350
- // "require-atomic-updates": "off",
351
-
352
- /**
353
- * Disallow comparisons with the value NaN ✅
354
- * https://eslint.org/docs/latest/rules/use-isnan.
355
- */
356
- "use-isnan": "error",
357
-
358
- /**
359
- * Ensure that the results of typeof are compared against a valid string ✅ 💡
360
- * https://eslint.org/docs/latest/rules/valid-typeof.
361
- */
362
- "valid-typeof": ["error", { requireStringLiterals: true }],
363
-
364
- // ==================== Suggestions ================================================
365
-
366
- /**
367
- * Enforces getter/setter pairs in objects
368
- * https://eslint.org/docs/latest/rules/accessor-pairs.
369
- */
370
- // "accessor-pairs": "off",
371
-
372
19
  /**
373
20
  * Enforces no braces where they can be omitted 🔧
374
21
  * https://eslint.org/docs/latest/rules/arrow-body-style.
@@ -408,40 +55,6 @@ export default {
408
55
  },
409
56
  ],
410
57
 
411
- /**
412
- * Enforce that class methods use "this"
413
- * https://eslint.org/docs/latest/rules/class-methods-use-this.
414
- */
415
- // "class-methods-use-this": [
416
- // "off",
417
- // {
418
- // exceptMethods: [
419
- // "render",
420
- // "getInitialState",
421
- // "getDefaultProps",
422
- // "getChildContext",
423
- // "componentWillMount",
424
- // "UNSAFE_componentWillMount",
425
- // "componentDidMount",
426
- // "componentWillReceiveProps",
427
- // "UNSAFE_componentWillReceiveProps",
428
- // "shouldComponentUpdate",
429
- // "componentWillUpdate",
430
- // "UNSAFE_componentWillUpdate",
431
- // "componentDidUpdate",
432
- // "componentWillUnmount",
433
- // "componentDidCatch",
434
- // "getSnapshotBeforeUpdate",
435
- // ],
436
- // },
437
- // ],
438
-
439
- /**
440
- * Specify the maximum cyclomatic complexity allowed in a program
441
- * https://eslint.org/docs/latest/rules/complexity.
442
- */
443
- // "complexity": ["off", 20],
444
-
445
58
  /**
446
59
  * Require return statements to either always or never specify values
447
60
  * https://eslint.org/docs/latest/rules/consistent-return.
@@ -449,10 +62,10 @@ export default {
449
62
  "consistent-return": "error",
450
63
 
451
64
  /**
452
- * Enforces consistent naming when capturing the current execution context
453
- * https://eslint.org/docs/latest/rules/consistent-this.
65
+ * Verify super() callings in constructors ✅
66
+ * https://eslint.org/docs/latest/rules/constructor-super.
454
67
  */
455
- // "consistent-this": "off",
68
+ "constructor-super": "error",
456
69
 
457
70
  /**
458
71
  * Specify curly brace conventions for all control statements 🔧
@@ -491,20 +104,10 @@ export default {
491
104
  "eqeqeq": ["error", "always", { null: "ignore" }],
492
105
 
493
106
  /**
494
- * Requires function names to match the name of the variable or property to which they are assigned
495
- * https://eslint.org/docs/latest/rules/func-name-matching.
496
- */
497
- // "func-name-matching": [
498
- // "off",
499
- // "always",
500
- // { includeCommonJSModuleExports: false, considerPropertyDescriptor: true },
501
- // ],
502
-
503
- /**
504
- * Require function expressions to have a name
505
- * https://eslint.org/docs/latest/rules/func-names.
107
+ * Enforce “for” loop update clause moving the counter in the right direction ✅
108
+ * https://eslint.org/docs/latest/rules/for-direction.
506
109
  */
507
- // "func-names": "off",
110
+ "for-direction": "error",
508
111
 
509
112
  /**
510
113
  * Enforces use of function declarations
@@ -513,17 +116,16 @@ export default {
513
116
  "func-style": ["error", "declaration", { allowArrowFunctions: true }],
514
117
 
515
118
  /**
516
- * Require grouped accessor pairs in object literals and classes
517
- * https://eslint.org/docs/latest/rules/grouped-accessor-pairs.
119
+ * Enforces that a return statement is present in property getters ✅
120
+ * https://eslint.org/docs/latest/rules/getter-return.
518
121
  */
519
- "grouped-accessor-pairs": "error",
122
+ "getter-return": ["error", { allowImplicit: true }],
520
123
 
521
124
  /**
522
- * Make sure for-in loops have an if statement
523
- * Off: not really a thing anymore
524
- * https://eslint.org/docs/latest/rules/guard-for-in.
125
+ * Require grouped accessor pairs in object literals and classes
126
+ * https://eslint.org/docs/latest/rules/grouped-accessor-pairs.
525
127
  */
526
- // "guard-for-in": "off",
128
+ "grouped-accessor-pairs": "error",
527
129
 
528
130
  /**
529
131
  * Disallow specified identifiers
@@ -531,14 +133,6 @@ export default {
531
133
  */
532
134
  "id-denylist": ["error", "any", "Undefined"],
533
135
 
534
- /**
535
- * This option enforces minimum and maximum identifier lengths
536
- * /**
537
- * (variable names, property names etc.)
538
- * https://eslint.org/docs/latest/rules/id-length.
539
- */
540
- // "id-length": "off",
541
-
542
136
  /**
543
137
  * Require identifiers to match the provided regular expression
544
138
  * https://eslint.org/docs/latest/rules/id-match.
@@ -546,128 +140,156 @@ export default {
546
140
  "id-match": "error",
547
141
 
548
142
  /**
549
- * Enforce or disallow variable initializations at definition
550
- * https://eslint.org/docs/latest/rules/init-declarations.
143
+ * Require a capital letter for constructors
144
+ * https://eslint.org/docs/latest/rules/new-cap.
551
145
  */
552
- // "init-declarations": "off",
146
+ "new-cap": [
147
+ "error",
148
+ {
149
+ newIsCap: true,
150
+ newIsCapExceptions: [],
151
+ capIsNew: false,
152
+ capIsNewExceptions: ["Immutable.Map", "Immutable.Set", "Immutable.List"],
153
+ },
154
+ ],
553
155
 
554
156
  /**
555
- * Enforce a maximum number of classes per file
556
- * https://eslint.org/docs/latest/rules/max-classes-per-file.
157
+ * Disallow the use of alert, confirm, and prompt
158
+ * https://eslint.org/docs/latest/rules/no-alert.
557
159
  */
558
- // "max-classes-per-file": "off",
160
+ "no-alert": "warn",
559
161
 
560
162
  /**
561
- * Specify the maximum depth that blocks can be nested
562
- * https://eslint.org/docs/latest/rules/max-depth.
163
+ * Disallow use of the Array constructor
164
+ * https://eslint.org/docs/latest/rules/no-array-constructor.
563
165
  */
564
- // "max-depth": ["off", 4],
166
+ "no-array-constructor": "error",
565
167
 
566
168
  /**
567
- * Specify the max number of lines in a file
568
- * https://eslint.org/docs/latest/rules/max-lines.
169
+ * Disallow using an async function as a Promise executor ✅
170
+ * https://eslint.org/docs/latest/rules/no-async-promise-executor.
569
171
  */
570
- // "max-lines": ["off", { max: 300, skipBlankLines: true, skipComments: true }],
172
+ "no-async-promise-executor": "error",
571
173
 
572
174
  /**
573
- * Enforce a maximum function length
574
- * https://eslint.org/docs/latest/rules/max-lines-per-function.
175
+ * Disallow await inside of loops
176
+ * https://eslint.org/docs/latest/rules/no-await-in-loop.
575
177
  */
576
- // "max-lines-per-function": [
577
- // "off",
578
- // {
579
- // max: 50,
580
- // skipBlankLines: true,
581
- // skipComments: true,
582
- // IIFEs: true,
583
- // },
584
- // ],
178
+ "no-await-in-loop": "off",
585
179
 
586
180
  /**
587
- * Specify the maximum depth callbacks can be nested
588
- * https://eslint.org/docs/latest/rules/max-nested-callbacks.
181
+ * Disallow use of bitwise operators
182
+ * https://eslint.org/docs/latest/rules/no-bitwise.
589
183
  */
590
- // "max-nested-callbacks": "off",
184
+ "no-bitwise": "error",
591
185
 
592
186
  /**
593
- * Limits the number of parameters that can be used in the function declaration.
594
- * Https://eslint.org/docs/latest/rules/max-params.
187
+ * Disallow use of arguments.caller or arguments.callee
188
+ * https://eslint.org/docs/latest/rules/no-caller.
595
189
  */
596
- // "max-params": ["off", 3],
190
+ "no-caller": "error",
597
191
 
598
192
  /**
599
- * Specify the maximum number of statement allowed in a function
600
- * https://eslint.org/docs/latest/rules/max-statements.
193
+ * Disallow lexical declarations in case/default clauses ✅
194
+ * https://eslint.org/docs/latest/rules/no-case-declarations.
601
195
  */
602
- // "max-statements": ["off", 10],
196
+ "no-case-declarations": "error",
603
197
 
604
198
  /**
605
- * Require a capital letter for constructors
606
- * https://eslint.org/docs/latest/rules/new-cap.
199
+ * Disallow modifying variables of class declarations ✅
200
+ * https://eslint.org/docs/latest/rules/no-class-assign.
607
201
  */
608
- "new-cap": [
609
- "error",
610
- {
611
- newIsCap: true,
612
- newIsCapExceptions: [],
613
- capIsNew: false,
614
- capIsNewExceptions: ["Immutable.Map", "Immutable.Set", "Immutable.List"],
615
- },
616
- ],
202
+ "no-class-assign": "error",
617
203
 
618
204
  /**
619
- * Disallow the use of alert, confirm, and prompt
620
- * https://eslint.org/docs/latest/rules/no-alert.
205
+ * Disallow comparisons to negative zero ✅
206
+ * https://eslint.org/docs/latest/rules/no-compare-neg-zero.
621
207
  */
622
- "no-alert": "warn",
208
+ "no-compare-neg-zero": "error",
623
209
 
624
210
  /**
625
- * Disallow use of the Array constructor
626
- * https://eslint.org/docs/latest/rules/no-array-constructor.
211
+ * Disallow assignment in conditional expressions ✅
212
+ * https://eslint.org/docs/latest/rules/no-cond-assign.
627
213
  */
628
- "no-array-constructor": "error",
214
+ "no-cond-assign": ["error", "except-parens"],
629
215
 
630
216
  /**
631
- * Disallow use of bitwise operators
632
- * https://eslint.org/docs/latest/rules/no-bitwise.
217
+ * Disallow modifying variables that are declared using const ✅
218
+ * https://eslint.org/docs/latest/rules/no-const-assign.
633
219
  */
634
- "no-bitwise": "error",
220
+ "no-const-assign": "error",
221
+
222
+ /**
223
+ * Disallow expressions where the operation doesn"t affect the value
224
+ * https://eslint.org/docs/latest/rules/no-constant-binary-expression.
225
+ */
226
+ "no-constant-binary-expression": "error",
227
+
228
+ /**
229
+ * Disallow use of constant expressions in conditions ✅
230
+ * https://eslint.org/docs/latest/rules/no-constant-condition.
231
+ */
232
+ "no-constant-condition": "error",
233
+
234
+ /**
235
+ * Disallow returning value in constructor
236
+ * https://eslint.org/docs/latest/rules/no-constructor-return.
237
+ */
238
+ "no-constructor-return": "error",
239
+
240
+ /**
241
+ * Disallow control characters in regular expressions ✅
242
+ * https://eslint.org/docs/latest/rules/no-control-regex.
243
+ */
244
+ "no-control-regex": "error",
245
+
246
+ /**
247
+ * Disallow use of debugger ✅
248
+ * https://eslint.org/docs/latest/rules/no-debugger.
249
+ */
250
+ "no-debugger": "error",
251
+
252
+ /**
253
+ * Disallow deletion of variables ✅
254
+ * https://eslint.org/docs/latest/rules/no-delete-var.
255
+ */
256
+ "no-delete-var": "error",
635
257
 
636
258
  /**
637
- * Disallow use of arguments.caller or arguments.callee
638
- * https://eslint.org/docs/latest/rules/no-caller.
259
+ * Disallow duplicate arguments in functions ✅
260
+ * https://eslint.org/docs/latest/rules/no-dupe-args.
639
261
  */
640
- "no-caller": "error",
262
+ "no-dupe-args": "error",
641
263
 
642
264
  /**
643
- * Disallow lexical declarations in case/default clauses ✅
644
- * https://eslint.org/docs/latest/rules/no-case-declarations.
265
+ * Disallow duplicate class members ✅
266
+ * https://eslint.org/docs/latest/rules/no-dupe-class-members.
645
267
  */
646
- "no-case-declarations": "error",
268
+ "no-dupe-class-members": "error",
647
269
 
648
270
  /**
649
- * Disallow use of console
650
- * https://eslint.org/docs/latest/rules/no-console.
271
+ * Disallow duplicate conditions in if-else-if chains ✅
272
+ * https://eslint.org/docs/latest/rules/no-dupe-else-if.
651
273
  */
652
- // "no-console": "off",
274
+ "no-dupe-else-if": "error",
653
275
 
654
276
  /**
655
- * Disallow use of the continue statement
656
- * https://eslint.org/docs/latest/rules/no-continue.
277
+ * Disallow duplicate keys when creating object literals ✅
278
+ * https://eslint.org/docs/latest/rules/no-dupe-keys.
657
279
  */
658
- // "no-continue": "off",
280
+ "no-dupe-keys": "error",
659
281
 
660
282
  /**
661
- * Disallow deletion of variables ✅
662
- * https://eslint.org/docs/latest/rules/no-delete-var.
283
+ * Disallow a duplicate case label. ✅
284
+ * https://eslint.org/docs/latest/rules/no-duplicate-case.
663
285
  */
664
- "no-delete-var": "error",
286
+ "no-duplicate-case": "error",
665
287
 
666
288
  /**
667
- * Disallow division operators explicitly at beginning of regular expression 🔧
668
- * https://eslint.org/docs/latest/rules/no-div-regex.
289
+ * Disallow importing from the same path more than once
290
+ * https://eslint.org/docs/latest/rules/no-duplicate-imports.
669
291
  */
670
- // "no-div-regex": "off",
292
+ "no-duplicate-imports": ["error", { allowSeparateTypeImports: true }],
671
293
 
672
294
  /**
673
295
  * Disallow else after a return in an if 🔧
@@ -681,6 +303,12 @@ export default {
681
303
  */
682
304
  "no-empty": "error",
683
305
 
306
+ /**
307
+ * Disallow the use of empty character classes in regular expressions ✅
308
+ * https://eslint.org/docs/latest/rules/no-empty-character-class.
309
+ */
310
+ "no-empty-character-class": "error",
311
+
684
312
  /**
685
313
  * Disallow empty functions, except for standalone funcs/arrows
686
314
  * https://eslint.org/docs/latest/rules/no-empty-function.
@@ -693,10 +321,16 @@ export default {
693
321
  ],
694
322
 
695
323
  /**
696
- * Disallow comparisons to null without a type-checking operator
697
- * https://eslint.org/docs/latest/rules/no-eq-null.
324
+ * Disallow empty destructuring patterns ✅
325
+ * https://eslint.org/docs/latest/rules/no-empty-pattern.
326
+ */
327
+ "no-empty-pattern": ["error", { allowObjectPatternsAsParameters: true }],
328
+
329
+ /**
330
+ * Disallow empty destructuring patterns ✅
331
+ * https://eslint.org/docs/latest/rules/no-empty-static-block.
698
332
  */
699
- // "no-eq-null": "off",
333
+ "no-empty-static-block": "error",
700
334
 
701
335
  /**
702
336
  * Disallow use of eval()
@@ -704,6 +338,12 @@ export default {
704
338
  */
705
339
  "no-eval": "error",
706
340
 
341
+ /**
342
+ * Disallow assigning to the exception in a catch block ✅
343
+ * https://eslint.org/docs/latest/rules/no-ex-assign.
344
+ */
345
+ "no-ex-assign": "error",
346
+
707
347
  /**
708
348
  * Disallow adding to native types
709
349
  * https://eslint.org/docs/latest/rules/no-extend-native.
@@ -729,30 +369,22 @@ export default {
729
369
  "no-extra-label": "error",
730
370
 
731
371
  /**
732
- * Disallow reassignments of native objects or read-only globals ✅
733
- * https://eslint.org/docs/latest/rules/no-global-assign.
372
+ * Disallow overwriting functions written as function declarations ✅
373
+ * https://eslint.org/docs/latest/rules/no-func-assign.
734
374
  */
735
- "no-global-assign": ["error", { exceptions: [] }],
375
+ "no-func-assign": "error",
736
376
 
737
377
  /**
738
- * Disallow implicit type conversions 🔧
739
- * https://eslint.org/docs/latest/rules/no-implicit-coercion.
378
+ * Disallow fallthrough of `case` statements ✅
379
+ * https://eslint.org/docs/latest/rules/no-fallthrough.
740
380
  */
741
- // "no-implicit-coercion": [
742
- // "off",
743
- // {
744
- // boolean: false,
745
- // number: true,
746
- // string: true,
747
- // allow: [],
748
- // },
749
- // ],
381
+ "no-fallthrough": "error",
750
382
 
751
383
  /**
752
- * Disallow var and named functions in global scope
753
- * https://eslint.org/docs/latest/rules/no-implicit-globals.
384
+ * Disallow reassignments of native objects or read-only globals ✅
385
+ * https://eslint.org/docs/latest/rules/no-global-assign.
754
386
  */
755
- // "no-implicit-globals": "off",
387
+ "no-global-assign": ["error", { exceptions: [] }],
756
388
 
757
389
  /**
758
390
  * Disallow use of eval()-like methods
@@ -761,16 +393,28 @@ export default {
761
393
  "no-implied-eval": "error",
762
394
 
763
395
  /**
764
- * Disallow comments inline after code
765
- * https://eslint.org/docs/latest/rules/no-inline-comments.
396
+ * Disallow import assignment ✅
397
+ * https://eslint.org/docs/latest/rules/no-import-assign.
398
+ */
399
+ "no-import-assign": "error",
400
+
401
+ /**
402
+ * Disallow function or variable declarations in nested blocks ✅
403
+ * https://eslint.org/docs/latest/rules/no-inner-declarations.
404
+ */
405
+ "no-inner-declarations": "error",
406
+
407
+ /**
408
+ * Disallow invalid regular expression strings in the RegExp constructor ✅
409
+ * https://eslint.org/docs/latest/rules/no-invalid-regexp.
766
410
  */
767
- // "no-inline-comments": "off",
411
+ "no-invalid-regexp": "error",
768
412
 
769
413
  /**
770
- * Disallow this keywords outside of classes or class-like objects
771
- * https://eslint.org/docs/latest/rules/no-invalid-this.
414
+ * Disallow irregular whitespace outside of strings and comments ✅
415
+ * https://eslint.org/docs/latest/rules/no-irregular-whitespace.
772
416
  */
773
- // "no-invalid-this": "off",
417
+ "no-irregular-whitespace": "error",
774
418
 
775
419
  /**
776
420
  * Disallow usage of __iterator__ property
@@ -809,18 +453,16 @@ export default {
809
453
  "no-loop-func": "error",
810
454
 
811
455
  /**
812
- * Disallow magic numbers
813
- * https://eslint.org/docs/latest/rules/no-magic-numbers.
456
+ * Disallow number literals that lose precision ✅
457
+ * https://eslint.org/docs/latest/rules/no-loss-of-precision.
458
+ */
459
+ "no-loss-of-precision": "error",
460
+
461
+ /**
462
+ * Disallow characters which are made with multiple code points in character class syntax ✅ 💡
463
+ * https://eslint.org/docs/latest/rules/no-misleading-character-class.
814
464
  */
815
- // "no-magic-numbers": [
816
- // "off",
817
- // {
818
- // ignore: [],
819
- // ignoreArrayIndexes: true,
820
- // enforceConst: true,
821
- // detectObjects: false,
822
- // },
823
- // ],
465
+ "no-misleading-character-class": "error",
824
466
 
825
467
  /**
826
468
  * Disallow use of chained assignment expressions
@@ -834,18 +476,6 @@ export default {
834
476
  */
835
477
  "no-multi-str": "error",
836
478
 
837
- /**
838
- * Disallow negated conditions
839
- * https://eslint.org/docs/latest/rules/no-negated-condition.
840
- */
841
- // "no-negated-condition": "off",
842
-
843
- /**
844
- * Disallow nested ternary expressions
845
- * https://eslint.org/docs/latest/rules/no-nested-ternary.
846
- */
847
- // "no-nested-ternary": "off",
848
-
849
479
  /**
850
480
  * Disallow use of new operator when not part of the assignment or comparison
851
481
  * https://eslint.org/docs/latest/rules/no-new.
@@ -859,10 +489,10 @@ export default {
859
489
  "no-new-func": "error",
860
490
 
861
491
  /**
862
- * Disallow use of the Object constructor
863
- * https://eslint.org/docs/latest/rules/no-object-constructor.
492
+ * Disallow symbol constructor ✅
493
+ * https://eslint.org/docs/latest/rules/no-new-native-nonconstructor.
864
494
  */
865
- "no-object-constructor": "error",
495
+ "no-new-native-nonconstructor": "error",
866
496
 
867
497
  /**
868
498
  * Disallows creating new instances of String, Number, and Boolean
@@ -876,6 +506,18 @@ export default {
876
506
  */
877
507
  "no-nonoctal-decimal-escape": "error",
878
508
 
509
+ /**
510
+ * Disallow the use of object properties of the global object (Math and JSON) as functions ✅
511
+ * https://eslint.org/docs/latest/rules/no-obj-calls.
512
+ */
513
+ "no-obj-calls": "error",
514
+
515
+ /**
516
+ * Disallow use of the Object constructor
517
+ * https://eslint.org/docs/latest/rules/no-object-constructor.
518
+ */
519
+ "no-object-constructor": "error",
520
+
879
521
  /**
880
522
  * Disallow use of (old style) octal literals ✅
881
523
  * https://eslint.org/docs/latest/rules/no-octal.
@@ -895,10 +537,10 @@ export default {
895
537
  "no-param-reassign": ["error", { props: false }],
896
538
 
897
539
  /**
898
- * Disallow use of unary operators, ++ and --
899
- * https://eslint.org/docs/latest/rules/no-plusplus.
540
+ * Disallow returning values from promise executor functions
541
+ * https://eslint.org/docs/latest/rules/no-promise-executor-return.
900
542
  */
901
- // "no-plusplus": "off",
543
+ "no-promise-executor-return": "error",
902
544
 
903
545
  /**
904
546
  * Disallow usage of __proto__ property
@@ -906,6 +548,12 @@ export default {
906
548
  */
907
549
  "no-proto": "error",
908
550
 
551
+ /**
552
+ * Disallow calling Object prototypes ✅
553
+ * https://eslint.org/docs/latest/rules/no-prototype-builtins.
554
+ */
555
+ "no-prototype-builtins": "warn",
556
+
909
557
  /**
910
558
  * Disallow declaring the same variable more than once ✅
911
559
  * https://eslint.org/docs/latest/rules/no-redeclare.
@@ -1040,12 +688,30 @@ export default {
1040
688
  */
1041
689
  "no-script-url": "error",
1042
690
 
691
+ /**
692
+ * Disallow self assignment ✅
693
+ * https://eslint.org/docs/latest/rules/no-self-assign.
694
+ */
695
+ "no-self-assign": ["error", { props: true }],
696
+
697
+ /**
698
+ * Disallow comparisons where both sides are exactly the same
699
+ * https://eslint.org/docs/latest/rules/no-self-compare.
700
+ */
701
+ "no-self-compare": "error",
702
+
1043
703
  /**
1044
704
  * Disallow use of comma operator
1045
705
  * https://eslint.org/docs/latest/rules/no-sequences.
1046
706
  */
1047
707
  "no-sequences": "error",
1048
708
 
709
+ /**
710
+ * Disallow returning values from setters ✅
711
+ * https://eslint.org/docs/latest/rules/no-setter-return.
712
+ */
713
+ "no-setter-return": "error",
714
+
1049
715
  /**
1050
716
  * Disallow declaration of variables already declared in the outer scope
1051
717
  * https://eslint.org/docs/latest/rules/no-shadow.
@@ -1059,10 +725,28 @@ export default {
1059
725
  "no-shadow-restricted-names": "error",
1060
726
 
1061
727
  /**
1062
- * Disallow the use of ternary operators
1063
- * https://eslint.org/docs/latest/rules/no-ternary.
728
+ * Disallow sparse arrays ✅
729
+ * https://eslint.org/docs/latest/rules/no-sparse-arrays.
730
+ */
731
+ "no-sparse-arrays": "error",
732
+
733
+ /**
734
+ * Disallow template literal placeholder syntax in regular strings
735
+ * https://eslint.org/docs/latest/rules/no-template-curly-in-string.
736
+ */
737
+ "no-template-curly-in-string": "error",
738
+
739
+ /**
740
+ * Disallow `let` or `var` variables that are read but never assigned ✅
741
+ * https://eslint.org/docs/latest/rules/no-unassigned-vars.
742
+ */
743
+ "no-unassigned-vars": "error",
744
+
745
+ /**
746
+ * Disallow to use this/super before super() calling in constructors. ✅
747
+ * https://eslint.org/docs/latest/rules/no-this-before-super.
1064
748
  */
1065
- // "no-ternary": "off",
749
+ "no-this-before-super": "error",
1066
750
 
1067
751
  /**
1068
752
  * Restrict what can be thrown as an exception
@@ -1071,31 +755,22 @@ export default {
1071
755
  "no-throw-literal": "error",
1072
756
 
1073
757
  /**
1074
- * Disallow use of undefined when initializing variables 🔧
1075
- * https://eslint.org/docs/latest/rules/no-undef-init.
758
+ * Disallow use of undeclared variables unless mentioned in a /global/ block ✅
759
+ * https://eslint.org/docs/latest/rules/no-undef.
1076
760
  */
1077
- "no-undef-init": "error",
761
+ "no-undef": "error",
1078
762
 
1079
763
  /**
1080
- * Disallow use of undefined variable
1081
- * https://eslint.org/docs/latest/rules/no-undefined.
764
+ * Disallow use of undefined when initializing variables 🔧
765
+ * https://eslint.org/docs/latest/rules/no-undef-init.
1082
766
  */
1083
- // "no-undefined": "off",
767
+ "no-undef-init": "error",
1084
768
 
1085
769
  /**
1086
- * Disallow dangling underscores in identifiers
1087
- * https://eslint.org/docs/latest/rules/no-underscore-dangle.
770
+ * Avoid code that looks like two expressions but is actually one ✅
771
+ * https://eslint.org/docs/latest/rules/no-unexpected-multiline.
1088
772
  */
1089
- // "no-underscore-dangle": [
1090
- // "off",
1091
- // {
1092
- // allow: [],
1093
- // allowAfterThis: true,
1094
- // allowFunctionParams: true,
1095
- // allowAfterSuper: false,
1096
- // enforceInMethodNames: true,
1097
- // },
1098
- // ],
773
+ "no-unexpected-multiline": "error",
1099
774
 
1100
775
  /**
1101
776
  * Disallow the use of Boolean literals in conditional expressions 🔧
@@ -1104,6 +779,36 @@ export default {
1104
779
  */
1105
780
  "no-unneeded-ternary": ["error", { defaultAssignment: false }],
1106
781
 
782
+ /**
783
+ * Disallow unreachable statements after a return, throw, continue, or break statement ✅
784
+ * https://eslint.org/docs/latest/rules/no-unreachable.
785
+ */
786
+ "no-unreachable": "error",
787
+
788
+ /**
789
+ * Disallow loops with a body that allows only one iteration
790
+ * https://eslint.org/docs/latest/rules/no-unreachable-loop.
791
+ */
792
+ "no-unreachable-loop": ["error", { ignore: [] }], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
793
+
794
+ /**
795
+ * Disallow return/throw/break/continue inside finally blocks ✅
796
+ * https://eslint.org/docs/latest/rules/no-unsafe-finally.
797
+ */
798
+ "no-unsafe-finally": "error",
799
+
800
+ /**
801
+ * Disallow negating the left operand of relational operators ✅ 💡
802
+ * https://eslint.org/docs/latest/rules/no-unsafe-negation.
803
+ */
804
+ "no-unsafe-negation": "error",
805
+
806
+ /**
807
+ * Disallow use of optional chaining in contexts where the undefined value is not allowed ✅
808
+ * https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining.
809
+ */
810
+ "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
811
+
1107
812
  /**
1108
813
  * Disallow usage of expressions in statement position
1109
814
  * https://eslint.org/docs/latest/rules/no-unused-expressions.
@@ -1123,6 +828,44 @@ export default {
1123
828
  */
1124
829
  "no-unused-labels": "error",
1125
830
 
831
+ /**
832
+ * Disallow unused private class members
833
+ * https://eslint.org/docs/latest/rules/no-unused-private-class-members.
834
+ */
835
+ "no-unused-private-class-members": "error",
836
+
837
+ /**
838
+ * Disallow declaration of variables that are not used in the code ✅
839
+ * https://eslint.org/docs/latest/rules/no-unused-vars.
840
+ */
841
+ "no-unused-vars": ["error", {
842
+ args: "all",
843
+ argsIgnorePattern: "^_",
844
+ caughtErrors: "all",
845
+ caughtErrorsIgnorePattern: "^_",
846
+ destructuredArrayIgnorePattern: "^_",
847
+ varsIgnorePattern: "^_",
848
+ ignoreRestSiblings: true,
849
+ }],
850
+
851
+ /**
852
+ * Disallow use of variables before they are defined
853
+ * https://eslint.org/docs/latest/rules/no-use-before-define.
854
+ */
855
+ "no-use-before-define": ["error", { functions: true, classes: true, variables: true, allowNamedExports: true }],
856
+
857
+ /**
858
+ * Disallow variable assignments when the value is not used ✅
859
+ * https://eslint.org/docs/latest/rules/no-useless-backreference.
860
+ */
861
+ "no-useless-assignment": "error",
862
+
863
+ /**
864
+ * Disallow useless backreferences in regular expressions ✅
865
+ * https://eslint.org/docs/latest/rules/no-useless-backreference.
866
+ */
867
+ "no-useless-backreference": "error",
868
+
1126
869
  /**
1127
870
  * Disallow unnecessary .call() and .apply()
1128
871
  * https://eslint.org/docs/latest/rules/no-useless-call.
@@ -1184,18 +927,6 @@ export default {
1184
927
  */
1185
928
  "no-var": "error",
1186
929
 
1187
- /**
1188
- * Disallow use of void operator
1189
- * https://eslint.org/docs/latest/rules/no-void.
1190
- */
1191
- // "no-void": "off",
1192
-
1193
- /**
1194
- * Disallow usage of configurable warning terms in comments: e.g. Todo
1195
- * https://eslint.org/docs/latest/rules/no-warning-comments.
1196
- */
1197
- // "no-warning-comments": ["off", { terms: ["todo", "fixme", "xxx"], location: "start" }],
1198
-
1199
930
  /**
1200
931
  * Disallow use of the with statement ✅
1201
932
  * https://eslint.org/docs/latest/rules/no-with.
@@ -1253,25 +984,12 @@ export default {
1253
984
  */
1254
985
  "prefer-exponentiation-operator": "error",
1255
986
 
1256
- /**
1257
- * Suggest using named capture group in regular expression
1258
- * https://eslint.org/docs/latest/rules/prefer-named-capture-group.
1259
- */
1260
- // "prefer-named-capture-group": "off",
1261
-
1262
987
  /**
1263
988
  * Disallow parseInt() in favor of binary, octal, and hexadecimal literals 🔧
1264
989
  * https://eslint.org/docs/latest/rules/prefer-numeric-literals.
1265
990
  */
1266
991
  "prefer-numeric-literals": "error",
1267
992
 
1268
- /**
1269
- * Disallow use of Object.prototype.hasOwnProperty.call() and prefer use of Object.hasOwn() 🔧
1270
- * https://eslint.org/docs/latest/rules/prefer-object-has-own.
1271
- * Turned off: only supported with ES2022 and node 18: can be turned on when all projects support node18/ES2022.
1272
- */
1273
- // "prefer-object-has-own": "off",
1274
-
1275
993
  /**
1276
994
  * Prefer use of an object spread over Object.assign 🔧
1277
995
  * https://eslint.org/docs/latest/rules/prefer-object-spread.
@@ -1312,19 +1030,13 @@ export default {
1312
1030
  * Require use of the second argument for parseInt()
1313
1031
  * https://eslint.org/docs/latest/rules/radix.
1314
1032
  */
1315
- "radix": ["error", "as-needed"],
1033
+ "radix": "off",
1316
1034
 
1317
1035
  /**
1318
- * Require `await` in `async function` (note: this is a horrible rule that should never be used)
1036
+ * Require `await` in `async function`
1319
1037
  * https://eslint.org/docs/latest/rules/require-await.
1320
1038
  */
1321
- // "require-await": "off",
1322
-
1323
- /**
1324
- * Enforce the use of u flag on RegExp
1325
- * https://eslint.org/docs/latest/rules/require-unicode-regexp.
1326
- */
1327
- // "require-unicode-regexp": "off",
1039
+ "require-await": "off",
1328
1040
 
1329
1041
  /**
1330
1042
  * Disallow generator functions that do not have yield ✅
@@ -1332,32 +1044,6 @@ export default {
1332
1044
  */
1333
1045
  "require-yield": "error",
1334
1046
 
1335
- /**
1336
- * Import sorting 🔧
1337
- * https://eslint.org/docs/latest/rules/sort-imports.
1338
- */
1339
- // "sort-imports": [
1340
- // "off",
1341
- // {
1342
- // ignoreCase: false,
1343
- // ignoreDeclarationSort: false,
1344
- // ignoreMemberSort: false,
1345
- // memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
1346
- // },
1347
- // ],
1348
-
1349
- /**
1350
- * Requires object keys to be sorted
1351
- * https://eslint.org/docs/latest/rules/sort-keys.
1352
- */
1353
- // "sort-keys": ["off", "asc", { caseSensitive: false, natural: true }],
1354
-
1355
- /**
1356
- * Sort variables within the same declaration block 🔧
1357
- * https://eslint.org/docs/latest/rules/sort-vars.
1358
- */
1359
- // "sort-vars": "off",
1360
-
1361
1047
  /**
1362
1048
  * Require or disallow strict mode directives 🔧
1363
1049
  * https://eslint.org/docs/latest/rules/strict.
@@ -1376,6 +1062,18 @@ export default {
1376
1062
  */
1377
1063
  "unicode-bom": ["error", "never"],
1378
1064
 
1065
+ /**
1066
+ * Disallow comparisons with the value NaN ✅
1067
+ * https://eslint.org/docs/latest/rules/use-isnan.
1068
+ */
1069
+ "use-isnan": "error",
1070
+
1071
+ /**
1072
+ * Ensure that the results of typeof are compared against a valid string ✅ 💡
1073
+ * https://eslint.org/docs/latest/rules/valid-typeof.
1074
+ */
1075
+ "valid-typeof": ["error", { requireStringLiterals: true }],
1076
+
1379
1077
  /**
1380
1078
  * Requires to declare all vars on top of their containing scope
1381
1079
  * https://eslint.org/docs/latest/rules/vars-on-top.