{"id":19799,"library":"eslint-plugin-import-zod","title":"eslint-plugin-import-zod","description":"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.","status":"active","version":"1.2.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/samchungy/eslint-plugin-import-zod","tags":["javascript","eslint","eslintplugin","eslint-plugin","zod","imports","typescript"],"install":[{"cmd":"npm install eslint-plugin-import-zod","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-import-zod","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-import-zod","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to run the plugin","package":"eslint","optional":false},{"reason":"peer dependency for TypeScript utility functions","package":"@typescript-eslint/utils","optional":false}],"imports":[{"note":"ESM-only; default export. Use dynamic import if needed in CJS.","wrong":"const importZod = require('eslint-plugin-import-zod')","symbol":"importZod","correct":"import importZod from 'eslint-plugin-import-zod'"},{"note":"Rule name is a string; imported plugin provides it.","wrong":"Use with require(): const importZod = require('eslint-plugin-import-zod')","symbol":"prefer-zod-namespace","correct":"import importZod from 'eslint-plugin-import-zod'; ... rules: { 'import-zod/prefer-zod-namespace': 'error' }"},{"note":"configs.recommended is an array of config objects.","wrong":"Using flat config array without spreading","symbol":"configs.recommended","correct":"import importZod from 'eslint-plugin-import-zod'; export default [...importZod.configs.recommended]"}],"quickstart":{"code":"import importZod from 'eslint-plugin-import-zod';\n\nexport default [\n  ...importZod.configs.recommended,\n  {\n    rules: {\n      'import-zod/prefer-zod-namespace': 'error',\n    },\n  },\n];","lang":"javascript","description":"Sets up the plugin with recommended config and enables the prefer-zod-namespace rule in ESLint flat config."},"warnings":[{"fix":"Use import syntax or configure ESLint as ESM.","message":"Plugin does not support CommonJS; must be used in ESM context.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Review auto-fix changes; namespace import may affect type inference.","message":"The rule 'prefer-zod-namespace' auto-fixes imports by converting default imports to namespace imports; this may change module semantics.","severity":"gotcha","affected_versions":">=1.2.0"},{"fix":"Use namespace import directly.","message":"Deprecated pattern: import zod from 'zod' is auto-fixed to import * as zod from 'zod'.","severity":"deprecated","affected_versions":">=1.2.0"},{"fix":"Migrate to flat config or wrap plugin with compatibility layer.","message":"Plugin only works with ESLint flat config (eslint.config.js), not .eslintrc.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'20':34 '2025':54 '9':31 'activ':56 'auto':39 'auto-fix':38 'bundl':27 'convert':41 'default/named':42 'develop':57 'ecosystem':68 'enforc':10 'eslint':2,6,30,70,73 'eslint-plugin':72 'eslint-plugin-import-zod':1 'eslintplugin':71 'fixabl':40 'import':4,12,15,43,46,49,63,76 'improv':21 'javascript':69 'mix':48 'namespac':11,45 'node':33 'patch':59 'plugin':3,7,74 'recent':58 'reduc':26 'releas':50 'rule':64 'shake':24 'ship':35 'size':28 'specif':65 'split':47 'target':29 'tree':23 'tree-shak':22 'type':37 'typescript':36,77 'uniqu':60 'v1.0.0':52 'v1.2.1':8 'vs':61 'z':17 'zod':5,14,19,67,75","created_at":"2026-04-25T11:19:43.386270+00:00","updated_at":"2026-04-25T11:19:43.386270+00:00","problems":[{"fix":"npm install -D eslint-plugin-import-zod and ensure ESLint is running in ESM mode.","cause":"Package not installed or module resolution fails in CJS","error":"Error: Cannot find module 'eslint-plugin-import-zod'"},{"fix":"Change to dynamic import: const importZod = (await import('eslint-plugin-import-zod')).default;","cause":"Using require() in CJS context","error":"TypeError: importZod is not a function or config"},{"fix":"Use flat config and import the plugin directly, not via string name.","cause":"ESLint cannot resolve plugin due to wrong config format","error":"Error: Failed to load plugin 'import-zod' declared in 'plugins': Cannot find module 'eslint-plugin-import-zod'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/samchungy/eslint-plugin-import-zod","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-import-zod","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","llm-agents","ai-ml","database","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}