This recommendation is motivated by the fact that a common code style will reduce extraneous git diffs caused by formatting differences. The git log will be more parseable.
A pre-commit hook is the appropriate hook to use for validating code changes before committing. We can use a precommit hook to:
- Validate JavaScript with jshint: example
- Validate white space usage: example
- Run staged files through js-beautify, in verify-only mode
The pre-commit hook should be used to run the CLI version of programs, not necessarily invoking them with Grunt. This should allow us more flexibility in controlling what constitues a "pass" or "fail" when verifying.
Git hooks can't be shared in the repo itself (imagine a hook that runs rm -rf /), so we'll need to have a simple way for sharing hooks. I'd recommend a repo on Github. Additionally, it might be wise to have some common Git settings tracked in a per repo gitconfig, such as how EOF is handled.