Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 2.33 KB

File metadata and controls

51 lines (40 loc) · 2.33 KB

General Rules

  • MUST: Use @antfu/ni. Use ni to install, nr SCRIPT_NAME to run. nun to uninstall.
  • MUST: Use TypeScript interfaces over types.
  • MUST: Keep all types in the global scope.
  • MUST: No inline imports unless nessessarty
  • MUST: Use arrow functions over function declarations
  • MUST: Default to NO comments. Only add a comment when the user explicitly asks, or when the "why" is truly non-obvious - browser quirks, platform bugs, performance tradeoffs, fragile internal patching, or counter-intuitive design decisions. Never add comments that restate what the code does or what a well-named function/variable already conveys. When in doubt, leave the comment out.
    • Do not delete descriptive comments >3 lines without confirming with the user
  • MUST: Use kebab-case for files
  • MUST: Use descriptive names for variables (avoid shorthands, or 1-2 character names).
    • Example: for .map(), you can use innerX instead of x
    • Example: instead of moved use didPositionChange
  • MUST: Frequently re-evaluate and refactor variable names to be more accurate and descriptive.
  • MUST: Do not type cast ("as") unless absolutely necessary
  • MUST: Remove unused code and don't repeat yourself.
  • MUST: Always search the codebase, think of many solutions, then implement the most elegant solution.
  • MUST: Put all magic numbers in constants.ts using SCREAMING_SNAKE_CASE with unit suffixes (_MS, _PX).
  • MUST: Put small, focused utility functions in utils/ with one utility per file.
  • MUST: Use Boolean over !!.

Testing

Run checks always before committing with:

pnpm test # runs tests
pnpm lint
pnpm typecheck # runs type checking
pnpm format

Development instructions

This is a pnpm monorepo with packages/ (libraries, tools). No external services (databases, Docker, etc.) are required.

Build before test

pnpm build must complete before pnpm test or pnpm lint. After modifying source files, always rebuild before running tests.

Key commands reference

See root package.json scripts for the full list. Quick reference:

  • Install: ni (or pnpm install)
  • Build: nr build (or pnpm build)
  • Dev watch: nr dev (or pnpm dev) - watches packages
  • Test: pnpm test - runs tests
  • Lint: pnpm lint - oxlint
  • Typecheck: pnpm typecheck - tsc
  • Format: pnpm format - oxfmt