-
Notifications
You must be signed in to change notification settings - Fork 339
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
vscode-eslint extension not working on latest version of VSCode, v1.90.0 #1856
Comments
Seeing this as well since the VSCode update; seems to be related to using I can reproduce it on a fresh project with the following steps, on multiple systems --
You'll also notice if you go to VSCode's Help -> Process Explorer that upon open a TS file, the ESLint server will die immediately upon starting (listed as 'defunct') -- probably related to #1855 as well (in fact, the server dying is the real issue; it occurs even if you don't have fix-on-save enabled. based on logs it seems to happen while still loading) If |
@cwsault, good info! I've got |
Interesting. I didn't have prettier or prettier extensions installed, but I removed an older .prettierrc and restarted ESLint, and it started working. I'm almost sure it's just a coincidence. |
We are seeing the same issue after updating to VSCode 1.90, running on Mac OS, using yarn PNP with eslint and prettier and I can also confirm that when restarting the ESLint server, it fails with "stopping the server timed out," but before explicitly trying to restart it, I don't see errors in its output. |
This is very likely related to yarnpkg/berry#6219. Can you see if upgrading to yarn 4.3 changes anything. |
I tired it wit yarn 4.3.0 and I couldn't make the server crash. |
I've had the same issue since VSCode May release last Thursday. I've tested in both cjs and mjs, I'm using flat config with yarn pnp. Apple Silicon, VSCode 1.90, Yarn Berry v4.3.0 // eslint.config.mjs
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
export default [eslintPluginPrettier]; After 2-3 days of research i decided to follow the debugging technique since it was my last option (here)
Steps to reproduce
// eslint.config.mjs
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
export default [eslintPluginPrettier]; Attaching the debugger from the cloned vscode-eslint project with the steps mentioned in the link above, it will produce the error stack above ONLY, without the hanging on saving. |
Still occurs for me using |
I tried a bunch of yarn versions including latest build and it doesn't work for me. I'm thinking it might have something to do with the jump to node 20 and changes to the way commonjs/ES modules are resolved. |
Here is a simple reproduction with 1 file. Just need to run |
I was able to reproduce this and I am pretty confident that this has nothing to do with the ESLint extension itself. The underlying problem is that prettier is using the syncKit to call sync into a worker which blocks the eslint server. For some reason the worker newer return and therefore the server is hanging here: |
Prettier creates the sync function with:
where
It looks like that this makes the worker fail which makes the Atomics.wait never return. |
This is nothing I can fix in the ESLint extension itself. I opened yarnpkg/berry#6335 Since things seemed to work with Node |
If anyone needs to fix this immediately, you can use this yarn patch on eslint-plugin-prettier. Basically just change the dynamic import in worker.js to a require and point it to prettier/index.cjs diff --git a/eslint-plugin-prettier.js b/eslint-plugin-prettier.js
index 74cd8c0497dadb3a79226bd059845a0fb662a697..cc7b6f7bcb2587d541e042c9e25fd76cf43936f8 100644
--- a/eslint-plugin-prettier.js
+++ b/eslint-plugin-prettier.js
@@ -164,7 +164,7 @@ const eslintPluginPrettier = {
if (!prettierFormat) {
// Prettier is expensive to load, so only load it if needed.
prettierFormat = require('synckit').createSyncFn(
- require.resolve('./worker'),
+ require.resolve('./worker.js'),
);
}
diff --git a/worker.js b/worker.js
index 8a8a802ca719a55f4d2ae526eb54e712edfd7455..06269d1c27ca49fd9c7da320318872aa7f40f4f5 100644
--- a/worker.js
+++ b/worker.js
@@ -7,11 +7,10 @@
*/
const { runAsWorker } = require('synckit');
-
+const prettier = require('prettier/index.cjs')
/**
* @type {typeof import('prettier')}
*/
-let prettier;
runAsWorker(
/**
@@ -32,9 +31,6 @@ runAsWorker(
},
eslintFileInfoOptions,
) => {
- if (!prettier) {
- prettier = await import('prettier');
- }
const prettierRcOptions = usePrettierrc
? await prettier.resolveConfig(onDiskFilepath, { |
I've tried the patch, it didn't seem to work sadly. |
You also need to run yarn unplug eslint-plugin-prettier. I'm not sure why it also needs to be unplugged, but it should work unless this is an issue across more plugins, which is possible |
Hello everyone. For me setting up "eslint.runtime": "node" helped to fix this problem without removing or fixing prettier plugin. Without this settings eslint used node 20.* when I actually have 18.14 and this settings force him to use my version and looks like this solves problem. |
By unplugging with |
* Added input method tabs for NoteInputDialog * Hotfix eslint microsoft/vscode-eslint#1856 * Refactor NoteInputDialog in a new component * Add reusable AddOrEditNoteFlow component * Setup tests and dsl for AddOrEditNoteFlow * Fixed act warning in AddOrEditNoteFlow tests * Moved tests from NoteInputDialog to AddOrEditNoteFlow * Use AddOrEditNoteFlow in EditNote * Added aider * Added reset for add/edit note mutations * Remove old NoteInputDialog * Upload and preview photo in AddOrEditNoteFlow * Merge repeated note props into FormValues prop * Hide tabs for edit note dialog * Implement recognize note in "From photo" tab * Remove unused components and hooks * Use type alias for productAutocompleteInput * Fix dialog and tab paddings * WIP: Fix clear note form after successful edit * Fixed focus trap issue * Fixed paddings
This is quite an issue, any plans here? |
@savolkov this has been fixed with latest release of "resolutions": {
"synckit": "^0.9.1"
} |
Interesting. I now get a different issue after both upgrading
I've got Just wanted to leave this here in case others run into this too. Here's my latest environment, FWIWOperating System: macOS
Aside from |
@D-Maher, I have similar problem after adding My project also runs Prettier through ESLint But text error a little bit shorter, than yours
Operating System: macOS
|
Could you see if this minimal example also fails in your environment: https://github.com/fmal/eslint-prettier-test ? I updated bunch of projects running eslint@8 to latest |
* Added input method tabs for NoteInputDialog * Hotfix eslint microsoft/vscode-eslint#1856 * Refactor NoteInputDialog in a new component * Add reusable AddOrEditNoteFlow component * Setup tests and dsl for AddOrEditNoteFlow * Fixed act warning in AddOrEditNoteFlow tests * Moved tests from NoteInputDialog to AddOrEditNoteFlow * Use AddOrEditNoteFlow in EditNote * Added aider * Added reset for add/edit note mutations * Remove old NoteInputDialog * Upload and preview photo in AddOrEditNoteFlow * Merge repeated note props into FormValues prop * Hide tabs for edit note dialog * Implement recognize note in "From photo" tab * Remove unused components and hooks * Use type alias for productAutocompleteInput * Fix dialog and tab paddings * WIP: Fix clear note form after successful edit * Fixed focus trap issue * Fixed paddings
That example repo does seem to work just fine in my environment, so it seems like my issue may be more specific to my particular setup. I'm running with a different version of Yarn (v.4.0.2) and using the Yarn SDKs, either of which could be a culprit for me. |
I was experiencing this issue, and it seems to have been resolved after updating Yarn to 4.4.0 from 4.1.1, then rerunning |
Just to close the loop on my particular issues, performing the following steps got me back to a working state:
TL;DR: Some combination of upgrading Yarn and upgrading the ESLint-related packages above did the trick. If I had to identify a culprit here, I'm fairly certain it was the eslint-plugin-import (or even the absence of the eslint-import-resolver-typescript package) that was causing this extension to stall out for me. Thank you all for the discussion here. And thank you, @dbaeumer, for this invaluable extension and for your support with this issue! |
Thanks for the update - I actually only needed these steps to fix the issue:
|
Environment
Operating System: macOS
VSCode Version: 1.90.0
vscode-eslint Version: 2.4.4
ESLint Version: 8.45.0
eslint-plugin-prettier
Version: 5.0.0Description
This extension does not appear to be formatting code when setting
"source.fixAll.eslint"
in VSCode'seditor.codeActionsOnSave
settings. When saving a file, the extension hangs indefinitely without much indication in the ESLint Output of what could be going on.This is an issue I've noticed happening in the last two days or so, and it seems to coincide with updating to the May 2024 release of VSCode, v1.90.0. When downgrading to VSCode v1.89.1, the issue disappears entirely.
I'm not sure if this is an issue with compatibility between the extension and the latest version of VSCode or if this is a bug in VSCode itself, but I'm inclined to think it's the former since other code actions I have configured to run on save (e.g.
"source.organizeImports"
) run just fine on VSCode v1.90.0.Additional Information
The extension appears to start up just fine based on what I'm seeing in the ESLint Output:
Note
This particular project is on Yarn v4.0.2 so there is an ESLint SDK installed, hence the path in the logs above.
But when saving a file, I see this pop-up at the bottom right of VSCode that seems to hang there indefinitely:
I've tried hitting 'Cancel' and then running the
ESLint: Restart ESLint Server
command, but then I get the following pop-up:And the ESLint output displays the following:
I've also run an extension bisect in VSCode and that did not identify any other extensions as the potential culprit here.
I'm happy to provide additional information if helpful.
The text was updated successfully, but these errors were encountered: