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

ESLint 6.6.0 does not account for module-hoisting via yarn workspaces when determining path for plugins #12508

Closed
Nantris opened this issue Oct 29, 2019 · 14 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue bug ESLint is working incorrectly core Relates to ESLint's core APIs and features evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion

Comments

@Nantris
Copy link

Nantris commented Oct 29, 2019

Tell us about your environment

Node version: v12.10.0
npm version: v6.2.0
Local ESLint version: Not found -- But it is installed (rolled back to 6.5.1 and it's working fine)
Global ESLint version: v6.5.1 (Currently used)

What did you expect to happen?
Upgrading from 6.5.1 to should not break linting (specifically seeing this in Sublime Text)

I get an error for the first plugin, no matter what plugin that is. The message I get is like this:

Error: Failed to load plugin 'react' declared in '.eslintrc': ENOENT: no such file or directory, open 'C:\projects\myProject\node_modules\eslint-plugin-react\node_modules\doctrine\lib\doctrine.js'

But we're using yarn workspaces and lerna and the proper location of that file in our environment after upgrading to 6.6.0 is: C:\projects\myProject\node_modules\doctrine\lib\doctrine.js

What actually happened? Please include the actual, raw output from ESLint.

See error text above.

Are you willing to submit a pull request to fix this bug?
Can't help with resolution.

@Nantris Nantris added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Oct 29, 2019
@kaicataldo
Copy link
Member

This looks like it's being caused by the changes to how ESLint loads shareable configs and plugins, however, that was released in v6.0.0. Can you share the config file you're using? I don't have a lot of experience with yarn workspaces or lerna, but maybe someone else who is more familiar can chime in.

@kaicataldo kaicataldo added core Relates to ESLint's core APIs and features evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Oct 29, 2019
@Nantris
Copy link
Author

Nantris commented Oct 30, 2019

Hey @kaicataldo thanks for your response. That sounds like exactly what I'm seeing, only as you mentioned it was implemented in 6.0.0 and also says it was implemented specifically to fix these sorts of issues.

Here's a gist with my .eslintrc config, but I can't imagine that anything in there is directly related.

Just to re-confirm, 6.5.1 works perfectly for me.

@kaicataldo
Copy link
Member

Thanks for the info. I'm not seeing anything that stands out to me, and that's really odd that you're noticing this behavior only in 6.6.0 on. One more possible thing to try: if you have a lockfile, can you try deleting and regenerating it to see if that fixes it?

@DimaSerhin
Copy link

@kaicataldo experiencing the same issue with similar setup: lerna and yarn workspaces.
I have config deeply nested in project tree which is different from one found at the . of project folder.
This config extends config module whose peerDependencies are present in ./node_modules. When i run ./node_modules/bin/eslint nested config is used but eslint cannot find any dependencies at the root level ./node_modules.

Issue is reproduced only with6.6.0. Locking version back to 6.5.1 resolves the problem.
Suggested deletion of lockfile and regenerating doesn't help.

@kaicataldo
Copy link
Member

Is there any chance either of you could make a minimal reproduction GitHub repository?

@Nantris
Copy link
Author

Nantris commented Nov 30, 2019

Unfortunately I'll never find the time to make a repro. I can describe the issue to help resolve, but until it's resolved I'll just have to stay on 6.5.1

Upgrading Sublime Linter and the associated Sublime addons didn't help, despite it referencing compatibility with yarn, lerna, and eslint6.6 being features of the newest version.

@kaicataldo
Copy link
Member

kaicataldo commented Nov 30, 2019

With all the moving parts here, it's a bit of a wild goose chase at the moment. Sounds like it might be beneficial to file an issue with the Sublime plugin you're using - they might be able to chase this down!

@fraywing
Copy link

fraywing commented Dec 2, 2019

I have this same issue after upgrading, but I'm not using Sublime. I don't think this is an issue with an external plugin. I'm having it while using yarn workspaces and Atom.

@fraywing
Copy link

fraywing commented Dec 2, 2019

Downgrading stopped the issue, but broke a nested Gatsby app that is in a workspace.

@Nantris
Copy link
Author

Nantris commented Dec 2, 2019

@kaicataldo I understand this might not be resolvable with the currently known information. That said, I feel reasonably, but not entirely, confident that the issue is in ESLint itself.

@kaicataldo
Copy link
Member

Does the most recent patch release fix the issue for folks who are encountering it? It includes the fix for this issue.

@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label Jan 4, 2020
@eslint-deprecated
Copy link

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that issues failing to reach accepted status after 21 days tend to
never be accepted, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@Nantris
Copy link
Author

Nantris commented Jun 28, 2020

@kaicataldo, the issue persists with ESLint@7.3.1

@Nantris
Copy link
Author

Nantris commented Jun 28, 2020

If I copy the doctrine folder from my node_modules into the ESLint's node_modules folder, I get past that issue, but just meet with another of the same kind:

SublimeLinter: ERROR: JSON Decode error: We expected JSON from 'eslint', but instead got this:
Error: Failed to load plugin 'compat' declared in '.eslintrc': ENOENT: no such file or directory, open 'C:\projects\myProject\node_modules\eslint-plugin-compat\node_modules\semver\semver.js'

According to SublimeLinter, this failure originates with ESLint. It looks for node_modules as child directories of the ESLint and its plugins, rather than in the root level node_modules.

If I was running via CLI, I suspect this comment about prefixing with pwd would resolve my issue, but I'm not running via CLI.

Any thoughts? I feel like I'm trapped in the past.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jul 4, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jul 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue bug ESLint is working incorrectly core Relates to ESLint's core APIs and features evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion
Projects
None yet
Development

No branches or pull requests

4 participants