1 ---
2 sidebar_label: "module-name-snake-case"
3 ---
4
5 export const metadata = {
6 title: `module-name-snake-case - ESLint plugin rules`,
7 }
8
9 # {metadata.title}
10
11 This rule requires that the name passed to `Module(name, ...)` contains only alphanumeric characters and underscores.
12
13 ## Severity
14
15 `error`. This rule is enabled in the [recommended](../../page.mdx#recommended) preset.
16
17 ## What it Targets
18
19 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.
20
21 The following code is reported by the rule:
22
23 ```ts title="src/modules/blog/index.ts"
24 import { Module } from "@medusajs/framework/utils"
25 import BlogModuleService from "./service"
26
27 export default Module("my-blog", {
28 service: BlogModuleService,
29 })
30 ```
31
32 Instead, use a name with only alphanumeric characters and underscores:
33
34 ```ts title="src/modules/blog/index.ts"
35 import { Module } from "@medusajs/framework/utils"
36 import BlogModuleService from "./service"
37
38 export default Module("blog", {
39 service: BlogModuleService,
40 })
41 ```
42
43 ## Why it's Important
44
45 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.
46
47 Learn more in the [Modules documentation](!docs!/learn/fundamentals/modules).
48
49 ## Fixable
50
51 This rule isn't auto-fixable.