Source: docs/guides/CONTINUOUS_LINT_MONITOR.md
π Continuous Lint & Error Monitoring System
Purpose: Automated monitoring and error detection for apps/backend/ and frontend applications
π Monitored Locations
Backend
- Path:
/apps/backend/ - Language: Python 3.11+
- Framework: FastAPI
- Key Files:
server.py- Main application entryservices/- Business logictools/- MCP tool implementationsroutes/- API route handlers
Frontend
- Path:
/clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities/ - Language: TypeScript/JavaScript
- Framework: Next.js 15.5.3
- Key Directories:
app/- Next.js App Router pageslib/- Utility functionscomponents/- React components
π οΈ Linting Tools & Commands
Backend (Python)
Syntax Check
cd apps/backend
python -m py_compile server.py
python -m py_compile services/**/*.pyType Checking (if using mypy)
cd apps/backend
mypy server.py --ignore-missing-importsCode Style (flake8/black)
cd apps/backend
flake8 . --max-line-length=120 --exclude=venv,__pycache__
black . --checkImport Sorting (isort)
cd apps/backend
isort . --check-onlyFrontend (Next.js/TypeScript)
TypeScript Type Check
cd clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities
npm run type-check # or: tsc --noEmitESLint
cd clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities
npx eslint . --ext .ts,.tsx,.js,.jsxBuild Check (catches most errors)
cd clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities
npm run buildπ€ Automated Monitoring Script
Quick Lint Script (lint-all.sh)
#!/bin/bash
echo "π Starting Continuous Lint Check..."
echo ""
# Backend linting
echo "π¦ Checking Backend (Python)..."
cd apps/backend
python -m py_compile server.py 2>&1
if [ $? -eq 0 ]; then
echo "β
Backend: No syntax errors"
else
echo "β Backend: Syntax errors detected!"
fi
echo ""
# Frontend linting
echo "π¨ Checking Frontend (Next.js)..."
cd ../../clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities
npm run build 2>&1 | tail -20
if [ $? -eq 0 ]; then
echo "β
Frontend: Build successful"
else
echo "β Frontend: Build failed!"
fi
echo ""
echo "π Lint check complete"Watch Mode Script (watch-lint.sh)
#!/bin/bash
echo "π Starting watch mode (checks every 30 seconds)..."
while true; do
clear
echo "π Continuous Lint Monitor - $(date)"
echo "========================================="
echo ""
# Backend check
cd apps/backend
python -m py_compile server.py 2>&1
BACKEND_STATUS=$?
# Frontend check (quick type check only)
cd ../../clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities
npm run type-check 2>&1 | tail -5
FRONTEND_STATUS=$?
echo ""
echo "========================================="
if [ $BACKEND_STATUS -eq 0 ] && [ $FRONTEND_STATUS -eq 0 ]; then
echo "β
All systems operational"
else
echo "β οΈ Issues detected - review above output"
fi
echo ""
echo "Next check in 30 seconds... (Ctrl+C to stop)"
sleep 30
doneπ¨ Common Issues & Fixes
Backend Issues
Import Errors
Symptom: ModuleNotFoundError or ImportError
Fix:
cd apps/backend
pip install -r requirements.txt
# or with uv:
uv pip install -r requirements.txtEnvironment Variables
Symptom: Missing .env file warnings
Fix:
cd /path/to/project/root
cp .env.example .env
# Edit .env with actual valuesFrontend Issues
Missing Dependencies
Symptom: Cannot find module errors
Fix:
cd clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities
npm install --legacy-peer-depsType Errors
Symptom: TypeScript compilation errors Fix: Check the specific error message and:
- Add missing type definitions
- Fix incorrect type usage
- Add
// @ts-ignoreas last resort for third-party issues
Build Warnings (Non-blocking)
Current Warnings:
- Missing exports (resolved with fallback implementations)
- Deprecated Next.js lint command (informational only)
π Pre-Commit Checks
Recommended Git Hook (.git/hooks/pre-commit)
#!/bin/bash
echo "π Running pre-commit checks..."
# Backend syntax check
cd apps/backend
python -m py_compile server.py
if [ $? -ne 0 ]; then
echo "β Backend has syntax errors. Commit aborted."
exit 1
fi
# Frontend type check (fast)
cd ../../clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities
npm run type-check > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "β οΈ Frontend has type errors. Consider fixing before committing."
# Don't abort, just warn
fi
echo "β
Pre-commit checks passed"
exit 0π CI/CD Integration
GitHub Actions Example (.github/workflows/lint.yml)
name: Lint & Type Check
on: [push, pull_request]
jobs:
backend-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
cd apps/backend
pip install -r requirements.txt
- name: Check syntax
run: |
cd apps/backend
python -m py_compile server.py
frontend-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: |
cd clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities
npm install --legacy-peer-deps
- name: Type check
run: |
cd clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities
npm run type-check
- name: Build check
run: |
cd clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities
npm run buildπ Monitoring Dashboard
Key Metrics to Track
| Metric | Backend | Frontend |
|---|---|---|
| Syntax Errors | py_compile exit code | TypeScript errors count |
| Build Status | N/A | npm run build success |
| Import Issues | ImportError count | Module not found count |
| Type Coverage | N/A | Types vs any ratio |
| Dependency Health | pip check | npm audit |
Quick Status Check Command
# One-line health check
cd apps/backend && python -m py_compile server.py && echo "β
Backend OK" || echo "β Backend Error"
cd clients/frontend-001-nextjs-ui-grok-chat-polymarket-micro-betting-altsport-opportunities && npm run type-check && echo "β
Frontend OK" || echo "β Frontend Error"π― Best Practices
For Backend Development
- Always run
python -m py_compilebefore committing - Test with
python server.pylocally before deploying - Use type hints consistently
- Keep imports organized (use
isort)
For Frontend Development
- Always run
npm run buildbefore pushing - Fix TypeScript errors immediately (don't accumulate tech debt)
- Use proper types instead of
any - Run Vercel preview deployments for each PR
Error Response Protocol
- Syntax Error: Fix immediately (blocks deployment)
- Type Error: Fix within 1 day (affects reliability)
- Lint Warning: Fix within 1 week (affects maintainability)
- Deprecation Warning: Track but don't block (plan migration)
π§ Tools Installation
Backend Tools
pip install flake8 black mypy isortFrontend Tools
npm install -g eslint typescriptπ Quick Reference
Current Status: β All systems operational (as of 2025-09-30)
Backend:
- No syntax errors
- FastAPI server running
- All core endpoints functional
Frontend:
- Build successful (1m 13s)
- 105 pages deployed
- 0 critical errors
- 12 non-blocking warnings
Last updated: 2025-09-30 Monitoring: Active