Skip to content

Instantly share code, notes, and snippets.

@kimniche
Last active December 22, 2016 23:04
Show Gist options
  • Save kimniche/c1e2fcb5ad174bbeccefff2f0510e22e to your computer and use it in GitHub Desktop.
Save kimniche/c1e2fcb5ad174bbeccefff2f0510e22e to your computer and use it in GitHub Desktop.
After commit, warn if `eslint-disabled` is found in any of the commit's files
#!/bin/bash
LOG="[post-commit]"
unlinted=`grep eslint-disable $(git diff-tree --no-commit-id --name-only -r HEAD~1) -H`
if [ -z "$unlinted" ]; then
tput setaf 2; echo "$LOG no lint-disabled files found in commit"
else
tput setaf 3; echo "$LOG WARNING: lint-disabled files detected in commit"
fi
tput setaf 7
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment