swords-and-ravens icon indicating copy to clipboard operation
swords-and-ravens copied to clipboard

Use prettier

Open gereon77 opened this issue 4 years ago • 1 comments

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

gereon77 avatar Feb 10 '21 14:02 gereon77

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.

alecejones avatar Feb 19 '21 04:02 alecejones