prettier-vscode not working for files managed by plugin when installed through pnpm
See original GitHub issueSummary
prettier-vscode ignore plugins when used in a vscode workspace in a mono repo installed with pnpm
Github Repository to Reproduce Issue
https://github.com/wighawag/issue-prettier-pnpm
Steps To Reproduce:
- git clone https://github.com/wighawag/issue-prettier-pnpm
- pnpm install
- open vs code
- edit a
.svelte
file and save
Expected result
Expect prettier to prettify every files, including the one handled by prettier plugins (like .svelte file)
Actual result
The .svelte file are completely ignored by vscode, even though the plugin for svelte is installed.
Note that it works fine when the mono repo is installed with yarn, see yarn branch here : https://github.com/wighawag/issue-prettier-pnpm/tree/yarn
VS Code Version: 1.52.0
Prettier Extension Version: 5.8.0
OS and version: Windows 10
Prettier Log Output
When saving a .svelte file no log get outputed. also the prettier icon do not show up for these files
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:6 (1 by maintainers)
Top Results From Across the Web
In VS Code, I'm getting this error, 'Failed to load module ...
This is a solution that worked for me. 1. Install Prettier Globally via npm if you have never installed it globally npm i...
Read more >Plugins - Prettier
Plugins are ways of adding new languages or formatting rules to Prettier. Prettier's own implementations of all languages are expressed using the plugin...
Read more >Prettier plugin does not support local installation with pnpm
The IDE Prettier plugin should work as expected with .java files when installing the plugin for it. What happens instead? Nothing happens on...
Read more >prettier-plugin-astro - npm Package Health Analysis - Snyk
When submitting issues about formatting in VS Code, first make sure you're actually using Prettier to format your files and not the Astro...
Read more >Your Open Source Project Needs a devcontainer - Here's Why
This is just a plain old Dockerfile , you can run it without VS Code ... so I'll make sure that's installed, along...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just tested switching my repository from Yarn Classic/v1 to
pnpm
(after having unsuccessfully tried using Yarn v2/PnP cause it breaks everything) and was surprised by the speed bump, less disk space usage and that everything continued to work fine. This appears to be the only caveat I have found with using pnpm so far; I’m not sure if this is pnpm’s fault or if pnpm simply hasn’t been accounted for by the prettier devs, but I’d really like to see prettier plugins work again in my IDE 😄 Edit: The plugin in question not working for me isprettier-plugin-package
which sorts thepackage.json
file and used to work before. Seeing that you’re having issues with a different plugin, this appears to be a pnpm<>prettier-vscode issue, not a plugin-specific one. Running prettier over the command line (withpnpx prettier --fix --plugin-search-dir=. package.json
) works as expected.As a workaround for this, you can create a
.prettierrc.js
in the monorepo and userequire.resolve
to generate the complete path to the plugin. Example: