lint-suite 2.0.1 → 2.0.2

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.
package/README.md CHANGED
@@ -207,7 +207,9 @@ literal class names inside `[class]="..."` expressions and `class="a {{ b }}"`
207
207
  interpolations. String literals, object-literal keys, array elements, and both
208
208
  branches of a ternary contribute names; identifiers, calls, pipes, and `+`
209
209
  concatenations contribute nothing, so a class the rule cannot see is never
210
- reported. `[ngClass]` is deliberately not analysed.
210
+ reported. `[ngClass]` is deliberately not analysed. `routerLinkActive`,
211
+ `animate.enter`, and `animate.leave` are also read as class lists, static or
212
+ bound.
211
213
 
212
214
  Stylesheets come from the component beside the template: `styleUrl`,
213
215
  `styleUrls`, and inline `styles` read as string or template literals from the
@@ -278,13 +280,17 @@ Selectors resolve through the same parser as the ESLint rule, so `&__element`,
278
280
  `&--modifier`, `&.other`, `& > .child`, `.wrapper &`, `@media` blocks, and
279
281
  selector lists all report the resolved name on the rule that declares it: in
280
282
  `.panel { .inner {} }` only `inner` is checked on the inner rule, never `panel`
281
- twice. Arguments of `:host(.dark)` and `:host-context(.rtl)` are skipped, and
283
+ twice. A rule that only wraps nested rules, like `.dialog` in
284
+ `.dialog { &__name {} }`, emits no selector of its own and is never reported;
285
+ `.shell` in `.shell { .inner {} }` still is, because `.shell .inner` reaches
286
+ the output. Arguments of `:host(.dark)` and `:host-context(.rtl)` are skipped, and
282
287
  everything after `::ng-deep`, `/deep/`, or `>>>` is skipped too, because those
283
288
  classes live in other templates. A selector built with interpolation
284
289
  (`.icon-#{$size}`) is never reported, and `@extend .base` counts `base` as
285
290
  used.
286
291
 
287
- The template side reads the same sources as `no-unstyled-classes` plus
292
+ The template side reads the same sources as `no-unstyled-classes` (including
293
+ `routerLinkActive`, `animate.enter`, and `animate.leave`, static or bound) plus
288
294
  `[ngClass]`, and it does not skip custom elements: a class on
289
295
  `<app-child class="foo">` is written by this template, so `.foo` counts as
290
296
  used. When any template of the stylesheet holds a class source the rule cannot
package/eslint.cjs CHANGED
@@ -687,7 +687,12 @@ var classExpressionLiterals = (source) => {
687
687
  };
688
688
 
689
689
  // packages/lint-suite/src/lib/rules/utils/template-classes.util.ts
690
- var CLASS_ATTRIBUTE = "class";
690
+ var CLASS_ATTRIBUTES = [
691
+ "class",
692
+ "routerLinkActive",
693
+ "animate.enter",
694
+ "animate.leave"
695
+ ];
691
696
  var CLASS_BINDING_PREFIX = "class.";
692
697
  var TOKEN = /\S+/gu;
693
698
  var expressionSource = (value) => {
@@ -716,11 +721,11 @@ var boundClassName = (input) => {
716
721
  return input.name;
717
722
  };
718
723
  var isClassExpression = (input) => {
719
- const isClassName = input.name === CLASS_ATTRIBUTE;
724
+ const isClassName = CLASS_ATTRIBUTES.includes(input.name);
720
725
  if (!isClassName) return false;
721
726
  const { details } = input.keySpan;
722
727
  if (details === null) return true;
723
- return details === CLASS_ATTRIBUTE;
728
+ return details === input.name;
724
729
  };
725
730
  var expressionClasses = (input) => {
726
731
  const source = expressionSource(input.value);
@@ -745,7 +750,7 @@ var inputClasses = (input) => {
745
750
  var templateClasses = (node) => {
746
751
  const classes = [];
747
752
  for (const attribute of node.attributes) {
748
- const isClassName = attribute.name === CLASS_ATTRIBUTE;
753
+ const isClassName = CLASS_ATTRIBUTES.includes(attribute.name);
749
754
  if (isClassName) {
750
755
  const found = staticClasses(attribute);
751
756
  classes.push(...found);
@@ -7292,6 +7297,14 @@ var typescriptSafety = (0, import_config18.defineConfig)([
7292
7297
  // Class actions carry their payload as constructor parameter properties.
7293
7298
  "@typescript-eslint/parameter-properties": "off"
7294
7299
  }
7300
+ },
7301
+ {
7302
+ files: ["**/*.stub.ts"],
7303
+ rules: {
7304
+ // local/test-file-shape requires STUB: Type; a literal stub would trip
7305
+ // no-inferrable-types.
7306
+ "@typescript-eslint/no-inferrable-types": "off"
7307
+ }
7295
7308
  }
7296
7309
  ]);
7297
7310