lo1tuma / eslint-plugin-mocha

ESLint rules for mocha
MIT License
279 stars 61 forks source link

ESLint peer dependency causing issues #321

Open fab1o opened 2 years ago

fab1o commented 2 years ago

I've been using this plugin version 8.0.0 in my projects to run ESLint 6.8.0 for over a year and it was working fine until today. Because today, I ran a fresh npm install

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: eslint-plugin-mocha@8.0.0
npm ERR! Found: eslint@6.8.0
npm ERR! node_modules/eslint
npm ERR!   eslint@"6.8.0" from the root project

So this comment is not 100% correct. As showed above, it does not only cause a warning, it causes an error

My point is: if 8.0.0 doesn't require a higher version of ESLint (and thus we could still use an earlier version) then there should not be a peerDependency or that should be of a version that is still compatible.

lo1tuma commented 2 years ago

ESLint v7 is already declared as a peer dependency since eslint-plugin-mocha v7. So this is nothing new.

The comment you mentioned seems also correct given the context that it was written 2 years ago. Back then npm ignored peerDependency incompatibilities and printed only a warning. This has changed with npm v7 which now automatically installs missing peer dependencies. So my guess is that you are now using npm > 7. Could that be the case?

fab1o commented 2 years ago

It sure is. I was able to downgrade this to 6.3.0 without issues so that solved it, but I just wanted to leave this here for future reference and knowledge sharing.

If you could release a 8.0.1 with a peerDependency ESLint >=6 that would be another way of solving this (since it supports ESLint 6 right?) but downgrading was okay for me for now so not a big deal.

Eventually I'd like to upgrade ESLint and all plugins, but this is the only one that caused this issue