Prettier v3 will change the plugin's interface. This document describes how to migrate to v3 for plugin developers.
1. Remove use of prettier.doc.build.concat(), use array literal instead.
Notes:
- Don't forget to update logic if your plugin traverse docs.
2. Remove 2nd parameter in parse() function.
If you need core plugins check how to get the core plugins from the changelog.
Notes:
parse()can be async function.
3. Update embed() 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 havevisitorKeysfor 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.
4. await your Prettier API calls.
If you are calling Prettier APIs inside your plugin or tests, make sure they are awaited.