Files
openconcho/.claude/rules/coding-standards.md
Offending Commit 764a7502a3 docs: add project docs, GitHub DX, fire-tools stamp
- CLAUDE.md with commands, structure, key constraints
- .claude/rules/ coding standards + workflows
- docs/architecture.md with design decisions
- .github/ CI workflow, issue templates, PR template
- LICENSE (MIT)
- .fire-tools.json initialization stamp
- README.md rewritten with features, quick start, stack table
2026-04-24 21:42:03 -05:00

1.4 KiB

description
description
Coding conventions — read when writing or reviewing any code file

Coding Standards

DO

  • Use TypeScript strict mode ("strict": true in tsconfig)
  • Use Zod only at user-input boundaries (settings form) — not for internal types
  • Use named constants — never magic numbers or strings
  • Keep components focused; co-locate sub-components in the same file if < 80 lines
  • Use type imports for framer-motion's Variants type to avoid widening issues
  • Cast TanStack Router params as as never for cross-route navigation

NEVER

  • Use any — use unknown and narrow explicitly
  • Inline Honcho base URL — always read from loadConfig() in src/lib/config.ts
  • Use Tailwind color classes for theme-sensitive values — use CSS var(--*) instead
  • Use React.FormEvent (deprecated in TS6) — use React.SyntheticEvent<HTMLFormElement>
  • Add as const to framer-motion variant objects — annotate with const x: Variants = {}

Test Standards

  • One assertion per test case
  • Test behavior, not implementation
  • Run targeted: pnpm vitest run src/path/to/file.test.ts
  • Never mock internal modules — mock only external API boundaries (openapi-fetch client)

API Query Patterns

  • All data fetching via TanStack Query hooks in src/api/queries.ts
  • POST body shapes are fixed per the openapi schema — do not guess field names
  • Use client.current (getter) to always get fresh config at call time