Skip to content

Support pageExtensions in no-html-link-for-pages eslint rule#91094

Open
boris324 wants to merge 1 commit intovercel:canaryfrom
boris324:fix/eslint-page-extensions
Open

Support pageExtensions in no-html-link-for-pages eslint rule#91094
boris324 wants to merge 1 commit intovercel:canaryfrom
boris324:fix/eslint-page-extensions

Conversation

@boris324
Copy link

@boris324 boris324 commented Mar 9, 2026

Fixes #53473

The no-html-link-for-pages ESLint rule currently has hardcoded file extension matching (tsx, ts, jsx, js) in the URL parsing functions. This means projects using custom pageExtensions (like mdx) in their Next.js config have those pages silently ignored by the lint rule.

This PR makes the internal parseUrlForPages and parseUrlForAppDir functions accept an optional pageExtensions parameter, building the file extension regex dynamically instead of using the hardcoded pattern. The rule reads pageExtensions from context.settings.next (same pattern used by getRootDirs for rootDir) and passes it through.

Users can configure it in their ESLint config:

{
  "settings": {
    "next": {
      "pageExtensions": ["tsx", "ts", "jsx", "js", "mdx"]
    }
  }
}

When not configured, defaults to the original ["tsx", "ts", "jsx", "js"] behavior.

Added tests covering custom page extensions detection and the default fallback behavior.

@nextjs-bot
Copy link
Collaborator

Allow CI Workflow Run

  • approve CI run for commit: 7db932d

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

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

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

2 participants