[Feature] enable Prettier to run automatically #520
Labels
💻 aspect: code
Concerns the software code in the repository
🤖 aspect: dx
Concerns developers' experience with the codebase
✨ goal: improvement
Improvement to an existing feature
help wanted
Open to participation from the community
🟩 priority: low
Low priority and doesn't need to be rushed
🏁 status: ready for work
Ready for work
Projects
Problem
I noticed when working on #507 that although this repository has the Prettier formatter enabled (since #351), it doesn't appear to be run automatically and so creates confusion when a contributor uses an IDE that does automatically apply the existing Prettier config (I believe I ran into it because of using VSCode with the official Prettier extension installed).
Description
My suggestion would be to enable Prettier via a pre-commit hook using Husky as recommended here.
If desired,
prettier . --check
could also be run in GitHub Actions, as suggested in Prettier docs.I would also suggest re-adding the
eslint-config-prettier
package to ensure ESLint and Prettier play nicely. It appears to have been removed to reduce the build size in #468 but, since it's adevDependency
, it won't affect the production build size.Alternatives
Leave it as is and remove Prettier config, however it seems like the use of Prettier is one of the CC javascript guidelines.
Additional context
There is already something here that appears to relate to pre-commit hooks. I'm not sure what that configures, potentially the git-hooks package, but that isn't installed and also doesn't appear as actively maintained or widely used as Husky:
chooser/package.json
Lines 82 to 84 in 5359920
Implementation
The text was updated successfully, but these errors were encountered: