eslint-plugin-zod-v4 0.2.1 → 0.3.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 +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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,16 @@ schema.partial() // shallow only
|
|
|
301
303
|
|
|
302
304
|
## Changelog
|
|
303
305
|
|
|
306
|
+
### v0.3.0 (2025-02-21)
|
|
307
|
+
|
|
308
|
+
**New Rules:**
|
|
309
|
+
- `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.
|
|
310
|
+
- `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.
|
|
311
|
+
|
|
312
|
+
**Improvements:**
|
|
313
|
+
- Added 61 new test cases (276 total tests passing)
|
|
314
|
+
- Updated documentation with migration examples for new rules
|
|
315
|
+
|
|
304
316
|
### v0.2.0 (2025-12-16)
|
|
305
317
|
|
|
306
318
|
**New Features:**
|