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

12 lines
223 B
Bash
Executable File

#!/usr/bin/env bash
set -e
FORMAT_FILES=$(
git --no-pager diff --name-status --no-color --cached | \
awk '$1 != "D" && $2 ~ /\.jsx?$|\.tsx?$/ {print $NF}'
)
prettier --write "$FORMAT_FILES"
git add "$FORMAT_FILES"