-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
5525 lines (5161 loc) · 268 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Config file for ESLint.
*
* @package Config - ESLint
*
* @author Nick Menke <nick@nlmenke.net>
* @copyright 2018-2020 Nick Menke
*
* @link https://github.com/nlmenke/vertebrae
* @since x.x.x introduced
*/
/**
* These rules relate to possible syntax or logic errors in JavaScript code.
*
* @type {object}
*/
let ESLintPossibleErrors = {
/**
* A `for` loop with a stop condition that can never be reached, such as one with a counter that moves in the wrong
* direction, will run infinitely. While there are occasions when an infinite loop is intended, the convention is
* to construct such loops as `while` loops. More typically, an infinite for loop is a bug.
*/
'for-direction': 'error',
/**
* This rule enforces that a return statement is present in property getters.
*
* @property {object} options
* - `allowImplicit` {bool} Disallows implicitly returning `undefined` with a `return`
* statement;
* default: false
*/
'getter-return': [
'error',
{
'allowImplicit': false,
},
],
/**
* This rule aims to disallow async Promise executor functions.
*/
'no-async-promise-executor': 'error',
/**
* This rule disallows the use of `await` within loop bodies.
*/
'no-await-in-loop': 'off',
/**
* The rule should warn against code that tries to compare against -0, since that will not work as intended. That
* is, code like `x === -0` will pass for both +0 and -0. The author probably intended `Object.is(x, -0)`.
*/
'no-compare-neg-zero': 'error',
/**
* This rule disallows ambiguous assignment operators in test conditions of `if`, `for`, `while`, and `do...while`
* statements.
*
* @property {string} options
* - `except-parens` Allows assignments in test conditions only if they are enclosed in
* parentheses (for example, to allow reassigning a variable in the
* test of a `while` or `do...while` loop)
* - `always` Disallows all assignments in test conditions
* default: `except-parens`
*/
'no-cond-assign': [
'error',
'except-parens',
],
/**
* This rule disallows calls to methods of the `console` object.
*
* @property {object} exceptions
* - `allow` {array} An array of strings which area allowed methods of the console
* object
*/
'no-console': 'off',
/**
* This rule disallows constant expressions in the test condition of:
* - `if`, `for`, `while`, or `do...while` statement
* - `?:` ternary expression
*
* @property {object} options
* - `checkLoops` {bool} Setting this option to `false` allows constant expression in
* loops;
* default: true
*/
'no-constant-condition': [
'error',
{
'checkLoops': false,
},
],
/**
* This rule disallows control characters in regular expressions.
*/
'no-control-regex': 'error',
/**
* This rule disallows `debugger` statements.
*/
'no-debugger': 'error',
/**
* This rule disallows duplicate parameter names in function declarations or expressions. It does not apply to
* arrow functions or class methods, because the parser reports the error.
*
* If ESLint parses code in strict mode, the parser (instead of this rule) reports the error.
*/
'no-dupe-args': 'error',
/**
* This rule disallows duplicate conditions in the same `if-else-if` chain.
*/
'no-dupe-else-if': 'off',
/**
* This rule disallows duplicate keys in object literals.
*/
'no-dupe-keys': 'error',
/**
* This rule disallows duplicate test expressions in `case` clauses of `switch` statements.
*/
'no-duplicate-case': 'error',
/**
* This rule disallows empty block statements. This rule ignores block statements which contain a comment (for
* example, in an empty `catch` or `finally` block of a `try` statement to indicate that execution should continue
* regardless of errors).
*
* @property {object} exceptions
* - `allowEmptyCatch` {bool} Allows empty `catch` clauses (that is, which do not
* contain a comment);
* default: false
*/
'no-empty': [
'error',
{
'allowEmptyCatch': false,
},
],
/**
* This rule disallows empty character classes in regular expressions.
*/
'no-empty-character-class': 'error',
/**
* This rule disallows reassigning exceptions in `catch` clauses.
*/
'no-ex-assign': 'error',
/**
* This rule disallows unnecessary boolean casts.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*/
'no-extra-boolean-cast': 'error',
/**
* This rule always ignores extra parentheses around the following:
* - RegExp literals such as `(/abc/).test(var)` to avoid conflicts with the wrap-regex rule
* - immediately-invoked function expressions (also known as IIFEs) such as `var x = (function () {})();` and
* `((function foo() {return 1;})())` to avoid conflicts with the wrap-iife rule
* - arrow function arguments to avoid conflicts with the arrow-parens rule
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*
* @property {string} options
* - `all` Disallows unnecessary parentheses around any expression
* - `functions Disallows unnecessary parentheses only around function expressions
* default: `all`
* @property {object} allExceptions This rule has an object option for exceptions to the `all` option
* - `"conditionalAssign": false` Allows extra parentheses
* around assignments in
* conditional test expressions
* - `"returnAssign": false` Allows extra parentheses
* around assignments in
* `return` statements
* - `"nestedBinaryExpressions": false` Allows extra parentheses in
* nested binary expressions
* - `"ignoreJSX": "none|all|multi-line|single-line" Allows extra parentheses
* around no/all/multi-line/
* single-line JSX components;
* default: `none`
* - `"enforceForArrowConditionals": false` Allows extra parentheses
* around ternary expressions
* which are the body of an
* arrow function
* - `"enforceForSequenceExpressions": false` Allows extra parentheses
* around sequence expressions
* - `"enforceForNewInMemberExpressions": false` Allows extra parentheses
* around `new` expressions in
* member expressions
*/
'no-extra-parens': [
'error',
'functions',
],
/**
* This rule disallows unnecessary semicolons.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*/
'no-extra-semi': 'off',
/**
* This rule disallows reassigning `function` declarations.
*/
'no-func-assign': 'error',
/**
* This rule warns the assignments, increments, and decrements of imported bindings.
*/
'no-import-assign': 'off',
/**
* This rule requires that function declarations and, optionally, variable declarations be in the root of a program
* or the body of a function.
*
* @property {string} options
* - `functions` Disallows `function` declarations in nested blocks
* - `both` Disallows `function` and `var` declarations in nested blocks
* default: `functions`
*/
'no-inner-declarations': [
'error',
'functions',
],
/**
* This rule disallows invalid regular expression strings in `RegExp` constructors.
*
* @property {object} exceptions
* - `allowConstructorFlags` {array} Array of flags
*/
'no-invalid-regexp': 'error',
/**
* This rule is aimed at catching invalid whitespace that is not a normal tab and space. Some of these characters
* may cause issues in modern browsers and others will be a debugging issue to spot.
*
* @property {object} exceptions
* - `skipStrings` {bool} Allows any whitespace characters in string literals;
* default: true
* - `skipComments` {bool} Allows any whitespace characters in comments;
* default: false
* - `skipRegExps` {bool} Allows any whitespace characters in regular expression
* literals;
* default: false
* - `skipTemplates` {bool} Allows any whitespace characters in template literals;
* default: false
*/
'no-irregular-whitespace': [
'error',
{
'skipStrings': true,
'skipComments': false,
'skipRegExps': false,
'skipTemplates': false,
},
],
/**
* This rule reports the regular expressions which include multiple code point characters in character class
* syntax.
*/
'no-misleading-character-class': 'error',
/**
* This rule disallows calling the `Math`, `JSON`, `Reflect` and `Atomics` objects as functions.
*/
'no-obj-calls': 'error',
/**
* This rule disallows calling some `Object.prototype` methods directly on object instances.
*/
'no-prototype-builtins': 'error',
/**
* This rule disallows multiple spaces in regular expression literals.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*/
'no-regex-spaces': 'error',
/**
* This rule disallows returning values from setters and reports `return` statements in setter functions.
*
* Only `return` without a value is allowed, as it's a control flow statement.
*
* This rule checks setters in:
* - object literals
* - class declarations and class expressions
* - property descriptors in `Object.create`, `Object.defineProperty`, `Object.defineProperties`, and
* `Reflect.defineProperty` methods of the global objects
*/
'no-setter-return': 'off',
/**
* This rule disallows sparse array literals which have "holes" where commas are not preceded by elements. It does
* not apply to a trailing comma following the last element.
*/
'no-sparse-arrays': 'error',
/**
* This rule aims to warn when a regular string contains what looks like a template literal placeholder. It will
* warn when it finds a string containing the template literal placeholder (`${something}`) that uses either `"` or
* `'` for the quotes.
*/
'no-template-curly-in-string': 'error',
/**
* This rule disallows confusing multiline expressions where a newline looks like it is ending a statement, but is
* not.
*/
'no-unexpected-multiline': 'error',
/**
* This rule disallows unreachable code after `return`, `throw`, `continue`, and `break` statements.
*/
'no-unreachable': 'error',
/**
* This rule disallows `return`, `throw`, `break`, and `continue` statements inside finally blocks. It allows
* indirect usages, such as in `function` or `class` definitions.
*/
'no-unsafe-finally': 'error',
/**
* This rule disallows negating the left operand of the following relational operators:
* - `in` operator
* - `instanceof` operator
*
* @property {object} options
* - `enforceForOrderingRelations` {bool} Disallows negation of the left-hand side of
* ordering relational operators (`<`, `>`, `<=`,
* `>=`);
* default: false
*/
'no-unsafe-negation': [
'error',
{
'enforceForOrderingRelations': false,
}
],
/**
* This rule aims to report assignments to variables or properties where all of the following are true:
* - a variable or property is reassigned to a new value which is based on its old value
* - a `yield` or `await` expression interrupts the assignment after the old value is read, and before the new
* value is set
* - the rule cannot easily verify that the assignment is safe (e.g.: if an assigned variable is local and would
* not be readable from anywhere else while the function is paused)
*/
'require-atomic-updates': 'off',
/**
* This rule disallows comparisons to 'NaN'.
*
* @property {object} options
* - `enforceForSwitchCase` {bool} Disallows `case NaN` and `switch(NaN` statements;
* default: false
* - `enforceForIndexOf` {bool} Disallows the use of `indexOf` and `lastIndexOf`
* methods with `NaN`;
* default: false
*/
'use-isnan': [
'error',
{
'enforceForSwitchCase': false,
'enforceForIndexOf': false,
},
],
/**
* This rule enforces comparing `typeof` expressions to valid string literals.
*
* @property {object} options
* - `requireStringLiterals` {bool} Requires `typeof` expressions to only be compared to
* string literals or other `typeof` expressions, and
* disallows comparisons to any other value;
* default: false
*/
'valid-typeof': [
'error',
{
'requireStringLiterals': true,
},
],
};
/**
* these rules relate to better ways of doing things to help you avoid problems.
*
* @type {object}
*/
let ESLintBestPractices = {
/**
* This rule enforces a style where it requires to have a getter for every property which has a setter defined.
*
* By activating the option `getWithoutSet` it enforces the presence of a setter for every property which has a
* getter defined.
*
* By default, this rule checks only object literals and property descriptors. If you want this rule to also check
* class declarations and class expressions, activate the option `enforceForClassMembers`.
*
* @property {object} options
* - `setWithoutGet` {bool} Warn for setters without getters;
* default: true
* - `getWithoutSet` {bool} Warn for getters without setters;
* default: false
* - `enforceForClassMembers` {bool} Additionally applies this rule to class getters/
* setters;
* default: false
*/
'accessor-pairs': 'off',
/**
* This rule finds callback functions of the following methods, then checks usage of `return` statement.
* - `Array.from`
* - `Array.prototype.every`
* - `Array.prototype.filter`
* - `Array.prototype.find`
* - `Array.prototype.findIndex`
* - `Array.prototype.map`
* - `Array.prototype.reduce`
* - `Array.prototype.reduceRight`
* - `Array.prototype.some`
* - `Array.prototype.sort`
* - and above of typed arrays
*
* @property {object} options
* - `allowImplicit` {bool} Allows implicitly returning `undefined` with a `return`
* statement containing no expression;
* default: false
*/
'array-callback-return': 'off',
/**
* This rule aims to reduce the usage of variables outside of their binding context and emulate traditional block
* scope from other languages. This is to help newcomers to the language avoid difficult bugs with variable
* hoisting.
*/
'block-scoped-var': 'off',
/**
* This rule is aimed to flag class methods that do not use `this`.
*
* @property {object} exceptions
* - `exceptMethods` {array} Array of method names for which warnings are ignored
*/
'class-methods-use-this': 'off',
/**
* This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a
* program. As such, it will warn when the cyclomatic complexity crosses the configured threshold.
*
* @property {object|int} options Object or maximum complexity integer
* - `max` {int} Maximum complexity;
* default: 20
*/
'complexity': 'off',
/**
* This rule requires `return` statements to either always or never specify values. This rule ignores function
* definitions where the name begins with an uppercase letter, because constructors (when invoked with the new
* operator) return the instantiated object implicitly if they do not return another object explicitly.
*
* @property {object} options
* - `treatUndefinedAsUnspecified` {bool} Always either specify values or return
* `undefined` explicitly or implicitly;
* default: false
*/
'consistent-return': 'off',
/**
* This rule is aimed at preventing bugs and increasing code clarity by ensuring that block statements are wrapped
* in curly braces. It will warn when it encounters blocks that omit curly braces.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*
* @property {string} options
* - `all` All of the below options
* - `multi` Warns whenever `if`, `else`, `for`, `while`, or `do` are used
* without block statements as their body. However, you can specify
* that block statements should be used only when there are multiple
* statements in the block and warn when there is only one statement
* in the block
* - `multi-line Alternatively, you can relax the rule to allow brace-less single-
* line `if`, `else if`, `else`, `for`, `while`, or `do`, while still
* enforcing the use of curly braces for other instances
* - `multi-or-nest` You can use another configuration that forces brace-less `if`,
* `else if`, `else`, `for`, `while`, or `do` if their body contains
* only one single-line statement and forces braces in all other cases
* - `consistent` When using any of the `multi*` options, you can add an option to
* enforce all bodies of a `if`, `else if`, and `else` chain to be
* with or without braces
*/
'curly': [
'error',
'all',
],
/**
* This rule aims to require `default` case in `switch` statements. You may optionally include a `// no default`
* after the last `case` if there is no `default` case. The comment may be in any desired case, such as `// No
* Default`.
*
* @property {object} options
* - `commentPattern` {string} Set the `commentPattern` option to a regular expression
* string to change the default comment test pattern;
* default: `/^no default$/i`
*/
'default-case': [
'error',
{
'commentPattern': '/^no default$/',
},
],
/**
* This rule enforces default parameters to be the last of parameters.
*/
'default-param-last': 'off',
/**
* This rule aims to enforce newline consistency in member expressions. This rule prevents the use of mixed
* newlines around the dot in a member expression.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*
* @property {string} dotLocation Where to require the dot in a member expression
* - `object`
* - `property`
* default: `object`
*/
'dot-location': [
'error',
'property',
],
/**
* This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot
* notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket
* notation.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*
* @property {object} options
* - `allowKeywords` {bool} Set this option to false to follow EXMAScript version 3
* compatible style, avoiding dot notation for reserved word
* properties;
* default: true
* - `allowPattern` {string} Set this option to a regular expression string to allow
* bracket notation for property names that match a pattern;
* default: (no pattern)
*/
'dot-notation': [
'error',
{
'allowKeywords': true,
},
],
/**
* This rule is aimed at eliminating the type-unsafe equality operators.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*
* @property {string} options
* - `always` Enforces the use of `===` and `!==` in every situation (except when you
* opt-in to more specific handling of `null` (see below))
* - `smart` Enforces the use of `===` and `!==` except for these cases:
* - comparing two literal values
* - evaluating the value of `typeof`
* - comparing against `null`
* default: `always`
* @property {object} supported This rule optionally takes a second argument, which should be an object with the
* following supported properties:
* - `null` Customize how this rule treats `null` literals
* - `always` Always use `===` or `!==`
* - `never` Never use `===` or `!--` with null
* - `ignore` Do not apply this rule to `null
* default: `always`
*/
'eqeqeq': [
'error',
'always',
{
'null': 'ignore',
},
],
/**
* This rule requires grouped definitions of accessor functions for the same property in object literals, class
* declarations and class expressions.
*
* Optionally, this rule can also enforce consistent order (getBeforeSet or setBeforeGet).
*
* This rule does not enforce the existence of the pair for a getter or a setter. See accessor-pairs if you also
* want to enforce getter/setter pairs.
*
* @property {string} order
* - `anyOrder` Does not enforce order
* - `getBeforeSet` If a property has both a getter and setter, requires the getter to be
* defined before the setter
* - `setBeforeGet` If a property has both a getter and setter, requires the setter to be
* defined before the getter
* default: `anyOrder`
*/
'grouped-accessor-pairs': 'off',
/**
* This rule is aimed at preventing unexpected behavior that could arise from using a `for in` loop without
* filtering the results in the loop. As such, it will warn when `for in` loops do not filter their results with an
* `if` statement.
*/
'guard-for-in': 'off',
/**
* This rule enforces that each file may contain only a particular number of classes and no more.
*
* @property {int} maxClasses Maximum number of classes allowed in the file;
* default: 1
*/
'max-classes-per-file': 'off',
/**
* This rule is aimed at catching debugging code that should be removed and popup UI elements that should be
* replaced with less obtrusive, custom UIs. As such, it will warn when it encounters `alert`, `prompt`, and
* `confirm` function calls which are not shadowed.
*/
'no-alert': 'off',
/**
* This rule is aimed at discouraging the use of deprecated and sub-optimal code by disallowing the use of
* `arguments.caller` and `arguments.callee`. As such, it will warn when `arguments.caller` and `arguments.callee`
* are used.
*/
'no-caller': 'error',
/**
* This rule aims to prevent access to uninitialized lexical bindings as well as accessing hoisted functions across
* case clauses.
*/
'no-case-declarations': 'error',
/**
* This rule disallows return statements in the constructor of a class. Note that returning nothing with flow
* control is allowed.
*/
'no-constructor-return': 'off',
/**
* This is used to disambiguate the division operator to not confuse users.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*/
'no-div-regex': 'off',
/**
* This rule is aimed at highlighting an unnecessary block of code following an `if` containing a return statement.
* As such, it will warn when it encounters an `else` following a chain of `if`s, all of them containing a `return`
* statement.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*
* @property {object} exceptions
* - `allowElseIf` {bool} Allows `else if` blocks after a return;
* default: true
*/
'no-else-return': 'off',
/**
* This rule is aimed at eliminating empty functions. A function will not be considered a problem if it contains a
* comment.
*
* @property {object} exceptions This rule has an option to allow specific kinds of functions to be empty
* - `allow` {array} A list of allowed function types
* - `functions` Normal functions
* - `arrowFunctions` Arrow functions
* - `generatorFunctions` Generator functions
* - `methods` Class methods and method shorthands of
* object literals
* - `generatorMethods` Class methods and method shorthands of
* object literals with generator
* - `getters` Getters
* - `setters` Setters
* - `constructors` Class constructors
* default: []
*/
'no-empty-function': 'off',
/**
* This rule aims to flag any empty patterns in destructured objects and arrays, and as such, will report a problem
* whenever one is encountered.
*/
'no-empty-pattern': 'error',
/**
* This rule aims to reduce potential bugs and unwanted behavior by ensuring that comparisons to `null` only match
* `null`, and not also `undefined`. As such it will flag comparisons to `null` when using `==` and `!=`.
*/
'no-eq-null': 'error',
/**
* This rule is aimed at preventing potentially dangerous, unnecessary, and slow code by disallowing the use of the
* `eval()` function. As such, it will warn whenever the `eval()` function is used.
*/
'no-eval': 'error',
/**
* Disallows directly modifying the prototype of builtin objects.
*
* @property {object} options
* - `exceptions` {array} List of builtins for which extensions will be allowed
*/
'no-extend-native': 'error',
/**
* This rule is aimed at avoiding the unnecessary use of `bind()` and as such will warn whenever an immediately-
* invoked function expression (IIFE) is using `bind()` and doesn't have an appropriate `this` value. This rule
* won't flag usage of `bind()` that includes function argument binding.
*
* Note: Arrow functions can never have their `this` value set using `bind()`. This rule flags all uses of `bind()`
* with arrow functions as a problem.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*/
'no-extra-bind': 'error',
/**
* This rule is aimed at eliminating unnecessary labels.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*/
'no-extra-label': 'off',
/**
* This rule is aimed at eliminating unintentional fallthrough of one case to the other. As such, it flags any
* fallthrough scenarios that are not marked by a comment.
*
* @property {object} options
* - `commentPattern` {string} Regular expression string to change the test for
* intentional fallthrough comment
*/
'no-fallthrough': 'error',
/**
* This rule is aimed at eliminating floating decimal points and will warn whenever a numeric value has a decimal
* point but is missing a number either before or after it.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*/
'no-floating-decimal': 'error',
/**
* This rule disallows modifications to read-only global variables.
*
* ESLint has the capability to configure global variables as read-only.
*
* @property {object} options
* - `exceptions` {array} List of builtins for which reassignments will be allowed
*/
'no-global-assign': 'error',
/**
* This rule is aimed to flag shorter notations for the type conversion, then suggest a more self-explanatory
* notation.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*
* @property {object} options
* - `boolean` Warns shorter type conversions for `boolean` type;
* default: true
* - `number` Warns shorter type conversions for `number` type;
* default: true
* - `string` Warns shorter type conversions for `string` type;
* default: true
* - `allow` {array} Each entry in this array can be one of `~`, `!!`, `+`, or `*` that
* are to be allowed;
* default: []
* Note: operator `+` in list would allow `+foo` (number coercion) as
* well as `'' + foo` (string coercion)
*/
'no-implicit-coercion': 'off',
/**
* When working with browser scripts, developers often forget that variable and function declarations at the top-
* level scope become global variables on the `window` object. As opposed to modules which have their own scope.
* Globals should be explicitly assigned to `window` or `self` if that is the intent. Otherwise variables intended
* to be local to the script should be wrapped in an IIFE.
*
* This rule disallows `var` and `function` declarations at the top-level script scope. This does not apply to ES
* and CommonJS modules since they have a module scope.
*
* When the code is not in `strict` mode, an assignment to an undeclared variable creates a new global variable.
* This will happen even is the code is in a function.
*
* This does not apply to ES modules since the module code is implicitly in `strict` mode.
*
* This rule also disallows re-declarations of read-only global variables and assignments to read-only global
* variables.
*
* A read-only global variable can be a built-in ES global (e.g. `Array`), an environment specific global (e.g.
* `window` in the browser environment), or a global variable defined as `readonly` in the configuration file or in
* a global comment.
*
* Lexical declarations `const` and `let`, as well as `class` declarations, create variables that are block-scoped.
*
* However, when declared in the top-level of a browser script these variables are not 'script-scoped'. They are
* actually created in the global scope and could produce name collisions with `var`, `const` and `let` variables
* and `function` and `class` declarations from other scripts. This does not apply to ES and CommonJS modules.
*
* If the variable is intended to be local to the script, wrap the code with a block or with an immediately-invoked
* function expression (IIFE).
*
* If you intend to create a global `const` or `let` variable or a global `class` declaration, to be used from
* other scripts, be aware that there are certain differences when compared to the traditional methods, which are
* `var` declarations and assigning to a property of the global `window` object:
* - lexically declared variables cannot be conditionally created. A script cannot check for the existence of a
* variable and then create a new one. `var` variables are also always created, but re-declarations do not
* cause runtime exceptions
* - lexically declared variables do not create properties on the global object, which is what a consuming script
* might expect
* - lexically declared variables are shadowing properties of the global object, which might produce errors if a
* consuming script is using both the variable and the property
* - lexically declared variables can produce a permanent Temporal Dead Zone (TDZ) if the initialization throws
* an exception. Even the `typeof` check is not safe from TDZ reference exceptions
*/
'no-implicit-globals': 'off',
/**
* This rule aims to eliminate implied `eval()` through the use of `setTimeout()`, `setInterval()`, or
* `execScript()`. As such, it will warn when either function is used with a string as the first argument.
*/
'no-implied-eval': 'error',
/**
* This rule aims to flag usage of `this` keywords outside of classes or class-like objects.
*
* Basically, this rule checks whether or not a function containing `this` keyword is a constructor or a method.
*
* This rule judges from following conditions whether or not the function is a constructor:
* - the name of the function starts with uppercase
* - the function is assigned to a variable which starts with an uppercase letter
* - the function is a constructor of ES2015 Classes
*
* This rule judges from following conditions whether or not the function is a method:
* - the function is on an object literal
* - the function is assigned to a property
* - the function is a method/getter/setter of ES2015 Classes (excepts static methods)
*
* And this rule allows this keywords in functions below:
* - the `call/apply/bind` method of the function is called directly
* - the function is a callback of array methods (such as `.forEach()`) if `thisArg` is given
* - the function has `@this` tag in its JSDoc comment
* - otherwise are considered problems
*
* This rule applies only in strict mode. With `"parserOptions": { "sourceType": "module" }` in the ESLint
* configuration, your code is in strict mode even without a `"use strict"` directive.
*
* @property {object} options
* - `capIsConstructor` {bool} Assume a function which name starts with an uppercase is
* a constructor;
* default: true
*/
'no-invalid-this': 'off',
/**
* This rule is aimed at preventing errors that may arise from using the `__iterator__` property, which is not
* implemented in several browsers. As such, it will warn whenever it encounters the `__iterator__` property.
*/
'no-iterator': 'error',
/**
* This rule aims to eliminate the use of labeled statements in JavaScript. It will warn whenever a labeled
* statement is encountered and whenever `break` or `continue` are used with a label.
*
* @property {object} options
* - `allowLoop` {bool} Ignore labels which are sticking to loop statements;
* default: false
* - `allowSwitch` {bool} Ignore labels which are sticking to switch statements;
* default: false
*/
'no-labels': [
'error',
{
'allowLoop': false,
'allowSwitch': false,
},
],
/**
* This rule aims to eliminate unnecessary and potentially confusing blocks at the top level of a script or within
* other blocks.
*/
'no-lone-blocks': 'error',
/**
* This error is raised to highlight a piece of code that may not work as you expect it to and could also indicate
* a misunderstanding of how the language works. Your code may run without any problems if you do not fix this
* error, but in some situations it could behave unexpectedly.
*
* This rule disallows any function within a loop that contains unsafe references (e.g. to modified variables from
* the outer scope).
*/
'no-loop-func': 'off',
/**
* This rule aims to make code more readable and refactoring easier by ensuring that special numbers are declared
* as constants to make their meaning explicit.
*
* @property {object} options
* - `ignore` {array} An array of numbers to ignore;
* default: []
* - `ignoreArrayIndexes` {bool} Specifies if numbers used as array indexes are
* considered okay;
* default: false
* - `enforceConst` {bool} Specifies if we should check for the const keyword in
* variable declaration of numbers;
* default: false
* - detectObjects` {bool} Specifies if we should detect numbers when setting
* object properties for example;
* default: false
*/
'no-magic-numbers': 'off',
/**
* This rule aims to disallow multiple whitespace around logical expressions, conditional expressions,
* declarations, array elements, object properties, sequences and function parameters.
*
* The `--fix` option on the command line can automatically fix some of the problems reported by this rule.
*
* @property {object} options
* - `ignoreEOLComments` {bool} Ignore multiple spaces before comments that occur at
* the end of lines;
* default: false
* - `exceptions` {object} specifies nodes to ignore;
* default: `{ "Property": true }
*/
'no-multi-spaces': [
'error',
{
'ignoreEOLComments': false,
'exceptions': {
'Property': true,
},
},
],
/**
* This rule is aimed at preventing the use of multiline strings.
*/
'no-multi-str': 'error',
/**
* This rule is aimed at maintaining consistency and convention by disallowing constructor calls using the new
* keyword that do not assign the resulting object to a variable.
*/
'no-new': 'error',
/**
* This error is raised to highlight the use of a bad practice. By passing a string to the Function constructor,
* you are requiring the engine to parse that string much in the way it has to when you call the `eval` function.
*/
'no-new-func': 'error',
/**
* This rule aims to eliminate the use of `String`, `Number`, and `Boolean` with the `new` operator. As such, it
* warns whenever it sees `new String`, `new Number`, or `new Boolean`.
*/
'no-new-wrappers': 'error',
/**
* The rule disallows octal literals.
*
* If ESLint parses code in strict mode, the parser (instead of this rule) reports the error.
*/
'no-octal': 'error',
/**
* This rule disallows octal escape sequences in string literals.
*
* If ESLint parses code in strict mode, the parser (instead of this rule) reports the error.
*/
'no-octal-escape': 'error',
/**
* This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.
*
* @property {object} options