Our repository has a shared formatter configuration, but one developer prefers a different local setup and overrides it before formatting their code. That produces large diffs, mixes formatting styles in the codebase, and makes future reviews harder. Would a pre-commit hook that always runs the formatter using the repository's configuration be the right solution, or is there a better workflow that still lets developers use their preferred style while editing locally?
4 Answers
This is mostly a team-process decision rather than a tooling problem. Choose one neutral format, commit its configuration to the repository, and make the formatter part of linting or the build pipeline. Individual exceptions tend to create recurring churn, so the shared standard should apply to everyone.
Personal formatting preferences and the project’s stored format serve different purposes. Some IDEs can display or temporarily reformat code using a local style, then apply the team configuration automatically when committing. That gives developers a familiar editing experience without allowing their local settings to affect the repository.
Large formatting-only changes should generally be rejected or separated from functional changes. Ask the contributor to reformat using the shared configuration and submit a smaller cleanup change if necessary. Keeping formatting changes isolated makes reviews and future history much easier.
The simplest approach is to agree on one formatting standard for the project and enforce it. Everyone can configure their editor however they like while working, but code should be normalized to the checked-in project configuration before it is committed. A pre-commit hook can help with that, although CI should also verify the result so the rule cannot be bypassed.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically