unguard 0.11.0 → 0.12.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 +17 -0
- package/dist/{chunk-ZNOFYNU4.js → chunk-PIWZRXCI.js} +575 -152
- package/dist/chunk-PIWZRXCI.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZNOFYNU4.js.map +0 -1
package/README.md
CHANGED
|
@@ -145,9 +145,16 @@ 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` |
|
|
150
151
|
|
|
152
|
+
### State management
|
|
153
|
+
|
|
154
|
+
| Rule | Severity | What it catches |
|
|
155
|
+
| ---- | -------- | --------------- |
|
|
156
|
+
| `no-module-state-write` | warning | Function mutates a module-scope binding (`count++`, `state.ready = ...`, `cache.set(...)`) |
|
|
157
|
+
|
|
151
158
|
### Cross-file analysis
|
|
152
159
|
|
|
153
160
|
| Rule | Severity | What it catches |
|
|
@@ -165,6 +172,7 @@ These rules use the TypeScript type checker. Non-nullable types suppress the dia
|
|
|
165
172
|
| `unused-export` | info | Exported function with no usages in the project |
|
|
166
173
|
| `optional-arg-always-used` | warning | Optional param provided at every call site |
|
|
167
174
|
| `explicit-null-arg` | warning | `fn(null)` / `fn(undefined)` to project functions |
|
|
175
|
+
| `dead-overload` | warning | Overload signature with zero matching project call sites |
|
|
168
176
|
|
|
169
177
|
### Imports
|
|
170
178
|
|
|
@@ -185,6 +193,15 @@ type AnyNode = Record<string, any>;
|
|
|
185
193
|
file.ts:2:31 error Explicit `any` annotation ... (intentional escape hatch for untyped AST access)
|
|
186
194
|
```
|
|
187
195
|
|
|
196
|
+
For `warning` and `info` diagnostics, you can explicitly mark a finding as intentional with `@unguard <rule-id>` on the same line or immediately above:
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
// @unguard no-module-state-write module cache is intentional in this adapter
|
|
200
|
+
cache.set(user.id, user);
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`@unguard` never suppresses `error` diagnostics.
|
|
204
|
+
|
|
188
205
|
## API
|
|
189
206
|
|
|
190
207
|
```typescript
|