@taiga-ui/eslint-plugin-experience-next 0.473.0 → 0.475.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +52 -4
  2. package/index.d.ts +3 -0
  3. package/index.esm.js +724 -563
  4. package/package.json +1 -1
  5. package/rules/no-fully-untracked-effect.d.ts +1 -2
  6. package/rules/no-infinite-loop.d.ts +6 -0
  7. package/rules/no-signal-reads-after-await-in-reactive-context.d.ts +1 -2
  8. package/rules/no-untracked-outside-reactive-context.d.ts +1 -2
  9. package/rules/no-useless-untracked.d.ts +1 -2
  10. package/rules/prefer-untracked-incidental-signal-reads.d.ts +1 -27
  11. package/rules/prefer-untracked-signal-getter.d.ts +1 -2
  12. package/rules/utils/{angular-signals.d.ts → angular/angular-signals.d.ts} +10 -5
  13. package/rules/utils/angular/pipes.d.ts +2 -0
  14. package/rules/utils/angular/providers.d.ts +3 -0
  15. package/rules/utils/ast/ancestors.d.ts +12 -0
  16. package/rules/utils/{ast-walk.d.ts → ast/ast-walk.d.ts} +1 -0
  17. package/rules/utils/ast/call-expressions.d.ts +2 -0
  18. package/rules/utils/ast/mutation-targets.d.ts +4 -0
  19. package/rules/utils/ast/parenthesized.d.ts +3 -0
  20. package/rules/utils/ast/property-names.d.ts +5 -0
  21. package/rules/utils/ast/returned-expression.d.ts +2 -0
  22. package/rules/utils/ast/string-literals.d.ts +10 -0
  23. package/rules/utils/text/dedent.d.ts +5 -0
  24. package/rules/utils/typescript/decorators.d.ts +2 -0
  25. package/rules/utils/typescript/function-usage.d.ts +5 -0
  26. package/rules/utils/typescript/node-map.d.ts +6 -0
  27. package/rules/utils/typescript/symbols.d.ts +4 -0
  28. package/rules/utils/typescript/type-aware-context.d.ts +14 -0
  29. /package/rules/utils/{angular-imports.d.ts → angular/angular-imports.d.ts} +0 -0
  30. /package/rules/utils/{get-decorator-metadata.d.ts → angular/get-decorator-metadata.d.ts} +0 -0
  31. /package/rules/utils/{get-imports-array.d.ts → angular/get-imports-array.d.ts} +0 -0
  32. /package/rules/utils/{import-fix-helpers.d.ts → angular/import-fix-helpers.d.ts} +0 -0
  33. /package/rules/utils/{is-imports-array-property.d.ts → angular/is-imports-array-property.d.ts} +0 -0
  34. /package/rules/utils/{untracked-docs.d.ts → angular/untracked-docs.d.ts} +0 -0
  35. /package/rules/utils/{ast-expressions.d.ts → ast/ast-expressions.d.ts} +0 -0
  36. /package/rules/utils/{get-const-array.d.ts → ast/get-const-array.d.ts} +0 -0
  37. /package/rules/utils/{is-array.d.ts → ast/is-array.d.ts} +0 -0
  38. /package/rules/utils/{is-object.d.ts → ast/is-object.d.ts} +0 -0
  39. /package/rules/utils/{is-spread.d.ts → ast/is-spread.d.ts} +0 -0
  40. /package/rules/utils/{name-of.d.ts → ast/name-of.d.ts} +0 -0
  41. /package/rules/utils/{intersect.d.ts → collections/intersect.d.ts} +0 -0
  42. /package/rules/utils/{same-order.d.ts → collections/same-order.d.ts} +0 -0
  43. /package/rules/utils/{get-imported-name.d.ts → imports/get-imported-name.d.ts} +0 -0
  44. /package/rules/utils/{npmrc-parser.d.ts → parsers/npmrc-parser.d.ts} +0 -0
  45. /package/rules/utils/{get-sorted-names.d.ts → sorting/get-sorted-names.d.ts} +0 -0
  46. /package/rules/utils/{get-field-types.d.ts → typescript/get-field-types.d.ts} +0 -0
  47. /package/rules/utils/{get-type-name.d.ts → typescript/get-type-name.d.ts} +0 -0
  48. /package/rules/utils/{is-class-type.d.ts → typescript/is-class-type.d.ts} +0 -0
  49. /package/rules/utils/{is-external-tuple.d.ts → typescript/is-external-tuple.d.ts} +0 -0
package/README.md CHANGED
@@ -50,11 +50,12 @@ export default [
50
50
  | no-fully-untracked-effect | Disallow reactive callbacks where all signal reads are hidden inside `untracked()` | ✅ | | |
51
51
  | no-href-with-router-link | Do not use href and routerLink attributes together on the same element | ✅ | 🔧 | |
52
52
  | no-implicit-public | Require explicit `public` modifier for class members and parameter properties | ✅ | 🔧 | |
53
+ | no-infinite-loop | Disallow `while (true)` and `for` loops without an explicit condition | ✅ | | |
53
54
  | no-legacy-peer-deps | Disallow `legacy-peer-deps=true` in `.npmrc` | ✅ | | |
54
55
  | no-playwright-empty-fill | Enforce `clear()` over `fill('')` in Playwright tests | ✅ | 🔧 | |
55
56
  | no-project-as-in-ng-template | `ngProjectAs` has no effect inside `<ng-template>` or dynamic outlets | ✅ | | |
56
57
  | no-redundant-type-annotation | Disallow redundant type annotations when the type is already inferred from the initializer | ✅ | 🔧 | |
57
- | no-side-effects-in-computed | Disallow observable side effects inside Angular `computed()` callbacks | ✅ | | |
58
+ | no-side-effects-in-computed | Disallow side effects and effectful helper calls inside Angular `computed()` callbacks | ✅ | | |
58
59
  | no-signal-reads-after-await-in-reactive-context | Disallow bare signal reads after `await` inside reactive callbacks | ✅ | | |
59
60
  | no-string-literal-concat | Disallow string literal concatenation; merge adjacent literals into one | ✅ | 🔧 | |
60
61
  | no-untracked-outside-reactive-context | Disallow `untracked()` outside reactive callbacks, except explicit post-`await` snapshots | ✅ | 🔧 | |
@@ -441,6 +442,48 @@ class MyService {
441
442
 
442
443
  ---
443
444
 
445
+ ## no-infinite-loop
446
+
447
+ <sup>`✅ Recommended`</sup>
448
+
449
+ Disallows the two loop forms banned by this project: `while (true)` and `for` loops without a condition, including the
450
+ canonical `for (;;)` form. These loops hide the real exit condition inside the body, which makes control flow harder to
451
+ scan and review.
452
+
453
+ ```ts
454
+ // ❌ error
455
+ while (true) {
456
+ if (isDone) {
457
+ break;
458
+ }
459
+
460
+ process();
461
+ }
462
+
463
+ // ✅ ok
464
+ while (!isDone) {
465
+ process();
466
+ }
467
+ ```
468
+
469
+ ```ts
470
+ // ❌ error
471
+ for (;;) {
472
+ if (queue.length === 0) {
473
+ break;
474
+ }
475
+
476
+ flush(queue.shift());
477
+ }
478
+
479
+ // ✅ ok
480
+ for (; queue.length > 0; ) {
481
+ flush(queue.shift());
482
+ }
483
+ ```
484
+
485
+ ---
486
+
444
487
  ## no-legacy-peer-deps
445
488
 
446
489
  <sup>`✅ Recommended`</sup>
@@ -681,8 +724,9 @@ const doubled = computed(() => {
681
724
  <sup>`✅ Recommended`</sup>
682
725
 
683
726
  `computed()` should only derive a value from its inputs. This rule reports observable side effects inside Angular
684
- `computed()` callbacks, including signal writes (`.set()`, `.update()`, `.mutate()`), assignments to captured state,
685
- `++/--`, `delete`, and property mutations on objects that were not created inside the computation itself.
727
+ `computed()` callbacks, including signal writes (`.set()`, `.update()`, `.mutate()`), `effect()`, `inject()`,
728
+ assignments to captured state, `++/--`, `delete`, property mutations on objects that were not created inside the
729
+ computation itself, and calls to local helper functions or methods when their bodies perform those operations.
686
730
 
687
731
  ```ts
688
732
  // ❌ error
@@ -691,8 +735,12 @@ import {computed, signal} from '@angular/core';
691
735
  const source = signal(0);
692
736
  const target = signal(0);
693
737
 
694
- const derived = computed(() => {
738
+ function syncTarget(): void {
695
739
  target.set(source() + 1);
740
+ }
741
+
742
+ const derived = computed(() => {
743
+ syncTarget();
696
744
  return target();
697
745
  });
698
746
  ```
package/index.d.ts CHANGED
@@ -49,6 +49,9 @@ declare const plugin: {
49
49
  'no-implicit-public': import("@typescript-eslint/utils/ts-eslint").RuleModule<"implicitPublic", readonly unknown[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
50
50
  name: string;
51
51
  };
52
+ 'no-infinite-loop': import("@typescript-eslint/utils/ts-eslint").RuleModule<"forLoop" | "whileLoop", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
53
+ name: string;
54
+ };
52
55
  'no-legacy-peer-deps': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noLegacyPeerDeps", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
53
56
  name: string;
54
57
  };