module-name-snake-case - ESLint plugin rules

This rule requires that the name passed to Module(name, ...) contains only alphanumeric characters and underscores.

Severity#

error. This rule is enabled in the recommended preset.

What it Targets#

This rule targets module definition files (index.ts) in your project's src/modules directory. It reports the name passed to Module(name, ...) when it contains characters other than letters, digits, and underscores.

The following code is reported by the rule:

src/modules/blog/index.ts
1import { Module } from "@medusajs/framework/utils"2import BlogModuleService from "./service"3
4export default Module("my-blog", {5  service: BlogModuleService,6})

Instead, use a name with only alphanumeric characters and underscores:

src/modules/blog/index.ts
1import { Module } from "@medusajs/framework/utils"2import BlogModuleService from "./service"3
4export default Module("blog", {5  service: BlogModuleService,6})

Why it's Important#

The module name is used as a registration key in the Medusa container. A name with dashes, spaces, or special characters can break resolution and lead to runtime errors.

Learn more in the Modules documentation.

Fixable#

This rule isn't auto-fixable.

Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵