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:
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
Why it's Important#
Medusa renders the default export of a 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?