Skip to content

Commit c0759d1

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent fc948a4 commit c0759d1

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

.githooks/pre-commit

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
set -eu
44

5-
files=$(git diff --cached --name-only --diff-filter=ACMR -- '*.js')
6-
if [ -n "$files" ]; then
7-
npx --no-install prettier --write $files
8-
printf '%s\n' "$files" | xargs git add --
5+
tmp=$(mktemp)
6+
git diff --cached --name-only --diff-filter=ACMR -- '*.js' > "$tmp"
7+
if [ -s "$tmp" ]; then
8+
while IFS= read -r file; do
9+
npx --no-install prettier --write "$file"
10+
git add -- "$file"
11+
done < "$tmp"
912
fi
13+
rm -f "$tmp"
1014

1115
npm run check

0 commit comments

Comments
 (0)