Skip to content

Upgrading to Prettier Apex v2

Dang Mai edited this page Aug 2, 2024 · 5 revisions

Prettier Apex v2 is meant to be used in conjunction with Prettier >= v3.0.0. Because of that, you have to upgrade both Prettier and Prettier Apex in tandem. Here is the upgrade process for Prettier: https://prettier.io/blog/2023/07/05/3.0.0.html

If you can't upgrade Prettier to v3, then you have to stay on Prettier Apex 1.13.0.

One notable difference for Prettier Apex v2 is that we are dropping support for NodeJS < 18.11.0 (which is a different requirement to Prettier's), so you can follow these concrete steps to upgrade both:

  • Upgrade NodeJS to version >= 18.11.0. We recommend the latest LTS version on the official website: https://nodejs.org/en
  • Upgrade Prettier to v3
  • Upgrade Prettier Apex to v2
  • Add plugins to Prettier config if you are using one (e.g. .prettierrc), for example:
{
  "plugins": ["prettier-plugin-apex"]
}
  • Add plugin to any CLI command you are currently using (e.g. in your CI/CD builds):
prettier --plugin=prettier-plugin-apex ...
  • If you are using VSCode, restart VSCode (otherwise the new versions won't be picked up).
Clone this wiki locally