2023-07-16 09:27:56 +02:00
|
|
|
#!/usr/bin/env sh
|
2023-10-28 13:08:53 +02:00
|
|
|
|
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}")
|
2023-10-28 13:08:53 +02:00
|
|
|
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-28 15:59:18 +02:00
|
|
|
git add "${files}"
|
|
|
|
exit 0
|
2023-10-28 13:08:53 +02:00
|
|
|
else
|
|
|
|
exit 0
|
|
|
|
fi
|