Skip to content
New issue

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

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

Already on GitHub? # to your account

upgrade to @typescript-eslint/parser v6 in eslint-config-next #52890

Closed
1 task done
yf-yang opened this issue Jul 19, 2023 · 4 comments
Closed
1 task done

upgrade to @typescript-eslint/parser v6 in eslint-config-next #52890

yf-yang opened this issue Jul 19, 2023 · 4 comments
Labels
bug Issue was opened via the bug report template. Linting Related to `next lint` or ESLint with Next.js. locked

Comments

@yf-yang
Copy link

yf-yang commented Jul 19, 2023

Verify canary release

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

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Tue Jul 11 08:42:52 UTC 2023
    Binaries:
      Node: 18.16.1
      npm: 9.5.1
      Yarn: 1.22.19
      pnpm: 8.6.7
    Relevant Packages:
      next: 13.4.10
      eslint-config-next: 13.4.10
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A

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

ESLint (eslint-config-next)

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

nope

To Reproduce

nope

Describe the Bug

I am using next as one repo of a monorepo, so for all of them I am using a global typescript eslint dependency. After upgrading typescript eslint to v6 (both rules and parser), other repos are working as expected, but next repo is corrupt because when computing one of the rule

TypeError: services.getTypeAtLocation is not a function

If I got it right, it is related to an API breaking change. Therefore, I check @typescript-eslint/parser's version, it is 5.62 in next repo, but it is 6.1 in other repos.

Therefore, maybe the problem is eslint-config-next's dependency, which is still ^5.42

Expected Behavior

Successfully run @typescript-eslint v6 plugin

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@yf-yang yf-yang added the bug Issue was opened via the bug report template. label Jul 19, 2023
@balazsorban44 balazsorban44 added the Linting Related to `next lint` or ESLint with Next.js. label Jul 19, 2023
@balazsorban44
Copy link
Member

Thanks, you can follow this PR for updates: #52848

@cjkihl
Copy link

cjkihl commented Jul 30, 2023

In the meanwhile, if you're using PNPM, you can use PNPM overrides to force using version 6.2.0:
Add to your package.json:

 "pnpm": {
    "overrides": {
      "@typescript-eslint/parser": "6.2.0"
    }
  }

Then run pnpm install again

@kachkaev
Copy link
Contributor

Upgrading to eslint-config-next@13.4.13 also helps. Here is the output of pnpm why @typescript-eslint/parser:

Before

devDependencies:
@typescript-eslint/eslint-plugin 6.2.0
└── @typescript-eslint/parser 6.2.1 peer
eslint-config-next 13.4.12
├── @typescript-eslint/parser 5.62.0
├─┬ eslint-import-resolver-typescript 3.5.5
│ ├─┬ eslint-module-utils 2.8.0
│ │ └── @typescript-eslint/parser 5.62.0 peer
│ └─┬ eslint-plugin-import 2.28.0 peer
│   ├── @typescript-eslint/parser 5.62.0 peer
│   └─┬ eslint-module-utils 2.8.0
│     └── @typescript-eslint/parser 5.62.0 peer
└─┬ eslint-plugin-import 2.28.0
  ├── @typescript-eslint/parser 5.62.0 peer
  └─┬ eslint-module-utils 2.8.0
    └── @typescript-eslint/parser 5.62.0 peer
eslint-plugin-import 2.28.0
├── @typescript-eslint/parser 6.2.1 peer
└─┬ eslint-module-utils 2.8.0
  └── @typescript-eslint/parser 6.2.1 peer
eslint-plugin-unused-imports 3.0.0
└─┬ @typescript-eslint/eslint-plugin 6.2.0 peer
  └── @typescript-eslint/parser 6.2.1 peer

After

devDependencies:
@typescript-eslint/eslint-plugin 6.2.0
└── @typescript-eslint/parser 6.2.1 peer
eslint-config-next 13.4.13
├── @typescript-eslint/parser 6.2.1
├─┬ eslint-import-resolver-typescript 3.5.5
│ ├─┬ eslint-module-utils 2.8.0
│ │ └── @typescript-eslint/parser 6.2.1 peer
│ └─┬ eslint-plugin-import 2.28.0 peer
│   ├── @typescript-eslint/parser 6.2.1 peer
│   └─┬ eslint-module-utils 2.8.0
│     └── @typescript-eslint/parser 6.2.1 peer
└─┬ eslint-plugin-import 2.28.0
  ├── @typescript-eslint/parser 6.2.1 peer
  └─┬ eslint-module-utils 2.8.0
    └── @typescript-eslint/parser 6.2.1 peer
eslint-plugin-import 2.28.0
├── @typescript-eslint/parser 6.2.1 peer
└─┬ eslint-module-utils 2.8.0
  └── @typescript-eslint/parser 6.2.1 peer
eslint-plugin-unused-imports 3.0.0
└─┬ @typescript-eslint/eslint-plugin 6.2.0 peer
  └── @typescript-eslint/parser 6.2.1 peer

(@typescript-eslint/parser 5.62.0 is gone)

What’s odd is that the problem with the parser only occurred for one developer in our team. Seems to be something to do with non-deterministic hoisting in pnpm.

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Issue was opened via the bug report template. Linting Related to `next lint` or ESLint with Next.js. locked
Projects
None yet
Development

No branches or pull requests

4 participants