jest-community / eslint-plugin-jest

ESLint plugin for Jest
MIT License
1.12k stars 228 forks source link

Lastest version 28.5 depends on @typescript-eslint/utils which has a peer dependency for "eslint": "^8.56.0" #1588

Closed gdholly closed 1 month ago

gdholly commented 1 month ago

When running with eslint 7 we get the following:

Oops! Something went wrong! :(

ESLint: 7.32.0

Error: Failed to load plugin 'jest' declared in '.eslintrc.js': Cannot find module 'eslint/use-at-your-own-risk' Require stack:

G-Rath commented 1 month ago

Please provide a proper reproduction - we have an optional peer dependency on @typescript-eslint/eslint-plugin so its not being pulled in or configured by us

SimenB commented 1 month ago

It's the utils in the stacktrace tho, not the eslint plugin. Not sure why that is hoisted 🤔 We'd need a full reproduction like Gareth mentions to properly investigate 👍

gdholly commented 1 month ago

Thanks for taking a look so quickly guys, here is the full stack trace.

eslint src

Oops! Something went wrong! :(

ESLint: 7.32.0

Error: Failed to load plugin 'jest' declared in '.eslintrc.js': Cannot find module 'eslint/use-at-your-own-risk' Require stack:

SimenB commented 1 month ago

Can you provide a separate repository with a minimal reproduction? Just remove everything you can while still getting the same error. I'm guessing this is a hoisting bug in a package manager, but cannot say without a full project.

gdholly commented 1 month ago

Looks like this is caused by some other packages having a dependency to eslint 8.0+ which npm can't seem to detect. Thanks for your help.

rpearce commented 1 month ago

@gdholly What did you do to fix this? Did you identify the packages? I'm having the same issue after this minor upgrade.

gdholly commented 1 month ago

In our case I think there was a defect in npm that was hiding the true issue. We have set it aside until we upgrade eslint. Try to do what @SimenB suggested and build a repo from scratch with just your package.json and your eslint config file, there might be another package that is pulling in eslint 8+.

rpearce commented 1 month ago

Thanks for getting back to me! Our issue turned out to be that we were still on eslint@6, and upgrading to 8.x resolved it.