Last active
October 12, 2016 11:36
-
-
Save teabyii/cbef22986ca607ea5f84b4cc08e811c8 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 | |
# 只检查提交的 src 下的 js 文件 | |
eslint=./node_modules/.bin/eslint | |
result=0 | |
for file in `git diff --cached --name-only` | |
do | |
if [[ $(echo $file | grep -E "^src\/.*\.js$" | wc -l) -gt 0 ]]; | |
then | |
git show :$file | $eslint --stdin --stdin-filename $file | |
result=$((result|$?)) | |
fi | |
done | |
exit $result | |
只检查提交的 src 下的 js 文件
改成 # 只检查提交的 src/ 下的 js 文件
会好点?
这是 githooks
的脚本吗
恩,githooks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
66666666666