mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
feat: add Claude Code hooks and lint checking
- Add pre-PR lint check hooks to prevent CI failures - Create check-lint.sh script for comprehensive linting - Configure hooks in .claude/settings.json - Improve development workflow with automated quality checks
This commit is contained in:
parent
7e0d44dac8
commit
ba4f0a375f
12
.claude/settings.json
Normal file
12
.claude/settings.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"hooks": {
|
||||
"pre-pr-create": {
|
||||
"command": "cd /home/fritz/workspace/utopia-map && ./scripts/check-lint.sh",
|
||||
"description": "Run linting checks before creating PR"
|
||||
},
|
||||
"pre-pr-update": {
|
||||
"command": "cd /home/fritz/workspace/utopia-map && ./scripts/check-lint.sh",
|
||||
"description": "Run linting checks before updating PR"
|
||||
}
|
||||
}
|
||||
}
|
||||
50
scripts/check-lint.sh
Executable file
50
scripts/check-lint.sh
Executable file
@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Claude Code Hook: Pre-PR Lint Check
|
||||
# This script runs linting checks on both app and lib before PR operations
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
echo "🔍 Running lint checks before PR operation..."
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
LINT_FAILED=0
|
||||
|
||||
# Check if we're in the utopia-map directory
|
||||
if [[ ! -f "tsconfig.base.json" ]]; then
|
||||
echo -e "${RED}❌ Error: Must be run from utopia-map root directory${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}📋 Checking app linting...${NC}"
|
||||
cd app
|
||||
if npm run test:lint:eslint; then
|
||||
echo -e "${GREEN}✅ App linting passed${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ App linting failed${NC}"
|
||||
LINT_FAILED=1
|
||||
fi
|
||||
cd ..
|
||||
|
||||
echo -e "${YELLOW}📋 Checking lib linting...${NC}"
|
||||
cd lib
|
||||
if npm run test:lint:eslint; then
|
||||
echo -e "${GREEN}✅ Lib linting passed${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Lib linting failed${NC}"
|
||||
LINT_FAILED=1
|
||||
fi
|
||||
cd ..
|
||||
|
||||
if [[ $LINT_FAILED -eq 1 ]]; then
|
||||
echo -e "${RED}❌ Lint checks failed. Please fix linting errors before creating/updating PR.${NC}"
|
||||
echo -e "${YELLOW}💡 Tip: Run 'npm run lintfix' in the failing directory to auto-fix some issues.${NC}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${GREEN}🎉 All lint checks passed! Ready for PR operation.${NC}"
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user