lint-suite 1.6.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.
- package/README.md +149 -16
- package/eslint.cjs +1137 -132
- package/eslint.cjs.map +4 -4
- package/eslint.js +1205 -132
- package/eslint.js.map +4 -4
- package/lib/angular.d.ts.map +1 -1
- package/lib/rules/explicit-accessibility/explicit-accessibility.d.ts +12 -0
- package/lib/rules/explicit-accessibility/explicit-accessibility.d.ts.map +1 -0
- package/lib/rules/explicit-accessibility/explicit-accessibility.spec.d.ts +2 -0
- package/lib/rules/explicit-accessibility/explicit-accessibility.spec.d.ts.map +1 -0
- package/lib/rules/no-inline-object-types/no-inline-object-types.d.ts +6 -0
- package/lib/rules/no-inline-object-types/no-inline-object-types.d.ts.map +1 -0
- package/lib/rules/no-inline-object-types/no-inline-object-types.spec.d.ts +2 -0
- package/lib/rules/no-inline-object-types/no-inline-object-types.spec.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/no-unused-angular-instance-fields.fixtures.spec.d.ts +2 -0
- package/lib/rules/no-unused-angular-instance-fields/no-unused-angular-instance-fields.fixtures.spec.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-component-discovery.d.ts +4 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-component-discovery.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-read-resolution.d.ts +5 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-read-resolution.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-reads.d.ts +4 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-reads.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/common/angular-index.type.d.ts +33 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/common/angular-index.type.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/common/project-usage.type.d.ts +7 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/common/project-usage.type.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/project-usage.d.ts +4 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/project-usage.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-destructuring-reads.d.ts +4 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-destructuring-reads.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-reads.d.ts +4 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-reads.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-symbol-reads.d.ts +8 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-symbol-reads.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/utils/spec-file.d.ts +2 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/utils/spec-file.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/utils/type-property-symbols.d.ts +4 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/utils/type-property-symbols.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/{angular-class-fields.d.ts → rule/angular/angular-class-fields.d.ts} +3 -3
- package/lib/rules/no-unused-angular-instance-fields/rule/angular/angular-class-fields.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/{utils/angular-expression-reads.util.d.ts → rule/angular/angular-expression-reads.d.ts} +1 -1
- package/lib/rules/no-unused-angular-instance-fields/rule/angular/angular-expression-reads.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/rule/angular/angular-metadata-reads.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/{common → rule/common}/no-unused-angular-instance-fields.type.d.ts +5 -0
- package/lib/rules/no-unused-angular-instance-fields/rule/common/no-unused-angular-instance-fields.type.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/rule/no-unused-angular-instance-fields.d.ts +9 -0
- package/lib/rules/no-unused-angular-instance-fields/rule/no-unused-angular-instance-fields.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/rule/no-unused-instance-fields.spec.d.ts.map +1 -0
- package/lib/rules/no-unused-angular-instance-fields/{utils/typescript-field-reads.util.d.ts → rule/typescript/typescript-field-reads.d.ts} +1 -1
- package/lib/rules/no-unused-angular-instance-fields/rule/typescript/typescript-field-reads.d.ts.map +1 -0
- package/lib/rules/readonly-type-properties/readonly-type-properties.d.ts +6 -0
- package/lib/rules/readonly-type-properties/readonly-type-properties.d.ts.map +1 -0
- package/lib/rules/readonly-type-properties/readonly-type-properties.spec.d.ts +2 -0
- package/lib/rules/readonly-type-properties/readonly-type-properties.spec.d.ts.map +1 -0
- package/lib/typescript.d.ts.map +1 -1
- package/package.json +8 -3
- package/lib/rules/explicit-accessibility.d.ts +0 -12
- package/lib/rules/explicit-accessibility.d.ts.map +0 -1
- package/lib/rules/no-unused-angular-instance-fields/angular-class-fields.d.ts.map +0 -1
- package/lib/rules/no-unused-angular-instance-fields/angular-metadata-reads.d.ts.map +0 -1
- package/lib/rules/no-unused-angular-instance-fields/common/no-unused-angular-instance-fields.type.d.ts.map +0 -1
- package/lib/rules/no-unused-angular-instance-fields/no-unused-angular-instance-fields.d.ts +0 -7
- package/lib/rules/no-unused-angular-instance-fields/no-unused-angular-instance-fields.d.ts.map +0 -1
- package/lib/rules/no-unused-angular-instance-fields/no-unused-instance-fields.spec.d.ts.map +0 -1
- package/lib/rules/no-unused-angular-instance-fields/utils/angular-expression-reads.util.d.ts.map +0 -1
- package/lib/rules/no-unused-angular-instance-fields/utils/typescript-field-reads.util.d.ts.map +0 -1
- /package/lib/rules/no-unused-angular-instance-fields/{angular-metadata-reads.d.ts → rule/angular/angular-metadata-reads.d.ts} +0 -0
- /package/lib/rules/no-unused-angular-instance-fields/{no-unused-instance-fields.spec.d.ts → rule/no-unused-instance-fields.spec.d.ts} +0 -0
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 {
|
|
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
|
|
81
|
-
|
|
|
82
|
-
| `base`
|
|
83
|
-
| `javascript`
|
|
84
|
-
| `typescript`
|
|
85
|
-
| `angular`
|
|
86
|
-
| `angularTemplate`
|
|
87
|
-
| `rxjs`
|
|
88
|
-
| `vitest`
|
|
89
|
-
| `playwright`
|
|
90
|
-
| `json`
|
|
91
|
-
| `storybook`
|
|
92
|
-
| `boundaries`
|
|
93
|
-
| `prettier`
|
|
94
|
-
| **`recommended`**
|
|
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.
|