Contributor
Linting & Formatting Strategy
## Overview
Overview
Toast uses Biome for linting and import organization. Formatting is handled separately by Prettier (Biome formatter is disabled).
Goals
- Fastest feedback loops — lint errors surface in-editor, not in PR review
- Zero recurring review nits — rules catch what reviewers repeatedly flag
- Graduated severity — errors block CI, warnings guide improvement
Rule Categories
Error-level (blocks CI)
| Rule | Why |
|---|---|
noUnusedImports | Dead code |
noUnusedVariables | Dead code |
noUndeclaredDependencies | Missing package.json entries |
noExplicitAny | Type safety — use unknown instead |
noNonNullAssertion | Type safety — handle null explicitly |
noDoubleEquals | Use === always |
noAssignInExpressions | Prevents accidental = vs === |
noAsyncPromiseExecutor | Error handling correctness |
noParameterAssign | Prevents confusing mutation |
useConst | Prefer const over let |
useImportType / useExportType | Correct type-only imports/exports |
noConfusingVoidType | Prevents misuse of void in unions |
noMisleadingInstantiator | Constructor/new() return-type bugs |
noConsole (API server only) | Use structured logger instead |
Warning-level (editor hints, doesn't block CI)
| Rule | Why |
|---|---|
noConsole (admin/client) | Migrate to structured logging over time |
noEmptyBlockStatements | Usually incomplete code |
useAwait | Async functions should use await |
noForEach | Prefer for...of for readability |
useDefaultSwitchClause | Exhaustive switch handling |
Overrides
- Test files (
*.test.ts,*.spec.ts):noConsoleanduseAwaitrelaxed - Scripts (
scripts/):noConsoleallowed (CLI output) - API config/logger/error-handler:
noConsoleallowed (bootstrap + logger internals) - UI component library (
packages/ui): linting disabled (third-party adapted code)
Recurring Review Nits Addressed
These patterns were repeatedly flagged by CodeRabbit and Greptile across PRs #512–#525:
console.errorinstead of structured logger →noConsole: erroron API serverprocess.envdirect access outside config → architectural convention (Biome can't enforce module boundaries, butnoConsoleon API catches the symptom)- Missing input validation →
noDoubleEquals,noAssignInExpressionscatch common variants - Parameter reassignment →
noParameterAssigncatchesif (!x) x = defaultpatterns - Unused imports accumulating →
noUnusedImportsalready enforced, now paired withnoUndeclaredDependencies
CI Integration
Biome runs as part of pnpm check in CI. Any error-level violation fails the pipeline. Warnings appear in logs but don't block merge.
Editor Setup
Install the Biome VS Code extension for real-time feedback. Warnings show as squiggly underlines — fix them as you go.