-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Plugin API not working with globally installed modules #4000
Comments
One solution is to set prettier/src/common/load-plugins.js Lines 22 to 24 in 1b61b81
|
@ikatyang looks like you're right – changing Searching for packages in a globally installed Prettier is still not working because there is no When I really wish I could submit a proper PR with a fix, but after spending a couple of hours on getting to where I am, I have to admit that I won't be able to lift it. Sorry for that and hope that my experiments help you with a proper fix! Happy to try something else if that's useful. |
This also breaks on non global installs when you invoke prettier from a parent directory. |
I think it's an ok solution. The use case I was originally trying to avoid was where plugins could be loaded unexpectedly (due to being intalled via transitive deps), and thus not having a way to opt out of these plugins being loaded. I wonder how parcel bundler handles this? |
IMO supporting transitive deps is a nice feature, not a thing to avoid – it'll be useful in tools similar to I never used parcel, so unfortunately don't know how to help with your question. Who would be a good candidate for trying to submit a PR in your opinion? 🙏 |
Looks like I was able to fix this in #4192! 🎉 Parcel bundler seems to be OK with all this – at least |
For those who can't wait to use npm install --global \
github:kachkaev/prettier#5e308113217638949cc6047527d0999fe4a30de6 \
@prettier/plugin-a \
prettier-plugin-b
cd /any/folder
prettier '**/*.(a,b)' This partially worked for me in Formatting of |
Shorter install name: |
Or In this case the package only has pre-built files and works better in editor plugins. The sources in |
Currently, globally installed plugins don't seem to be discovered by the CLI:
It seems that
read-pkg-up
is just looking for the closestpackage.json
file, which doesn't work for global installsprettier/src/common/load-plugins.js
Line 4 in 1b61b81
(in case you're wondering why i'm explicitly passing the plugin: There also seems to be an issue with automatic discovery, running the command without results in
SyntaxError: Unexpected token
(see prettier/plugin-php#55))The text was updated successfully, but these errors were encountered: