Closed ghost closed 2 years ago
It looks like the ESLint server is running out of memory. You could use the eslint.runtime
setting to point to a script that starts node with --max_old_space_size
set yo a higher value.
What is suspicious is the fact that restarting the server doesn't correctly register a confirmESLintExecution
handler. Will look into why this is happening.
Thanks @dbaeumer , yes if the restart would work properly then it's better. I see there's a lengthy discussion on the Typescript eslint repo about the high memory usage: https://github.com/typescript-eslint/typescript-eslint/issues/1192
I tried using the runtime
setting but keep getting Launching server using runtime ./vscode-eslint.sh failed
despite the file being there. I'm on Windows, the rest of my team is on MacOS and Linux so I'm also worried about cross platform issues.
See issue: https://github.com/microsoft/vscode-eslint/issues/733
Ideally there's a way to configure the node command line arguments, e.g. eslint.node-args
or something.
I agree on the possibility to configure that as a eslint setting. PR welcome.
Regarding the shell script. That will not work on Windows since there it will try to use cmd.exe. Does it work for your team mates using Mac?
I had exactly the same issue. None of the solutions I found in similar issues worked on my Windows environment. The only one which work is to set "eslint.runtime": "node"
without passing --max_old_space_size=4096
option. The settings.json file looks as follow:
{
"files.exclude": {
"**/*.js": {
"when": "$(basename).ts"
},
"**/*.map": {
"when": "$(basename).map"
},
"hooks": true,
"platforms": true,
"node_modules": true
},
"typescript.updateImportsOnFileMove.enabled": "always",
"nativescript.analytics.enabled": false,
"javascript.updateImportsOnFileMove.enabled": "always",
"workbench.activityBar.visible": true,
"window.zoomLevel": 0,
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"git.showPushSuccessNotification": true,
"scm.alwaysShowRepositories": true,
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"diffEditor.ignoreTrimWhitespace": false,
"eslint.alwaysShowStatus": true,
"eslint.validate": [
"javascript",
"html",
"typescript"
],
"eslint.runtime": "node"
}
It works fine in monorepo project with four angular, cordova and electron projects in the same workspace with over 1'200 ts files.
Tip:
Try to update your .eslintignore
.
You must put node_modules
folder to your .eslintignore
to prevent eslint analys scan over this huge folder.
Putting node_modules
into .eslintignore does not help, eslint server crashes in the first run always. It started happening after updating to 2.1.14, it was not so often with 2.1.8.
I can use --max_old_space_size
but I tested up to 4096 and it still crashes and worse, it starts killing other processes.
@ranisalt does the validation happen correctly when you use eslint in the terminal. If this is the case can you please provide me with a GitHub repository I can clone that demos what you are experiencing.
I am experiencing the same problem in a monorepo + TypeScript environment. Setting "eslint.runtime": "node"
as @kzimny suggested fixed the problem for me.
Confirmed the same. I had this issue for months, I could not save files sometimes because eslint never finished doing is lint/format/whatever actions. The CPU many times was stuck on 100%, the extensions reports were pointing always to eslint-server and I couldn't find any reason why. My monorepo had this basic setup:
I had tried many things, like root: true
, or a single eslint for all the packages, disabling auto formatting, ignoring all node_modules... But "eslint.runtime": "node"
is working so good that eslint finally is telling me for the first time in this monorepo that my code is wrong instantaneously after wrongly typing it, without 1 - 5 seconds delay (or never if CPU blocked) and a unstable cpu jumping from 0 - 100% for this task for no reason. Thanks @kzimny
In addition to @JaLe29 suggestion, folders which should not be checked by eslint should be excluded in .eslintrc.json file:
{
"root": true,
"parserOptions": {
"ecmaVersion": 6
},
"ignorePatterns": [
"build/**/*",
"dist/**/*",
"mobile/**/*",
"node_modules/**/*",
"node-mobile/**/*",
"node-native/**/*",
"obj/**/*",
"styles/**/*",
"themes/**/*"
]
}
The vscode-eslint extension completely stopped working for us!!! We are using a yarn v2 (aka. berry) monorepo with the @yarnpkg/pnpify setup.
At some point our eslint settings completely stopped working on all our machines and always gave us Getting code actions from ''ESLint'' with a Code Helper Process at 100%... it vscode even tried to get code actions from ESLint - even though our setting is set to "[html]": {"editor.defaultFormatter": "vscode.html-language-features"},
...
We now tried to figure out if yarn berry was the problem and installed our project with yarn v1.22.4 - problem exactly the same. Even tried to disable all other vscode extensions - and only run eslint, to figure out if it is a problem with other extensions... same result.
We now installed version 2.1.6 of vscode-eslint, which seems to work perfectly... so the bug must be somewhere between those versions.
this is a newly created next.js app, with a minimal dependencies.
// package.json
{
"name": "with-styled-components",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"postinstall": "husky install",
"prepublishOnly": "pinst --disable",
"postpublish": "pinst --enable"
},
"dependencies": {
"google-map-react": "^2.1.9",
"husky": "^6.0.0",
"next": "latest",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-is": "^17.0.2",
"styled-components": "^5.2.3"
},
"devDependencies": {
"@yarnpkg/pnpify": "^3.0.0-rc.3",
"babel-eslint": "^10.1.0",
"babel-plugin-styled-components": "^1.12.0",
"eslint": "^7.27.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.3",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^6.0.0",
"pinst": "^2.0.0",
"prettier": "^2.3.0",
"pretty-quick": "^3.1.0"
},
"license": "MIT"
}
// .eslintrc.json
{
"extends": ["airbnb", "plugin:prettier/recommended"],
"ignorePatterns": ["build/**/*", "dist/**/*", "mobile/**/*", "node_modules/**/*", "node-mobile/**/*", "node-native/**/*", "obj/**/*", "styles/**/*", "themes/**/*"],
"parserOptions": {
"ecmaVersion": 6
},
"root": true,
"plugins": ["prettier"],
"rules":{
"prettier/prettier": 2,
"react/jsx-filename-extension": 0
}
}
@ChiefORZ since it sounds like you are able to reproduce this could you provide me with a GitHub repository I can clone that demos that?
Also facing this, I'm working around it by closing some files that I'm not actively working at the moment and restarting the server too. I have a medium monorepo, and whenever I have 8+ files open it starts to happen. Not really sure, but it might be a regression because I used to work on a considerably larger monorepo fine. And even if it's the case, it's hard to tell if it's on eslint
side or vscode-eslint
.
More and more it seems that we have reached the ceiling with tooling written in JS and we should go with Rust/Go instead as ESBuild and friends are doing, to achieve better performance.
The number of open files shouldn't have an huge impact on the server. The server is only validating the file you are typing in, not the others.
Interesting. It might have to do with @typescript-eslint
that I'm using with type-checking rules enabled, it for sure considers more than just the single file that's open.
@rdsedmundo it depends on the rules you are using. If you use rules that require type resolving then typescript-eslint will read other TS/JS files and parses them. But it will not validate them.
Got fixed with https://github.com/microsoft/vscode-eslint/issues/733
I am new to the computing world so i don't know most of the things here. However, I can't do anything when it comes to my vs codespace, it takes forever to start, and when it eventually loads, it tells me it cannot connect, that I need to reload page, just after 1 minute of use. I have failed to completely have my lectures on coding in C just because i cannot use the vs codespace at all.
We've recently switched from TSLint to ESLint in a large mono repo. After a while, about every 10-30 minutes, ESLint stops working and I have to reload the VSCode window. It will then no longer show new issues, and when I click CTRL + . on an issue it found before the crash, it shows "No code actions available".
When I check the Output console, I see these errors all the time:
Once it has crashed, and I try to do CTRL + . for the code actions, I see this in the output console:
It just crashed again, at the time it happened this was in the logs:
I can't find any existing issue about it.
I'm on Node 12.14.1 and ESLint 2.1.14