bootstrap/specs/nodejs/template/.githooks/pre-commit

14 lines
246 B
Plaintext
Raw Normal View History

2023-12-01 22:52:24 +00:00
#!/usr/bin/env bash
set -e
filesToFormat=$(
git --no-pager diff --name-status --no-color --cached | \
awk '$1 != "D" && $2 ~ /\.jsx?$|\.tsx?$/ {print $NF}'
)
for path in $filesToFormat
do
prettier --write "$path"
git add "$path"
done