Toast
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

  1. Fastest feedback loops — lint errors surface in-editor, not in PR review
  2. Zero recurring review nits — rules catch what reviewers repeatedly flag
  3. Graduated severity — errors block CI, warnings guide improvement

Rule Categories

Error-level (blocks CI)

RuleWhy
noUnusedImportsDead code
noUnusedVariablesDead code
noUndeclaredDependenciesMissing package.json entries
noExplicitAnyType safety — use unknown instead
noNonNullAssertionType safety — handle null explicitly
noDoubleEqualsUse === always
noAssignInExpressionsPrevents accidental = vs ===
noAsyncPromiseExecutorError handling correctness
noParameterAssignPrevents confusing mutation
useConstPrefer const over let
useImportType / useExportTypeCorrect type-only imports/exports
noConfusingVoidTypePrevents misuse of void in unions
noMisleadingInstantiatorConstructor/new() return-type bugs
noConsole (API server only)Use structured logger instead

Warning-level (editor hints, doesn't block CI)

RuleWhy
noConsole (admin/client)Migrate to structured logging over time
noEmptyBlockStatementsUsually incomplete code
useAwaitAsync functions should use await
noForEachPrefer for...of for readability
useDefaultSwitchClauseExhaustive switch handling

Overrides

  • Test files (*.test.ts, *.spec.ts): noConsole and useAwait relaxed
  • Scripts (scripts/): noConsole allowed (CLI output)
  • API config/logger/error-handler: noConsole allowed (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:

  1. console.error instead of structured loggernoConsole: error on API server
  2. process.env direct access outside config → architectural convention (Biome can't enforce module boundaries, but noConsole on API catches the symptom)
  3. Missing input validationnoDoubleEquals, noAssignInExpressions catch common variants
  4. Parameter reassignmentnoParameterAssign catches if (!x) x = default patterns
  5. Unused imports accumulatingnoUnusedImports already enforced, now paired with noUndeclaredDependencies

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.

On this page