pre-commit Git hook for JSONlinting

Posted by & filed under Open-source.

Place it in .git/hooks in your git source controlled directory #!/bin/sh git diff-index -z –cached HEAD –name-only –diff-filter=ACMRTUXB | xargs -0 -t -L1 /usr/local/bin/jsonlint -c; if [ “$?” != “0” ]; then echo “\nOne or more JSON file didn’t pass jsonlint’ing.”; echo “Fix them before committing. If it is not possible to fix them all… Read more »