Skip to content

Instantly share code, notes, and snippets.

@sbisbee
Created March 8, 2016 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbisbee/ba77b1cca728bfb4a975 to your computer and use it in GitHub Desktop.
Save sbisbee/ba77b1cca728bfb4a975 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Looks for jshint unnecessary semicolon errors and automatically strips them
# out, dealing with trailing white spaces.
IFS=$'\n'
for line in $(./node_modules/.bin/jshint ./lib | grep 'Unnecessary semicolon');
file=$(echo $line | sed -e 's/: .*//')
lNum=$(echo $line | sed -e 's/.* line \([0-9]*\),.*/\1/')
sed -i -e "$lNum s/ *$//" -e "$lNum s/;$//" $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment