lint-suite 1.5.0 → 1.6.1

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 (82) hide show
  1. package/README.md +149 -16
  2. package/eslint.cjs +1685 -101
  3. package/eslint.cjs.map +4 -4
  4. package/eslint.js +1766 -98
  5. package/eslint.js.map +4 -4
  6. package/lib/angular-template.d.ts +1 -2
  7. package/lib/angular-template.d.ts.map +1 -1
  8. package/lib/angular.d.ts +1 -2
  9. package/lib/angular.d.ts.map +1 -1
  10. package/lib/base.d.ts +1 -1
  11. package/lib/base.d.ts.map +1 -1
  12. package/lib/boundaries.d.ts +1 -1
  13. package/lib/boundaries.d.ts.map +1 -1
  14. package/lib/javascript.d.ts +1 -2
  15. package/lib/javascript.d.ts.map +1 -1
  16. package/lib/json.d.ts +1 -1
  17. package/lib/json.d.ts.map +1 -1
  18. package/lib/playwright.d.ts +1 -1
  19. package/lib/playwright.d.ts.map +1 -1
  20. package/lib/prettier.d.ts +1 -1
  21. package/lib/prettier.d.ts.map +1 -1
  22. package/lib/rules/explicit-accessibility/explicit-accessibility.d.ts +12 -0
  23. package/lib/rules/explicit-accessibility/explicit-accessibility.d.ts.map +1 -0
  24. package/lib/rules/explicit-accessibility/explicit-accessibility.spec.d.ts +2 -0
  25. package/lib/rules/explicit-accessibility/explicit-accessibility.spec.d.ts.map +1 -0
  26. package/lib/rules/no-inline-object-types/no-inline-object-types.d.ts +6 -0
  27. package/lib/rules/no-inline-object-types/no-inline-object-types.d.ts.map +1 -0
  28. package/lib/rules/no-inline-object-types/no-inline-object-types.spec.d.ts +2 -0
  29. package/lib/rules/no-inline-object-types/no-inline-object-types.spec.d.ts.map +1 -0
  30. package/lib/rules/no-unused-angular-instance-fields/no-unused-angular-instance-fields.fixtures.spec.d.ts +2 -0
  31. package/lib/rules/no-unused-angular-instance-fields/no-unused-angular-instance-fields.fixtures.spec.d.ts.map +1 -0
  32. package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-component-discovery.d.ts +4 -0
  33. package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-component-discovery.d.ts.map +1 -0
  34. package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-read-resolution.d.ts +5 -0
  35. package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-read-resolution.d.ts.map +1 -0
  36. package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-reads.d.ts +4 -0
  37. package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-reads.d.ts.map +1 -0
  38. package/lib/rules/no-unused-angular-instance-fields/project-usage/common/angular-index.type.d.ts +33 -0
  39. package/lib/rules/no-unused-angular-instance-fields/project-usage/common/angular-index.type.d.ts.map +1 -0
  40. package/lib/rules/no-unused-angular-instance-fields/project-usage/common/project-usage.type.d.ts +7 -0
  41. package/lib/rules/no-unused-angular-instance-fields/project-usage/common/project-usage.type.d.ts.map +1 -0
  42. package/lib/rules/no-unused-angular-instance-fields/project-usage/project-usage.d.ts +4 -0
  43. package/lib/rules/no-unused-angular-instance-fields/project-usage/project-usage.d.ts.map +1 -0
  44. package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-destructuring-reads.d.ts +4 -0
  45. package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-destructuring-reads.d.ts.map +1 -0
  46. package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-reads.d.ts +4 -0
  47. package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-reads.d.ts.map +1 -0
  48. package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-symbol-reads.d.ts +8 -0
  49. package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-symbol-reads.d.ts.map +1 -0
  50. package/lib/rules/no-unused-angular-instance-fields/project-usage/utils/spec-file.d.ts +2 -0
  51. package/lib/rules/no-unused-angular-instance-fields/project-usage/utils/spec-file.d.ts.map +1 -0
  52. package/lib/rules/no-unused-angular-instance-fields/project-usage/utils/type-property-symbols.d.ts +4 -0
  53. package/lib/rules/no-unused-angular-instance-fields/project-usage/utils/type-property-symbols.d.ts.map +1 -0
  54. package/lib/rules/no-unused-angular-instance-fields/rule/angular/angular-class-fields.d.ts +8 -0
  55. package/lib/rules/no-unused-angular-instance-fields/rule/angular/angular-class-fields.d.ts.map +1 -0
  56. package/lib/rules/no-unused-angular-instance-fields/rule/angular/angular-expression-reads.d.ts +6 -0
  57. package/lib/rules/no-unused-angular-instance-fields/rule/angular/angular-expression-reads.d.ts.map +1 -0
  58. package/lib/rules/no-unused-angular-instance-fields/rule/angular/angular-metadata-reads.d.ts +3 -0
  59. package/lib/rules/no-unused-angular-instance-fields/rule/angular/angular-metadata-reads.d.ts.map +1 -0
  60. package/lib/rules/no-unused-angular-instance-fields/rule/common/no-unused-angular-instance-fields.type.d.ts +15 -0
  61. package/lib/rules/no-unused-angular-instance-fields/rule/common/no-unused-angular-instance-fields.type.d.ts.map +1 -0
  62. package/lib/rules/no-unused-angular-instance-fields/rule/no-unused-angular-instance-fields.d.ts +9 -0
  63. package/lib/rules/no-unused-angular-instance-fields/rule/no-unused-angular-instance-fields.d.ts.map +1 -0
  64. package/lib/rules/no-unused-angular-instance-fields/rule/no-unused-instance-fields.spec.d.ts +2 -0
  65. package/lib/rules/no-unused-angular-instance-fields/rule/no-unused-instance-fields.spec.d.ts.map +1 -0
  66. package/lib/rules/no-unused-angular-instance-fields/rule/typescript/typescript-field-reads.d.ts +7 -0
  67. package/lib/rules/no-unused-angular-instance-fields/rule/typescript/typescript-field-reads.d.ts.map +1 -0
  68. package/lib/rules/readonly-type-properties/readonly-type-properties.d.ts +6 -0
  69. package/lib/rules/readonly-type-properties/readonly-type-properties.d.ts.map +1 -0
  70. package/lib/rules/readonly-type-properties/readonly-type-properties.spec.d.ts +2 -0
  71. package/lib/rules/readonly-type-properties/readonly-type-properties.spec.d.ts.map +1 -0
  72. package/lib/rxjs.d.ts +1 -1
  73. package/lib/rxjs.d.ts.map +1 -1
  74. package/lib/storybook.d.ts +1 -1
  75. package/lib/storybook.d.ts.map +1 -1
  76. package/lib/typescript.d.ts +1 -2
  77. package/lib/typescript.d.ts.map +1 -1
  78. package/lib/vitest.d.ts +1 -1
  79. package/lib/vitest.d.ts.map +1 -1
  80. package/package.json +22 -16
  81. package/lib/rules/explicit-accessibility.d.ts +0 -12
  82. package/lib/rules/explicit-accessibility.d.ts.map +0 -1
package/README.md CHANGED
@@ -62,7 +62,13 @@ export default [
62
62
  `recommended` is intentionally framework-agnostic — it ships only the language + architecture + format baseline (`base`, `javascript`, `typescript`, `json`, `boundaries`, `prettier`). Add the framework/tooling configs your project actually uses:
63
63
 
64
64
  ```js
65
- import { recommended, angular, angularTemplate, rxjs, vitest } from 'lint-suite/eslint';
65
+ import {
66
+ recommended,
67
+ angular,
68
+ angularTemplate,
69
+ rxjs,
70
+ vitest
71
+ } from 'lint-suite/eslint';
66
72
 
67
73
  export default [
68
74
  ...recommended,
@@ -77,21 +83,28 @@ export default [
77
83
 
78
84
  ## Available Configurations
79
85
 
80
- | Configuration | Description |
81
- | ------------------- | -------------------------------------------------------- |
82
- | `base` | Core JavaScript rules, formatting, and complexity limits |
83
- | `javascript` | JavaScript-specific rules via `@nx/eslint-plugin` |
84
- | `typescript` | TypeScript strict typing, imports, and naming conventions |
85
- | `angular` | Angular component best practices with Signal support |
86
- | `angularTemplate` | HTML template rules with accessibility and performance |
87
- | `rxjs` | Observable patterns, operator safety, and subscriptions |
88
- | `vitest` | Vitest testing rules and matcher improvements |
89
- | `playwright` | Playwright e2e locator and matcher best practices |
90
- | `json` | JSON linting with comment support for tsconfig/vscode |
91
- | `storybook` | Storybook CSF enforcement |
92
- | `boundaries` | Module boundary rules (feature, data-access, ui, etc.) |
93
- | `prettier` | Disables rules that conflict with Prettier (use last) |
94
- | **`recommended`** | **Baseline only: `base` + `javascript` + `typescript` + `json` + `boundaries` + `prettier` — compose the rest on top** |
86
+ | Configuration | Description |
87
+ | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
88
+ | `base` | Core JavaScript rules, formatting, and complexity limits |
89
+ | `javascript` | JavaScript-specific rules via `@nx/eslint-plugin` |
90
+ | `typescript` | TypeScript strict typing, imports, and naming conventions |
91
+ | `angular` | Angular component best practices with Signal support |
92
+ | `angularTemplate` | HTML template rules with accessibility and performance |
93
+ | `rxjs` | Observable patterns, operator safety, and subscriptions |
94
+ | `vitest` | Vitest testing rules and matcher improvements |
95
+ | `playwright` | Playwright e2e locator and matcher best practices |
96
+ | `json` | JSON linting with comment support for tsconfig/vscode |
97
+ | `storybook` | Storybook CSF enforcement |
98
+ | `boundaries` | Module boundary rules (feature, data-access, ui, etc.) |
99
+ | `prettier` | Disables rules that conflict with Prettier (use last) |
100
+ | **`recommended`** | **Baseline only: `base` + `javascript` + `typescript` + `json` + `boundaries` + `prettier` — compose the rest on top** |
101
+ | **Angular project analysis:** The `angular` preset enables `projectService: true` and project analysis for |
102
+ | `lint-suite-angular/no-unused-instance-fields`. It counts exact reads in the configured TypeScript/Angular |
103
+ | Program, including external parent templates/TypeScript, subclasses, and Angular interface implementations; |
104
+ | code outside that Program is unknowable. Project mode also reports unused public/protected directive members. |
105
+ | Direct rule usage remains local by default, and `allowEffectFields` is opt-in. After cross-file or template |
106
+ | changes, do not use ESLint `--cache` for correctness gates; run a full non-cached lint (for example, |
107
+ | `eslint --no-cache`). |
95
108
 
96
109
  ## Customization
97
110
 
@@ -111,6 +124,126 @@ export default [
111
124
  ];
112
125
  ```
113
126
 
127
+ ### Unused Angular instance fields
128
+
129
+ The `angular` config enables `lint-suite-angular/no-unused-instance-fields`.
130
+ Local analysis recognizes reads from the class, component template, and host
131
+ expressions. Use project analysis when other TypeScript files or Angular
132
+ templates can read a component or directive member:
133
+
134
+ ```js
135
+ {
136
+ files: ['**/*.ts'],
137
+ languageOptions: {
138
+ parserOptions: {
139
+ projectService: true,
140
+ tsconfigRootDir: import.meta.dirname
141
+ }
142
+ },
143
+ rules: {
144
+ 'lint-suite-angular/no-unused-instance-fields': [
145
+ 'error',
146
+ {
147
+ analysis: 'project',
148
+ allowEffectFields: true
149
+ }
150
+ ]
151
+ }
152
+ }
153
+ ```
154
+
155
+ - `analysis` defaults to `'local'`. Project mode excludes spec-file reads and
156
+ fails closed when it cannot build a reliable TypeScript or Angular index.
157
+ - `allowEffectFields` defaults to `false`. When enabled, fields holding
158
+ auto-cleaned Angular `effect()` calls are allowed; effects configured with
159
+ `manualCleanup: true` must still be read.
160
+ - Angular signal inputs, models, outputs, and query fields are always treated
161
+ as framework-managed.
162
+ - Fields typed with `ComponentRef` imported from `@angular/core` are excluded
163
+ from unused-field reports.
164
+ - In local mode, non-private members of `abstract` components and directives
165
+ are exempt: subclasses that read them live in other files. Project mode
166
+ resolves those subclass reads and reports the members normally.
167
+
168
+ ### Explicit accessibility
169
+
170
+ The `typescript` preset enables `local/explicit-accessibility`, which reports
171
+ class members (fields, methods, accessors, abstract members, and constructor
172
+ parameter properties) without an explicit `public`, `private`, or `protected`
173
+ modifier. `#private` members are ignored: TypeScript forbids a modifier there.
174
+
175
+ ```js
176
+ {
177
+ rules: {
178
+ 'local/explicit-accessibility': [
179
+ 'error',
180
+ { defaultAccessibility: 'private' }
181
+ ]
182
+ }
183
+ }
184
+ ```
185
+
186
+ - `defaultAccessibility` defaults to `public` and drives `eslint --fix`; the
187
+ IDE offers the other two levels as suggestions.
188
+ - `defaultAccessibility: 'none'` reports without an auto-fix and offers all
189
+ three levels as suggestions.
190
+ - Constructors are always fixed to `public`. A private constructor breaks
191
+ `new` and dependency injection.
192
+ - The fix does not default to `private` because members implementing an
193
+ interface or read by an Angular template must stay non-private, and the
194
+ rule cannot see either.
195
+
196
+ ### Readonly type properties
197
+
198
+ The `typescript` preset enables `local/readonly-type-properties`, which
199
+ reports primitive-typed properties in `type` aliases, interfaces, and
200
+ inline object types that are not marked `readonly`, and auto-fixes them
201
+ with `eslint --fix`. A property is primitive-typed when its annotation is
202
+ `string`, `number`, `boolean`, `bigint`, `symbol`, `null`, `undefined`, a
203
+ literal or template-literal type, or a union/intersection of those.
204
+
205
+ ```ts
206
+ // Before
207
+ type User = { name: string; roles: string[]; profile: Profile };
208
+
209
+ // After --fix
210
+ type User = { readonly name: string; roles: string[]; profile: Profile };
211
+ ```
212
+
213
+ - Arrays, object types, type references (including string-union aliases
214
+ like `Status`), functions, and tuples are left untouched because the
215
+ rule is syntactic and does not resolve types.
216
+ - Index signatures, mapped types, and method signatures are out of scope.
217
+ - Use `// eslint-disable-next-line local/readonly-type-properties` when a
218
+ property genuinely needs to stay mutable.
219
+
220
+ ### No inline object types
221
+
222
+ The `typescript` preset enables `local/no-inline-object-types`, which
223
+ reports object type literals nested inside a `type NAME = ...` alias
224
+ declaration (nested properties, array element types, union members,
225
+ intersection members, and generic arguments such as `Readonly<{...}>`).
226
+ It is not auto-fixable: extracting an inline object type requires
227
+ choosing a name.
228
+
229
+ ```ts
230
+ // Before
231
+ type LineItem = { readonly name: string; readonly item: { readonly id: string } };
232
+
233
+ // After
234
+ type Item = { readonly id: string };
235
+ type LineItem = { readonly name: string; readonly item: Item };
236
+ ```
237
+
238
+ - The direct body of a `type X = {...}` alias is allowed to be an object
239
+ literal; any object type literal nested inside that alias must reference
240
+ a named type instead.
241
+ - Positions outside a type alias — function parameters and return types,
242
+ `as`/`satisfies` expressions, generic call arguments, interface members,
243
+ and class members — are not checked by this rule.
244
+ - Declare the shape as `type Item = {...}` and reference it instead of
245
+ inlining the object type.
246
+
114
247
  ## Stylelint and Prettier presets
115
248
 
116
249
  These are standalone configs exported as subpaths — they are not part of the `recommended` ESLint array.