eslint-plugin-zod-v4 0.2.1 → 0.4.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 +29 -3
- package/dist/index.cjs +3808 -3431
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +97 -31
- package/dist/index.d.ts +97 -31
- package/dist/index.js +3808 -3431
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -22,12 +22,12 @@ npm install --save-dev eslint-plugin-zod-v4
|
|
|
22
22
|
|
|
23
23
|
## Requirements
|
|
24
24
|
|
|
25
|
-
- ESLint >= 9.0.0
|
|
26
|
-
- Node.js >=
|
|
25
|
+
- ESLint >= 9.0.0 (supports ESLint 9.x and 10.x)
|
|
26
|
+
- Node.js >= 20.19.0 (ESLint 10 requires Node 20.19+, 22.13+, or 24+)
|
|
27
27
|
|
|
28
28
|
## Usage
|
|
29
29
|
|
|
30
|
-
### ESLint 9+ (Flat Config)
|
|
30
|
+
### ESLint 9+ / 10+ (Flat Config)
|
|
31
31
|
|
|
32
32
|
```javascript
|
|
33
33
|
// eslint.config.js
|
|
@@ -81,6 +81,8 @@ These rules detect Zod v3 patterns that will break in v4.
|
|
|
81
81
|
| [no-deep-partial](docs/rules/no-deep-partial.md) | Disallow `.deepPartial()` (removed in v4). | ❌ No |
|
|
82
82
|
| [no-deprecated-ip-methods](docs/rules/no-deprecated-ip-methods.md) | Disallow `.ip()`/`.cidr()`. Use `.ipv4()`/`.ipv6()` variants. | ❌ No |
|
|
83
83
|
| [no-promise-schema](docs/rules/no-promise-schema.md) | Disallow `z.promise()`. Await before parsing. | ❌ No |
|
|
84
|
+
| [no-throw-in-refine](docs/rules/no-throw-in-refine.md) | Disallow `throw` inside `.refine()`/`.superRefine()`/`.transform()`. Use return patterns. | ❌ No |
|
|
85
|
+
| [require-enum-as-const](docs/rules/require-enum-as-const.md) | Require `as const` for arrays passed to `z.enum()`. | ❌ No |
|
|
84
86
|
|
|
85
87
|
### Best Practices (severity: warn)
|
|
86
88
|
|
|
@@ -301,6 +303,30 @@ schema.partial() // shallow only
|
|
|
301
303
|
|
|
302
304
|
## Changelog
|
|
303
305
|
|
|
306
|
+
### v0.4.0 (2026-06-21)
|
|
307
|
+
|
|
308
|
+
**ESLint 10 Compatibility:**
|
|
309
|
+
- Peer dependency updated to support both ESLint 9.x and 10.x (`"eslint": "^9.0.0 || ^10.0.0"`).
|
|
310
|
+
- Minimum Node.js bumped to `20.19.0` to match ESLint 10's engine requirements.
|
|
311
|
+
- Plugin `meta` now exposes `namespace: "zod-v4"` so the plugin resolves correctly under flat config (`--cache`, `--print-config`).
|
|
312
|
+
- Plugin `meta.version` is now in sync with the published package version.
|
|
313
|
+
- `eslint.config.js` rewritten to use `parserOptions.projectService` (recommended by `@typescript-eslint` v8) so tests and config files lint cleanly without polluting the type-aware scope.
|
|
314
|
+
- Resolved 10 transitive vulnerabilities (`npm audit fix`) in dev dependencies.
|
|
315
|
+
|
|
316
|
+
**Notes:**
|
|
317
|
+
- No rule code changes required — the plugin already used the modern flat config APIs and does not rely on any `context`/`SourceCode` methods removed in ESLint 10.
|
|
318
|
+
- Fixes a pre-existing TypeScript inference bug in `src/utils/zod-helpers.ts` (`findRootZodCall`) that surfaced under `strict` + `noUncheckedIndexedAccess`.
|
|
319
|
+
|
|
320
|
+
### v0.3.0 (2025-02-21)
|
|
321
|
+
|
|
322
|
+
**New Rules:**
|
|
323
|
+
- `no-throw-in-refine`: Detects `throw` statements inside `.refine()`, `.superRefine()`, and `.transform()` callbacks. These errors are **not captured by Zod**, causing silent failures. The rule provides educational messages with correct patterns for each method.
|
|
324
|
+
- `require-enum-as-const`: Requires `as const` for arrays passed to `z.enum()`. Without it, TypeScript infers `string[]` instead of the literal union, breaking type inference.
|
|
325
|
+
|
|
326
|
+
**Improvements:**
|
|
327
|
+
- Added 61 new test cases (276 total tests passing)
|
|
328
|
+
- Updated documentation with migration examples for new rules
|
|
329
|
+
|
|
304
330
|
### v0.2.0 (2025-12-16)
|
|
305
331
|
|
|
306
332
|
**New Features:**
|