123456789101112131415161718192021#!/bin/sh
# Get the staged files before running check so formatter changes can be restaged.STAGED_FILES=$(git diff --cached --name-only)
echo "Running formatting, linting, and type checking..."npm run checkif [ $? -ne 0 ]; then echo "Checks failed. Please fix the errors before committing." exit 1fi
# Restage files that were previously staged and may have been modified by formatting.for file in $STAGED_FILES; do if [ -f "$file" ]; then git add "$file" fidone
echo "All pre-commit checks passed."