Prettier 3 support
erropix opened this issue ยท comments
The @prettier/plugin-php requires prettier@"^1.15.0 || ^2.0.0"
and I couldn't update to prettier 3
Can you bump the required version?
Working with prettier 3 would be amazing
Kindly fix this ASAP ๐
with node v20.5.0
i forced install of prettier 3 and this plugin with :
npm install -D prettier@latest
npm install -D --force @prettier/plugin-php
i have type: module in package.json
when running prettier it said
[error] No parser could be inferred for file "src/Controller/ControlController.php"
so i added the following in .prettierrc.js
{
...
plugins: ["@prettier/plugin-php"],
}
and now it says :
[error] src/Controller/ControlController.php: TypeError: Invalid value used as weak map key
[error] at WeakMap.set ()
[error] at getSortedChildNodes (file://node_modules/prettier/index.mjs:17581:19)
[error] at file://node_modules/prettier/index.mjs:17576:52
[error] at Array.flatMap ()
[error] at getSortedChildNodes (file://node_modules/prettier/index.mjs:17575:6)
[error] at decorateComment (file://node_modules/prettier/index.mjs:17588:22)
[error] at decorateComment (file://node_modules/prettier/index.mjs:17599:14)
[error] at file://node_modules/prettier/index.mjs:17655:8
[error] at Array.map ()
[error] at attachComments (file://node_modules/prettier/index.mjs:17654:38)
@czosel, Do you have any information on when this plugin will be supporting prettier@3?
@czosel thanks for the reply, that's good news ๐
Prettier's plugin migration guidance: How to migrate my plugin to support Prettier v3?
More from the Prettier v3 changelog:
In order to support async parsers for embedded languages, we had to introduce a breaking change to the plugin API. Namely, the embed method of a printer has now to match a completely new signature, incompatible with previous versions. If you're a plugin author and your plugins don't define embed, you have nothing to worry about, otherwise see the docs for details.
Thanks for posting the reference @joemaller! AFAIK weโre currently not implementing embed. There might be a few tweaks we should do though - PRs are more than welcome!
I gave the upgrade a try in #2200, but got stuck in the process. Turns out that several changes are needed to make this plugin compatible with prettier v3. Since I'm short on time, I'd be happy for any help with completing the upgrade.
Do we have plan to migrate to ESM?
Definitely! Thanks for all your contributions @fisker, Iโll review and merge them tonight (CET)!
Prettier 3 support landed in v0.20.0 ๐ฅณ
Thanks you @czosel ๐
Updated playground to Prettier 3 and Plugin version v0.20. ๐
Nice, thanks @loilo! ๐ฏ