Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@next/next/no-html-link-for-pages doesn't work with app router #51742

Closed
1 task done
osdiab opened this issue Jun 24, 2023 · 6 comments · Fixed by #68770
Closed
1 task done

@next/next/no-html-link-for-pages doesn't work with app router #51742

osdiab opened this issue Jun 24, 2023 · 6 comments · Fixed by #68770
Labels
bug Issue was opened via the bug report template. good first issue Easy to fix issues, good for newcomers

Comments

@osdiab
Copy link

osdiab commented Jun 24, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.12.1
      npm: 8.19.2
      Yarn: 1.22.19
      pnpm: 8.6.2
    Relevant packages:
      next: 13.4.7
      eslint-config-next: 13.4.7
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.3

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://github.com/osdiab/next-eslint-repro-links/blob/main/src/app/page.js#L13

To Reproduce

  • set up next app
  • make an about page
  • add a link to the index page to the /about page with an <a /> tag
  • run next lint
  • no error shows up

Describe the Bug

I expect from the description of the lint rule that if i use an <a /> tag where I should be using a <Link /> tag for an internal link, it would tell me that i should use <Link /> instead.

Expected Behavior

It should show a lint error

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@osdiab osdiab added the bug Issue was opened via the bug report template. label Jun 24, 2023
@shuding shuding added the good first issue Easy to fix issues, good for newcomers label Jun 25, 2023
@DerTimonius
Copy link
Contributor

I'd like to take a look into this!

@Nick-surferboy
Copy link

Can you assign it to me please ?

@maanil17
Copy link

can you assign it to me?

@Gabby-Codes25
Copy link

I'll love to check this out

@Aperrix
Copy link

Aperrix commented Oct 21, 2023

hi everyone, any news ?

@abhiyadav05
Copy link

Hello sir can you assign it to me

ijjk added a commit that referenced this issue Sep 17, 2024
supersedes #51783 
## What
This PR fixes the issue of `<a>` tags for internal routing not being
caught by linting in the app directory.

## Why
The linting of the html links should be consistent across pages and app
directories.

## How
- Added a new function to parse the URLs in the appDir (since it's a bit
different from the /pages directory)
- Lint now checks against pagesUrls and appUrls
- Added tests for the appDir in the no-html-link-for-pages test file

fixes #51742

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. good first issue Easy to fix issues, good for newcomers
Projects
None yet
8 participants