npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

eslint-plugin-zod

1.4.0

@gajus

npmHomeRepoSnykSocket
Downloads:647445
$ npm install eslint-plugin-zod
DailyWeeklyMonthlyYearly

eslint-plugin-zod

Canonical Code Style NPM version Twitter Follow

Zod linting rules for ESLint.

  • eslint-plugin-zod
    • Installation
    • Configuration
    • Rules
      • prefer-enum
      • require-strict

Installation

  1. Install ESLint.
  2. Install eslint-plugin-zod plugin.
npm install eslint --save-dev
npm install eslint-plugin-zod --save-dev

Configuration

  1. Add plugins section and specify eslint-plugin-zod as a plugin.
  2. 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

configurationformatdefaultdescription
allowPassthroughbooleantrueIgnores objects explicitly set to allowPassthrough().