mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Fix {pretty,lint} when staging more than one file
This commit is contained in:
parent
bc2abbb812
commit
ad261b2e4f
2 changed files with 7 additions and 4 deletions
|
@ -7,9 +7,9 @@ cachedJS() {
|
||||||
ugly() {
|
ugly() {
|
||||||
local acc=()
|
local acc=()
|
||||||
for jsfile in "$@"; do
|
for jsfile in "$@"; do
|
||||||
diff "$jsfile" <($(npm bin)/prettier "$jsfile") >/dev/null || acc+=("$jsfile")
|
diff "$jsfile" <($(npm bin)/prettier $jsfile) >/dev/null || acc+=("$jsfile")
|
||||||
done
|
done
|
||||||
echo $acc
|
echo ${acc[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
noisy() {
|
noisy() {
|
||||||
|
@ -19,5 +19,5 @@ noisy() {
|
||||||
acc+=("jsfile")
|
acc+=("jsfile")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo $acc
|
echo ${acc[@]}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
|
|
||||||
source ./scripts/common
|
source ./scripts/common
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
uglyFiles=$(ugly $(cachedJS))
|
uglyFiles=$(ugly $(cachedJS))
|
||||||
|
|
||||||
if [ -n "$uglyFiles" ]; then
|
if [ -n "$uglyFiles" ]; then
|
||||||
prettier --write "$uglyFiles"
|
prettier --write $uglyFiles
|
||||||
|
git add $uglyFiles
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue