Implement Git Hooks to improve the engineer experience #3806
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds automatic code formatting on commit using elixir_git_hooks.
When you commit code, git hooks now automatically format your staged files:
.ex,.exs,.heex) withmix format.js,.ts,.tsx,.jsx) withprettier.md) withprettierThe hooks format the files and re-stage them, so your commit always contains properly formatted code. If the formatter removes your only changes (like a blank line that violated formatting rules), the commit is blocked with a clear message.
Re #269
Validation steps
Additional notes for the reviewer
The hooks run on pre-commit (not pre-push as suggested in #269). This catches formatting issues earlier in the workflow. The hooks are configured in
config/dev.exsand only run in development mode.The
git_hookspackage auto-installs hooks when you runmix compile, so developers don't need to manually set anything up.AI Usage
Pre-submission checklist
:owner,:admin,:editor,:viewer)