This document outlines the coding conventions and standards for the ax-score project.
strict: trueis mandatory intsconfig.json.- No
anytype allowed. Useunknownif the type is truly dynamic. as any,@ts-ignore, and@ts-expect-errorare strictly forbidden.
- Use
interfacefor public APIs and external contracts. - Use
typefor internal definitions, unions, and intersections.
- Omit type annotations when the type can be clearly inferred by the compiler.
- Use type-only imports:
import type { ... } from '...'.
| Target | Rule | Example |
|---|---|---|
| File | kebab-case | base-audit.ts |
| Variable | camelCase | auditResult |
| Function | camelCase | calculateScore() |
| Constant | UPPER_SNAKE_CASE | DEFAULT_TIMEOUT |
| Type/Interface | PascalCase | GathererResult |
- Node.js built-in modules (
fs,path,http) - External libraries (
commander,chalk) - Internal project modules using
@/alias or relative paths - Type-only imports
- Never use empty catch blocks.
- Use custom error classes for specific failure modes (e.g.,
GathererError,AuditError). - Provide actionable error messages that help the user understand what went wrong.
- We use vitest for testing.
- Follow the Given-When-Then pattern for test descriptions.
- Aim for high coverage on audits and gatherers.
- No console.log: Use the project's logger or reporter for output.
- No magic numbers: Use named constants for timeouts, weights, and thresholds.
- No deep nesting: Prefer early returns to reduce indentation.
- No side effects in gatherers: Gatherers should only collect data, not modify state or perform audits.