-
Notifications
You must be signed in to change notification settings - Fork 345
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 fails to load plugins when using ESLint 6.x #696
Comments
I'm getting the same error. I'm using
Restarting Visual Studio Code seemed to have fixed it temporarily for me but the issue keeps coming back. |
I still continue to have this problem, even after restarting VS Code. I've tried everything:
And weirdly, it's just a problem with this project. In another project, I get this error: 6/26/2019, 6:35:31 PM:
----------------------
Cannot find module './utils/ast-utils' |
@samrith-s since this seems to be setup specific can you share a GitHub repository I can clone that demos this. |
I unfortunately cannot share the repository, it's a private one on GitHub. I'll setup a repository which tries to replicate this. Also, could you just tell me what does |
@dbaeumer Here is a reproducible repository. Do let me know if you get the error, because I am getting it in this repository as well. https://github.com/samrith-s/vscode-eslint-reproduce-error |
Also most likely related to this: prettier/prettier-vscode#672 |
@samrith-s actually it works for me |
@dbaeumer I think this happened with Prettier-ESLint integration on. I'm closing this issue as it is related to the issue with |
I have this same problem and i don't use |
@sevenmay What version of Node are you on? |
v8.11.2 |
same problem here. |
Do any of you use |
same issue here,
|
I am not using it. |
A GitHub repository that demos this is highly appreciated. Otherwise it is very hard to track this down. |
Hey @dbaeumer, the repo I sent doesn't work with Node v12, but works with Node v10. I do not have |
I think that's a prettier-vscode problem: here is a repo to see: |
Hi there! I ran into this today while updating our ESLint config repository (found here). I've done some digging and found that it's probably an incompatibility between vscode-eslint and ESLint 6, but without more detailed error reporting from the extension I can't pinpoint the problem. Here's some major things I noted while testing:
I hope this helps find the root cause! I'm going to continue trying to find a workaround to make ESLint 6 work, but so far the only thing I've found is to downgrade to ESLint 5.16.0 |
I'm seconding that it's related to ESLint reaching a new semver V6 on Jun21/(6.01 on Jun24) Best Practice has always been to install eslint and setup Real World is that many of us use either global eslint installations, global Apparently, as of ESLint v6, while you can still technically use a global eslint installation, all plugins need to be "locally" installed [per project]. See ESLint v6 Migration Docs for details. |
@r-i-c-h and @UncleClapton thanks for providing the detailed information. I upgraded my test projects to use ESLint 6.0 and the latest version of the plugins and every thing works for me. I tried to test https://github.com/fuelrats/fuelrats-eslint-config but I can't reach the repository. @UncleClapton is it public? |
I was getting the same error for |
Started having issues with ESLint today after experimenting with migration to node 12. I had everything installed at global level (ESLint and babel-eslint) and started seeing the This statement from @r-i-c-h helped me resolve my issue.
I simply installed the plugin at project level and everything started to work. Hoping that this helps others as well. |
@dbaeumer it's public on npm, yes. What @r-i-c-h suggested doesn't reflect my own testing unfortunately, so this is still an issue I'm having. I have always preferred an all local install over global. Makes for less version conflicts across projects. I have a few ideas of what to try next. I'll update if I get a solid answer. EDIT: |
@UncleClapton does the repository still show the problem of loading ESLint ? |
I face the same issue. The issue started when i upgraded to eslint 6 and disappears when downgraded to 5. |
@dbaeumer it does. After some further digging I think I finally found a culprit, however I'm not sure if this is the cause or just another side-effect of the changes in ESLint v6. I found that in my specific case, this error was caused by the project not being vscode's workspace root. Whenever I load one of the individual config projects into vscode, everything resolves fine. When I load the repository root, however, both projects fail to load their plugins. This is despite the extension's ESLint server loading ESLint via each project's respective I was able to confirm that plugins will only load from the workspace root by copying the I also just attempted to update one the projects using this config, and everything is working for that project on ESLint v6. TL;DR: ESLint v6 broke the ability to have multiple projects in a workspace. Would this be fixable from this extension? |
I agree with @UncleClapton, I have something like this
If I open I also tried to downgrade to ESLint 5 and the situation is the same. |
my use case for this is I like to have some basic linting when I'm just messing around outside of any projects writing test JS in VS Code. Previously I had a global eslintrc in my home folder that had some basic rules enabled. The fact that this doesn't work anymore has actually proven to be a pretty big loss for me |
Honestly, this is kinda ridiculous. In the last 2 days I've lost about 3 hours fighting it, reinstalling my dependencies, deleting them one by one, nothing helped. |
The following worked for me the quotation marks ' are actually ` tildes |
There is now a new Insider version of the extension that should help improve this. Please see #815 on how to beta test it. Please be aware that this is a bigger rewrite of some functionality so other things might break :-) |
Having |
In case it helps anyone searching, the following (based on previous comments) fixed it for me in a lerna monorepo. ESLint is installed in the root project, and its config file is there too. "eslint.workingDirectories": ["./"], |
In my case, I had the following folder structure:
I just had to add a
This removes the mentioned error (for reference, I'm using eslint v6.7.2). |
@MarceloPrado the next version will improve this. I do want to point out that eslint in the terminal fails as well in this setup if not executed from one of the directories front, back and shared. |
I'm not sure if the issue I'm currently having is related to this one but here's my file structure:
{
"eslint.enable": true,
"eslint.packageManager": "yarn",
"eslint.workingDirectories": [
{
"changeProcessCWD": true,
"directory": "./packages/core"
},
{
"changeProcessCWD": true,
"directory": "./packages/angularjs-component"
}
],
"typescript.tsdk": "node_modules/typescript/lib"
}
{
"root": true,
"extends": "../../configs/.eslintrc.json"
}
{
"extends": "../../configs/tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist",
"paths": {
"@tier-based-promotions/core": [
"../core/src/index.ts"
]
}
},
"exclude": [
"./coverage/**/*",
"./dist/**/*",
"./node_modules/**/*",
"./*.config.js"
]
} And here's my issue... When I run However, this extension is reporting me the following error: For more context, my base "parserOptions": {
"project": "./tsconfig.json",
}, It seems that ESLit CLI is using this configuration properly (and reading Thoughts? |
These settings look good to me:
Do you have a repository I can clone that demos this. Otherwise it is very hard to tell what is going on. The extension does use the ESLint npm module to do all the resolving and validating. So code wise it does the same as the eslint comment in the terminal. So it can only be a config / cwd issue. |
@dbaeumer I don't have one for the moment and I'm kinda busy this sprint but I'll try to create one as soon as possible and post back. Thank you. |
@dbaeumer Just remembered something that might be relevant to my issue... I'm using Windows 10 and my project is stored in the Windows filesystem. However, when I open the terminal inside VS Code I'm running WSL and that's where I have installed all my dependencies with |
@rfgamaral actually that shouldn't make a difference. But you never know :-) |
With the VS code
I was able to verify that Eslint now works in my projects. |
With plugins? It still fails on my machine if I don't configure ESLint Output-Channel:
eslint --debug output:
Version: 1.41.0 |
I do not use prettier, but it does work with all of I've installed As (poorly) mentioned before there are probably a bunch of cases where things will continue to not work but it's worth checking if you can use eslint@6 now. For the failing situations, we'll probably have to wait on the next fix. Either by the VScode team or @dbaeumer. |
For me with 1.41.0 it still doesn't work. I get no error but there is no linting whenever I open a root with many projects. However opening only one project folder (which has .eslintrc) it works. Using eslint 5.16.0. Also tried with 6 - same problem. |
I released version 2.0.4 of the extension which should improve this but it will still require some configuration work if the workspace is not a single project (e.g. the workspace root doesn't contain the package.json and .eslintrc file). The major reason why this can't be fixed in all cases is that ESLint itself (the npm module) is very sensitive to the current working directory for the module and plugin resolution, the .eslintrc and the .eslintignore file. Choosen an incorrect directory might make one of those fail. The new version therefore allows the following working directory settings (from the readme):
Then using the setting: "eslint.workingDirectories": [ "./client", "./server" ] will validate files inside the server directory with the server directory as the current eslint working directory. Same for files in the client directory. The ESLint extension will also change the process's working directory to the provided directories. If this is not wanted a literal with the
In most cases |
@simon-lorenz please see my comments in the previous post. I will close the issue since in a more complex folder setup (e.g. mono repository) I couldn't find a way, without false positives, to detect a correct setup .It is comparable to the fact that eslint executed in a terminal usually requires to cd into the right directory. I am open for suggestions to further improve this though. If you still see a problem after trying the new auto mode or pattern please open a new issue with steps on how to reproduce what you are experiencing. Best a GitHub repository to clone |
For whom it might help, the only thing that has worked in my case was
|
thanks to bartekpacia: #696 (comment)
it's working for me |
Working for me! Thanks! |
So, there has been a LOT of activity since I posted this well received comment relating to a create-react-app setup. Since that comment I've had to revisit my vscode settings.json again and update as follows:
The reason for Edit: If you use Typescript then also add a flag to stop built-in format on save for that. |
I have the following packages installed as dev deps:
And this is my
.eslintrc
file:I have

Format on Save
on. When I runeslint --fix
, it works properly. But when I hit save, I get the following error. It doesn't work for any plugin, even though I have all of them installed.The text was updated successfully, but these errors were encountered: