prettier / prettier-vscode

Visual Studio Code extension for Prettier
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
MIT License
5.14k stars 455 forks source link

`prettier.resolveGlobalModules` does not resolve plugins? #3233

Open vincerubinetti opened 9 months ago

vincerubinetti commented 9 months ago

The documentation for prettier.resolveGlobalModules says:

When enabled, this extension will attempt to use global npm or yarn modules if local modules cannot be resolved.

This implies that any kind of reference to a module would attempted to be resolved this way, but looking at the code, it seems that this really only applies to resolving the Prettier module itself (I guess if you wanted to manually use a global installation of Prettier instead?).

The documentation should really be changed to make this clear, and possibly even the option name itself (e.g. resolveGlobalPrettier).

And moreover, it would be really good to have plugins be able to be resolved in the same way. By looking at that code, and by testing it locally (I can verify I have the listed plugins installed globally with both npm and yarn).

For the past several hours, I've been trying to set up this extension to simply be able to use a global .prettierrc configuration in my ~/ home directory (MacOS) with some plugins like prettier-plugin-css-order, and I can't get it to work because of #3104 and this issue (even when downgrading the extension). I need this because I work on many one-off, stand-alone .js/.html/.svg/etc. files that I want to format, and cannot define a whole .pretterrc, package.json, and node_modules for each one.

dmwallace commented 8 months ago

I'm running into a similar issue trying to run prettier using prettier.resolveGlobalModules with prettier-plugin-tailwindcss because my local version of prettier is pinned to 2.x because of jest

github-actions[bot] commented 1 month ago

This issue has been labeled as stale due to inactivity. Reply to keep this issue open.