Back to Audits

Code & Testing

Is this maintainable?

Review coding standards, test coverage, and dependency health. Maintainable code scales; messy code creates debt.

Stage expectations

POC

Skip

  • Lint passes, that's enough

  • Tests are optional

  • Speed over quality

MVP

Light

  • Happy path tests exist

  • No critical vulnerabilities

  • Basic structure established

MMP

Full

  • Good test coverage

  • Tech debt documented

  • Dependencies audited

PROD

Complete

  • High coverage on critical paths

  • Dependencies current and secure

  • Debt actively managed

Linting & Formatting

POC+
  • ESLint passes with no errors
  • Prettier formatting applied consistently
  • No disabled linting rules without justification
  • Lint runs in CI on every PR
  • Pre-commit hooks enforce linting
  • Editor settings match project config

TypeScript Quality

MVP+
  • TypeScript strict mode enabled
  • No use of 'any' without explicit justification
  • Proper types for API responses
  • Shared types in dedicated files
  • Enums or const objects for fixed values
  • Generics used appropriately for reusable code
  • No ts-ignore comments without explanation

Naming Conventions

MVP+
  • PascalCase for components and types
  • camelCase for variables and functions
  • SCREAMING_SNAKE_CASE for constants
  • kebab-case for file names
  • Descriptive names (not single letters except loops)
  • Boolean variables start with is/has/should
  • Event handlers prefixed with handle or on

File Structure

MVP+
  • Files organized by feature or route
  • Components in appropriate folders (core, ui, shared)
  • Imports organized (external, internal, relative)
  • Barrel exports where appropriate
  • No circular dependencies
  • Related files colocated together

Code Organization

MMP+
  • Functions small and focused (single responsibility)
  • No deeply nested conditionals
  • Complex logic extracted to utility functions
  • Comments explain WHY, not WHAT
  • No commented-out code left in codebase
  • Magic numbers replaced with named constants

Common Issues & Quick Fixes

ESLint errors ignored in CI: Make lint failure block PR merges
TypeScript 'any' scattered throughout: Gradually type with unknown or proper types
Inconsistent naming: Document conventions in CONTRIBUTING.md, enforce with lint rules
Console.log statements in production: Add no-console lint rule, use proper logging
Circular dependencies causing bugs: Use madge or circular-dependency-plugin to detect

Quick Commands

Linting & Formatting

  • pnpm lint
  • pnpm format --check
  • npx tsc --noEmit

Dependencies

  • npm audit
  • npx depcheck
  • npx npm-check-updates

Tools & Resources

Testing Frameworks

Code Quality

Dependency Management

  • DependabotAutomated dependency updates
  • SocketSupply chain security
  • depcheckFind unused dependencies
  • knipFind unused files and dependencies

Code Analysis

AI Agent Commands

Use these prompts with your AI coding agent to check code quality:

  • Run the Code & Testing audit at MVP level
  • Find files missing test coverage
  • Check for TypeScript any usage
  • Find TODO comments without linked issues
  • Audit dependencies for security vulnerabilities

Related audits