TypeScript Tooling
Priority: P1 (OPERATIONAL)
Implementation Guidelines
- Compiler: Use
tscfor CI builds;esbuildorts-nodefor development. - Linting: Enforce
ESLintwith@typescript-eslint/recommended. Enable strict type checking. - Formatting: Mandate
Prettiervialint-stagedand.prettierrc. - Testing: Use
Vitest(orJest) for unit/integration testing. Target > 80% line coverage. - Builds: Use
tsup(library bundling) orVite(web applications). - TypeScript Config: Aim for
strict: truelong-term. For existing projects, migrate incrementally: start withstrictNullChecks, thennoImplicitAny,strictFunctionTypes. Do NOT flipstrict: truein one step. - CI/CD: Always run
tsc --noEmitin build pipeline to catch type errors. - Error Suppression: Favor
@ts-expect-errorover@ts-ignorefor documented edge-cases.
ESLint Configuration
Enable @typescript-eslint/recommended at minimum. When strict: false in tsconfig, no-unsafe-* rules may produce excessive noise — suppress selectively with @ts-expect-error rather than disabling globally.
See reference for common linting issues (request typing, unused params, test mock typing) and tsconfig migration examples.
Verification Workflow (Mandatory)
After editing any .ts / .tsx file:
- Call
getDiagnostics(typescript-lsp MCP tool) — surfaces type errors in real time. - Run
tsc --noEmitin CI — catches project-wide errors LSP may miss. - Run
eslint --fix— auto-fix formatting and lint violations.
Fallback when typescript-lsp MCP unconfigured: run
tsc --noEmitdirectly.
getDiagnostics fastest feedback loop. Use it before every commit on modified files. Use getHover to inspect inferred types, getReferences before renaming symbols.
Anti-Patterns
- No
@ts-ignore: Use@ts-expect-error— self-documents intent, fails if error disappears. - No
anyfor request objects: Import centralized interfaces fromsrc/common/interfaces/. - No
eslint-disable(global): Suppress per-line; fix root cause instead. - No atomic
strict: trueflip on existing repos: migrate incrementally starting withstrictNullChecks.