Skip to content

fix(eslint-plugin-next): support custom pageExtensions in no-html-link-for-pages#94082

Open
bobu-putheeckal wants to merge 1 commit into
vercel:canaryfrom
bobu-putheeckal:codex/eslint-page-extensions
Open

fix(eslint-plugin-next): support custom pageExtensions in no-html-link-for-pages#94082
bobu-putheeckal wants to merge 1 commit into
vercel:canaryfrom
bobu-putheeckal:codex/eslint-page-extensions

Conversation

@bobu-putheeckal
Copy link
Copy Markdown

What?

Make @next/next/no-html-link-for-pages respect custom settings.next.pageExtensions when discovering routes in pages and app directories.

Why?

Projects using custom page extensions such as *.page.jsx were not being recognized by the rule, so internal <a href="/"> links could be missed.

Closes #53473

How?

  • Thread configured page extensions through the route-discovery helpers.
  • Normalize leading dots in settings.next.pageExtensions.
  • Add coverage for a custom index.page.jsx route.
  • Document the setting in the ESLint config docs.

Testing

  • jest --runInBand test/unit/eslint-plugin-next/no-html-link-for-pages.test.ts
  • git diff --check
  • prettier --check on touched files

if (dirent.isDirectory(dirPath) && !dirent.isSymbolicLink()) {
res.push(...parseUrlForPages(urlprefix + dirent.name + '/', dirPath))
res.push(
...parseUrlForPages(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In parseUrlForAppDir, the recursive call for subdirectories incorrectly calls parseUrlForPages instead of parseUrlForAppDir, causing nested app directory routes to be parsed with pages-router logic.

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@next/next/no-html-link-for-pages rule does not work with pageExtensions

1 participant