www/apps/resources/app/lint/rules/module-name-snake-case/page.mdx
export const metadata = {
title: module-name-snake-case - ESLint plugin rules,
}
This rule requires that the name passed to Module(name, ...) contains only alphanumeric characters and underscores.
error. This rule is enabled in the recommended preset.
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:
import { Module } from "@medusajs/framework/utils"
import BlogModuleService from "./service"
export default Module("my-blog", {
service: BlogModuleService,
})
Instead, use a name with only alphanumeric characters and underscores:
import { Module } from "@medusajs/framework/utils"
import BlogModuleService from "./service"
export default Module("blog", {
service: BlogModuleService,
})
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.
This rule isn't auto-fixable.