fix(no-navigation-without-resolve): do not report parent-directory relative urls in anchor links
#1383
Pull request
updated (without refactor): #1383 (comment)
⚠️ No Changeset found
Latest commit: e1e1eca
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Hi, thank you for the PR, however, I think this has mostly been superseded by #1476 and can be closed, right?
nice one, appreciate the big refactor @marekdedic it's better than my attempt + sorry for my bad etiquette, I got carried away with the refactor originally when trying to introduce this change, didn't provide background as to why parent-directory relative urls present an issue, and took 6 months to circle back 🫣
I've just rebased this branch, removes any refactor and now just adds an allowed case for (i.e. <a href="../"> along with test fixtures
without this change we report these urls to be unexpected without resolve()
attempting to wrap <a href="../"> as <a href={resolve("../")}> changes the output from "../" to "/./" and breaks the link
without using resolve() these urls pass through and are also unaffected in SSR - they might be ignored intentionally
an example of where you might use this url structure: say you have a blog on example.com/blog/ and posts are on example.com/blog/first-post/ etc, then to decouple the layout for posts from your routes you can use <a href="../"> on a post instead of <a href="/blog/"> to go back up to view all posts, which avoids having to find-and-replace all root-level links if you moved the route from /blog to /articles
a simple example but the problem compounds in more complex route hierarchies
Thanks for the rebase.
I am not sure that your proposal is sound in that a relative navigation (href="../") is not guaranteed to be internal and valid. It may be (such as in your example), but it may also not be (depending on the depth of the route and the href). In your example, I don't really see a big benefit of using relative paths (it looks neater, but is more fragile).
Also, I don't want to beat you with process too much, but I think next time creating an issue first (and having this discussion making it more precise) and only then opening a PR is the preferred way.
@baseballyama I think the whole PR is unsound (in that it isn't safe to do at all), your example notwithstanding.
I’ve moved away from this rule tbh, the URL spec is complex, and it’s hard for one maintainer to decide which parts are safe to support
will close and leave for someone else to raise an issue (which I should've done firstly!) for discussion if still needed
fix(no-navigation-without-resolve): do not report parent-directory relative urls in anchor links
• Sep 26, 2025, 10:06 PM