tridactyl/scripts/common

28 lines
598 B
Text
Raw Normal View History

#!/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' ' '
}
staged() {
git show :"$1"
}
ugly() {
local acc=()
for jsfile in "$@"; do
diff <(staged $jsfile) <(staged $jsfile | $(npm bin)/prettier --stdin-filepath $jsfile) >/dev/null || acc+=("$jsfile")
done
echo ${acc[@]}
}
noisy() {
local acc=()
for jsfile in "$@"; do
if [ "$(git diff --cached "$jsfile" | grep '^+.*console.log' -c)" -gt '0' ] ; then
acc+=("jsfile")
fi
done
echo ${acc[@]}
}