Skip to content

Instantly share code, notes, and snippets.

@shannonmoeller
Created May 28, 2020 16:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shannonmoeller/302ebe85315207467e239210658eb0ae to your computer and use it in GitHub Desktop.
Save shannonmoeller/302ebe85315207467e239210658eb0ae to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
JS_FILES="$(git diff --name-only --staged --diff-filter=ACM | grep '.js$')"
if [ -n "$JS_FILES" ]; then
set -e
echo 'eslint' && ./node_modules/.bin/eslint --fix $JS_FILES
echo 'prettier' && ./node_modules/.bin/prettier --write $JS_FILES
echo 'git add' && git add $JS_FILES
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment