- It is opinionated so teams no longer have to debate about coding styles. It is a refreshing change once you get used to that mindset. IC2 formatter has many configurations that developers can tweak, but that means you as a team need to debate within yourself which one(s) to configure.
- It is a CLI tool. That means you can do things like: run it as a linting tool on every commit to enforce coding styles, run it as a pre-commit hook, auto format files when you save in your IDE, etc. IC2 is closed source, and as far as I know there's no easy way to run it in a headless way.
- It is free.
- It is open source and has been tested on millions of lines of code. If you're using an open source Apex library, chances are it's part of the integration test suite, see [0]
- It is written specifically for Apex/SOQL/SOSL. That means it knows the context of your code and can format based on that. Tools like Uncrustify technically do work on Apex code, but it is being parsed as a generic C-like syntax so a lot of things do not work right (especially when Apex moves farther away from being Java-like).
- It is blessed by Salesforce, and their official IDE (VSCode) will soon adopt Prettier as the formatting tool of choice.
Those are just a few reasons. Prettier has a dedicated page [1] for everything else that also applies to this project.
I agree with you here, their tech generally lags behind the industry. It's inevitable for such a large company with so many customers relying on backwards compatibility though (the Lightning Experience switch is a counter point to that).
What I have noticed in recent years is that they have been trying to be more open when it comes to their development process, and empowering to open source developers building stuff for their platform. I built a Prettier plugin [0] for their proprietary language Apex and received a lot of support from them. Hopefully that means their ecosystem will get less "enterprisey" in the future.
- It is opinionated so teams no longer have to debate about coding styles. It is a refreshing change once you get used to that mindset. IC2 formatter has many configurations that developers can tweak, but that means you as a team need to debate within yourself which one(s) to configure.
- It is a CLI tool. That means you can do things like: run it as a linting tool on every commit to enforce coding styles, run it as a pre-commit hook, auto format files when you save in your IDE, etc. IC2 is closed source, and as far as I know there's no easy way to run it in a headless way.
- It is free.
- It is open source and has been tested on millions of lines of code. If you're using an open source Apex library, chances are it's part of the integration test suite, see [0]
- It is written specifically for Apex/SOQL/SOSL. That means it knows the context of your code and can format based on that. Tools like Uncrustify technically do work on Apex code, but it is being parsed as a generic C-like syntax so a lot of things do not work right (especially when Apex moves farther away from being Java-like).
- It is blessed by Salesforce, and their official IDE (VSCode) will soon adopt Prettier as the formatting tool of choice.
Those are just a few reasons. Prettier has a dedicated page [1] for everything else that also applies to this project.
[0] - https://github.com/dangmai/prettier-plugin-apex/blob/master/...
[1] - https://prettier.io/docs/en/why-prettier.html