Repository navigation
fix(eslint-plugin): exempt /api paths from no-raw-hrefs - #73
Merged
JasonPaff merged 2 commits intoOct 2, 2026
Conversation
Links to route handlers can't be built with href(), because the route registry lists only pages, so no-raw-hrefs reported a warning with no fix. The Cadence rc trial hit this on <Link href="/api/auth/auto-signin" />. Paths under /api are now always exempt, segment-bounded like ignorePaths. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…o-route-handlers-which-href-cannot
JasonPaff
deleted the
jasonpaff/par-117-no-raw-hrefs-flags-links-to-route-handlers-which-href-cannot
branch
October 2, 2026 22:11
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the Cadence rc trial (PAR-3), the
recommendedpreset's only paramour warning wasno-raw-hrefson<Link href='/api/auth/auto-signin' />. That path is a route handler. The registry lists only pages, so the route can't be defined andhref()can't build the link. The only way to clear the warning wasignorePaths, which the docs present as a migration escape hatch.Change
/apiare always exempt. The match uses the same segment-bounded logic asignorePaths:/api,/api/…,/api?…and/api#…are exempt,/apiaryand/apis/…are not. The exemption stacks with configuredignorePaths./apiis the Pages Router's reserved API directory and the App Router convention for route handlers. The accepted cost is that a real page under/apiisn't checked. The docs say so.Reporting fewer warnings isn't a breaking change.
Verification
no-raw-hrefs.test.tscases cover/apipaths across Link, theUrlObjectpathname,router.pushandNextResponse.redirectwith no options; stacking withignorePaths; and/apiaryand/apis/v2still being reported. The six valid cases fail without the fix.pnpm test packages/eslint-plugin: 227 passed. Typecheck and lint are clean.Fixes PAR-117
🤖 Generated with Claude Code