#!/usr/bin/env sh pattern="\.ts|\.tsx|\.js$" files=$(git --no-pager diff --cached --name-only | grep -E -e "${pattern}") if [ "$?" = "0" ]; then npm run prettier -- ${files} || exit 1 npm run eslint -- --fix --exit-on-fatal-error ${files} || exit 1 git add "${files}" exit 0 else exit 0 fi