1 ---
2 sidebar_label: "ui-route-file-name-page-tsx"
3 ---
4
5 export const metadata = {
6 title: `ui-route-file-name-page-tsx - ESLint plugin rules`,
7 }
8
9 # {metadata.title}
10
11 This rule requires UI route files under `src/admin/routes` to be named `page.tsx`.
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 files in your project's `src/admin/routes` directory. It reports a file that uses `defineRouteConfig` but isn't named `page.tsx`.
20
21 The following code is reported by the rule:
22
23 ```tsx title="src/admin/routes/custom/custom.tsx"
24 import { defineRouteConfig } from "@medusajs/admin-sdk"
25
26 const CustomPage = () => <div />
27
28 export const config = defineRouteConfig({
29 label: "Custom",
30 })
31
32 export default CustomPage
33 ```
34
35 Instead, rename the file to `page.tsx`:
36
37 ```tsx title="src/admin/routes/custom/page.tsx"
38 import { defineRouteConfig } from "@medusajs/admin-sdk"
39
40 const CustomPage = () => <div />
41
42 export const config = defineRouteConfig({
43 label: "Custom",
44 })
45
46 export default CustomPage
47 ```
48
49 ## Why it's Important
50
51 Medusa only registers UI routes from files named `page.tsx`. A route defined in a differently named file won't be added to the admin dashboard.
52
53 Learn more in the [UI Routes documentation](!docs!/learn/fundamentals/admin/ui-routes).
54
55 ## Fixable
56
57 This rule isn't auto-fixable.