TypeScript · security
require-zod-form-validation
eslint:require-zod-form-validation Require Zod validation (`Schema.parse(...)` / `Schema.safeParse(...)`) when reading values out of a `FormData` object.
- Default
- error
- Fix
- none
- Languages
- typescript
Why
FormData values are untrusted strings or files and need runtime validation before use.
Fix
Read the value inside a Zod schema's `parse` or `safeParse` input.
Before / after
Executed by this rule’s unit tests.
Before
Do not use a raw form value
const name = formData.get('name'); After
Validate the form value
const input = UserSchema.parse({ name: formData.get('name') }); Message IDs
missingZodValidation