-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Wrong ESLint plugin loaded (works w/ NPM) #3332
Comments
As noted above, I filed a similar issue against eslint in case the problem is on their end. Hoping someone from one of the teams might have an idea what is going on. |
Ditto - I'm in the same boat as @cmoesel on my project. |
If anyone wants to see this in action, I've created a simple project that reproduces the problem: https://github.com/cmoesel/eslint-8547 In fact, it's even worse than my real project since there are also some react rules that can't be found (but again, it all works fine if you install with npm instead of yarn). |
Thanks for a report. |
Thanks @bestander. I've updated my example project with the data for your (and others') convenience. NPM You will find the results of In the
and under react-scripts@0.9.5 w/ v 2.0.1:
Yarn You will find the results of In the
and twice (?) under react-scripts@0.9.5 w/ v2.0.1:
|
Forgot to mention the versions of tools I'm working with:
|
So far looks like Yarn is behaving correctly. The double output of I ran And according to your findings both npm and yarn give you correct
I checked the package.json files of all 3 of them and it is all right. I don't think the issue is here. |
Thank you for looking into this, @bestander. It sounds like both yarn and npm are technically doing the right things from a dependency installation/resolution point of view -- so any difference in eslint behavior is likely due to some variance that is not technically illegal but still somehow affects eslint plugin resolution. There have been a couple of "me too"s over on the eslint side (see eslint#8547), so I'm hoping that maybe someone over there will be able to take a look and shed some light on this. Thanks again for taking a look. I appreciate it. |
I'll have another look when I have a moment.
Eslint is known for being sensitive to node_modules structure.
Any help to pin point the problem is very much welcome
…On 15 May 2017 at 20:14, Chris Moesel ***@***.***> wrote:
Thank you for looking into this, @bestander <https://github.com/bestander>.
It sounds like both yarn and npm are *technically* doing the right things
from a dependency installation/resolution point of view -- so any
difference in eslint behavior is likely due to some variance that is not
technically *illegal* but still somehow affects eslint plugin resolution.
There have been a couple of "me too"s over on the eslint side (see
eslint#8547), so I'm hoping that maybe someone over there will be able to
take a look and shed some light on this.
Thanks again for taking a look. I appreciate it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3332 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACBdWMZ9EauYJqBy-c6CvPMG2I80Ma_aks5r6KQxgaJpZM4NSC9k>
.
|
See #3535 for what looks like it may be a smoking gun. |
This is fixed via #3545 |
When using yarn, eslint is loading an older version of eslint-plugin-import, which causes problems in the current configuration. This commit fixes the problems by disabling the problem rule and adjusting the problem glob. See: yarnpkg/yarn#3332 And: import-js/eslint-plugin-import#602
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Our project uses react-scripts and eslint-config-airbnb devDependencies. react-scripts declares eslint-plugin-import "2.0.1" as a dependency. eslint-config-airbnb declares eslint-plugin-import "^2.2.0" as a peer dependency. We've added eslint-plugin-import "^2.2.0" as our own devDependency to satisfy the peer dependency.
When we run eslint, we get many of these errors:
error Definition for rule 'import/no-named-default' was not found
. Since this rule was added in eslint-plugin-import v2.2.0, my best guess is that eslint is looking for the rule in the eslint-plugin-import v2.0.1 transitive dependency.I'm suspecting the issue may be with yarn because if we use
npm install
instead ofyarn install
, then it works as expected and we do not get the previous errors when running eslint. That said, I'm not confident -- so feel free to disagree.If the current behavior is a bug, please provide the steps to reproduce.
See above.
What is the expected behavior?
ESLint should find the rule in eslint_plugin_import v2.2.0 rather than v2.0.1"
Please mention your node.js, yarn and operating system version.
Node 6.6.0, Yarn 0.23.4, Mac OS X 10.12.4
The text was updated successfully, but these errors were encountered: