1.4.0 • Published 3 years ago
eslint-plugin-zod v1.4.0
eslint-plugin-zod
Zod linting rules for ESLint.
Installation
- Install ESLint.
- Install
eslint-plugin-zodplugin.
npm install eslint --save-dev
npm install eslint-plugin-zod --save-dev
Configuration
- Add
pluginssection and specifyeslint-plugin-zodas a plugin. - Enable rules.
{
"plugins": [
"zod"
],
"rules": {
"zod/prefer-enum": 2,
"zod/require-strict": 2
}
}
Rules
prefer-enum
The --fix option on the command line automatically fixes problems reported by this rule.
Prefers z.enum over a union of literals.
require-strict
The --fix option on the command line automatically fixes problems reported by this rule.
Requires that objects are initialized with .strict().
Options
| configuration | format | default | description |
|---|---|---|---|
allowPassthrough | boolean | true | Ignores objects explicitly set to allowPassthrough(). |