al-quran.reflectslight.io/.husky/pre-commit

15 lines
328 B
Text
Raw Normal View History

2023-07-16 09:27:56 +02:00
#!/usr/bin/env sh
2023-10-30 00:01:32 +01:00
pattern="\.ts|\.tsx|\.js$"
2023-10-28 15:59:18 +02:00
files=$(git --no-pager diff --cached --name-only | grep -E -e "${pattern}")
if [ "$?" = "0" ]; then
2023-10-30 00:01:32 +01:00
npm run prettier -- ${files} || exit 1
npm run eslint -- --fix --exit-on-fatal-error ${files} || exit 1
2023-10-30 06:33:06 +01:00
for f in $files; do
git add "${f}"
done
2023-10-28 15:59:18 +02:00
exit 0
else
exit 0
fi