Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Mercer drmercer

View GitHub Profile
@drmercer
drmercer / pre-commit
Last active Apr 19, 2017 — forked from wesbos/commit-msg
ESLint 3.0 Git Pre Commit Hook
View pre-commit
#!/bin/sh
# Get a list of all JS files currently staged for commit
files=$(git diff --cached --name-only | grep '\.jsx\?$')
# Prevent ESLint help message if no files matched
if [ -z "$files" ] ; then
echo "(No JavaScript files to lint.)"
exit 0
fi