Skip to content

Instantly share code, notes, and snippets.

@felippenardi
Last active February 14, 2022 12:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save felippenardi/7810b0824f47bf838eb2c8a75a09e560 to your computer and use it in GitHub Desktop.
Save felippenardi/7810b0824f47bf838eb2c8a75a09e560 to your computer and use it in GitHub Desktop.
Shell script to Run Eslint only on modified files
#!/bin/bash
CHANGED_FILES=`git diff origin/master...HEAD --name-only`
node_modules/eslint/bin/eslint.js -f json $CHANGED_FILES --quiet | node_modules/eslines/index.js --quiet
if [[ $? != 0 ]] ; then
echo "Fix style violations"
exit 1
fi
echo "All changed files are good"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment