Skip to content

Commit 27a7970

Browse files
committed
Don't run linter on pre-push if nothing to lint
1 parent 112cd52 commit 27a7970

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.husky/pre-push

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ if echo "$stdin" | grep -q "^(delete)"; then
99
exit 0
1010
fi
1111

12-
files_to_check=$(git diff --cached "$(git merge-base main HEAD)" --name-only --diff-filter=d)
13-
if [[ -n $files_to_check ]]; then
12+
raw_files_to_check="$(git diff main...HEAD --name-only --diff-filter=d)"
13+
if [[ -n "$raw_files_to_check" ]]; then
1414
echo "*** Checking for lint violations in changed files ***************"
1515
echo
1616

17-
yarn prettier --check --ignore-unknown $files_to_check || exit $?
17+
echo "$raw_files_to_check" | while IFS='\n' read -r line; do
18+
printf '%s\0' "$line"
19+
done | xargs -0 yarn prettier --check --ignore-unknown || exit $?
1820
fi
1921

2022
echo

0 commit comments

Comments
 (0)