-
-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Describe the bug
With the 6.0 update, the extension is no longer working in any repositories where prettier-eslint is not installed locally, even though I have it installed globally. I also tried reinstalling it and switching node/npm versions, to no avail. This is troubling for me since I work on very large repositories with already established workflows, so I can't just add prettier-eslint to every package I work on. So I've had to use an old version of the extension, even though the newer version works on my other repos.
I'm thinking this is unexpected behavior because the readme says:
This extension requires the following NPM packages to be installed either locally or globally:
prettier-eslint@^16.1.2
To Reproduce
Not sure about STR, just starting vscode I immediately see the following:
Error: Could not warm up worker. Formatting a file for the first time may take longer than usual.
Message: Cannot find module 'prettier-eslint'
Require stack:
- c:\Users\shmed\.vscode\extensions\rvest.vs-code-prettier-eslint-6.0.0\dist\extension.js
- c:\Users\shmed\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js
- c:\Users\shmed\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-amd.js
- c:\Users\shmed\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-fork.js
The module is definitely installed and working for all other purposes:
$ npm list -g
C:\Program Files\nodejs -> .\
├── @typescript-eslint/parser@5.0.1-alpha.22+6746b8cc
├── corepack@0.12.1
├── eslint@8.52.0
├── npm@8.15.0
├── prettier-eslint@16.1.2
├── prettier@3.1.0
├── typescript@4.4.4
└── yarn@1.22.19
I'm using nvm-windows but I also tried a standard npm installation.
Expected behavior
Extension should be able to find global modules
Example Project
This is happening with all projects, until I install prettier-eslint locally in them. I first noticed it on mozilla-central but I'm getting the same issue everywhere, e.g. here's a simple example.
Versions (please complete the following information):
- VS Code Prettier ESLint extension: 6.0.0
- Visual Studio Code: 1.86.2 (user setup)
- Node: 21.6.2, plus node for all my installed npm versions
- Package Manager: npm 19.0.0, 18.10.0, 17.2.0, 16.17.1, 15.8.0, 14.15.4, 12.3.1
- prettier: 2.8.8 and 3.1.0
- eslint: 8.56.0 and 8.52.0
System Specifications (please complete the following information):
- OS: Windows 10 (build 19045)
- Processor: Ryzen 9 5950X
- RAM Size: 64 GB
Additional context
I assume module resolution problems have more to do with my environment than anything else, so let me know if there are any logs I can provide that would help with debugging.
I haven't looked at the extension's source code, but this is the same error you'll see when you try to import a global module without first linking it, so I wonder if the extension is just naively importing prettier-eslint and assuming it will resolve as normal. But I don't know how you could practically link a global module to a vscode extension.
This might be the same issue as #197. It seems that one was closed automatically without resolution.