-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.json
1152 lines (844 loc) · 43.1 KB
/
.eslintrc.json
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
{
//
// folkhack's personal eslint config :D
// - "Standard Style" can be opinionated and difficult to read with it's lack of whitesapce, 2-space indents, and
// varibale naming convention (does not like snake_case)
//
// Search for these strings to find rules regarding each:
// - 🔴 Node.js support
// - 🟠 TypeScript support
// - 🟡 Browser support
// - 🟢 Jest support
// - 🔵 React support
"env": {
"es6" : true, // ES6 support; ex: Map, Set
"node" : false, // 🔴 Node.js support; ex: process, Buffer
"browser" : true, // 🟡 Browser support; ex: window, document
"jest/globals" : true // 🟢 Jest support; ex: jest
},
"globals" : {
// 🔴 Node.js support
// Ensure process included as global variable
"process" : true
},
"parser": "@typescript-eslint/parser", // 🟠 TypeScript support
"parserOptions": {
"ecmaVersion" : 2020, // Targeted ECMA version (should match tsconfig.json)
"sourceType" : "module", // Module (package.json type="module")
"ecmaFeatures" : { "jsx": true } // 🔵 React support
},
"extends": [
"eslint:recommended",
// 🔴 Node.js support:
// - https://github.com/eslint-community/eslint-plugin-n
// - Ensure to use eslint-plugin-n as eslint-plugin-node no longer supported
// "plugin:n/recommended",
// 🟠 TypeScript support:
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
// 🔵 React support:
"plugin:react/jsx-runtime",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended"
],
"plugins": [
"@typescript-eslint", // 🟠 TypeScript support
"jest", // 🟢 Jest support
// 🔵 React support
"react",
"react-hooks",
"jsx-a11y"
],
// Ignore rules
"ignorePatterns": [
"*.md" // Ignore Markdown JS/TS code segments
],
"settings": {
// 🔵 React support:
"react": {
// Regex for Component Factory to use, default to "createReactClass"
"createClass": "createReactClass",
// Pragma to use, default to "React"
"pragma": "React",
// Fragment to use (may be a property of <pragma>), default to "Fragment"
"fragment": "Fragment",
// React version:
// "detect" automatically picks the version you have installed. You can also use
// `16.0`, `16.3`, etc, if you want to override the detected value. It will
// default to "latest" and warn if missing, and to "detect" in the future
"version": "detect"
},
"propWrapperFunctions": [
// The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this
// isn't set, any propTypes wrapped in a function will be skipped.
"forbidExtraProps",
{ "property": "freeze", "object": "Object" },
{ "property": "myFavoriteWrapper" },
// For rules that check exact prop wrappers
{ "property": "forbidExtraProps", "exact": true }
],
"componentWrapperFunctions": [
// The name of any function used to wrap components, e.g. Mobx `observer` function.
// If this isn't set, components wrapped by these functions will be skipped.
"observer", // `property`
// `object` is optional
{ "property": "styled" },
{ "property": "observer", "object": "Mobx" },
// sets `object` to whatever value `settings.react.pragma` is set to
{ "property": "observer", "object": "<pragma>" }
],
"formComponents": [
// Components used as alternatives to <form> for forms, eg. <Form endpoint={ url } />
"CustomForm",
{ "name": "Form", "formAttribute": "endpoint" }
],
"linkComponents": [
// Components used as alternatives to <a> for linking, eg. <Link to={ url } />
"Hyperlink",
{ "name": "Link", "linkAttribute": "to" }
]
// /React support
},
"overrides": [
// 🔵 React support:
{
// Disable max-length checks for tsx files because general markup can make for long lines
"files": [ "*.tsx" ],
"rules": {
"max-len": "off"
}
}
],
"rules": {
//
// ██ TECHNOLOGY-SPECIFIC RULES █████████████████████████████████████████████████████████████████████████████████
//
// - At top for easy enabling/disabling if employing these tools
//
// ━━ 🔴 Node.js support ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// // Check to ensure file paths of imports exist
// // - 🟠 TypeScript support
// // - 🟢 Jest support
// "n/no-missing-import": [
// "off",
// {
// // TODO: Map the extensions correctly
// // - Re-enable when https://github.com/eslint-community/eslint-plugin-n/commit/20d2713de7054b823ab29f40925ba782123208c3
// // is in main version; commit literally done 12 hours into work causing issues
// // - May work hand-in-hand with allowing *.ts imports
// // "typescriptExtensionMap": [
// // [ "", ".js" ],
// // [ ".ts", ".js" ],
// // [ ".cts", ".cjs" ],
// // [ ".mts", ".mjs" ],
// // [ ".tsx", ".js" ]
// // ]
// }
// ],
// // Disable process environment variable checking
// // - Can be a bad practice if environment not correctly isolated
// "no-process-env": "off",
// // Disable unpublished require/import in lieu of no-extraneous to allow devDependencies
// // - https://stackoverflow.com/questions/67551956/node-no-unpublished-import-chai-is-not-published#comment129800141_69926854
// "n/no-unpublished-require" : "off",
// "n/no-unpublished-import" : "off",
// "n/no-extraneous-require" : "error",
// "n/no-extraneous-import" : "error",
// // Disable any process.exit()
// // - process.exit is still valid if throws/handling are correctly thought through; keeping
// // this enabled allows for traditional POSIX CLI applications with consistent/on-exception
// // error handling
// "no-process-exit": "off",
// // Don"t allow new and require in same statement
// "no-new-require": "error",
// // Blows up on path concat for cross-platform support
// "no-path-concat": "error",
// // Don"t allow mixed requires, but do allow "require( "something" )( 123 )" calls
// "no-mixed-requires": [ "error", { "allowCall" : true } ],
// // Nesting a require within a method can have reason - warn
// "global-require": "warn",
// ━━ 🟠 TypeScript support ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// - No custom rules yet!
// ━━ 🟡 Browser support ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Disable alert, confirm, and prompt
"no-alert": "error",
// Using scripts in URLs is bad practice
"no-script-url": "error",
// ━━ 🟢 Jest support ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// - No custom rules yet!
// ━━ 🔵 React support ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// JSX may not be employed in project
"jsx-quotes": [ "error", "prefer-double" ],
// Rules of hooks
// - https://react.dev/warnings/invalid-hook-call-warning
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
// Ensures spaces before/after curley brackets in JSX:
// - ex: `value={ipAddress}` would change to `value={ ipAddress }`
"react/jsx-curly-spacing": [ "error", { "when": "always", "children": true } ],
//
// ██ GENERAL ECMA RULES ████████████████████████████████████████████████████████████████████████████████████████
//
// - These rules should apply to modern ECMAScript in all contexts (ex: not just Browser or Node.js)
//
// ━━ Best Practices ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Should we allow console?
"no-console": "off",
// Allow ternary
"no-ternary": "off",
// Allow extra parentheses because people may be using them to hint at order of operations
"no-extra-parens": "off",
// Function name must match assigned value; ie: `const foo = function bar() {};` - intrusive for things like
// arbitrary callback assignments; ex: `const handler = something_callback() {};`
"func-name-matching": "off",
// Disable negated condition enforcement
// - Sometimes code is more readable when checking for a negative condition
"no-negated-condition": "off",
// Allow modification or reassignment of function parameters
"no-param-reassign": "off",
// Variable shadowing on out-of-scope stuff is illegal
"no-shadow": "off",
// Allow handling of undefined
"no-undef-init" : "off",
"no-undefined" : "off",
// Don't allow "self = this" hoisting variable names
"consistent-this": "warn",
// Hoisting to the global objects is sometimes needed (ex: window) - only warn on behavior
"no-implicit-globals": "warn",
// Require a guard for prototype properties when processing for-in
// - `Object.hasOwn( foo, key )`
// - `Object.prototype.hasOwnProperty.call( foo, key )`
// - `{}.hasOwnProperty.call( foo, key )`
"guard-for-in": "error",
// Don"t allow variables to be used outside of their scopes (ie: "var")
"block-scoped-var": "error",
// Don"t allow unnecessary primitive wrappers like "Boolean( true )" - makes type expectations confusing
"no-new-wrappers": "error",
// Prevents the use of `.call()` and `.apply()` when not needed
"no-useless-call" : "error",
// Flags empty constructor functions that serve no purpose
"no-useless-constructor" : "error",
// Eliminates unnecessary renaming of imported or destructured values
"no-useless-rename" : "error",
// Throw error on incorrect or unnecessary usage of `.bind()`
"no-extra-bind": "error",
// No weird type casting using language weirdness... Use stuff like "Boolean()"
// - Example: `var b = !!foo;`
"no-implicit-coercion": "error",
// Don"t reassign globals like window
"no-native-reassign": "error",
// Don"t allow weird negation in things like objects/etc.
"no-negated-in-lhs": "error",
// Disable use of comma sequences outside of for loops and parantheses
"no-sequences": "error",
// Prefer the spread operator when doing Object.assign operations
"prefer-object-spread": "error",
// Try to keep "this" scope sane by only tying it to methods
"no-invalid-this": "error",
// If peroperty must follow on new line, ensure starts with "."
"dot-location": [
"error",
"property"
],
// Always use dot notation; ie: `something.property` vs. `something['property']` when non-variable
"dot-notation": "error",
// Disable Yoda conditionals
// - Example `'red' === color` is invalid; should be `color === 'red'`
"yoda": [ "error", "never" ],
// Require descriptions when using Symbol
"symbol-description": "error",
// Only allow throwing of Error instance
"no-throw-literal": "error",
// Avoid duplicate imports/exports
"no-duplicate-imports": [
"error",
{ "includeExports" : true }
],
// ━━ General Formatting/Lengths ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Set a VERY relaxed "max-length" for code/comments lines
"max-len": [
"error",
{
"code" : 140,
"comments" : 140
}
],
// Set a VERY relaxed file-length limit
"max-lines": [ "error", 2500 ],
// Set a VERY relaxed max lines per-function limit
"max-lines-per-function": [ "error", 250 ],
// Require semi-colons
"semi": "error",
// Semi-colons are at end of line for multi-line purposes (think multi-line for)
"semi-style": [
"error",
"last"
],
// Only use quotes around properties if needed
"quote-props": [ "error", "as-needed" ],
// Disable unicode BOM
"unicode-bom": [
"error",
"never"
],
// Turn off sorts
"sort-imports" : "off",
"sort-keys" : "off",
"sort-vars" : "off",
// No .04, must be 0.04
"no-floating-decimal": "error",
// Avoids unnecessary square brackets around object keys, which simplifies object literal definitions
"no-useless-computed-key" : "error",
// Flags pointless string concatenation, making the code shorter and more readable
"no-useless-concat" : "error",
// Don"t allow more than one statement per-line
"max-statements-per-line": [ "error", { "max" : 2 } ],
// Enforce trailing comma use on multi-line arrays/objects
// "comma-dangle": "off"
"comma-dangle": [
"error",
"always-multiline"
],
// ━━ Code Complexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Don"t throw fit on complexity depth
"complexity": "off",
// Max level of nesting
"max-depth": [ "error", 4 ],
// Max level of nested callbacks
"max-nested-callbacks": [ "error", 3 ],
// Set a VERY relaxed max parameters number - should likely be using an object after that point
"max-params": [ "error", 6 ],
// Don"t enforce a max number of statements within a function
"max-statements": "off",
// Don"t allow nested ternarys
"no-nested-ternary": "error",
// ━━ Whitespace - Spaces ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 4-space indent + disable legacy indent rule
"indent": [
"error",
4,
{
// Don"t blow up switch statement cases
"SwitchCase": 1,
// Offset ternary statements if they"re broken to new lines
"offsetTernaryExpressions": true
}
],
"indent-legacy": "off",
// No \t"s
"no-tabs": "error",
// Align keys within objects
// - Weird side-effects, best to let developer handle this
"key-spacing": "off",
// "key-spacing": [ "error", {
// "singleLine": {
// "beforeColon" : true,
// "afterColon" : true
// },
// "multiLine": {
// "align": {
// "beforeColon" : true,
// "afterColon" : true
// }
// }
// } ],
// Always have extra spaces preceeding/proceeding items within array brackets
"array-bracket-spacing": [
"error",
"always"
],
// Space before/after arrow
"arrow-spacing": [
"error",
{
"after" : true,
"before" : true
}
],
// Space before/after code blocks () => { return false; } vs. () => {return false;}
"block-spacing": [
"error",
"always"
],
// Ensure space after commas
"comma-spacing": [
"error",
{
"after" : true,
"before" : false
}
],
// Generator functions require space before/after star
"generator-star-spacing": [
"error", {
"before" : true,
"after" : true
}
],
// Ensures space before/after object properties
"computed-property-spacing": [ "error", "always" ],
// Space before/after keywords, except if(), for(), and while()
"keyword-spacing": [
"error",
{
"before" : true,
"after" : true,
"overrides" : {
"if" : { "after" : false },
"for" : { "after" : false },
"while" : { "after" : false },
"switch" : { "after" : false },
"catch" : { "after" : false }
}
}
],
// Don"t allow space between function and opening ()
"no-spaced-func": "error",
// Fix trailing space issues
"no-trailing-spaces": "error",
// No whitespace before property like "foo. bar"
"no-whitespace-before-property": "error",
// Spacing after { and before } for single line objects
"object-curly-spacing": [
"error",
"always"
],
// No space between ...args like "... args"
"rest-spread-spacing": [
"error",
"never"
],
// Space after semi-colons if multiple on same line
"semi-spacing": [
"error",
{
"before" : false,
"after" : true
}
],
// Put a space before {} blocks
"space-before-blocks": "error",
// No space before parens for functions
"space-before-function-paren": [
"error",
"never"
],
// Add inner and outter space within parens "( 1 + 1 )"
"space-in-parens": [ "error", "always" ],
// Add space around operations ie: "( 1 + 1 )"
"space-infix-ops": "error",
// Unary ops spacing
// - Words like "new" and "typeof" should have spacing
// - Non-words like "++" etc. should not have spacing
// - ! and !! should have space
"space-unary-ops": [
"error",
{
"words" : true,
"nonwords" : false,
"overrides" : {
"!" : true,
"!!" : true
}
}
],
// Spaced comments like you seen on this line
"spaced-comment": [
"error",
"always"
],
// switch case/default statements have a space after the :
"switch-colon-spacing": [
"error",
{
"after" : true,
"before" : false
}
],
// Space before/after yeild star ie: "function * gen()"
"yield-star-spacing": [ "error", "both" ],
// Always use spacing during `asdf ${ variable }` for readability
"template-curly-spacing": [ "error", "always" ],
// Put a space between template tag and template
"template-tag-spacing": [ "error", "always" ],
// No space between function name and opening bracket
"func-call-spacing": [
"error",
"never"
],
// ━━ Whitespace - New lines ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Unix new lines (\n vs \r\n)
"linebreak-style": [
"error",
"unix"
],
// Only allow for one line spacing
// "no-multi-spaces": "off",
"no-multi-spaces": [
"error",
{
"ignoreEOLComments" : true,
"exceptions" : {
"ObjectExpression" : true,
"Property" : true,
"AssignmentExpression" : true,
"VariableDeclarator" : true,
"IfStatement" : true
}
}
],
// Max 2 empty new lines, no new line at BOF, and max one new line at EOF
"no-multiple-empty-lines": [
"error",
{
"max" : 2,
"maxBOF" : 0,
"maxEOF" : 1
}
],
// Consistent use of new lines in arrays (either on one line, or broken out to multi-line)
"array-bracket-newline" : [ "error", "consistent" ],
"array-element-newline" : [ "error", "consistent" ],
// Opening brace is on the same line, and allow single lines
"brace-style": [
"error",
"1tbs",
{ "allowSingleLine" : true }
],
// Enforce consistent function call/args new line patterns (all on one line, or all on new lines)
"function-call-argument-newline": [
"error",
"consistent"
],
"function-paren-newline": [
"error",
"consistent"
],
// Ensure no linebreak after => arrow
"implicit-arrow-linebreak": [
"error",
"beside"
],
// Ensure a line break before a comment
"lines-around-comment": [
"error",
{
"beforeLineComment" : true,
"beforeBlockComment" : true
}
],
// Always have new lines around "use strict";
"lines-around-directive": [
"error",
"always"
],
// Ensure lines between class members except for single-liners
"lines-between-class-members": [
"error",
"always",
{ "exceptAfterSingleLine" : true }
],
// Put a new line after variable assigment blocks
// - Disabled - veritcal whitespace is up to the developer
"newline-after-var": "off",
// Require new lines before return but not within if conditional or single line scenarios
// - Disabled - veritcal whitespace is up to the developer
"newline-before-return": "off",
// Set chain call limit to 3 when on new lines; ie: "something()\n\t.something()\n\t.something()"
"newline-per-chained-call": [ "error", { "ignoreChainWithDepth" : 3 } ],
// No weirdness with \ character to do new lines
"no-multi-str": "error",
// If not using {} with if/etc. ensure everything constrained on same line vs. breaking control scope
"nonblock-statement-body-position": "error",
// Enforce new lines within object {} if multi-line but still allow single-line objects
// - "multiline" doesn't work well due to single-properties being broken out on new line causing issues
"object-curly-newline": [
"error",
{ "consistent" : true }
],
// Either all properties are on the same line or enforce multi-line
"object-property-newline": [
"error",
{ "allowAllPropertiesOnSameLine" : true }
],
// If operators and line breaks are being used have the operators trail the operation vs. preceed
"operator-linebreak": [ "error", "after" ],
// Disable new-line padding between statement block rules
// - Best to let developer manage this
"padding-line-between-statements": "off",
// End-of-file must have new line - just a common sense thing that avoids headaches
"eol-last": "error",
// Disable padded blocks - too much whitespace
"padded-blocks": "off",
// Ensure comma on same line as element
"comma-style": [
"error",
"last"
],
// ━━ Naming ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Fully turn off camel case rule - standard is CapitalCase and snake_case
"camelcase": "off",
// As long as keywords are not being stepped on, give developer freedom with naming
"id-blacklist" : "off",
"id-denylist" : "off",
// Don"t enforce a limit to variable names
"id-length": "off",
// Only allow variable names following:
// - Does not start with a number
// - Upper/lowercase letters
// - Numbers allowed
// - Underscores allowed
// - Special variable names _ and $ are allowed
"id-match": [
"error",
"^[a-zA-Z_$]([a-zA-Z0-9_$]+)?$"
],
// "private" underscore dangling weirdness - ECMA has no private members deal with it.
"no-underscore-dangle": "error",
// new Something "Something" must be capitalized because it is a class
"new-cap": [ "error", { "newIsCap" : true } ],
// Blacklists
// - Certain names may be disallowed from being used as exported names for various reasons
// "no-restricted-exports" : "error",
// "no-restricted-globals" : "error",
// "no-restricted-imports" : "error",
// "no-restricted-modules" : "error",
// "no-restricted-properties" : "error",
// "no-restricted-syntax" : "error",
// ━━ Assignment and Declaration ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Allow instantiation without initialization of variable; ex: `let x;`
"init-declarations": "off",
// Variable declaration blocks don"t necessarily need to be at top of function
"vars-on-top": "off",
// Sometimes you want to declare an empty function as a placeholder, or as a future general-use callback
"no-empty-function": "off",
// Allow object shorthand
"object-shorthand": "off",
// Operator assignment is totally fine and can be more readable - allowing
"operator-assignment": "off",
// No need to destructure if you don"t want to
"prefer-destructuring": "off",
// Ensure things are defined before their potential usage
"no-use-before-define": "error",
// Use const when we can
"prefer-const": "error",
// No "var" variable declaration
"no-var": "error",
// Catch can overwrite a variable out of scope so disable this condition
"no-catch-shadow": "error",
// Warn on non-individual variable declarations, ex: "let a = b = c"
"no-multi-assign": "warn",
// Don"t allow single var/let/const to define multiple variables
"one-var": [ "error", "never" ],
// Only allow one variable declaration per-line
"one-var-declaration-per-line": "error",
// Catch ternary statements that can be converted to simpler statemenet
"no-unneeded-ternary": "error",
// If there are unused expressions yell
"no-unused-expressions": "error",
// Assigning a value on return is an odd practice and be obscure/difficult to read
"no-return-assign": "error",
// ━━ Classes ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// new must be made with assignment vs just "new Thing();" (no class constructor side-effects)
// - constructor can have global assignments that are useful without explicitly needing
// a full instantiated class; example: setup dotenv globals but all methods are static
"no-new": "off",
// Don"t allow parens around target for instantiation; ie no: "new (Person)()"
"new-parens": [ "error", "never" ],
// Keep getters/setters grouped together
"grouped-accessor-pairs": "error",
// All class getters must have setters
"accessor-pairs": "error",
// Makes sense and can cause confusion as to what constructor is doing
"no-constructor-return": "error",
// No need to use new Object - reject
"no-new-object": "error",
// Don"t throw fit if to convert to static if we don"t use "this"
"class-methods-use-this": "off",
// Ensure only one class-per file
"max-classes-per-file": [ "error", 1 ],
// ━━ Operators ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Allow ++
"no-plusplus": "off",
// Allow mixed operators - super restrictive rule
// - `a + b * c` is OK
"no-mixed-operators": "off",
// Not very readable to use bitwise operators but don"t outright block use
"no-bitwise": "warn",
// Always enforce === over ==
"eqeqeq": "error",
// Null eqivilence must be === or !==
"no-eq-null": "error",
// Yell on variable compare with self
"no-self-compare": "error",
// ━━ Numbers and Math ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Allow numbers inline with code
"no-magic-numbers": "off",
// Disable parsing string literals with parseInt ie: "10010010"
"prefer-numeric-literals": "error",
// Require radix for parseInt
// - Can safely assume we"re always going to be using base-10
"radix": "off",
// Avoid numbers that will lose precision at runtime as-per IEEE 754
"no-loss-of-precision": "error",
// Allow Math.pow()
"prefer-exponentiation-operator": "off",
// ━━ Strings ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Prefer " for strings for non-concatenation operations
"quotes": [ "error", "single" ],
// Warn on `` strings for concats
// - Template literals can be more readable but are much slower than normal string concatenation
"prefer-template": "off",
// As of the ECMAScript 5 specification, escape sequences in string literals are deprecated
"no-octal-escape": "error",
// Look out for incorrect `${variable}` in double or single quoted strings
"no-template-curly-in-string": "error",
// ━━ Control Flow ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// If last statement of an else is return then warn because else is unnecessary
"no-else-return": "warn",
// "default" cases not required in "switch" statements
"default-case": "off",
// "default" case must appear as last case in "switch" statement
"default-case-last": "error",
// Default arguments must not become before non-default assigned arguments
"default-param-last": "error",
// Curly braces are not strictly enforced
"curly": "off",
// Disable nested ifs since they can usually be flattened to else-if else conditions
"no-lonely-if": "error",
// Removes unnecessary `return;` statements
"no-useless-return" : "error",
// Allow/disallow "return" without a value (which just returns undefined)
"consistent-return": "off",
// ━━ Async ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Only throw warning for await in loop because it can be valid if programming in a synchronus style
"no-await-in-loop": "warn",
// Returning from a promise "executor" function doesn"t do jack
"no-promise-executor-return": "error",
// No warn/error on synchronus operations
// - Many situations were things like existsSync are fine
"no-sync": "off",
// Throw a fit on unnecessary async
"require-await": "error",
// Enforce atomic updates for async operations
"require-atomic-updates": "error",
// Disable non try/catch on `return await blah()` due to causing extra operations/confusion
"no-return-await": "error",
// Reject Error instance from promises best-practices
"prefer-promise-reject-errors": "error",
// ━━ Functional ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Allow anonymous functions w/o names
"func-names": "off",
// Must wrap self-invoking functions with ()
"wrap-iife": "error",
// Array functions like "map" should always have a return statement
"array-callback-return": "error",
// If multiple callbacks are present then enforce "return" to avoid calling callback multiple times
"callback-return": "error",
// Ensure that callback errors are handled with a `if( err )` and not skipped
"handle-callback-err": "error",
// Prefer Reflect.apply
"prefer-reflect": "error",