Last active
October 3, 2017 01:01
-
-
Save luisliuchao/a9964c58e0c22096e983179993b8bd10 to your computer and use it in GitHub Desktop.
Automatically add /* eslint-disable */ at the beginning of all *.js files excluding node_modules and bower_components
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
function addEslintDisable { | |
filepath="$1" | |
if [ -d $filepath ] && [[ $filepath != node_modules ]] && [[ $filepath != bower_components ]] | |
then | |
for file in $(ls $filepath | cat); do | |
newfilepath="$filepath/$file" | |
$(addEslintDisable $newfilepath) | |
done | |
elif [[ $filepath = *.js ]] | |
then | |
sed -i '' '1s/^/\/\/ remove eslint disable comment when you edit this file\'$'\n/' $filepath | |
sed -i '' '1s/^/\/\* eslint-disable \*\/\'$'\n/' $filepath | |
fi | |
} | |
addEslintDisable $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run
sh sk-eslint-disable.sh $filepath