Skip to content

Conversation

@mrjatinduggal
Copy link

Fixes #53473

Summary

  • update @next/next/no-html-link-for-pages to read page extensions from next.config.js or ESLint settings
  • reuse the extensions when scanning pages/app directories instead of hardcoded regexes
  • add regression tests covering custom pageExtensions scenarios

Testing

  • npm run test-unit -- test/unit/eslint-plugin-next/no-html-link-for-pages.test.ts

…k-for-pages rule

This fixes issue vercel#53473 by updating the  rule to properly recognize pages with custom  configured in  or ESLint settings.

Changes:
- Added  utility to read  from config
- Updated  and  to use dynamic extensions
- Modified rule to pass  to URL parsing functions
- Added tests for custom  from both  and ESLint settings

The rule now correctly identifies internal links to pages with custom extensions (e.g., .mdx) and flags them appropriately.
}
} else {
const dirPath = path.join(directory, dirent.name)
if (dirent.isDirectory(dirPath) && !dirent.isSymbolicLink()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The isDirectory() method on the dirent object doesn't accept any parameters. It should be called without arguments:

if (dirent.isDirectory() && !dirent.isSymbolicLink()) {

This appears to be a bug that could cause incorrect directory detection, as the current code is passing dirPath as an argument to a method that doesn't expect one.

Suggested change
if (dirent.isDirectory(dirPath) && !dirent.isSymbolicLink()) {
if (dirent.isDirectory() && !dirent.isSymbolicLink()) {

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@ijjk
Copy link
Member

ijjk commented Nov 10, 2025

Allow CI Workflow Run

  • approve CI run for commit: 4756d26

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