{"id":19992,"library":"eslint-plugin-zod","title":"eslint-plugin-zod","description":"An ESLint plugin providing custom lint rules to enforce best practices when using Zod (v3/v4). Current stable version 3.8.0, released Oct 2025, with minor releases every few weeks. Works with ESLint 9/10 and Oxlint 1.59+. Key differentiators: dedicated Zod linting, rules for schema consistency, import style, and error handling. Supports both zod and zod-mini. Ships TypeScript types.","status":"active","version":"3.8.0","language":"javascript","source_language":"en","source_url":"https://github.com/marcalexiei/eslint-plugin-zod","tags":["javascript","eslint","eslintplugin","eslint-plugin","oxlint","zod","typescript"],"install":[{"cmd":"npm install eslint-plugin-zod","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-zod","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-zod","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for core ESLint functionality","package":"eslint","optional":false},{"reason":"Peer dependency for runtime use of Zod","package":"zod","optional":false},{"reason":"Optional peer dependency for Oxlint support (v3.7.0+)","package":"oxlint","optional":true}],"imports":[{"note":"ESM-only since v3. Requires Node >=20. ESLint 9+ flat config expects default import.","wrong":"const zodPlugin = require('eslint-plugin-zod')","symbol":"plugin","correct":"import zodPlugin from 'eslint-plugin-zod'"},{"note":"Named export for accessing rule definitions programmatically.","symbol":"rules","correct":"import { rules } from 'eslint-plugin-zod'"},{"note":"Configs are nested under default export. Direct named import fails.","wrong":"import { configs } from 'eslint-plugin-zod'","symbol":"configs.recommended","correct":"import zodPlugin from 'eslint-plugin-zod';\nconst config = [zodPlugin.configs.recommended];"}],"quickstart":{"code":"// eslint.config.js\nimport zodPlugin from 'eslint-plugin-zod';\n\nexport default [\n  zodPlugin.configs.recommended,\n  {\n    rules: {\n      'zod/require-schema-suffix': ['error', { suffix: 'Schema', excludeFormattingUtils: true }],\n      'zod/prefer-string-schema-with-trim': 'error',\n    },\n  },\n];","lang":"javascript","description":"Flat config setup using the recommended config and custom rule configuration."},"warnings":[{"fix":"Migrate to ESLint 9 and use flat config format. See eslint-plugin-zod migration guide.","message":"v3 requires ESLint 9+ (flat config). ESLint 8 is not supported.","severity":"breaking","affected_versions":">=3.0"},{"fix":"Upgrade Node to v20 or later.","message":"v3 requires Node >=20. Older Node versions cause import errors.","severity":"breaking","affected_versions":">=3.0"},{"fix":"Remove or replace deprecated rule names from config.","message":"Legacy rules like 'zod/prefer-enum' are removed and may cause lint errors if still referenced.","severity":"deprecated","affected_versions":">=3.0"},{"fix":"Use eslint.config.js with flat config.","message":"Plugin does not support ESLint's .eslintrc (JSON/JS) config format; only flat config.","severity":"gotcha","affected_versions":">=3.0"},{"fix":"Review changes before applying --fix; use suggestions for manual review.","message":"Some rules (e.g., consistent-schema-output-type-style) are auto-fixable; review fixes as they may alter inferred types.","severity":"gotcha","affected_versions":">=3.8.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install eslint-plugin-zod --save-dev","cause":"Package not installed or incorrect import path.","error":"Error: Cannot find module 'eslint-plugin-zod'"},{"fix":"Update eslint-plugin-zod to >=3.5.1 or remove the option.","cause":"The 'excludeFormattingUtils' option was added in v3.5.1; older versions throw error.","error":"Configuration for rule \"zod/require-schema-suffix\" is invalid: Value {\"suffix\":\"Schema\",\"excludeFormattingUtils\":true} should NOT have additional properties."},{"fix":"Use `import zodPlugin from 'eslint-plugin-zod'` and then `zodPlugin.configs.recommended`.","cause":"Importing configs as named export instead of default.","error":"TypeError: Cannot read properties of undefined (reading 'configs')"},{"fix":"npm install zod","cause":"Missing peer dependency 'zod'.","error":"ESLint: Error: Failed to load plugin 'zod': Cannot find module 'zod'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}