3 ms·
I recall the React team were discussing at what part of the build step they should include Prettier. I believe there was an idea of adding it as a pre-commit h
by vmasto 9y ago
I recall the React team were discussing at what part of the build step they should include Prettier.
I believe there was an idea of adding it as a pre-commit hook, a second one as a manual step and another one as a post-commit amend.
Have we reached a consensus on that? Not up to date what they went with, what seems to be the best way to do this?
- jcuanan 9y agoI'm also curious about this. FWIW, I came across this post on adding Prettier as a pre-commit hook that might help others: https://medium.com/@brindelle/format-your-javascript-with-prettier-before-committing-177079ec356a https://medium.com/@brindelle/format-your-javascript-with-pr...
- llimllib 9y agoI run it at pre-commit and in CI before approving a PR. Basically my thought is to trust my team to do it whatever way they want to, in the editor, manually, or as a commit hook; and then verify it on the backend before committing.
- paulddraper 9y agoThis is exactly right. First project I saw using this approach a couple years ago was Play Framework + scalariform.
- danabramov 9y agoWe currently do the same thing Jest does: no hooks, but we offer it as `npm run prettier`, and we also run the comparison on CI (so if the prettier output is different, the PR fails). This means the code is always checked in formatted, but people need to remember to run `npm run prettier` or CI will fail.
- vmasto 9y agoInteresting, thanks Dan.