Closed ottodevs closed 1 year ago
Just an update, I mistakenly thought that motoko package was needed but I was wrong sorry, it seems that just adjusting the prettier config pointing to the node.js path in the package is enough for it to work, but the rest of the issues still seem relevant.
Let me know if you can reproduce them. Thank you.
Thanks for pointing out these issues in the readme. It's been an adventure trying to support both Prettier 2 and 3 at the same time, so I appreciate the detailed repro.
Fixing in #112. Due to how recently Prettier 3 was released (and because it's also causing issues in other tools such as the Prettier VS Code extension), I would encourage using Prettier 2.x if possible.
Updated the readme (let me know if you continue to run into issues and I'll reopen).
Thanks for the quick action!
Just a side note, although the demo shows behavior with prettier 3, I tested both prettier 2 and 3 before creating the issue and both were failing the same way (I pointed out this detail in the issue).
That's a good point; I'll do another update to the readme. Prettier used to auto-detect plugins in the node_modules
directory (and motoko
would resolve to prettier-plugin-motoko
), but it seems like that's changed at some point over the past year.
Hello, there are multiple issues with this prettier plugin, and it is not working as expected with the instructions provided.
I tested both with prettier version 2 and 3.
List of issues:
.prettierrc
config indications with{ "plugins": ["motoko"] }
don't work at all... the correct config should be:{ "plugins": ["node_modules/prettier-plugin-motoko/lib/environments/node.js"] }
for it to work (pointing to node_modules path)npx prettier -- --check **/*.mo
andnpx prettier -- --write **/*.mo
are just wrong, no need to add double--
after prettier command, it returns an error doing so.I provide an easy and reproducible gif demo showcasing all these errors. Other prettier plugins work as expected without needing to add the deep
node_modules
path, so I think something is not well configured with this motoko plugin, also the need of the extramotoko
dependency looks so weird, if that's just something on my end, I would like to locate the causes to fix them.