Last active
February 15, 2018 15:48
-
-
Save timurista/9c79d10521d4ce186d6581cf21e26cb6 to your computer and use it in GitHub Desktop.
Bash script for finding console logs in your branch
This file contains 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
# grabs files between develop / master and head | |
files=`git diff --name-only develop..HEAD -- "*.js"` | |
# Save current IFS | |
SAVEIFS=$IFS | |
# Change IFS to new line. | |
IFS=$'\n' | |
names=($files) | |
# Restore IFS | |
IFS=$SAVEIFS | |
# iterate and run eslint on those files | |
echo 'linting js files for console log errors...' | |
for (( i=0; i<${#files[@]}; i++ )) | |
do | |
file=$files[$i] | |
eslint --rule 'no-console: [2]' $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment