Code Style

Rule

Formatting & Syntax

  • MUSTUse Biome as the single source of truth for formatting.
  • MUSTUse double quotes for strings and include semicolons.
  • MUSTInclude trailing commas (ES5: objects, arrays, function params).
  • SHOULDWrap all arrow function parameters in parentheses.
  • MUSTUse kebab-case ASCII filenames. Components: component-name.tsx; utilities: util-name.ts.
  • SHOULDOrder imports external → internal → relative, and MUST use node: for Node builtins (Biome organizes imports).

Naming & Comments

  • MUSTPrefer clear function/variable names over inline comments.
  • SHOULDInclude brief inline comments only when behavior is non-obvious.
  • SHOULDUse JSDoc for exported functions/components when additional context improves DX.
  • MUSTKeep comments minimal and focused on "why" rather than "what".
  • NEVERCreate .md documentation files for application code (README.md files for packages and the .ruler system are allowed).
  • NEVERUse emojis in code or commit messages.

Canonical Code Principle

  • MUSTCode is always canonical. No backward compatibility layers, deprecation warnings, or legacy patterns.
  • MUSTWhen updating patterns or APIs, update ALL usage sites immediately. No migration periods.
  • NEVERLeave comments about "old way" vs "new way". The current code IS the way.
  • NEVERAdd compatibility shims or adapters for old patterns. Remove old patterns entirely.
  • MUSTRefactor fearlessly. The codebase reflects current best practices only.

Patterns

  • SHOULDUse regex literals over RegExp constructor.
  • MUSTUse indexOf/lastIndexOf for simple value lookups (not findIndex/findLastIndex).
  • MUSTUse .flatMap() over map().flat().

Bug Ownership

  • NEVERDismiss errors as "pre-existing bugs" and move on. If you encounter a failing test, type error, or broken behavior during your session, you caused it or your changes exposed it. Fix it.
  • NEVERWork around a bug instead of fixing it. No // @ts-ignore, no as any casts, no skipped tests to silence errors you introduced.
  • MUSTIf a test, build, or lint check fails, treat it as your responsibility. Investigate, identify the root cause, and fix it before continuing.

Cleanup

  • SHOULDUse knip to find and remove unused code when making large changes.