Registry / web-framework / eslint-plugin-import-zod

eslint-plugin-import-zod

JSON →
library1.2.1jsnpmunverified

ESLint plugin (v1.2.1) that enforces namespace imports for zod (`import * as z from "zod"`) to improve tree-shaking and reduce bundle sizes. Targets eslint >=9 and Node >=20, ships TypeScript types. Auto-fixable: converts default/named imports to namespace imports, splits mixed imports. Released as v1.0.0 in 2025, with active development (recent patches). Unique vs other import rules: specifically for zod ecosystem.

web-frameworkllm-agentsai-mldatabasehttp-networking
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESM-only; default export. Use dynamic import if needed in CJS.

import importZod from 'eslint-plugin-import-zod'

Rule name is a string; imported plugin provides it.

import importZod from 'eslint-plugin-import-zod'; ... rules: { 'import-zod/prefer-zod-namespace': 'error' }

configs.recommended is an array of config objects.

import importZod from 'eslint-plugin-import-zod'; export default [...importZod.configs.recommended]

Sets up the plugin with recommended config and enables the prefer-zod-namespace rule in ESLint flat config.

import importZod from 'eslint-plugin-import-zod'; export default [ ...importZod.configs.recommended, { rules: { 'import-zod/prefer-zod-namespace': 'error', }, }, ];
Debug
Known footguns
gotchaPlugin does not support CommonJS; must be used in ESM context.
gotchaThe rule 'prefer-zod-namespace' auto-fixes imports by converting default imports to namespace imports; this may change module semantics.
deprecatedDeprecated pattern: import zod from 'zod' is auto-fixed to import * as zod from 'zod'.
gotchaPlugin only works with ESLint flat config (eslint.config.js), not .eslintrc.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
10 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources