TypeScript · style
zod-naming-convention
eslint:zod-naming-convention Enforce a consistent Zod schema naming convention — a `Z` prefix (`ZUser`) or a `Schema` suffix (`userSchema`); both are accepted by default.
- Default
- error
- Fix
- none
- Languages
- typescript
Why
A recognizable schema name distinguishes runtime validators from ordinary values at each use site.
Fix
Rename the schema with a `Z` prefix or `Schema` suffix, according to the configured convention.
Before / after
Executed by this rule’s unit tests.
Before
Do not hide the schema behind a value name
import { z } from 'zod';
const user = z.object({ id: z.string() }); After
Mark the value as a schema
import { z } from 'zod';
const userSchema = z.object({ id: z.string() }); Message IDs
schemaSuffixzPrefixzodSchemaName