Skip to content

prettier.resolveGlobalModules does not resolve plugins?Β #3233

@vincerubinetti

Description

@vincerubinetti

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions