We use pre-commit to enforce our .editorconfig (newline at EOF, no bad indentation, etc.) before code is committed.
# install pre-commit if you don’t already have it
pip install pre-commit # or brew install pre-commit / pipx install pre-commit
# enable the git hook in this repo
pre-commit install
# optional: clean up the repo on demand
pre-commit run --all-files
git add -A
- Auto-fixers run (e.g. add final newlines).
- After the auto-fixers, the editorconfig-checker runs inside Docker to validate all staged files.
- If violations remain, fix them manually until the commit passes.