Closed David-Else closed 10 months ago
Maybe a prettier core bug?
Maybe a prettier core bug?
Seems unlikely, could you give an example of a command that you have used that definitely works?
Seems unlikely
How do you confirm this? I've never used global installed plugins. Did you tried any other plugin that works?
I see the same problem using npx
. I cannot use the 1.0.0 release of prettier-plugin-toml
. The 0.4.0 release works fine. (I'm using npx
here outside of any JavaScript project.)
% npx --package=prettier-plugin-toml@1.0.0 prettier --tab-width 4 --write pyproject.toml
[error] No parser could be inferred for file "/Users/bruce/clo/triple-settlement-rewards-network/pyproject.toml".
% npx --package=prettier-plugin-toml@0.4.0 prettier --tab-width 4 --write pyproject.toml
pyproject.toml 7ms
I see the same problem using
npx
. I cannot use the 1.0.0 release ofprettier-plugin-toml
. The 0.4.0 release works fine. (I'm usingnpx
here outside of any JavaScript project.)% npx --package=prettier-plugin-toml@1.0.0 prettier --tab-width 4 --write pyproject.toml [error] No parser could be inferred for file "/Users/bruce/clo/triple-settlement-rewards-network/pyproject.toml". % npx --package=prettier-plugin-toml@0.4.0 prettier --tab-width 4 --write pyproject.toml pyproject.toml 7ms
Thanks a lot for this reply, I finally find a way to run prettier-plugin-toml
with npx and vim autocmd
Newest version of Prettier seems to need plugins
set. Seems to no longer auto-load them. Either with --plugin=NAME
or in configuration:
"plugins": ["prettier-plugin-ini", "prettier-plugin-toml"]
@Tatsh Thanks for the pointer to the Prettier documentation about plugins! Unfortunately, Prettier's --plugin
option doesn't seem to work with npx
😢
% npx --package=prettier-plugin-toml prettier --plugin=prettier-plugin-toml --tab-width 4 --write pyproject.toml
[error] Cannot find package 'prettier-plugin-toml' imported from /Users/bruce/sample-pythoni/noop.js
The workaround in this comment on a Prettier issue works with npx
🎉.
% npx prettier-pnp --pn toml --tab-width 4 --write pyproject.toml
----- Already installed ----
- prettier-plugin-toml
----- Running prettier -----
pyproject.toml 5ms
With a global install the full path to the main export must be given (.exports['.']
in package.json
):
prettier --plugin=${HOME}/somewhere/node_modules/prettier-plugin-toml/lib/api.js a.toml
This can be made easier by using a global config.
So it's really a prettier core issue, I'll close this issue for now, if you still confirm it's related to this plugin instead, please raise a new issue with reproduction, thanks all.
I have Prettier and
prettier-plugin-toml
installed globally.I try:
and get:
I also try:
and get:
Am I missing something here, or is there a bug? Thanks.