unguard 0.12.0 → 0.13.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.
- package/README.md +18 -0
- package/dist/{chunk-HE647T6E.js → chunk-KNKWDZ6H.js} +1707 -1259
- package/dist/chunk-KNKWDZ6H.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-HE647T6E.js.map +0 -1
package/README.md
CHANGED
|
@@ -145,8 +145,17 @@ These rules use the TypeScript type checker. Non-nullable types suppress the dia
|
|
|
145
145
|
|
|
146
146
|
| Rule | Severity | What it catches |
|
|
147
147
|
| ---- | -------- | --------------- |
|
|
148
|
+
| `no-inline-param-type` | warning | `(params: { id: string; ... })` — inline object type on parameter |
|
|
148
149
|
| `prefer-default-param-value` | info | Optional param reassigned with `??` in the body |
|
|
149
150
|
| `prefer-required-param-with-guard` | info | `arg?: T` followed by `if (!arg) throw` |
|
|
151
|
+
| `repeated-literal-property` | warning | Same literal value (`as const`: 3+, plain: 5+) repeated in object properties within a file |
|
|
152
|
+
| `repeated-return-shape` | warning | 3+ functions return object literals with the same property name set |
|
|
153
|
+
|
|
154
|
+
### State management
|
|
155
|
+
|
|
156
|
+
| Rule | Severity | What it catches |
|
|
157
|
+
| ---- | -------- | --------------- |
|
|
158
|
+
| `no-module-state-write` | warning | Function mutates a module-scope binding (`count++`, `state.ready = ...`, `cache.set(...)`) |
|
|
150
159
|
|
|
151
160
|
### Cross-file analysis
|
|
152
161
|
|
|
@@ -186,6 +195,15 @@ type AnyNode = Record<string, any>;
|
|
|
186
195
|
file.ts:2:31 error Explicit `any` annotation ... (intentional escape hatch for untyped AST access)
|
|
187
196
|
```
|
|
188
197
|
|
|
198
|
+
For `warning` and `info` diagnostics, you can explicitly mark a finding as intentional with `@unguard <rule-id>` on the same line or immediately above:
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
// @unguard no-module-state-write module cache is intentional in this adapter
|
|
202
|
+
cache.set(user.id, user);
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`@unguard` never suppresses `error` diagnostics.
|
|
206
|
+
|
|
189
207
|
## API
|
|
190
208
|
|
|
191
209
|
```typescript
|