eslint-plugin-remix-react-routes
eslint-plugin-remix-react-routes copied to clipboard
Consider `<Link relative="path">`
Currently the rules evaluate paths in relation to the route containing the element, as is the case with <Link> by default at runtime; i.e. consider a route hierarchy like so:
/accounts/$accountId/projects/$projectId
If the /projects route has a <Link to="..">, it will always point to /accounts/$accountId, even if our current path is /accounts/$accountId/projects/$projectId
<Link relative="path"> makes it relative to the current path. So in the example above, that same link with relative="path" would point to /accounts/$accountId/projects when the current path is /accounts/$accountId/projects/$projectId.
We should make the rule aware of that; we can't know what the current path will actually be, so perhaps the rule could ignore such elements by default, but also consider optionally detecting/reporting them based on an option.