chore: setup husky, lint-staged and ci pipeline (infrastructure)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
echo "🔍 Running pre-commit checks..."
|
||||
|
||||
# 1. Run lint-staged (Fast, only staged files)
|
||||
pnpm lint-staged
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Lint failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 2. Additional Global Safety Checks (Per t2.md) - Optimized for staged files
|
||||
staged_files=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(ts|tsx|js|jsx)$')
|
||||
|
||||
if [ -n "$staged_files" ]; then
|
||||
# UUID misuse check
|
||||
grep "parseInt(.*uuid" $staged_files && {
|
||||
echo "❌ UUID misuse detected (parseInt) in staged files"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# console.log check
|
||||
grep "console.log" $staged_files && {
|
||||
echo "❌ console.log is not allowed in staged files"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
echo "✅ Pre-commit passed"
|
||||
Reference in New Issue
Block a user