Last active
July 1, 2025 15:12
-
-
Save camwest/f55852e300fdf39880a3a27fc26d55d4 to your computer and use it in GitHub Desktop.
Claude Code Hook: Code Quality Check - Runs TypeScript and linting after file edits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Claude Code Hook: Code Quality Check | |
# Runs TypeScript check and lint fix after file modifications | |
echo "π Running code quality checks..." | |
# Run TypeScript check | |
echo " β Type checking..." | |
npx tsc --noEmit | |
if [ $? -ne 0 ]; then | |
echo "β TypeScript errors found" | |
echo '{"decision": "block", "reason": "TypeScript errors detected. Please fix type errors before proceeding."}' | |
exit 0 | |
fi | |
# Run lint fix | |
echo " β Linting and fixing..." | |
yarn lint:fix | |
if [ $? -ne 0 ]; then | |
echo "β Linting failed" | |
echo '{"decision": "block", "reason": "Linting failed. Please fix linting errors manually."}' | |
exit 0 | |
fi | |
echo "β Code quality checks passed" | |
echo '{"decision": "approve"}' | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment