-
-
Save ichim-david/129cbeeeb1f29e1620c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| files=$(git diff --cached --name-only | grep '\.js$') | |
| # Prevent ESLint help message if no files matched | |
| if [[ $files = "" ]] ; then | |
| exit 0 | |
| fi | |
| echo $files | xargs eslint | |
| rc=$? | |
| if [[ $rc != 0 ]] ; then | |
| echo "ESLint check failed, commit denied" | |
| exit $rc | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment