Socket
Book a DemoInstallSign in
Socket

eslint-plugin-zod-x

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-zod-x

ESLint plugin that adds custom linting rules to enforce best practices when using Zod

latest
Source
npmnpm
Version
1.8.0
Version published
Weekly downloads
4K
-8.06%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-zod-x

CI Code style: prettier Lint: eslint npm version issues

ESLint plugin that adds custom linting rules to enforce best practices when using Zod

Rules

💼 Configurations enabled in.
✅ Set in the recommended configuration.
🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.

Name                            Description💼🔧💡
array-styleEnforce consistent Zod array style🔧
consistent-import-sourceEnforce consistent source from Zod imports
no-anyDisallow usage of z.any() in Zod schemas💡
no-empty-custom-schemaDisallow usage of z.custom() without arguments
no-number-schema-with-intDisallow usage of z.number().int() as it is considered legacy🔧
no-optional-and-default-togetherDisallow using both .optional() and .default() on the same Zod schema🔧
no-throw-in-refineDisallow throwing errors directly inside Zod refine callbacks
prefer-metaEnforce usage of .meta() over .describe()🔧
prefer-meta-lastEnforce .meta() as last method🔧
prefer-namespace-importEnforce importing zod as a namespace import (import * as z from 'zod')🔧
prefer-strict-objectEnforce usage of .strictObject() over .object() and/or .looseObject()
require-brand-type-parameterRequire type parameter on .brand() functions💡
require-error-messageEnforce that custom refinements include an error message🔧
require-schema-suffixRequire schema suffix when declaring a Zod schema🔧
schema-error-property-styleEnforce consistent style for error messages in Zod schema validation (using ESQuery patterns)

Installation

Install eslint and eslint-plugin-zod-x using your preferred package manager:

npm i --save-dev eslint eslint-plugin-zod-x
yarn add --dev eslint eslint-plugin-zod-x
pnpm add --save-dev eslint eslint-plugin-zod-x

Configuration

  • Import the plugin

    import eslintPluginZodX from 'eslint-plugin-zod-x';
    
  • Add recommended config to your ESLint setup

    eslintPluginZodX.configs.recommended,
    

Here’s a minimal example using the flat config format:

// eslint.config.js
import { defineConfig } from 'eslint/config';
import eslint from '@eslint/js';
import eslintPluginZodX from 'eslint-plugin-zod-x';

export default defineConfig(
  eslint.configs.recommended,
  eslintPluginZodX.configs.recommended,
);

Keywords

eslint

FAQs

Package last updated on 09 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts