@prowise/eslint-config-linting-rules 0.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.
@@ -0,0 +1,1957 @@
1
+ const confusingBrowserGlobals = require("confusing-browser-globals");
2
+ const eslintPkg = require("eslint/package.json");
3
+ const semver = require("semver");
4
+
5
+ module.exports = {
6
+ /*
7
+ * βœ… recommended
8
+ * πŸ”§ fixable
9
+ * πŸ’‘ has suggestion
10
+ */
11
+
12
+ rules: {
13
+ // ========================= Possible problems ==========================
14
+
15
+ /**
16
+ * Enforces return statements in callbacks of array"s methods
17
+ * https://eslint.org/docs/latest/rules/array-callback-return.
18
+ */
19
+ "array-callback-return": ["error", { allowImplicit: true }],
20
+
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": "error",
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 assigning to the exception in a catch block βœ…
155
+ * https://eslint.org/docs/latest/rules/no-ex-assign.
156
+ */
157
+ "no-ex-assign": "error",
158
+
159
+ /**
160
+ * Disallow fallthrough of case statements βœ…
161
+ * https://eslint.org/docs/latest/rules/no-fallthrough.
162
+ */
163
+ "no-fallthrough": "off",
164
+
165
+ /**
166
+ * Disallow overwriting functions written as function declarations βœ…
167
+ * https://eslint.org/docs/latest/rules/no-func-assign.
168
+ */
169
+ "no-func-assign": "error",
170
+
171
+ /**
172
+ * Disallow import assignment βœ…
173
+ * https://eslint.org/docs/latest/rules/no-import-assign.
174
+ */
175
+ "no-import-assign": "error",
176
+
177
+ /**
178
+ * Disallow function or variable declarations in nested blocks βœ…
179
+ * https://eslint.org/docs/latest/rules/no-inner-declarations.
180
+ */
181
+ "no-inner-declarations": "error",
182
+
183
+ /**
184
+ * Disallow invalid regular expression strings in the RegExp constructor βœ…
185
+ * https://eslint.org/docs/latest/rules/no-invalid-regexp.
186
+ */
187
+ "no-invalid-regexp": "error",
188
+
189
+ /**
190
+ * Disallow irregular whitespace outside of strings and comments βœ…
191
+ * https://eslint.org/docs/latest/rules/no-irregular-whitespace.
192
+ */
193
+ "no-irregular-whitespace": "error",
194
+
195
+ /**
196
+ * Disallow number literals that lose precision βœ…
197
+ * https://eslint.org/docs/latest/rules/no-loss-of-precision.
198
+ */
199
+ "no-loss-of-precision": "error",
200
+
201
+ /**
202
+ * Disallow characters which are made with multiple code points in character class syntax βœ… πŸ’‘
203
+ * https://eslint.org/docs/latest/rules/no-misleading-character-class.
204
+ */
205
+ "no-misleading-character-class": "error",
206
+
207
+ /**
208
+ * Disallow symbol constructor βœ…
209
+ * https://eslint.org/docs/latest/rules/no-new-symbol.
210
+ */
211
+ "no-new-symbol": "error",
212
+
213
+ /**
214
+ * Disallow the use of object properties of the global object (Math and JSON) as functions βœ…
215
+ * https://eslint.org/docs/latest/rules/no-obj-calls.
216
+ */
217
+ "no-obj-calls": "error",
218
+
219
+ /**
220
+ * Disallow returning values from promise executor functions
221
+ * https://eslint.org/docs/latest/rules/no-promise-executor-return.
222
+ */
223
+ "no-promise-executor-return": "error",
224
+
225
+ /**
226
+ * Disallow calling Object prototypes βœ…
227
+ * https://eslint.org/docs/latest/rules/no-prototype-builtins.
228
+ */
229
+ "no-prototype-builtins": "warn",
230
+
231
+ /**
232
+ * Disallow self assignment βœ…
233
+ * https://eslint.org/docs/latest/rules/no-self-assign.
234
+ */
235
+ "no-self-assign": ["error", { props: true }],
236
+
237
+ /**
238
+ * Disallow comparisons where both sides are exactly the same
239
+ * https://eslint.org/docs/latest/rules/no-self-compare.
240
+ */
241
+ "no-self-compare": "error",
242
+
243
+ /**
244
+ * Disallow returning values from setters βœ…
245
+ * https://eslint.org/docs/latest/rules/no-setter-return.
246
+ */
247
+ "no-setter-return": "error",
248
+
249
+ /**
250
+ * Disallow sparse arrays βœ…
251
+ * https://eslint.org/docs/latest/rules/no-sparse-arrays.
252
+ */
253
+ "no-sparse-arrays": "error",
254
+
255
+ /**
256
+ * Disallow template literal placeholder syntax in regular strings
257
+ * https://eslint.org/docs/latest/rules/no-template-curly-in-string.
258
+ */
259
+ "no-template-curly-in-string": "error",
260
+
261
+ /**
262
+ * Disallow to use this/super before super() calling in constructors. βœ…
263
+ * https://eslint.org/docs/latest/rules/no-this-before-super.
264
+ */
265
+ "no-this-before-super": "error",
266
+
267
+ /**
268
+ * Disallow use of undeclared variables unless mentioned in a /global/ block βœ…
269
+ * https://eslint.org/docs/latest/rules/no-undef.
270
+ */
271
+ "no-undef": "error",
272
+
273
+ /**
274
+ * Avoid code that looks like two expressions but is actually one βœ…
275
+ * https://eslint.org/docs/latest/rules/no-unexpected-multiline.
276
+ */
277
+ "no-unexpected-multiline": "error",
278
+
279
+ /**
280
+ * Disallow unmodified conditions of loops
281
+ * https://eslint.org/docs/latest/rules/no-unmodified-loop-condition.
282
+ */
283
+ "no-unmodified-loop-condition": "off",
284
+
285
+ /**
286
+ * Disallow unreachable statements after a return, throw, continue, or break statement βœ…
287
+ * https://eslint.org/docs/latest/rules/no-unreachable.
288
+ */
289
+ "no-unreachable": "error",
290
+
291
+ /**
292
+ * Disallow loops with a body that allows only one iteration
293
+ * https://eslint.org/docs/latest/rules/no-unreachable-loop.
294
+ */
295
+ "no-unreachable-loop": ["error", { ignore: [] }], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
296
+
297
+ /**
298
+ * Disallow return/throw/break/continue inside finally blocks βœ…
299
+ * https://eslint.org/docs/latest/rules/no-unsafe-finally.
300
+ */
301
+ "no-unsafe-finally": "error",
302
+
303
+ /**
304
+ * Disallow negating the left operand of relational operators βœ… πŸ’‘
305
+ * https://eslint.org/docs/latest/rules/no-unsafe-negation.
306
+ */
307
+ "no-unsafe-negation": "error",
308
+
309
+ /**
310
+ * Disallow use of optional chaining in contexts where the undefined value is not allowed βœ…
311
+ * https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining.
312
+ */
313
+ "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
314
+
315
+ /**
316
+ * Disallow unused private class members
317
+ * https://eslint.org/docs/latest/rules/no-unused-private-class-members.
318
+ */
319
+ "no-unused-private-class-members": "error",
320
+
321
+ /**
322
+ * Disallow declaration of variables that are not used in the code βœ…
323
+ * https://eslint.org/docs/latest/rules/no-unused-vars.
324
+ */
325
+ "no-unused-vars": ["error", { vars: "all", args: "after-used", ignoreRestSiblings: true }],
326
+
327
+ /**
328
+ * Disallow use of variables before they are defined
329
+ * https://eslint.org/docs/latest/rules/no-use-before-define.
330
+ */
331
+ "no-use-before-define": ["error", { functions: true, classes: true, variables: true }],
332
+
333
+ /**
334
+ * Disallow useless backreferences in regular expressions βœ…
335
+ * https://eslint.org/docs/latest/rules/no-useless-backreference.
336
+ */
337
+ "no-useless-backreference": "error",
338
+
339
+ /**
340
+ * Disallow assignments that can lead to race conditions due to usage of await or yield
341
+ * note: not enabled because it is very buggy
342
+ * https://eslint.org/docs/latest/rules/require-atomic-updates.
343
+ */
344
+ "require-atomic-updates": "off",
345
+
346
+ /**
347
+ * Disallow comparisons with the value NaN βœ…
348
+ * https://eslint.org/docs/latest/rules/use-isnan.
349
+ */
350
+ "use-isnan": "error",
351
+
352
+ /**
353
+ * Ensure that the results of typeof are compared against a valid string βœ… πŸ’‘
354
+ * https://eslint.org/docs/latest/rules/valid-typeof.
355
+ */
356
+ "valid-typeof": ["error", { requireStringLiterals: true }],
357
+
358
+ // ==================== Suggestions ================================================
359
+
360
+ /**
361
+ * Enforces getter/setter pairs in objects
362
+ * https://eslint.org/docs/latest/rules/accessor-pairs.
363
+ */
364
+ "accessor-pairs": "off",
365
+
366
+ /**
367
+ * Enforces no braces where they can be omitted πŸ”§
368
+ * https://eslint.org/docs/latest/rules/arrow-body-style.
369
+ */
370
+ "arrow-body-style": ["error", "as-needed", { requireReturnForObjectLiteral: false }],
371
+
372
+ /**
373
+ * Treat var statements as if they were block scoped
374
+ * https://eslint.org/docs/latest/rules/block-scoped-var.
375
+ */
376
+ "block-scoped-var": "error",
377
+
378
+ /**
379
+ * Require camel case names
380
+ * https://eslint.org/docs/latest/rules/camelcase.
381
+ */
382
+ camelcase: ["error", { properties: "never", ignoreDestructuring: false }],
383
+
384
+ /**
385
+ * Enforce or disallow capitalization of the first letter of a comment πŸ”§
386
+ * https://eslint.org/docs/latest/rules/capitalized-comments.
387
+ */
388
+ "capitalized-comments": [
389
+ "off",
390
+ "never",
391
+ {
392
+ line: {
393
+ ignorePattern: ".*",
394
+ ignoreInlineComments: true,
395
+ ignoreConsecutiveComments: true,
396
+ },
397
+ block: {
398
+ ignorePattern: ".*",
399
+ ignoreInlineComments: true,
400
+ ignoreConsecutiveComments: true,
401
+ },
402
+ },
403
+ ],
404
+
405
+ /**
406
+ * Enforce that class methods use "this"
407
+ * https://eslint.org/docs/latest/rules/class-methods-use-this.
408
+ */
409
+ "class-methods-use-this": ["error", { exceptMethods: [] }],
410
+
411
+ /**
412
+ * Specify the maximum cyclomatic complexity allowed in a program
413
+ * https://eslint.org/docs/latest/rules/complexity.
414
+ */
415
+ complexity: ["off", 20],
416
+
417
+ /**
418
+ * Require return statements to either always or never specify values
419
+ * https://eslint.org/docs/latest/rules/consistent-return.
420
+ */
421
+ "consistent-return": "error",
422
+
423
+ /**
424
+ * Enforces consistent naming when capturing the current execution context
425
+ * https://eslint.org/docs/latest/rules/consistent-this.
426
+ */
427
+ "consistent-this": "off",
428
+
429
+ /**
430
+ * Specify curly brace conventions for all control statements πŸ”§
431
+ * https://eslint.org/docs/latest/rules/curly.
432
+ */
433
+ curly: ["error", "multi-line"],
434
+
435
+ /**
436
+ * Require default case in switch statements
437
+ * https://eslint.org/docs/latest/rules/default-case.
438
+ */
439
+ "default-case": ["error", { commentPattern: "^no default$" }],
440
+
441
+ /**
442
+ * Enforce default clauses in switch statements to be last
443
+ * https://eslint.org/docs/latest/rules/default-case-last.
444
+ */
445
+ "default-case-last": "error",
446
+
447
+ /**
448
+ * Enforce default parameters last
449
+ * https://eslint.org/docs/latest/rules/default-param-last.
450
+ */
451
+ "default-param-last": "error",
452
+
453
+ /**
454
+ * Encourages use of dot notation whenever possible πŸ”§
455
+ * https://eslint.org/docs/latest/rules/dot-notation.
456
+ */
457
+ "dot-notation": ["error"],
458
+
459
+ /**
460
+ * Require the use of === and !== πŸ”§
461
+ * https://eslint.org/docs/latest/rules/eqeqeq.
462
+ */
463
+ eqeqeq: ["error", "always", { null: "ignore" }],
464
+
465
+ /**
466
+ * Requires function names to match the name of the variable or property to which they are assigned
467
+ * https://eslint.org/docs/latest/rules/func-name-matching.
468
+ */
469
+ "func-name-matching": [
470
+ "off",
471
+ "always",
472
+ { includeCommonJSModuleExports: false, considerPropertyDescriptor: true },
473
+ ],
474
+
475
+ /**
476
+ * Require function expressions to have a name
477
+ * https://eslint.org/docs/latest/rules/func-names.
478
+ */
479
+ "func-names": "warn",
480
+
481
+ /**
482
+ * Enforces use of function declarations
483
+ * https://eslint.org/docs/latest/rules/func-style.
484
+ */
485
+ "func-style": ["error", "declaration"],
486
+
487
+ /**
488
+ * Require grouped accessor pairs in object literals and classes
489
+ * https://eslint.org/docs/latest/rules/grouped-accessor-pairs.
490
+ */
491
+ "grouped-accessor-pairs": "error",
492
+
493
+ /**
494
+ * Make sure for-in loops have an if statement
495
+ * Off: not really a thing anymore
496
+ * https://eslint.org/docs/latest/rules/guard-for-in.
497
+ */
498
+ "guard-for-in": "off",
499
+
500
+ /**
501
+ * Disallow specified identifiers
502
+ * https://eslint.org/docs/latest/rules/id-denylist.
503
+ */
504
+ "id-blacklist": ["error", "any", "Undefined"],
505
+
506
+ /**
507
+ * This option enforces minimum and maximum identifier lengths
508
+ * /**
509
+ * (variable names, property names etc.)
510
+ * https://eslint.org/docs/latest/rules/id-length.
511
+ */
512
+ "id-length": "off",
513
+
514
+ /**
515
+ * Require identifiers to match the provided regular expression
516
+ * https://eslint.org/docs/latest/rules/id-match.
517
+ */
518
+ "id-match": "error",
519
+
520
+ /**
521
+ * Enforce or disallow variable initializations at definition
522
+ * https://eslint.org/docs/latest/rules/init-declarations.
523
+ */
524
+ "init-declarations": "off",
525
+
526
+ /**
527
+ * Enforce a maximum number of classes per file
528
+ * https://eslint.org/docs/latest/rules/max-classes-per-file.
529
+ */
530
+ "max-classes-per-file": "off",
531
+
532
+ /**
533
+ * Specify the maximum depth that blocks can be nested
534
+ * https://eslint.org/docs/latest/rules/max-depth.
535
+ */
536
+ "max-depth": ["off", 4],
537
+
538
+ /**
539
+ * Specify the max number of lines in a file
540
+ * https://eslint.org/docs/latest/rules/max-lines.
541
+ */
542
+ "max-lines": ["off", { max: 300, skipBlankLines: true, skipComments: true }],
543
+
544
+ /**
545
+ * Enforce a maximum function length
546
+ * https://eslint.org/docs/latest/rules/max-lines-per-function.
547
+ */
548
+ "max-lines-per-function": ["off", { max: 50, skipBlankLines: true, skipComments: true, IIFEs: true }],
549
+
550
+ /**
551
+ * Specify the maximum depth callbacks can be nested
552
+ * https://eslint.org/docs/latest/rules/max-nested-callbacks.
553
+ */
554
+ "max-nested-callbacks": "off",
555
+
556
+ /**
557
+ * Limits the number of parameters that can be used in the function declaration.
558
+ * Https://eslint.org/docs/latest/rules/max-params.
559
+ */
560
+ "max-params": ["off", 3],
561
+
562
+ /**
563
+ * Specify the maximum number of statement allowed in a function
564
+ * https://eslint.org/docs/latest/rules/max-statements.
565
+ */
566
+ "max-statements": ["off", 10],
567
+
568
+ /**
569
+ * Enforce a particular style for multiline comments πŸ”§
570
+ * https://eslint.org/docs/latest/rules/multiline-comment-style.
571
+ */
572
+ "multiline-comment-style": ["off", "starred-block"],
573
+
574
+ /**
575
+ * Require a capital letter for constructors
576
+ * https://eslint.org/docs/latest/rules/new-cap.
577
+ */
578
+ "new-cap": [
579
+ "error",
580
+ {
581
+ newIsCap: true,
582
+ newIsCapExceptions: [],
583
+ capIsNew: false,
584
+ capIsNewExceptions: ["Immutable.Map", "Immutable.Set", "Immutable.List"],
585
+ },
586
+ ],
587
+
588
+ /**
589
+ * Disallow the use of alert, confirm, and prompt
590
+ * https://eslint.org/docs/latest/rules/no-alert.
591
+ */
592
+ "no-alert": "warn",
593
+
594
+ /**
595
+ * Disallow use of the Array constructor
596
+ * https://eslint.org/docs/latest/rules/no-array-constructor.
597
+ */
598
+ "no-array-constructor": "error",
599
+
600
+ /**
601
+ * Disallow use of bitwise operators
602
+ * https://eslint.org/docs/latest/rules/no-bitwise.
603
+ */
604
+ "no-bitwise": "error",
605
+
606
+ /**
607
+ * Disallow use of arguments.caller or arguments.callee
608
+ * https://eslint.org/docs/latest/rules/no-caller.
609
+ */
610
+ "no-caller": "error",
611
+
612
+ /**
613
+ * Disallow lexical declarations in case/default clauses βœ…
614
+ * https://eslint.org/docs/latest/rules/no-case-declarations.
615
+ */
616
+ "no-case-declarations": "error",
617
+
618
+ /**
619
+ * Disallow arrow functions where they could be confused with comparisons πŸ”§
620
+ * https://eslint.org/docs/latest/rules/no-confusing-arrow.
621
+ */
622
+ "no-confusing-arrow": ["error", { allowParens: true }],
623
+
624
+ /**
625
+ * Disallow use of console
626
+ * https://eslint.org/docs/latest/rules/no-console.
627
+ */
628
+ "no-console": "off",
629
+
630
+ /**
631
+ * Disallow use of the continue statement
632
+ * https://eslint.org/docs/latest/rules/no-continue.
633
+ */
634
+ "no-continue": "error",
635
+
636
+ /**
637
+ * Disallow deletion of variables βœ…
638
+ * https://eslint.org/docs/latest/rules/no-delete-var.
639
+ */
640
+ "no-delete-var": "error",
641
+
642
+ /**
643
+ * Disallow division operators explicitly at beginning of regular expression πŸ”§
644
+ * https://eslint.org/docs/latest/rules/no-div-regex.
645
+ */
646
+ "no-div-regex": "off",
647
+
648
+ /**
649
+ * Disallow else after a return in an if πŸ”§
650
+ * https://eslint.org/docs/latest/rules/no-else-return.
651
+ */
652
+ "no-else-return": ["error", { allowElseIf: false }],
653
+
654
+ /**
655
+ * Disallow empty statements βœ…
656
+ * https://eslint.org/docs/latest/rules/no-empty.
657
+ */
658
+ "no-empty": "error",
659
+
660
+ /**
661
+ * Disallow empty functions, except for standalone funcs/arrows
662
+ * https://eslint.org/docs/latest/rules/no-empty-function.
663
+ */
664
+ "no-empty-function": [
665
+ "error",
666
+ {
667
+ allow: ["arrowFunctions", "functions", "methods"],
668
+ },
669
+ ],
670
+
671
+ /**
672
+ * Disallow comparisons to null without a type-checking operator
673
+ * https://eslint.org/docs/latest/rules/no-eq-null.
674
+ */
675
+ "no-eq-null": "off",
676
+
677
+ /**
678
+ * Disallow use of eval()
679
+ * https://eslint.org/docs/latest/rules/no-eval.
680
+ */
681
+ "no-eval": "error",
682
+
683
+ /**
684
+ * Disallow adding to native types
685
+ * https://eslint.org/docs/latest/rules/no-extend-native.
686
+ */
687
+ "no-extend-native": "error",
688
+
689
+ /**
690
+ * Disallow unnecessary function binding πŸ”§
691
+ * https://eslint.org/docs/latest/rules/no-extra-bind.
692
+ */
693
+ "no-extra-bind": "error",
694
+
695
+ /**
696
+ * Disallow double-negation boolean casts in a boolean context βœ… πŸ”§
697
+ * https://eslint.org/docs/latest/rules/no-extra-boolean-cast.
698
+ */
699
+ "no-extra-boolean-cast": "error",
700
+
701
+ /**
702
+ * Disallow unnecessary labels πŸ”§
703
+ * https://eslint.org/docs/latest/rules/no-extra-label.
704
+ */
705
+ "no-extra-label": "error",
706
+
707
+ /**
708
+ * Disallow unnecessary semicolons βœ… πŸ”§
709
+ * https://eslint.org/docs/latest/rules/no-extra-semi.
710
+ */
711
+ "no-extra-semi": "error",
712
+
713
+ /**
714
+ * Disallow the use of leading or trailing decimal points in numeric literals πŸ”§
715
+ * https://eslint.org/docs/latest/rules/no-floating-decimal.
716
+ */
717
+ "no-floating-decimal": "error",
718
+
719
+ /**
720
+ * Disallow reassignments of native objects or read-only globals βœ…
721
+ * https://eslint.org/docs/latest/rules/no-global-assign.
722
+ */
723
+ "no-global-assign": ["error", { exceptions: [] }],
724
+
725
+ /**
726
+ * Disallow implicit type conversions πŸ”§
727
+ * https://eslint.org/docs/latest/rules/no-implicit-coercion.
728
+ */
729
+ "no-implicit-coercion": [
730
+ "off",
731
+ {
732
+ boolean: false,
733
+ number: true,
734
+ string: true,
735
+ allow: [],
736
+ },
737
+ ],
738
+
739
+ /**
740
+ * Disallow var and named functions in global scope
741
+ * https://eslint.org/docs/latest/rules/no-implicit-globals.
742
+ */
743
+ "no-implicit-globals": "off",
744
+
745
+ /**
746
+ * Disallow use of eval()-like methods
747
+ * https://eslint.org/docs/latest/rules/no-implied-eval.
748
+ */
749
+ "no-implied-eval": "error",
750
+
751
+ /**
752
+ * Disallow comments inline after code
753
+ * https://eslint.org/docs/latest/rules/no-inline-comments.
754
+ */
755
+ "no-inline-comments": "off",
756
+
757
+ /**
758
+ * Disallow this keywords outside of classes or class-like objects
759
+ * https://eslint.org/docs/latest/rules/no-invalid-this.
760
+ */
761
+ "no-invalid-this": "warn",
762
+
763
+ /**
764
+ * Disallow usage of __iterator__ property
765
+ * https://eslint.org/docs/latest/rules/no-iterator.
766
+ */
767
+ "no-iterator": "error",
768
+
769
+ /**
770
+ * Disallow labels that share a name with a variable
771
+ * https://eslint.org/docs/latest/rules/no-label-var.
772
+ */
773
+ "no-label-var": "error",
774
+
775
+ /**
776
+ * Disallow use of labels for anything other than loops and switches
777
+ * https://eslint.org/docs/latest/rules/no-labels.
778
+ */
779
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
780
+
781
+ /**
782
+ * Disallow unnecessary nested blocks
783
+ * https://eslint.org/docs/latest/rules/no-lone-blocks.
784
+ */
785
+ "no-lone-blocks": "error",
786
+
787
+ /**
788
+ * Disallow if as the only statement in an else block πŸ”§
789
+ * https://eslint.org/docs/latest/rules/no-lonely-if.
790
+ */
791
+ "no-lonely-if": "error",
792
+
793
+ /**
794
+ * Disallow creation of functions within loops
795
+ * https://eslint.org/docs/latest/rules/no-loop-func.
796
+ */
797
+ "no-loop-func": "error",
798
+
799
+ /**
800
+ * Disallow magic numbers
801
+ * https://eslint.org/docs/latest/rules/no-magic-numbers.
802
+ */
803
+ "no-magic-numbers": [
804
+ "off",
805
+ {
806
+ ignore: [],
807
+ ignoreArrayIndexes: true,
808
+ enforceConst: true,
809
+ detectObjects: false,
810
+ },
811
+ ],
812
+
813
+ /**
814
+ * Disallow un-paren"d mixes of different operators
815
+ * https://eslint.org/docs/latest/rules/no-mixed-operators.
816
+ */
817
+ "no-mixed-operators": [
818
+ "error",
819
+ {
820
+ // the list of arithmetic groups disallows mixing `%` and `**`
821
+ // with other arithmetic operators.
822
+ groups: [
823
+ ["%", "**"],
824
+ ["%", "+"],
825
+ ["%", "-"],
826
+ ["%", "*"],
827
+ ["%", "/"],
828
+ ["/", "*"],
829
+ ["&", "|", "<<", ">>", ">>>"],
830
+ ["==", "!=", "===", "!=="],
831
+ ["&&", "||"],
832
+ ],
833
+ allowSamePrecedence: false,
834
+ },
835
+ ],
836
+
837
+ /**
838
+ * Disallow use of chained assignment expressions
839
+ * https://eslint.org/docs/latest/rules/no-multi-assign.
840
+ */
841
+ "no-multi-assign": ["error", { ignoreNonDeclaration: true }],
842
+
843
+ /**
844
+ * Disallow use of multiline strings
845
+ * https://eslint.org/docs/latest/rules/no-multi-str.
846
+ */
847
+ "no-multi-str": "error",
848
+
849
+ /**
850
+ * Disallow negated conditions
851
+ * https://eslint.org/docs/latest/rules/no-negated-condition.
852
+ */
853
+ "no-negated-condition": "off",
854
+
855
+ /**
856
+ * Disallow nested ternary expressions
857
+ * https://eslint.org/docs/latest/rules/no-nested-ternary.
858
+ */
859
+ "no-nested-ternary": "error",
860
+
861
+ /**
862
+ * Disallow use of new operator when not part of the assignment or comparison
863
+ * https://eslint.org/docs/latest/rules/no-new.
864
+ */
865
+ "no-new": "error",
866
+
867
+ /**
868
+ * Disallow use of new operator for Function object
869
+ * https://eslint.org/docs/latest/rules/no-new-func.
870
+ */
871
+ "no-new-func": "error",
872
+
873
+ /**
874
+ * Disallow use of the Object constructor
875
+ * https://eslint.org/docs/latest/rules/no-new-object.
876
+ */
877
+ "no-new-object": "error",
878
+
879
+ /**
880
+ * Disallows creating new instances of String, Number, and Boolean
881
+ * https://eslint.org/docs/latest/rules/no-new-wrappers.
882
+ */
883
+ "no-new-wrappers": "error",
884
+
885
+ /**
886
+ * Disallow \8 and \9 escape sequences in string literals βœ…
887
+ * https://eslint.org/docs/latest/rules/no-nonoctal-decimal-escape.
888
+ */
889
+ "no-nonoctal-decimal-escape": "error",
890
+
891
+ /**
892
+ * Disallow use of (old style) octal literals βœ…
893
+ * https://eslint.org/docs/latest/rules/no-octal.
894
+ */
895
+ "no-octal": "error",
896
+
897
+ /**
898
+ * Disallow use of octal escape sequences in string literals, such as: var foo = "Copyright \251";
899
+ * https://eslint.org/docs/latest/rules/no-octal-escape.
900
+ */
901
+ "no-octal-escape": "error",
902
+
903
+ /**
904
+ * Disallow reassignment of function parameters
905
+ * /**
906
+ * disallow parameter object manipulation except for specific exclusions
907
+ * https://eslint.org/docs/latest/rules/no-param-reassign.
908
+ */
909
+ "no-param-reassign": [
910
+ "error",
911
+ {
912
+ props: true,
913
+ ignorePropertyModificationsFor: [
914
+ "acc", // for reduce accumulators
915
+ "accumulator", // for reduce accumulators
916
+ "e", // for e.returnvalue
917
+ "ctx", // for Koa routing
918
+ "context", // for Koa routing
919
+ "req", // for Express requests
920
+ "request", // for Express requests
921
+ "res", // for Express responses
922
+ "response", // for Express responses
923
+ "$scope", // for Angular 1 scopes
924
+ "staticContext", // for ReactRouter context
925
+ ],
926
+ },
927
+ ],
928
+
929
+ /**
930
+ * Disallow use of unary operators, ++ and --
931
+ * https://eslint.org/docs/latest/rules/no-plusplus.
932
+ */
933
+ "no-plusplus": "error",
934
+
935
+ /**
936
+ * Disallow usage of __proto__ property
937
+ * https://eslint.org/docs/latest/rules/no-proto.
938
+ */
939
+ "no-proto": "error",
940
+
941
+ /**
942
+ * Disallow declaring the same variable more than once βœ…
943
+ * https://eslint.org/docs/latest/rules/no-redeclare.
944
+ */
945
+ "no-redeclare": "error",
946
+
947
+ /**
948
+ * Disallow multiple spaces in a regular expression literal βœ… πŸ”§
949
+ * https://eslint.org/docs/latest/rules/no-regex-spaces.
950
+ */
951
+ "no-regex-spaces": "error",
952
+
953
+ /**
954
+ * Disallow specified names in exports
955
+ * https://eslint.org/docs/latest/rules/no-restricted-exports.
956
+ */
957
+ "no-restricted-exports": [
958
+ "error",
959
+ {
960
+ restrictedNamedExports: [
961
+ "default", // use `export default` to provide a default export
962
+ "then", // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
963
+ ],
964
+ },
965
+ ],
966
+
967
+ /**
968
+ * Disallow specific globals
969
+ * https://eslint.org/docs/latest/rules/no-restricted-globals.
970
+ */
971
+ "no-restricted-globals": [
972
+ "error",
973
+ {
974
+ name: "isFinite",
975
+ message: "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite",
976
+ },
977
+ {
978
+ name: "isNaN",
979
+ message: "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan",
980
+ },
981
+ ].concat(confusingBrowserGlobals),
982
+
983
+ /**
984
+ * Disallow specific imports
985
+ * https://eslint.org/docs/latest/rules/no-restricted-imports.
986
+ */
987
+ "no-restricted-imports": ["off", { paths: [], patterns: [] }],
988
+
989
+ /**
990
+ * Disallow certain object properties
991
+ * https://eslint.org/docs/latest/rules/no-restricted-properties.
992
+ */
993
+ "no-restricted-properties": [
994
+ "error",
995
+ {
996
+ object: "arguments",
997
+ property: "callee",
998
+ message: "arguments.callee is deprecated",
999
+ },
1000
+ {
1001
+ object: "global",
1002
+ property: "isFinite",
1003
+ message: "Please use Number.isFinite instead",
1004
+ },
1005
+ {
1006
+ object: "self",
1007
+ property: "isFinite",
1008
+ message: "Please use Number.isFinite instead",
1009
+ },
1010
+ {
1011
+ object: "window",
1012
+ property: "isFinite",
1013
+ message: "Please use Number.isFinite instead",
1014
+ },
1015
+ {
1016
+ object: "global",
1017
+ property: "isNaN",
1018
+ message: "Please use Number.isNaN instead",
1019
+ },
1020
+ {
1021
+ object: "self",
1022
+ property: "isNaN",
1023
+ message: "Please use Number.isNaN instead",
1024
+ },
1025
+ {
1026
+ object: "window",
1027
+ property: "isNaN",
1028
+ message: "Please use Number.isNaN instead",
1029
+ },
1030
+ {
1031
+ property: "__defineGetter__",
1032
+ message: "Please use Object.defineProperty instead.",
1033
+ },
1034
+ {
1035
+ property: "__defineSetter__",
1036
+ message: "Please use Object.defineProperty instead.",
1037
+ },
1038
+ {
1039
+ object: "Math",
1040
+ property: "pow",
1041
+ message: "Use the exponentiation operator (**) instead.",
1042
+ },
1043
+ ],
1044
+
1045
+ /**
1046
+ * Disallow certain syntax forms
1047
+ * https://eslint.org/docs/latest/rules/no-restricted-syntax.
1048
+ */
1049
+ "no-restricted-syntax": [
1050
+ "error",
1051
+ {
1052
+ selector: "ForInStatement",
1053
+ message:
1054
+ "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
1055
+ },
1056
+ {
1057
+ selector: "ForOfStatement",
1058
+ message:
1059
+ "iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.",
1060
+ },
1061
+ {
1062
+ selector: "LabeledStatement",
1063
+ message:
1064
+ "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
1065
+ },
1066
+ {
1067
+ selector: "WithStatement",
1068
+ message:
1069
+ "`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
1070
+ },
1071
+ ],
1072
+
1073
+ /**
1074
+ * Disallow use of assignment in return statement
1075
+ * https://eslint.org/docs/latest/rules/no-return-assign.
1076
+ */
1077
+ "no-return-assign": ["error", "always"],
1078
+
1079
+ /**
1080
+ * Disallow redundant `return await`
1081
+ * https://eslint.org/docs/latest/rules/no-return-await.
1082
+ */
1083
+ "no-return-await": "error",
1084
+
1085
+ /**
1086
+ * Disallow use of `javascript:` urls.
1087
+ * Https://eslint.org/docs/latest/rules/no-script-url.
1088
+ */
1089
+ "no-script-url": "error",
1090
+
1091
+ /**
1092
+ * Disallow use of comma operator
1093
+ * https://eslint.org/docs/latest/rules/no-sequences.
1094
+ */
1095
+ "no-sequences": "error",
1096
+
1097
+ /**
1098
+ * Disallow declaration of variables already declared in the outer scope
1099
+ * https://eslint.org/docs/latest/rules/no-shadow.
1100
+ */
1101
+ "no-shadow": ["error", { hoist: "all" }],
1102
+
1103
+ /**
1104
+ * Disallow shadowing of names such as arguments βœ…
1105
+ * https://eslint.org/docs/latest/rules/no-shadow-restricted-names.
1106
+ */
1107
+ "no-shadow-restricted-names": "error",
1108
+
1109
+ /**
1110
+ * Disallow the use of ternary operators
1111
+ * https://eslint.org/docs/latest/rules/no-ternary.
1112
+ */
1113
+ "no-ternary": "off",
1114
+
1115
+ /**
1116
+ * Restrict what can be thrown as an exception
1117
+ * https://eslint.org/docs/latest/rules/no-throw-literal.
1118
+ */
1119
+ "no-throw-literal": "error",
1120
+
1121
+ /**
1122
+ * Disallow use of undefined when initializing variables πŸ”§
1123
+ * https://eslint.org/docs/latest/rules/no-undef-init.
1124
+ */
1125
+ "no-undef-init": "error",
1126
+
1127
+ /**
1128
+ * Disallow use of undefined variable
1129
+ * https://eslint.org/docs/latest/rules/no-undefined.
1130
+ */
1131
+ "no-undefined": "off",
1132
+
1133
+ /**
1134
+ * Disallow dangling underscores in identifiers
1135
+ * https://eslint.org/docs/latest/rules/no-underscore-dangle.
1136
+ */
1137
+ "no-underscore-dangle": [
1138
+ "error",
1139
+ {
1140
+ allow: [],
1141
+ allowAfterThis: false,
1142
+ allowAfterSuper: false,
1143
+ enforceInMethodNames: true,
1144
+ },
1145
+ ],
1146
+
1147
+ /**
1148
+ * Disallow the use of Boolean literals in conditional expressions πŸ”§
1149
+ * also, prefer `a || b` over `a ? A : b`
1150
+ * https://eslint.org/docs/latest/rules/no-unneeded-ternary.
1151
+ */
1152
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
1153
+
1154
+ /**
1155
+ * Disallow usage of expressions in statement position
1156
+ * https://eslint.org/docs/latest/rules/no-unused-expressions.
1157
+ */
1158
+ "no-unused-expressions": [
1159
+ "error",
1160
+ {
1161
+ allowShortCircuit: false,
1162
+ allowTernary: false,
1163
+ allowTaggedTemplates: false,
1164
+ },
1165
+ ],
1166
+
1167
+ /**
1168
+ * Disallow unused labels βœ… πŸ”§
1169
+ * https://eslint.org/docs/latest/rules/no-unused-labels.
1170
+ */
1171
+ "no-unused-labels": "error",
1172
+
1173
+ /**
1174
+ * Disallow unnecessary .call() and .apply()
1175
+ * https://eslint.org/docs/latest/rules/no-useless-call.
1176
+ */
1177
+ "no-useless-call": "off",
1178
+
1179
+ /**
1180
+ * Disallow unnecessary catch clauses βœ…
1181
+ * https://eslint.org/docs/latest/rules/no-useless-catch.
1182
+ */
1183
+ "no-useless-catch": "error",
1184
+
1185
+ /**
1186
+ * Disallow useless computed property keys πŸ”§
1187
+ * https://eslint.org/docs/latest/rules/no-useless-computed-key.
1188
+ */
1189
+ "no-useless-computed-key": "error",
1190
+
1191
+ /**
1192
+ * Disallow useless string concatenation
1193
+ * https://eslint.org/docs/latest/rules/no-useless-concat.
1194
+ */
1195
+ "no-useless-concat": "error",
1196
+
1197
+ /**
1198
+ * Disallow unnecessary constructor
1199
+ * https://eslint.org/docs/latest/rules/no-useless-constructor.
1200
+ */
1201
+ "no-useless-constructor": "error",
1202
+
1203
+ /**
1204
+ * Disallow unnecessary string escaping βœ…
1205
+ * https://eslint.org/docs/latest/rules/no-useless-escape.
1206
+ */
1207
+ "no-useless-escape": "error",
1208
+
1209
+ /**
1210
+ * Disallow renaming import, export, and destructured assignments to the same name πŸ”§
1211
+ * https://eslint.org/docs/latest/rules/no-useless-rename.
1212
+ */
1213
+ "no-useless-rename": [
1214
+ "error",
1215
+ {
1216
+ ignoreDestructuring: false,
1217
+ ignoreImport: false,
1218
+ ignoreExport: false,
1219
+ },
1220
+ ],
1221
+
1222
+ /**
1223
+ * Disallow redundant return; keywords πŸ”§
1224
+ * https://eslint.org/docs/latest/rules/no-useless-return.
1225
+ */
1226
+ "no-useless-return": "error",
1227
+
1228
+ /**
1229
+ * Require let or const instead of var πŸ”§
1230
+ * https://eslint.org/docs/latest/rules/no-var.
1231
+ */
1232
+ "no-var": "error",
1233
+
1234
+ /**
1235
+ * Disallow use of void operator
1236
+ * https://eslint.org/docs/latest/rules/no-void.
1237
+ */
1238
+ "no-void": "error",
1239
+
1240
+ /**
1241
+ * Disallow usage of configurable warning terms in comments: e.g. Todo
1242
+ * https://eslint.org/docs/latest/rules/no-warning-comments.
1243
+ */
1244
+ "no-warning-comments": ["off", { terms: ["todo", "fixme", "xxx"], location: "start" }],
1245
+
1246
+ /**
1247
+ * Disallow use of the with statement βœ…
1248
+ * https://eslint.org/docs/latest/rules/no-with.
1249
+ */
1250
+ "no-with": "error",
1251
+
1252
+ /**
1253
+ * Require method and property shorthand syntax for object literals πŸ”§
1254
+ * https://eslint.org/docs/latest/rules/object-shorthand.
1255
+ */
1256
+ "object-shorthand": ["error", "always", { ignoreConstructors: false, avoidQuotes: true }],
1257
+
1258
+ /**
1259
+ * Allow just one var statement per function πŸ”§
1260
+ * https://eslint.org/docs/latest/rules/one-var.
1261
+ */
1262
+ "one-var": ["error", "never"],
1263
+
1264
+ /**
1265
+ * Require a newline around variable declaration πŸ”§
1266
+ * https://eslint.org/docs/latest/rules/one-var-declaration-per-line.
1267
+ */
1268
+ "one-var-declaration-per-line": ["error", "always"],
1269
+
1270
+ /**
1271
+ * Require assignment operator shorthand where possible or prohibit it entirely πŸ”§
1272
+ * https://eslint.org/docs/latest/rules/operator-assignment.
1273
+ */
1274
+ "operator-assignment": ["error", "always"],
1275
+
1276
+ /**
1277
+ * Suggest using arrow functions as callbacks πŸ”§
1278
+ * https://eslint.org/docs/latest/rules/prefer-arrow-callback.
1279
+ */
1280
+ "prefer-arrow-callback": ["error", { allowNamedFunctions: false, allowUnboundThis: true }],
1281
+
1282
+ /**
1283
+ * Suggest using of const declaration for variables that are never modified after declared πŸ”§
1284
+ * https://eslint.org/docs/latest/rules/prefer-const.
1285
+ */
1286
+ "prefer-const": ["error", { destructuring: "any", ignoreReadBeforeAssign: true }],
1287
+
1288
+ /**
1289
+ * Prefer destructuring from arrays and objects πŸ”§
1290
+ * https://eslint.org/docs/latest/rules/prefer-destructuring.
1291
+ */
1292
+ "prefer-destructuring": [
1293
+ "error",
1294
+ {
1295
+ VariableDeclarator: { array: false, object: true },
1296
+ AssignmentExpression: { array: true, object: false },
1297
+ },
1298
+ {
1299
+ enforceForRenamedProperties: false,
1300
+ },
1301
+ ],
1302
+
1303
+ /**
1304
+ * Disallow the use of Math.pow in favor of the ** operator πŸ”§
1305
+ * https://eslint.org/docs/latest/rules/prefer-exponentiation-operator.
1306
+ */
1307
+ "prefer-exponentiation-operator": "error",
1308
+
1309
+ /**
1310
+ * Suggest using named capture group in regular expression
1311
+ * https://eslint.org/docs/latest/rules/prefer-named-capture-group.
1312
+ */
1313
+ "prefer-named-capture-group": "off",
1314
+
1315
+ /**
1316
+ * Disallow parseInt() in favor of binary, octal, and hexadecimal literals πŸ”§
1317
+ * https://eslint.org/docs/latest/rules/prefer-numeric-literals.
1318
+ */
1319
+ "prefer-numeric-literals": "error",
1320
+
1321
+ /**
1322
+ * Disallow use of Object.prototype.hasOwnProperty.call() and prefer use of Object.hasOwn() πŸ”§
1323
+ * https://eslint.org/docs/latest/rules/prefer-object-has-own.
1324
+ */
1325
+ "prefer-object-has-own": "error",
1326
+
1327
+ /**
1328
+ * Prefer use of an object spread over Object.assign πŸ”§
1329
+ * https://eslint.org/docs/latest/rules/prefer-object-spread.
1330
+ */
1331
+ "prefer-object-spread": "error",
1332
+
1333
+ /**
1334
+ * Require using Error objects as Promise rejection reasons
1335
+ * https://eslint.org/docs/latest/rules/prefer-promise-reject-errors.
1336
+ */
1337
+ "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
1338
+
1339
+ /**
1340
+ * Disallow use of the RegExp constructor in favor of regular expression literals
1341
+ * https://eslint.org/docs/latest/rules/prefer-regex-literals.
1342
+ */
1343
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
1344
+
1345
+ /**
1346
+ * Use rest parameters instead of arguments
1347
+ * https://eslint.org/docs/latest/rules/prefer-rest-params.
1348
+ */
1349
+ "prefer-rest-params": "error",
1350
+
1351
+ /**
1352
+ * Suggest using the spread syntax instead of .apply()
1353
+ * https://eslint.org/docs/latest/rules/prefer-spread.
1354
+ */
1355
+ "prefer-spread": "error",
1356
+
1357
+ /**
1358
+ * Suggest using template literals instead of string concatenation πŸ”§
1359
+ * https://eslint.org/docs/latest/rules/prefer-template.
1360
+ */
1361
+ "prefer-template": "error",
1362
+
1363
+ /**
1364
+ * Require quotes around object literal property names πŸ”§
1365
+ * https://eslint.org/docs/latest/rules/quote-props.
1366
+ */
1367
+ "quote-props": ["error", "as-needed", { keywords: false, unnecessary: true, numbers: false }],
1368
+
1369
+ /**
1370
+ * Require use of the second argument for parseInt()
1371
+ * https://eslint.org/docs/latest/rules/radix.
1372
+ */
1373
+ radix: "error",
1374
+
1375
+ /**
1376
+ * Require `await` in `async function` (note: this is a horrible rule that should never be used)
1377
+ * https://eslint.org/docs/latest/rules/require-await.
1378
+ */
1379
+ "require-await": "off",
1380
+
1381
+ /**
1382
+ * Enforce the use of u flag on RegExp
1383
+ * https://eslint.org/docs/latest/rules/require-unicode-regexp.
1384
+ */
1385
+ "require-unicode-regexp": "off",
1386
+
1387
+ /**
1388
+ * Disallow generator functions that do not have yield βœ…
1389
+ * https://eslint.org/docs/latest/rules/require-yield.
1390
+ */
1391
+ "require-yield": "error",
1392
+
1393
+ /**
1394
+ * Import sorting πŸ”§
1395
+ * https://eslint.org/docs/latest/rules/sort-imports.
1396
+ */
1397
+ "sort-imports": [
1398
+ "off",
1399
+ {
1400
+ ignoreCase: false,
1401
+ ignoreDeclarationSort: false,
1402
+ ignoreMemberSort: false,
1403
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
1404
+ },
1405
+ ],
1406
+
1407
+ /**
1408
+ * Requires object keys to be sorted
1409
+ * https://eslint.org/docs/latest/rules/sort-keys.
1410
+ */
1411
+ "sort-keys": ["off", "asc", { caseSensitive: false, natural: true }],
1412
+
1413
+ /**
1414
+ * Sort variables within the same declaration block πŸ”§
1415
+ * https://eslint.org/docs/latest/rules/sort-vars.
1416
+ */
1417
+ "sort-vars": "off",
1418
+
1419
+ /**
1420
+ * Require or disallow strict mode directives πŸ”§
1421
+ * https://eslint.org/docs/latest/rules/strict.
1422
+ */
1423
+ strict: ["error", "never"],
1424
+
1425
+ /**
1426
+ * Require a Symbol description
1427
+ * https://eslint.org/docs/latest/rules/symbol-description.
1428
+ */
1429
+ "symbol-description": "error",
1430
+
1431
+ /**
1432
+ * Requires to declare all vars on top of their containing scope
1433
+ * https://eslint.org/docs/latest/rules/vars-on-top.
1434
+ */
1435
+ "vars-on-top": "error",
1436
+
1437
+ /**
1438
+ * Require or disallow Yoda conditions πŸ”§
1439
+ * https://eslint.org/docs/latest/rules/yoda.
1440
+ */
1441
+ yoda: "error",
1442
+
1443
+ // ======================= Styling & formatting =======================
1444
+
1445
+ /**
1446
+ * Enforce line breaks after opening and before closing array brackets πŸ”§
1447
+ * https://eslint.org/docs/latest/rules/array-bracket-newline.
1448
+ */
1449
+ "array-bracket-newline": ["off", "consistent"], // object option alternative: { multiline: true, minItems: 3 }
1450
+
1451
+ /**
1452
+ * Enforce spacing inside array brackets πŸ”§
1453
+ * https://eslint.org/docs/latest/rules/array-bracket-spacing.
1454
+ */
1455
+ "array-bracket-spacing": ["error", "never"],
1456
+
1457
+ /**
1458
+ * Enforce line breaks between array elements πŸ”§
1459
+ * https://eslint.org/docs/latest/rules/array-element-newline.
1460
+ */
1461
+ "array-element-newline": ["off", { multiline: true, minItems: 3 }],
1462
+
1463
+ /**
1464
+ * Require parens in arrow function arguments πŸ”§
1465
+ * https://eslint.org/docs/latest/rules/arrow-parens.
1466
+ */
1467
+ "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
1468
+
1469
+ /**
1470
+ * Require space before/after arrow function"s arrow πŸ”§
1471
+ * https://eslint.org/docs/latest/rules/arrow-spacing.
1472
+ */
1473
+ "arrow-spacing": ["error", { before: true, after: true }],
1474
+
1475
+ /**
1476
+ * Enforce spacing inside single-line blocks πŸ”§
1477
+ * https://eslint.org/docs/latest/rules/block-spacing.
1478
+ */
1479
+ "block-spacing": ["error", "always"],
1480
+
1481
+ /**
1482
+ * Enforce one true brace style πŸ”§
1483
+ * https://eslint.org/docs/latest/rules/brace-style.
1484
+ */
1485
+ "brace-style": ["error", "1tbs", { allowSingleLine: true }],
1486
+
1487
+ /**
1488
+ * Require trailing commas in multiline object literals πŸ”§
1489
+ * https://eslint.org/docs/latest/rules/comma-dangle.
1490
+ */
1491
+ "comma-dangle": [
1492
+ "error",
1493
+ {
1494
+ arrays: "always-multiline",
1495
+ objects: "always-multiline",
1496
+ imports: "always-multiline",
1497
+ exports: "always-multiline",
1498
+ functions: "always-multiline",
1499
+ },
1500
+ ],
1501
+
1502
+ /**
1503
+ * Enforce spacing before and after comma πŸ”§
1504
+ * https://eslint.org/docs/latest/rules/comma-spacing.
1505
+ */
1506
+ "comma-spacing": ["error", { before: false, after: true }],
1507
+
1508
+ /**
1509
+ * Enforce one true comma style πŸ”§
1510
+ * https://eslint.org/docs/latest/rules/comma-style.
1511
+ */
1512
+ "comma-style": [
1513
+ "error",
1514
+ "last",
1515
+ {
1516
+ exceptions: {
1517
+ ArrayExpression: false,
1518
+ ArrayPattern: false,
1519
+ ArrowFunctionExpression: false,
1520
+ CallExpression: false,
1521
+ FunctionDeclaration: false,
1522
+ FunctionExpression: false,
1523
+ ImportDeclaration: false,
1524
+ ObjectExpression: false,
1525
+ ObjectPattern: false,
1526
+ VariableDeclaration: false,
1527
+ NewExpression: false,
1528
+ },
1529
+ },
1530
+ ],
1531
+
1532
+ /**
1533
+ * Disallow padding inside computed properties πŸ”§
1534
+ * https://eslint.org/docs/latest/rules/computed-property-spacing.
1535
+ */
1536
+ "computed-property-spacing": ["error", "never"],
1537
+
1538
+ /**
1539
+ * Enforces consistent newlines before or after dots πŸ”§
1540
+ * https://eslint.org/docs/latest/rules/dot-location.
1541
+ */
1542
+ "dot-location": ["error", "property"],
1543
+
1544
+ /**
1545
+ * Enforce newline at the end of file, with no multiple empty lines πŸ”§
1546
+ * https://eslint.org/docs/latest/rules/eol-last.
1547
+ */
1548
+ "eol-last": ["error", "always"],
1549
+
1550
+ /**
1551
+ * Enforce spacing between functions and their invocations πŸ”§
1552
+ * https://eslint.org/docs/latest/rules/func-call-spacing.
1553
+ */
1554
+ "func-call-spacing": ["error", "never"],
1555
+
1556
+ /**
1557
+ * Enforce line breaks between arguments of a function call πŸ”§
1558
+ * https://eslint.org/docs/latest/rules/function-call-argument-newline.
1559
+ */
1560
+ "function-call-argument-newline": ["error", "consistent"],
1561
+
1562
+ /**
1563
+ * Require line breaks inside function parentheses if there are line breaks between parameters πŸ”§
1564
+ * https://eslint.org/docs/latest/rules/function-paren-newline.
1565
+ */
1566
+ "function-paren-newline": [
1567
+ "error",
1568
+ semver.satisfies(eslintPkg.version, ">= 6") ? "multiline-arguments" : "consistent",
1569
+ ],
1570
+
1571
+ /**
1572
+ * Enforce the spacing around the * in generator functions πŸ”§
1573
+ * https://eslint.org/docs/latest/rules/generator-star-spacing.
1574
+ */
1575
+ "generator-star-spacing": ["error", { before: false, after: true }],
1576
+
1577
+ /**
1578
+ * Enforce the location of arrow function bodies with implicit returns πŸ”§
1579
+ * https://eslint.org/docs/latest/rules/implicit-arrow-linebreak.
1580
+ */
1581
+ "implicit-arrow-linebreak": ["error", "beside"],
1582
+
1583
+ /**
1584
+ * This option sets a specific tab width for your code πŸ”§
1585
+ * https://eslint.org/docs/latest/rules/indent.
1586
+ */
1587
+ indent: [
1588
+ "error",
1589
+ 4,
1590
+ {
1591
+ SwitchCase: 1,
1592
+ VariableDeclarator: 1,
1593
+ outerIIFEBody: 1,
1594
+ FunctionDeclaration: { parameters: 1, body: 1 },
1595
+ FunctionExpression: { parameters: 1, body: 1 },
1596
+ CallExpression: { arguments: 1 },
1597
+ ArrayExpression: 1,
1598
+ ObjectExpression: 1,
1599
+ ImportDeclaration: 1,
1600
+ flatTernaryExpressions: false,
1601
+ ignoredNodes: [
1602
+ "JSXElement",
1603
+ "JSXElement > *",
1604
+ "JSXAttribute",
1605
+ "JSXIdentifier",
1606
+ "JSXNamespacedName",
1607
+ "JSXMemberExpression",
1608
+ "JSXSpreadAttribute",
1609
+ "JSXExpressionContainer",
1610
+ "JSXOpeningElement",
1611
+ "JSXClosingElement",
1612
+ "JSXFragment",
1613
+ "JSXOpeningFragment",
1614
+ "JSXClosingFragment",
1615
+ "JSXText",
1616
+ "JSXEmptyExpression",
1617
+ "JSXSpreadChild",
1618
+ ],
1619
+ ignoreComments: false,
1620
+ },
1621
+ ],
1622
+
1623
+ /**
1624
+ * Specify whether double or single quotes should be used in JSX attributes πŸ”§
1625
+ * https://eslint.org/docs/latest/rules/jsx-quotes.
1626
+ */
1627
+ "jsx-quotes": ["error", "prefer-double"],
1628
+
1629
+ /**
1630
+ * Enforces spacing between keys and values in object literal properties πŸ”§
1631
+ * https://eslint.org/docs/latest/rules/key-spacing.
1632
+ */
1633
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
1634
+
1635
+ /**
1636
+ * Require a space before & after certain keywords πŸ”§
1637
+ * https://eslint.org/docs/latest/rules/keyword-spacing.
1638
+ */
1639
+ "keyword-spacing": [
1640
+ "error",
1641
+ {
1642
+ before: true,
1643
+ after: true,
1644
+ overrides: {
1645
+ return: { after: true },
1646
+ throw: { after: true },
1647
+ case: { after: true },
1648
+ },
1649
+ },
1650
+ ],
1651
+
1652
+ /**
1653
+ * Enforce position of line comments
1654
+ * https://eslint.org/docs/latest/rules/line-comment-position.
1655
+ */
1656
+ "line-comment-position": [
1657
+ "off",
1658
+ {
1659
+ position: "above",
1660
+ ignorePattern: "",
1661
+ applyDefaultPatterns: true,
1662
+ },
1663
+ ],
1664
+
1665
+ /**
1666
+ * Disallow mixed "LF" and "CRLF" as linebreaks πŸ”§
1667
+ * https://eslint.org/docs/latest/rules/linebreak-style.
1668
+ */
1669
+ "linebreak-style": ["error", "unix"],
1670
+
1671
+ /**
1672
+ * Enforces empty lines around comments πŸ”§
1673
+ * https://eslint.org/docs/latest/rules/lines-around-comment.
1674
+ */
1675
+ "lines-around-comment": "off",
1676
+
1677
+ /**
1678
+ * Require or disallow an empty line between class members πŸ”§
1679
+ * https://eslint.org/docs/latest/rules/lines-between-class-members.
1680
+ */
1681
+ "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: false }],
1682
+
1683
+ /**
1684
+ * Specify the maximum length of a line in your program
1685
+ * https://eslint.org/docs/latest/rules/max-len.
1686
+ */
1687
+ "max-len": [
1688
+ "error",
1689
+ 120,
1690
+ 2,
1691
+ {
1692
+ ignoreUrls: true,
1693
+ ignoreComments: false,
1694
+ ignoreRegExpLiterals: true,
1695
+ ignoreStrings: true,
1696
+ ignoreTemplateLiterals: true,
1697
+ },
1698
+ ],
1699
+
1700
+ /**
1701
+ * Restrict the number of statements per line
1702
+ * https://eslint.org/docs/latest/rules/max-statements-per-line.
1703
+ */
1704
+ "max-statements-per-line": ["off", { max: 1 }],
1705
+
1706
+ /**
1707
+ * Require multiline ternary πŸ”§
1708
+ * https://eslint.org/docs/latest/rules/multiline-ternary.
1709
+ */
1710
+ "multiline-ternary": ["off", "never"],
1711
+
1712
+ /**
1713
+ * Disallow the omission of parentheses when invoking a constructor with no arguments πŸ”§
1714
+ * https://eslint.org/docs/latest/rules/new-parens.
1715
+ */
1716
+ "new-parens": "error",
1717
+
1718
+ /**
1719
+ * Enforces new line after each method call in the chain to make it more readable and easy to maintain πŸ”§
1720
+ * https://eslint.org/docs/latest/rules/newline-per-chained-call.
1721
+ */
1722
+ "newline-per-chained-call": ["error", { ignoreChainWithDepth: 4 }],
1723
+
1724
+ /**
1725
+ * Disallow unnecessary parentheses πŸ”§
1726
+ * https://eslint.org/docs/latest/rules/no-extra-parens.
1727
+ */
1728
+ "no-extra-parens": [
1729
+ "off",
1730
+ "all",
1731
+ {
1732
+ conditionalAssign: true,
1733
+ nestedBinaryExpressions: false,
1734
+ returnAssign: false,
1735
+ ignoreJSX: "all", // delegate to eslint-plugin-react
1736
+ enforceForArrowConditionals: false,
1737
+ },
1738
+ ],
1739
+
1740
+ /**
1741
+ * Disallow mixed spaces and tabs for indentation βœ…
1742
+ * https://eslint.org/docs/latest/rules/no-mixed-spaces-and-tabs.
1743
+ */
1744
+ "no-mixed-spaces-and-tabs": "error",
1745
+
1746
+ /**
1747
+ * Disallow use of multiple spaces πŸ”§
1748
+ * https://eslint.org/docs/latest/rules/no-multi-spaces.
1749
+ */
1750
+ "no-multi-spaces": ["error", { ignoreEOLComments: false }],
1751
+
1752
+ /**
1753
+ * Disallow multiple empty lines, only one newline at the end, and no new lines at the beginning πŸ”§
1754
+ * https://eslint.org/docs/latest/rules/no-multiple-empty-lines.
1755
+ */
1756
+ "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
1757
+
1758
+ /**
1759
+ * Disallow tab characters entirely
1760
+ * https://eslint.org/docs/latest/rules/no-tabs.
1761
+ */
1762
+ "no-tabs": "error",
1763
+
1764
+ /**
1765
+ * Disallow trailing whitespace at the end of lines πŸ”§
1766
+ * https://eslint.org/docs/latest/rules/no-trailing-spaces.
1767
+ */
1768
+ "no-trailing-spaces": ["error", { skipBlankLines: false, ignoreComments: false }],
1769
+
1770
+ /**
1771
+ * Disallow whitespace before properties πŸ”§
1772
+ * https://eslint.org/docs/latest/rules/no-whitespace-before-property.
1773
+ */
1774
+ "no-whitespace-before-property": "error",
1775
+
1776
+ /**
1777
+ * Enforce the location of single-line statements πŸ”§
1778
+ * https://eslint.org/docs/latest/rules/nonblock-statement-body-position.
1779
+ */
1780
+ "nonblock-statement-body-position": ["error", "beside", { overrides: {} }],
1781
+
1782
+ /**
1783
+ * Enforce line breaks between braces πŸ”§
1784
+ * https://eslint.org/docs/latest/rules/object-curly-newline.
1785
+ */
1786
+ "object-curly-newline": [
1787
+ "error",
1788
+ {
1789
+ ObjectExpression: { minProperties: 5, multiline: true, consistent: true },
1790
+ ObjectPattern: { minProperties: 5, multiline: true, consistent: true },
1791
+ ImportDeclaration: { minProperties: 5, multiline: true, consistent: true },
1792
+ ExportDeclaration: { minProperties: 5, multiline: true, consistent: true },
1793
+ },
1794
+ ],
1795
+
1796
+ /**
1797
+ * Require padding inside curly braces πŸ”§
1798
+ * https://eslint.org/docs/latest/rules/object-curly-spacing.
1799
+ */
1800
+ "object-curly-spacing": ["error", "always"],
1801
+
1802
+ /**
1803
+ * Enforce "same line" or "multiple line" on object properties. πŸ”§
1804
+ * https://eslint.org/docs/latest/rules/object-property-newline.
1805
+ */
1806
+ "object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
1807
+
1808
+ /**
1809
+ * Requires operator at the beginning of the line in multiline statements πŸ”§
1810
+ * https://eslint.org/docs/latest/rules/operator-linebreak.
1811
+ */
1812
+ "operator-linebreak": ["error", "before", { overrides: { "=": "none" } }],
1813
+
1814
+ /**
1815
+ * Disallow padding within blocks πŸ”§
1816
+ * https://eslint.org/docs/latest/rules/padded-blocks.
1817
+ */
1818
+ "padded-blocks": [
1819
+ "error",
1820
+ {
1821
+ blocks: "never",
1822
+ classes: "never",
1823
+ switches: "never",
1824
+ },
1825
+ {
1826
+ allowSingleLineBlocks: true,
1827
+ },
1828
+ ],
1829
+
1830
+ /**
1831
+ * Require or disallow padding lines between statements πŸ”§
1832
+ * https://eslint.org/docs/latest/rules/padding-line-between-statements.
1833
+ */
1834
+ "padding-line-between-statements": "off",
1835
+
1836
+ /**
1837
+ * Specifies double quotes should be used πŸ”§
1838
+ * https://eslint.org/docs/latest/rules/quotes.
1839
+ */
1840
+ quotes: ["error", "double", { avoidEscape: true }],
1841
+
1842
+ /**
1843
+ * Enforce spacing between object rest-spread πŸ”§
1844
+ * https://eslint.org/docs/latest/rules/rest-spread-spacing.
1845
+ */
1846
+ "rest-spread-spacing": ["error", "never"],
1847
+
1848
+ /**
1849
+ * Require or disallow use of semicolons instead of ASI.
1850
+ */
1851
+ semi: ["error", "always"],
1852
+
1853
+ /**
1854
+ * Enforce spacing before and after semicolons πŸ”§
1855
+ * https://eslint.org/docs/latest/rules/semi-spacing.
1856
+ */
1857
+ "semi-spacing": ["error", { before: false, after: true }],
1858
+
1859
+ /**
1860
+ * Enforce location of semicolons πŸ”§
1861
+ * https://eslint.org/docs/latest/rules/semi-style.
1862
+ */
1863
+ "semi-style": ["error", "last"],
1864
+
1865
+ /**
1866
+ * Require or disallow space before blocks πŸ”§
1867
+ * https://eslint.org/docs/latest/rules/space-before-blocks.
1868
+ */
1869
+ "space-before-blocks": "error",
1870
+
1871
+ /**
1872
+ * Require or disallow space before function opening parenthesis πŸ”§
1873
+ * https://eslint.org/docs/latest/rules/space-before-function-paren.
1874
+ */
1875
+ "space-before-function-paren": ["error", { anonymous: "always", named: "never", asyncArrow: "always" }],
1876
+
1877
+ /**
1878
+ * Require or disallow spaces inside parentheses πŸ”§
1879
+ * https://eslint.org/docs/latest/rules/space-in-parens.
1880
+ */
1881
+ "space-in-parens": ["error", "never"],
1882
+
1883
+ /**
1884
+ * Require spacing around infix operators πŸ”§
1885
+ * https://eslint.org/docs/latest/rules/space-infix-ops.
1886
+ */
1887
+ "space-infix-ops": ["error", { int32Hint: false }],
1888
+
1889
+ /**
1890
+ * Require or disallow spaces before/after unary operators πŸ”§
1891
+ * https://eslint.org/docs/latest/rules/space-unary-ops.
1892
+ */
1893
+ "space-unary-ops": ["error", { words: true, nonwords: false, overrides: {} }],
1894
+
1895
+ /**
1896
+ * Require or disallow a space immediately following the // or /* in a comment πŸ”§
1897
+ * https://eslint.org/docs/latest/rules/spaced-comment.
1898
+ */
1899
+ "spaced-comment": [
1900
+ "error",
1901
+ "always",
1902
+ {
1903
+ line: {
1904
+ exceptions: ["-", "+"],
1905
+ markers: ["=", "!", "/"], // space here to support sprockets directives, slash for TS /// comments
1906
+ },
1907
+ block: {
1908
+ exceptions: ["-", "+"],
1909
+ markers: ["=", "!", ":", "::"], // space here to support sprockets directives and flow comment types
1910
+ balanced: true,
1911
+ },
1912
+ },
1913
+ ],
1914
+
1915
+ /**
1916
+ * Enforce spacing around colons of switch statements πŸ”§
1917
+ * https://eslint.org/docs/latest/rules/switch-colon-spacing.
1918
+ */
1919
+ "switch-colon-spacing": ["error", { after: true, before: false }],
1920
+
1921
+ /**
1922
+ * Enforce usage of spacing in template strings πŸ”§
1923
+ * https://eslint.org/docs/latest/rules/template-curly-spacing.
1924
+ */
1925
+ "template-curly-spacing": "error",
1926
+
1927
+ /**
1928
+ * Require or disallow spacing between template tags and their literals πŸ”§
1929
+ * https://eslint.org/docs/latest/rules/template-tag-spacing.
1930
+ */
1931
+ "template-tag-spacing": ["error", "never"],
1932
+
1933
+ /**
1934
+ * Require or disallow the Unicode Byte Order Mark πŸ”§
1935
+ * https://eslint.org/docs/latest/rules/unicode-bom.
1936
+ */
1937
+ "unicode-bom": ["error", "never"],
1938
+
1939
+ /**
1940
+ * Require immediate function invocation to be wrapped in parentheses πŸ”§
1941
+ * https://eslint.org/docs/latest/rules/wrap-iife.
1942
+ */
1943
+ "wrap-iife": ["error", "outside", { functionPrototypeMethods: false }],
1944
+
1945
+ /**
1946
+ * Require regex literals to be wrapped in parentheses πŸ”§
1947
+ * https://eslint.org/docs/latest/rules/wrap-regex.
1948
+ */
1949
+ "wrap-regex": "off",
1950
+
1951
+ /**
1952
+ * Enforce spacing around the * in yield* expressions πŸ”§
1953
+ * https://eslint.org/docs/latest/rules/yield-star-spacing.
1954
+ */
1955
+ "yield-star-spacing": ["error", "after"],
1956
+ },
1957
+ };