Update instructions for how to get Prettier to format on save #55

Merged
niat8586 merged 3 commits from update-prettier-format-on-save into develop 2024-12-16 13:26:20 +01:00

View File

@ -19,9 +19,14 @@ to format all Java code. To reformat the code run
Yes it's a mouthful but unfortunately the [prettier-maven-plugin](https://github.com/HubSpot/prettier-maven-plugin) Yes it's a mouthful but unfortunately the [prettier-maven-plugin](https://github.com/HubSpot/prettier-maven-plugin)
does not work due to an [outstanding issue](https://github.com/HubSpot/prettier-maven-plugin/issues/79). does not work due to an [outstanding issue](https://github.com/HubSpot/prettier-maven-plugin/issues/79).
An easier way to reformat code is to set IntelliJ to do it on save. Go to The formatting is validated by CI, but you should do it beforehand with a simple `./mvnw verify -pl .`.
`Settings -> Language & Frameworks -> JavaScript -> Prettier` and then check
### Making IntelliJ format for you
For this to work you also need to have [Node.js](https://nodejs.org)
installed and configured under `Settings -> Language & Frameworks -> Node.js`
and the file you're saving *must* be able to compile otherwise no formatting
can be performed.
Go to `Settings -> Language & Frameworks -> JavaScript -> Prettier` and then check
`Automatic Prettier Configuration`, set `Run for files` to `**/*.{java}`, `Automatic Prettier Configuration`, set `Run for files` to `**/*.{java}`,
and finally check `Run on save`. and finally check `Run on save`.
The formatting is validated by CI, but you should do it beforehand with a simple `./mvnw verify -pl .`.