How to migrate my plugin to support Prettier v3?
fisker Cheung edited this page Jul 11, 2023
·
5 revisions
Prettier v3 will change the plugin's interface. So this document describes how to migrate to v3 for plugin developers.
Notes:
- Don't forget to update logic if your plugin traverse docs.
If you need core plugins check how to get the core plugins from the changelog.
Notes:
parse()
can be async function.
Check this link to see how the new embed
works.
Notes:
- If your plugin doesn't support
embed()
print, make sure you remove it (Empty function will cause print process slower). - If your plugin supports
embed()
print and you already havevisitorKeys
for your AST, please addgetVisitorKeys()
function, it will improveembed()
print. - If your plugin supports
embed()
print and your AST have cycles, make sure exclude them ingetVisitorKeys()
function, otherwise your plugin won't work.
If you are calling Prettier APIs inside your plugin or tests, make sure they are await
ed.