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

Nextjs 13.4.9 - ESLint couldn't determine the plugin "react-hooks" uniquely. #52365

Closed
1 task done
belgattitude opened this issue Jul 6, 2023 · 8 comments · Fixed by #53751
Closed
1 task done

Nextjs 13.4.9 - ESLint couldn't determine the plugin "react-hooks" uniquely. #52365

belgattitude opened this issue Jul 6, 2023 · 8 comments · Fixed by #53751
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. Linting Related to `next lint` or ESLint with Next.js. locked

Comments

@belgattitude
Copy link
Contributor

belgattitude commented Jul 6, 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: #47~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jun 21 15:35:31 UTC 2
    Binaries:
      Node: 18.16.0
      npm: 9.5.1
      Yarn: N/A
      pnpm: 8.6.6
    Relevant Packages:
      next: 13.4.9
      eslint-config-next: 13.4.9
      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

belgattitude/artist#7

To Reproduce

See belgattitude/artist#7 and https://github.com/belgattitude/artist/actions/runs/5480794201/jobs/9984365681?pr=7

git clone -b nextjs-reprod-eslint-react-hooks --single-branch https://github.com/belgattitude/artist.git
cd artist
corepack enable && pnpm install
cd apps/web
pnpm lint

image

pnpm why -r eslint-plugin-react-hooks
artist-monorepo /home/sebastien/github/artist

devDependencies:
@belgattitude/eslint-config-bases 1.35.1
└── eslint-plugin-react-hooks 4.6.0

web@0.1.0 /home/sebastien/github/artist/apps/web

devDependencies:
@belgattitude/eslint-config-bases 1.35.1
└── eslint-plugin-react-hooks 4.6.0
eslint-config-next 13.4.9
└── eslint-plugin-react-hooks 5.0.0-canary-7118f5dd7-20230705

artist-strapi-api@0.1.0 /home/sebastien/github/artist/packages/strapi-api

devDependencies:
@belgattitude/eslint-config-bases 1.35.1
└── eslint-plugin-react-hooks 4.6.0

Describe the Bug

Since #52275, projects using a custom eslint configuration might run into Nextjs 13.4.9 - ESLint couldn't determine the plugin "react-hooks" uniquely.

Based on the reproduction PR above, see an example

In that case there will be 2 versions installed (with pnpm at least)

devDependencies:
@belgattitude/eslint-config-bases 1.35.1
└── eslint-plugin-react-hooks 4.6.0
eslint-config-next 13.4.9
└── eslint-plugin-react-hooks 5.0.0-canary-7118f5dd7-20230705

Which leads to ESLint couldn't determine the plugin "react-hooks" uniquely.

As a workaround:

  "resolutions": {
    "eslint-plugin-react-hooks": "4.6.0"
  },

Expected Behavior

Imho, eslint-plugin-next should allow usage of customized/shared eslint-config. Using a canary: eslint-plugin-react-hooks 5.0.0-canary-7118f5dd7-20230705 makes the setup slightly more difficult for some advanced usages.

PS: Tested with pnpm 8.6.6 and yarn 4.0.0-rc.48 but I guess other variant will fail to as it's different major version.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1476

@belgattitude belgattitude added the bug Issue was opened via the bug report template. label Jul 6, 2023
@belgattitude belgattitude changed the title Nextjs 13.4.9 - ESLint couldn't determine the plugin "react-hooks" uniquely (pnpm). Nextjs 13.4.9 - ESLint couldn't determine the plugin "react-hooks" uniquely. Jul 6, 2023
@balazsorban44 balazsorban44 added the Linting Related to `next lint` or ESLint with Next.js. label Jul 7, 2023
@nareshbhatia
Copy link

nareshbhatia commented Jul 9, 2023

I am running into the same issue with npm:

Plugin "react-hooks" was conflicted between
".eslintrc.js » eslint-config-next/core-web-vitals » my-app/node_modules/eslint-config-next/index.js » plugin:react-hooks/recommended"
and ".eslintrc.js » @my-lint-config/strict#overrides[1] » plugin:react-hooks/recommended"

My lint config is using eslint-plugin-react-hooks@4.6.0 (which is the latest tag), whereas eslint-config-next/core-web-vitals is using eslint-plugin-react-hooks@5.0.0-canary-7118f5dd7-20230705:

npm list eslint-plugin-react-hooks
my-repo
├─┬ my-app
│ └─┬ eslint-config-next@13.4.9
│   └── eslint-plugin-react-hooks@5.0.0-canary-7118f5dd7-20230705
└─┬ my-lint-config
  └── eslint-plugin-react-hooks@4.6.0

eslint-config-next@13.4.8 did not have this issue.

@emondpph
Copy link

Also running into this issue, reverting to eslint-config-next@13.4.8 seems to fix the problem for now

@balazsorban44 balazsorban44 added the linear: next Confirmed issue that is tracked by the Next.js team. label Jul 27, 2023
synuns pushed a commit to synuns/synuns-blog that referenced this issue Jul 29, 2023
- apply simple-import-sort
- react-hooks error fix with @13.4.8
vercel/next.js#52365
synuns pushed a commit to synuns/synuns-blog that referenced this issue Jul 29, 2023
- apply simple-import-sort
- remove react-hooks
vercel/next.js#52365
@gvillenave
Copy link

Any update here? We're still blocked in 13.4.12.

@terrymun
Copy link

terrymun commented Aug 8, 2023

Just an update: we are still experiencing this issue with the latest release 13.4.13.

@gvillenave
Copy link

Can anyone look at this? We are still stuck on version 13.4.7 because of this issue.

@emondpph
Copy link

I could remove this error by removing the direct dependency of eslint-plugin-react-hooks, and instead use the one that is bundled by NextJs

@kodiakhq kodiakhq bot closed this as completed in #53751 Aug 17, 2023
kodiakhq bot pushed a commit that referenced this issue Aug 17, 2023
Fixes #52365

In #52275 that eslint config changed to a fixed canary version to leverage the improvement of `react-hooks` eslint plugin but breaks the installation when 3rd party packages having strict matching for certain version of eslint plugin.

This PR allows both previous version and the canary version be present.
@M1chaelChen
Copy link

still experiencing this issue in 13.4.18. got it working with manual resolution

"resolutions": {
  ...,
  "eslint-plugin-react-hooks": "4.6.0"
}

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2023

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 added the locked label Sep 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. Linting Related to `next lint` or ESLint with Next.js. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants