www/apps/resources/app/lint/rules/ui-route-must-have-default-export/page.mdx
export const metadata = {
title: ui-route-must-have-default-export - ESLint plugin rules,
}
This rule requires UI route page files to default-export the React component.
error. This rule is enabled in the recommended preset.
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:
import { defineRouteConfig } from "@medusajs/admin-sdk"
const CustomPage = () => <>Custom</>
export const config = defineRouteConfig({
label: "Custom",
})
export { CustomPage }
Instead, default-export the React component:
import { defineRouteConfig } from "@medusajs/admin-sdk"
const CustomPage = () => <>Custom</>
export const config = defineRouteConfig({
label: "Custom",
})
export default CustomPage
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.
This rule isn't auto-fixable.