vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.09k stars 26.72k forks source link

v14 npm run lint (eslint+typescript) Not implemented correctly #68868

Open cjg1122 opened 1 month ago

cjg1122 commented 1 month ago

Link to the code that reproduces this issue

To Reproduce

https://github.com/user-attachments/assets/9e7b3fe0-5e20-42fa-bf9d-59b21448b361

codesandbox

Current vs. Expected behavior

Running npm run lint should prompt an error or warning doc: https://nextjs.org/docs/app/building-your-application/configuring/eslint#typescript

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: 1.22.19
  pnpm: 8.15.4
Relevant Packages:
  next: 14.2.1 // There is a newer version (14.2.5) available, upgrade recommended! 
  eslint-config-next: 14.2.1
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

create-next-app

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

samcx commented 1 month ago

@cjg1122 Thank you for submitting an issue!

Tough to say if this was ever the intention with next lint — but I'm sure you can extend the existing linting to catch this.

cjg1122 commented 1 month ago

@samcx The documentation mentions ‘next/typescript’ but ‘v14.2.5’ doesn't implement it. I found that ‘canary’ implements this ‘next/typescript’.

https://github.com/vercel/next.js/blob/canary/packages/eslint-config-next/typescript.js

samcx commented 1 month ago

@cjg1122 I can confirm that on the latest canary, next lint doesn't catch that. next build does though, via Webpack.

Adding the relevant PR to our backport for the next v14 minor release.