zod-import-source - ESLint plugin rules
This rule requires importing Zod from @medusajs/framework/zod (Medusa v2.13+), not the bare zod package.
Severity#
warn. This rule is enabled in the recommended preset.
What it Targets#
This rule targets all files in your backend customizations. It reports imports and re-exports whose source is the bare zod package.
The following code is reported by the rule:
Instead, import from the Medusa Framework entry point:
Why it's Important#
Importing Zod from ensures you use the same Zod version Medusa relies on, avoiding version mismatches and duplicate copies in your project.
Learn more in the API route validation documentation.
Fixable#
This rule is auto-fixable. Run the linter with the --fix option to apply the fix automatically.
Turn it Off#
To turn off this rule, set it to off in your ESLint configuration:
Or disable it for a single line using an inline comment: