Closed n-peugnet closed 4 years ago
hmm I am still hesitating between Prettier and the eclipse formatter. Prettier has no config and the result is great except for some small problems. On the other hand the eclipse one is fully configurable but a little bit long to get a correct config file. Another benefit of the eclipse one is that it can be imported in intellij withour plugins and it also works with eclipse and vscode out of the box.
I think I will take some time with @SylvainJoube to carefully craft an eclipse formatter file (I already started to make one some time ago) that suit my needs.
Here is the eclipse formatter plugin for maven.
Hmmm after some tweaking of the eclipse formatter I found out that it is not possible to set it up to fix the only problem I had with Prettier. So I guess that I will stick with Prettier.
This PR will be easier to review if split in two parts:
Checkstyle didn't have the capacity to fix errors automatically and also it does not support indentation with tabs. So I decided instead to add an auto-formatter: Prettier (with java extension).
Also I wanted to add some checks on the code (especially to force the use of braces on single line statements), that's why I added PMD. I just used a basic config to which I added some rules that I liked.
For now both PMD and Prettier checks will fail. I will wait for #63 to be merged before trying to fix them as otherwise it would generate a lot of conflicts.
Resolves #65
Here are the 2 extensions I recommend for VSCode with these changes:
Intellij should also have at least one plugin for Prettier and PMD, but Eclipse does not have one for Prettier yet.