ESLint Plugin Router could report route components only returning <Outlet /> as unnecessary #7360
ulrichstark
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
ESLint Plugin Router could report route components only returning
<Outlet />as unnecessary. Because declaring a route component that only returns<Outlet />is the same as declaring no route component as far as I understand. We had this a few times in our code base as a leftover after refactoring or artifact of AI. We use routes without components to propagate shared logic or values to the route context of child routes.Having such a rule would reduce unnecessary code and make routes easier to understand as a result. If there's interest in my idea, I can work on it.
export const Route = createFileRoute("/_authed/_employee")({ beforeLoad: ({ context }) => ({ isSupportOrAdmin: doesUserHaveRoleOrIsAdmin(context.authenticatedUser, "support"), }), - component: RouteComponent, }); - function RouteComponent() { - return <Outlet />; - }export const Route = createFileRoute("/_authed/_employee")({ beforeLoad: ({ context }) => ({ isSupportOrAdmin: doesUserHaveRoleOrIsAdmin(context.authenticatedUser, "support"), }), - component: Outlet, });Beta Was this translation helpful? Give feedback.
All reactions