Skip to content
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

prettier.resolveGlobalModules does not resolve plugins? #3233

Open
vincerubinetti opened this issue Dec 18, 2023 · 2 comments
Open

prettier.resolveGlobalModules does not resolve plugins? #3233

vincerubinetti opened this issue Dec 18, 2023 · 2 comments
Labels

Comments

@vincerubinetti
Copy link

vincerubinetti commented Dec 18, 2023

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
Copy link

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

Copy link

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

@github-actions github-actions bot added the Stale label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants