Skip to content

Instantly share code, notes, and snippets.

@timurista
Last active February 15, 2018 15:48
Show Gist options
  • Save timurista/9c79d10521d4ce186d6581cf21e26cb6 to your computer and use it in GitHub Desktop.
Save timurista/9c79d10521d4ce186d6581cf21e26cb6 to your computer and use it in GitHub Desktop.
Bash script for finding console logs in your branch
# 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