forked from DaveMBush/SmartNgRX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.json
894 lines (894 loc) · 35 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
{
"root": true,
"ignorePatterns": ["**/*"],
"parser": "@typescript-eslint/parser",
"plugins": [
"jsdoc",
"@nx",
"sonarjs",
"deprecation",
"eslint-plugin-import",
"@angular-eslint/eslint-plugin",
"eslint-comments",
"eslint-plugin-unicorn",
"eslint-plugin-rxjs",
"@typescript-eslint",
"unused-imports",
"ngrx",
"max-params-no-constructor",
"jest"
],
"overrides": [
{
"files": ["jest.config.ts"],
// no rules for jest.config.js
"rules": {
"eslint-comments/no-restricted-disable": "off",
"eslint-comments/require-description": "off",
"unicorn/no-abusive-eslint-disable": "off"
}
},
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"parserOptions": {
"project": ["tsconfig.base.json"]
},
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"plugins": ["simple-import-sort"],
"rules": {
"simple-import-sort/imports": [
"error",
{
"groups": [
// Side effect imports.
["^\\u0000"],
// 3rd party Packages.
["^@?\\w"],
// Internal packages.
["^(@smart)(/.*|$)"],
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything not matched in another group.
["^"],
// Relative imports.
// Anything that starts with a dot.
["^\\."]
]
}
],
"simple-import-sort/exports": "error"
}
},
{
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:ngrx/recommended",
"plugin:sonarjs/recommended-legacy"
],
"rules": {
// Standard ESLint Rules
"complexity": [
"error",
{
"max": 10
}
],
//// Make sure that any constructors in a class that extends another
//// class calls super()
"constructor-super": "error",
"curly": "error",
"default-case": "error",
"eslint-comments/require-description": "error",
"eslint-comments/no-restricted-disable": [
"error",
"eslint-comments/no-restricted-disable", // prevent from disabling THIS rule
"@nx/enforce-module-boundaries", // So we can implement buildable libs and eventually build caching
"no-console", // don"t checkin with console. Use debugging API
// // Strong typing issues
"@angular-eslint/template/eqeqeq",
"@angular-eslint/template/no-any",
"@angular-eslint/template/no-negated-async",
"@typescript-eslint/explicit-function-return-type",
"@typescript-eslint/explicit-module-boundary-types",
"@typescript-eslint/no-unsafe-argument",
"@typescript-eslint/no-unsafe-assignment",
"@typescript-eslint/no-unsafe-call",
"@typescript-eslint/no-unsafe-member-access",
"@typescript-eslint/no-unsafe-return",
"rxjs/no-implicit-any-catch",
// the following enforce single responsibility principle
"complexity",
"max-depth", // also for code clarity
"max-lines",
"max-lines-per-function",
"max-classes-per-file",
"max-statements",
"max-statements-per-line",
"max-nested-callbacks" // also for clarity.
],
"eqeqeq": ["error", "always"],
"guard-for-in": "error",
"id-blacklist": [
"warn",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined"
],
"id-match": "off",
//// Each file should do one, and only one, thing.
//// Generally we want one export per file. This is
//// a step in that direction.
"max-classes-per-file": ["error", 1],
//// Nesting deeper than 2 levels increases cognitive complexity
//// and leads to bugs. Often, you can flip your conditions, return
//// immediately and still have essentially the same code without
//// the nesting issues. Other times, you can combine conditions
//// to reduce nesting.
"max-depth": [
"error",
{
"max": 2
}
],
//// The statistical optimal number of lines of code per file is between
//// 200 and 400 (possibly 500) with 300 being the sweet spot. See link.
//// https://web.archive.org/web/20160725154648/http://www.mind2b.com/component/content/article/24-software-module-size-and-file-size
"max-lines": [
"error",
{
"max": 300,
"skipBlankLines": true,
"skipComments": true
}
],
//// Any function/method that has more than 50 executable lines is
//// doing too much.
"max-lines-per-function": [
"error",
{
"max": 50,
"skipBlankLines": true,
"skipComments": true
}
],
//// Nesting of any sort is asking for bugs.
"max-nested-callbacks": [
"error",
{
"max": 2
}
],
"max-statements": ["error", 50],
"max-statements-per-line": [
"error",
{
"max": 1
}
],
"no-bitwise": "error",
"no-caller": "error",
//// don"t declare variables inside a case statement
"no-case-declarations": "error",
//// use devConsoleLogger from @cu/core-logging instead,
//// more info https://staging.clickup.com/333/v/dc/ad-34192/ad-857176
"no-console": "error",
//// don"t allow constants in conditions ie, if(false) {}
//// also catches if(v = "abc") {} when you meant if(v === "abc") {}
"no-constant-condition": "error",
//// If you are going to return as part of the else, there is
//// no need for the else.
"no-else-return": [
"error",
{
"allowElseIf": false
}
],
//// There is no reason for empty blocks of code
"no-empty": "error",
//// There are multiple ways of eval()ing code, which is a security
//// issue. This makes sure we don"t use them.
"no-eval": "error",
//// Where casting code to a boolean will already happen implicitly
//// there is no good reason to force the cast ourselves.
"no-extra-boolean-cast": "error",
//// Catches hidden whitespace issues
"no-irregular-whitespace": "error",
//// Disallows calling some Object.prototype methods directly on objects.
"no-prototype-builtins": "error",
"no-new-wrappers": "error",
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "ngx-bootstrap",
"message": "Please use deep imports from ngx-bootstrap instead."
},
{
"name": "ngx-bootstrap/public_api",
"message": "Please use deep imports from ngx-bootstrap instead."
},
{
"name": "moment",
"message": "Please use moment-timezone instead."
},
{
"name": "@angular/compiler",
"message": "You should never need to import anything from this package"
},
{
"name": "jest-preset-angular",
"message": "Please use jest-preset-angular/setup-jest instead."
},
{
"name": "lodash",
"message": "Please don't use any form of lodash"
},
{
"name": "lodash-es",
"message": "Please don't use any form of lodash"
}
]
}
],
// NOTE: These rules are turned off for spec files (below).
"no-restricted-syntax": [
"error",
{
// these were added because there is no easy way to fix (so not worth writing a rule)
// and lastValueFrom and firstValueFrom are not part of the ngrx/no-to-promise rule
// as for WHY they were added see ngrx/no-to-promise
"selector": "NewExpression Identifier[name=\"Promise\"], CallExpression Identifier[name=\"firstValueFrom\"], CallExpression Identifier[name=\"lastValueFrom\"]",
"message": "Prefer Observables over of Promises"
}
],
//// Off because the typescript rule does this instead
"no-shadow": "off",
"no-throw-literal": "error",
"no-undef-init": "error",
//// prevent leading and trailing underscore in variable names
"no-underscore-dangle": "error",
//// make sure all code can be executed
"no-unreachable": "error",
"no-unreachable-loop": "error",
//// use unused-imports rule instead
"no-unused-vars": "off",
//// fixup strings
"no-useless-escape": "error",
"object-shorthand": "error",
"prefer-rest-params": "error",
//// This rule is aimed to flag usage of Function.prototype.apply()
//// in situations where spread syntax could be used instead
"prefer-spread": "error",
"prefer-arrow-callback": "error",
"radix": "error",
// Angular Rules
"@angular-eslint/component-class-suffix": "error",
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": ["dmb", "dmb"],
"style": "kebab-case"
}
],
"@angular-eslint/contextual-decorator": "error",
"@angular-eslint/contextual-lifecycle": "error",
"@angular-eslint/directive-class-suffix": "error",
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": ["dmb"],
"style": "camelCase"
}
],
"@angular-eslint/no-attribute-decorator": "error",
//// Don"t allow empty methods
"@angular-eslint/no-empty-lifecycle-method": "error",
"@angular-eslint/no-host-metadata-property": "off",
"@angular-eslint/no-input-rename": "error",
"@angular-eslint/no-lifecycle-call": "error",
"@angular-eslint/no-output-on-prefix": "error",
"@angular-eslint/no-output-rename": "error",
"@angular-eslint/no-pipe-impure": "error",
"@angular-eslint/no-queries-metadata-property": "error",
"@angular-eslint/pipe-prefix": [
"error",
{
"prefixes": ["dmb"]
}
],
"@angular-eslint/prefer-on-push-component-change-detection": "error",
"@angular-eslint/prefer-output-readonly": "error",
// Make view encapsulation "error" once we move to a design
// system that supports it better.
"@angular-eslint/use-component-view-encapsulation": "error",
"@angular-eslint/use-component-selector": "error",
"@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/use-pipe-transform-interface": "error",
// Typescript Rules
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/ban-tslint-comment": "error",
"@typescript-eslint/ban-types": "error",
//// off because of prettier
"@typescript-eslint/brace-style": "off",
"@typescript-eslint/consistent-indexed-object-style": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-definitions": "error",
//// Yes, this messes with old style reducers but if you
//// move to new style reducers you will no longer have
//// an issue following this standard.
"@typescript-eslint/default-param-last": "error",
//// prevents the use of index notation to go after
//// a field/method of an object
"@typescript-eslint/dot-notation": [
"error",
{
"allowIndexSignaturePropertyAccess": true
}
],
//// Explicit types for function return values makes
//// it clear to any calling code what type is returned.
//// Further it prevents accidentally returning multiple
//// types.
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true,
"allowTypedFunctionExpressions": true,
"allowHigherOrderFunctions": true
}
],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/member-ordering": [
"error",
{
"default": {
"memberTypes": [
"public-static-field",
"public-static-method",
"protected-static-field",
"protected-static-method",
"private-static-field",
"private-static-method",
"public-constructor",
"protected-constructor",
"private-constructor",
"public-instance-method",
"protected-instance-method",
"private-instance-method"
],
"order": "as-written"
}
}
],
"@typescript-eslint/explicit-module-boundary-types": "error",
//// Improves code readability
"@typescript-eslint/lines-between-class-members": [
"error",
"always",
{
"exceptAfterSingleLine": true
}
],
//// code consistency - make methods declared in interfaces look
//// like methods declared in classes.
"@typescript-eslint/method-signature-style": ["error", "method"],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": ["camelCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": ["classMethod"],
"format": ["camelCase"],
"leadingUnderscore": "forbid"
},
{
"selector": "classProperty",
"format": ["camelCase"]
},
{
"selector": "enumMember",
"format": ["PascalCase"]
},
{
"selector": "interface",
"format": ["PascalCase"],
"custom": {
//Don"t let it start with an I
"regex": "^I[A-Z]",
"match": false
}
},
{
"selector": "objectLiteralProperty",
"format": null
},
{
"selector": "parameter",
"custom": {
// multiple underscores or camelCase
// also allow variable name to end with $, because classProperty allows it. For example, this.action$ is allowed so action$ should be allowed.
"regex": "^_*$|^[a-z0-9]{1,}([A-Z][a-z0-9]{0,}){0,}\\$?$",
"match": true
},
"format": null
},
{
"selector": "parameter",
"modifiers": ["destructured"],
"format": null
},
{
"selector": "typeLike",
"format": ["PascalCase"]
},
{
"selector": "typeProperty",
"format": ["camelCase"]
},
{
"selector": "variable",
"format": ["camelCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": "variable",
// Allow constants to be UPPER_CASE or camelCase
"modifiers": ["const"],
"format": ["camelCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": "variable",
"modifiers": ["destructured"],
// Allow any formatting because it will be controlled by
// what we are destructuring
"format": null
}
],
//// requires toString() to provide useful information.
"@typescript-eslint/no-base-to-string": "error",
//// Using a non-null assertion (!) next to an assign or equals
//// check (= or == or ===) creates code that is confusing as
//// it looks similar to a not equals check (!= !==)
"@typescript-eslint/no-confusing-non-null-assertion": "error",
//// code clarity and consistency
//// Requires expressions of type void to appear in statement position.
"@typescript-eslint/no-confusing-void-expression": [
"error",
{
"ignoreArrowShorthand": true
}
],
"@typescript-eslint/no-dupe-class-members": "error",
//// Dynamic deletes and strong typing are a really bad combination
//// The ONLY place this MIGHT be acceptable is while transforming data
//// from the service back to the effect.
"@typescript-eslint/no-dynamic-delete": "error",
"@typescript-eslint/no-empty-function": "error",
//// Prevents unnecessary and possibly erroneous code
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/no-extraneous-class": [
"error",
{
"allowWithDecorator": true
}
],
//// requires promises to be handled appropriately
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-for-in-array": "error",
//// Disallow the use of eval()-like methods. (beyond just eval())
"@typescript-eslint/no-implied-eval": "error",
"@typescript-eslint/no-inferrable-types": [
"error",
{
"ignoreParameters": true
}
],
"@typescript-eslint/no-invalid-this": "error",
"@typescript-eslint/no-invalid-void-type": "error",
"@typescript-eslint/no-loop-func": "error",
"@typescript-eslint/no-loss-of-precision": "error",
"@typescript-eslint/no-meaningless-void-operator": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-namespace": "error",
//// turning on @typescript-eslint/non-null-assertion
//// doesn"t work with the rule
//// @typescript-eslint/non-nullable-type-assertion-style.
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-redeclare": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-this-alias": "error",
// Use types for what interfaces can"t do.
"@typescript-eslint/no-type-alias": [
"error",
{
"allowAliases": "always",
"allowCallbacks": "always",
"allowGenerics": "always",
"allowConstructors": "always",
"allowConditionalTypes": "always",
// Because it is a lot easier to read and understand
// than creating tuple definitions with interfaces
"allowTupleTypes": "always"
}
],
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
//// no-unnecessary-condition requires strictNullCheck before we can turn it on
//"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unnecessary-type-constraint": "error",
"@typescript-eslint/no-unsafe-argument": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
"@typescript-eslint/no-unused-expressions": "error",
// covered by another rule
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
//// This rule detects when an as cast is doing the same job as
//// an ! would, and suggests fixing the code to be an !
"@typescript-eslint/non-nullable-type-assertion-style": "error",
"@typescript-eslint/padding-line-between-statements": "error",
"@typescript-eslint/prefer-enum-initializers": "error",
// for of is 10x slower than for/next. Use the forNext function
// instead to gain the performance benefits as well as readability.
"@typescript-eslint/prefer-for-of": "off",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-literal-enum-member": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
// This rule requires strictNullChecks which is not yet enabled on the repo
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/prefer-reduce-type-parameter": "error",
"@typescript-eslint/prefer-regexp-exec": "error",
"@typescript-eslint/prefer-return-this-type": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/prefer-ts-expect-error": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": [
"error",
{
"ignoreStringArrays": true
}
],
"@typescript-eslint/require-await": "error",
"@typescript-eslint/return-await": "error",
"@typescript-eslint/restrict-template-expressions": "error",
"@typescript-eslint/sort-type-constituents": "error",
"@typescript-eslint/strict-boolean-expressions": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/typedef": "error",
"@typescript-eslint/unbound-method": [
"error",
{
"ignoreStatic": true
}
],
"@typescript-eslint/unified-signatures": [
"error",
{
"ignoreDifferentlyNamedParameters": true
}
],
// Unused imports
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
// NgRX Plugin
"ngrx/avoid-combining-selectors": "error",
"ngrx/avoid-cyclic-effects": "error",
//// we don"t care about sequential dispatches
"ngrx/avoid-dispatching-multiple-actions-sequentially": "off",
"ngrx/avoid-duplicate-actions-in-reducer": "error",
"ngrx/avoid-mapping-selectors": "error",
"ngrx/good-action-hygiene": "error",
"ngrx/no-dispatch-in-effects": "error",
"ngrx/no-effect-decorator": "error",
"ngrx/no-effect-decorator-and-creator": "error",
"ngrx/no-effects-in-providers": "error",
"ngrx/no-multiple-global-stores": "error",
"ngrx/no-reducer-in-key-names": "error",
"ngrx/no-store-subscription": "error",
//// We don"t want to type the store when it is injected
//// because it will only be available for that one type
//// when often we want to use it for multiple types.
//// But, we also don"t want to leave things with "implied any"
//// The proper way to deal with this conflict in rules it to
//// specify `unknown` as the type for the store. ie,
//// `store: Store<unknown>` instead of using `any`.
"ngrx/no-typed-global-store": "error",
"ngrx/on-function-explicit-return-type": "error",
"ngrx/prefer-action-creator": "error",
"ngrx/prefer-action-creator-in-dispatch": "error",
"ngrx/prefer-action-creator-in-of-type": "error",
"ngrx/prefer-concat-latest-from": "error",
"ngrx/prefer-effect-callback-in-block-statement": "off",
//// This one isn"t quite so obvious why we need it to be
//// implemented. But we want to tread the props as parameters
//// and for this, we need to specify them directly.
//// Also, the first time you try to pass an array in, you"ll
//// realize just how important this rule is.
//// Read the docs here to understand why we implement this.
//// https://github.com/timdeschryver/eslint-plugin-ngrx/blob/main/docs/rules/prefer-inline-action-props.md
"ngrx/prefer-inline-action-props": "error",
"ngrx/prefer-one-generic-in-create-for-feature-selector": "error",
"ngrx/prefix-selectors-with-select": "error",
"ngrx/select-style": ["error", "method"],
"ngrx/updater-explicit-return-type": "error",
"ngrx/use-consistent-global-store-name": "error",
"ngrx/use-effects-lifecycle-interface": "error",
// RxJS Plugin
"rxjs/no-finnish": "error",
// rxjs rules require typescript so they are turned off by default
//// prevents async methods from being passed to subscribe()
"rxjs/no-async-subscribe": "error",
//// Keeps people from copy and pasting older code. Even if we never
//// need it, it is a good rule to add. Especially as we bring on
//// new people from who knows where and what they"ve done in the
//// past (despite our best efforts to hire the best!)
"rxjs/no-compat": "error",
"rxjs/no-create": "error",
"rxjs/no-exposed-subjects": "error",
//// ensures repeatWhen or retryWhen notifies get used
"rxjs/no-ignored-notifier": "error",
//// ensures the buffer size is specified
"rxjs/no-ignored-replay-buffer": "error",
//// ensures the takeWhile value is used
"rxjs/no-ignored-takewhile-value": "error",
//// makes sure errors are typed
"rxjs/no-implicit-any-catch": "error",
//// Make sure you import from the directory instead of index.*
"rxjs/no-index": "error",
//// Make sure you import from root instead of deep referencing
"rxjs/no-internal": "error",
"rxjs/no-nested-subscribe": "error",
//// (if an attempt is made to send a notification to an
//// observer after a complete or error notification has
//// already been sent
"rxjs/no-redundant-notify": "error",
"rxjs/no-sharereplay": [
"error",
{
"allowConfig": true
}
],
//// Unsubscribing a subject isn"t the same
//// as unsubscribing a subscription. This rule
//// protects us against someone who thinks they are
"rxjs/no-subject-unsubscribe": "error",
"rxjs/no-subject-value": "error",
//// Using promises, directly or indirectly, is
//// normally an indication that the programmer
//// does not know how to use observables OR
//// they are still thinking about the problem
//// they are solving in an imperative way instead
//// of in a reactive way. If your code has been
//// flagged with this error, you should consider
//// re-thinking your approach.
//// Having said that, there are some cases where
//// you can"t avoid using promises. In this case,
//// add an eslint exclusion comment with an
//// explanation as to why you think using a promise
//// is acceptable.
"rxjs/no-topromise": "error",
"rxjs/no-unbound-methods": "error",
"rxjs/no-unsafe-catch": "error",
"rxjs/no-unsafe-first": "error",
//// don"t pass undefined to next()
"rxjs/no-unsafe-subject-next": "error",
"rxjs/no-unsafe-switchmap": "error",
"rxjs/no-unsafe-takeuntil": "error",
"rxjs/prefer-observer": "error",
// One off plugins
"unicorn/filename-case": "error",
"unicorn/no-abusive-eslint-disable": "error",
"import/no-duplicates": ["error"],
"deprecation/deprecation": "error",
//// The next two rules don"t allow default exports particularly
//// to defend against React guys who are still doing this even
//// though it really makes no sense there either 🙄
"import/prefer-default-export": "off",
"import/no-default-export": "error",
//// If you need more params, your function/class is probably doing too
//// much. So, the first thing you should look at is breaking things down
//// more. If all else fails, your second choice would be passing an object.
//// But, really try to break things down more first!
"max-params-no-constructor/max-params-no-constructor": [
"error",
{
"max": 4
}
],
// Sonarlint
"sonarjs/cognitive-complexity": "error",
"sonarjs/max-switch-cases": "error",
"sonarjs/no-all-duplicated-branches": "error",
"sonarjs/no-collapsible-if": "error",
"sonarjs/no-duplicated-branches": "error",
"sonarjs/no-duplicate-string": "error",
"sonarjs/no-element-overwrite": "error",
"sonarjs/no-identical-expressions": "error",
"sonarjs/no-identical-functions": "error",
"sonarjs/no-ignored-return": "error",
"sonarjs/no-gratuitous-expressions": "error",
"sonarjs/no-nested-switch": "error",
"sonarjs/no-nested-template-literals": "error",
"sonarjs/no-one-iteration-loop": "error",
"sonarjs/no-redundant-boolean": "error",
"sonarjs/no-redundant-jump": "error",
"sonarjs/no-small-switch": "off",
"sonarjs/no-use-of-empty-return-value": "error",
"sonarjs/prefer-single-boolean-return": "error"
}
},
{
"files": ["*.reducer.ts"],
"plugins": ["functional"],
"rules": {
// these rules require typescript to run so they are off by default
"@typescript-eslint/prefer-readonly": "error",
"@typescript-eslint/prefer-readonly-parameter-types": "off",
// Functional Plugin
"functional/immutable-data": [
"error",
{
"ignoreImmediateMutation": true,
"ignoreAccessorPattern": "this.*"
}
],
"functional/no-let": [
"error",
{
"allowInFunctions": true
}
],
"functional/no-loop-statements": "error"
}
},
{
"files": ["reducer.factory.ts"],
"rules": {
"max-lines-per-function": "off"
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {
"@angular-eslint/template/alt-text": "error",
"@angular-eslint/template/elements-content": "error",
"@angular-eslint/template/label-has-associated-control": ["error", {}],
"@angular-eslint/template/table-scope": "error",
"@angular-eslint/template/valid-aria": "error",
"@angular-eslint/template/banana-in-box": "error",
// The best way to deal with click-events-have-key-events is to
// change your code to use something that already has a click event
// like a button instead of implmenting your own click event in your
// component.
"@angular-eslint/template/click-events-have-key-events": "error",
//// Reduces the noise in the template by forcing conditional
//// code into the TS file (or beyond) making the template more
//// readable and less error prone as well as adhering to the
//// concept that components should only render data or fire events.
//// nothing more.
"@angular-eslint/template/conditional-complexity": "error",
//// Forces the cyclomatic complexity to be measured in the
//// template. This often further forces the issue mentioned
//// above (reduce noise...) to get corrected.
"@angular-eslint/template/cyclomatic-complexity": "error",
// disable auto fixing until this bug is fixed: https://github.com/angular-eslint/angular-eslint/issues/538
"@angular-eslint/template/eqeqeq": [
"error",
{
"allowNullOrUndefined": true
}
],
"@angular-eslint/template/mouse-events-have-key-events": "error",
"@angular-eslint/template/no-any": "error",
"@angular-eslint/template/no-autofocus": "error",
// no-call-expression is no longer valid because signals are allowed
// hopefully someone will create a rule that excludes signal
"@angular-eslint/template/no-call-expression": "warn",
"@angular-eslint/template/no-distracting-elements": "error",
"@angular-eslint/template/no-negated-async": "error",
"@angular-eslint/template/no-positive-tabindex": "error",
"@angular-eslint/template/use-track-by-function": "error",
"@angular-eslint/template/no-duplicate-attributes": [
"error",
{
"allowTwoWayDataBinding": true
}
]
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"extends": ["plugin:jest/recommended"],
"plugins": ["jest"],
"env": {
"jest": true
},
"rules": {
"no-restricted-syntax": "off",
"max-lines": "off",
"max-lines-per-function": "off",
"max-nested-callbacks": "off",
"jest/expect-expect": [
"error",
{
"assertFunctionNames": [
"expect",
"expectObservable",
"expectSubscriptions"
]
}
]
}
}
]
}