diff --git a/agents.md b/agents.md new file mode 100644 index 0000000..c4b41f6 --- /dev/null +++ b/agents.md @@ -0,0 +1,136 @@ +# Static Testing Strategy for UI Changes + +## Overview +This document outlines the static testing strategy to ensure code quality and build integrity after UI changes. Run these checks from the `web` directory to validate TypeScript and ESLint rules. + +## Commands + +### 1. Run All Checks +```bash +cd /home/sschuhmann/dev/rehearshalhub/web +npm run check +``` +This command runs both TypeScript and ESLint checks sequentially. + +### 2. Run TypeScript Check +```bash +cd /home/sschuhmann/dev/rehearshalhub/web +npm run typecheck +``` +Validates TypeScript types and catches unused variables/imports. + +### 3. Run ESLint +```bash +cd /home/sschuhmann/dev/rehearshalhub/web +npm run lint +``` +Enforces code style, formatting, and best practices. + +## When to Run +- **After Every UI Change**: Run `npm run check` to ensure no regressions. +- **Before Commits**: Add a pre-commit hook to automate checks. +- **Before Deployment**: Verify build integrity. + +## Common Issues and Fixes + +### 1. Unused Imports +**Error**: `TS6133: 'X' is declared but its value is never read.` +**Fix**: Remove the unused import or variable. + +**Example**: +```ts +// Before +import { useQuery } from "@tanstack/react-query"; // Unused + +// After +// Removed unused import +``` + +### 2. Missing Imports +**Error**: `TS2304: Cannot find name 'X'.` +**Fix**: Import the missing dependency. + +**Example**: +```ts +// Before +function Component() { + useEffect(() => {}, []); // Error: useEffect not imported +} + +// After +import { useEffect } from "react"; +function Component() { + useEffect(() => {}, []); +} +``` + +### 3. Formatting Issues +**Error**: ESLint formatting rules violated. +**Fix**: Use consistent indentation (2 spaces) and semicolons. + +**Example**: +```ts +// Before +function Component(){return