2018-05-18 15:35:32 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cachedJS() {
|
2018-05-24 08:07:51 -06:00
|
|
|
git diff --cached --name-only --diff-filter=ACM "*.js" "*.jsx" "*.ts" "*.tsx" "*.md" "*.css" | tr '\n' ' '
|
2018-05-18 15:35:32 +01:00
|
|
|
}
|
|
|
|
|
2018-05-21 16:22:29 +01:00
|
|
|
staged() {
|
|
|
|
git show :"$1"
|
|
|
|
}
|
|
|
|
|
2018-05-18 15:35:32 +01:00
|
|
|
ugly() {
|
|
|
|
local acc=()
|
|
|
|
for jsfile in "$@"; do
|
2018-05-21 16:22:29 +01:00
|
|
|
diff <(staged $jsfile) <(staged $jsfile | $(npm bin)/prettier --stdin-filepath $jsfile) >/dev/null || acc+=("$jsfile")
|
2018-05-18 15:35:32 +01:00
|
|
|
done
|
2018-05-21 15:30:36 +01:00
|
|
|
echo ${acc[@]}
|
2018-05-18 15:35:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
noisy() {
|
|
|
|
local acc=()
|
|
|
|
for jsfile in "$@"; do
|
|
|
|
if [ "$(git diff --cached "$jsfile" | grep '^+.*console.log' -c)" -gt '0' ] ; then
|
|
|
|
acc+=("jsfile")
|
|
|
|
fi
|
|
|
|
done
|
2018-05-21 15:30:36 +01:00
|
|
|
echo ${acc[@]}
|
2018-05-18 15:35:32 +01:00
|
|
|
}
|