ui-route-must-have-default-export - ESLint plugin rules

This rule requires UI route page files to default-export the React component.

Severity#

error. This rule is enabled in the recommended preset.

What it Targets#

This rule targets page.tsx files in your project's src/admin/routes directory. It reports a UI route file that doesn't have a default export.

The following code is reported by the rule:

src/admin/routes/custom/page.tsx
1import { defineRouteConfig } from "@medusajs/admin-sdk"2
3const CustomPage = () => <>Custom</>4
5export const config = defineRouteConfig({6  label: "Custom",7})8
9export { CustomPage }

Instead, default-export the React component:

src/admin/routes/custom/page.tsx
1import { defineRouteConfig } from "@medusajs/admin-sdk"2
3const CustomPage = () => <>Custom</>4
5export const config = defineRouteConfig({6  label: "Custom",7})8
9export default CustomPage

Why it's Important#

Medusa renders the default export of a page.tsx file as the route's page. Without a default export, the route has no component to render.

Learn more in the UI Routes 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
⇧↵