Longwelwind / swords-and-ravens

An online platform to play the board game "A Game of Thrones: The Board Game 2nd Edition"
https://swordsandravens.net/
GNU General Public License v3.0
109 stars 30 forks source link

Use prettier #783

Open gereon77 opened 3 years ago

gereon77 commented 3 years ago

https://prettier.io/docs/en/install.html

alecejones commented 3 years ago

This can be done effectively using husky and the lint-staged module. It will auto-format staged files as part of the commit process. You can add a .prettierrc.js file to customize the format.

https://www.npmjs.com/package/husky https://www.npmjs.com/package/lint-staged

The only caveat is to use husky version 4, as version 5 (latest) has some ongoing licensing issues.

Because it auto-formats the entire file, it may be best to start using prettier with one large commit from running prettier across the entire codebase. That will ensure that future commits don't have formatting-based changes in PRs.