1 ---
2 sidebar_label: "no-config-on-dynamic-ui-route"
3 ---
4
5 export const metadata = {
6 title: `no-config-on-dynamic-ui-route - ESLint plugin rules`,
7 }
8
9 # {metadata.title}
10
11 This rule disallows `defineRouteConfig` in dynamic UI routes, such as `[id]/page.tsx`, since they aren't added to the sidebar.
12
13 ## Severity
14
15 `warn`. This rule is enabled in the [recommended](../../page.mdx#recommended) preset.
16
17 ## What it Targets
18
19 This rule targets dynamic `page.tsx` files in your project's `src/admin/routes` directory, such as `[id]/page.tsx`. It reports a `defineRouteConfig` call in a dynamic route.
20
21 The following code is reported by the rule:
22
23 ```tsx title="src/admin/routes/products/[id]/page.tsx"
24 import { defineRouteConfig } from "@medusajs/admin-sdk"
25
26 const ProductPage = () => null
27
28 export const config = defineRouteConfig({
29 label: "Product",
30 })
31
32 export default ProductPage
33 ```
34
35 Instead, remove the `defineRouteConfig` call:
36
37 ```tsx title="src/admin/routes/products/[id]/page.tsx"
38 const ProductPage = () => null
39
40 export default ProductPage
41 ```
42
43 ## Why it's Important
44
45 Dynamic UI routes aren't added to the sidebar, so `defineRouteConfig` has no effect and Medusa warns at runtime.
46
47 Learn more in the [UI Routes documentation](!docs!/learn/fundamentals/admin/ui-routes).
48
49 ## Fixable
50
51 This rule isn't auto-fixable.
52
53 ## Turn it Off
54
55 To turn off this rule, set it to `off` in your ESLint configuration:
56
57 ```ts title="eslint.config.ts"
58 import { defineConfig } from "eslint/config"
59 import medusa from "@medusajs/eslint-plugin"
60
61 export default defineConfig([
62 ...medusa.configs.recommended,
63 {
64 rules: {
65 "@medusajs/no-config-on-dynamic-ui-route": "off",
66 },
67 },
68 ])
69 ```
70
71 Or disable it for a single line using an inline comment:
72
73 ```tsx
74 // eslint-disable-next-line @medusajs/no-config-on-dynamic-ui-route
75 export const config = defineRouteConfig({ label: "Product" })
76 ```