Axiom updates

This commit is contained in:
jableader 2025-11-02 18:33:51 +11:00
parent 1b740c0234
commit d5fbc5d212

View file

@ -48,13 +48,15 @@ Key axioms
- No casts (`as`, angle brackets) and no `any`/`unknown` in app code. Generated files are exempt. - No casts (`as`, angle brackets) and no `any`/`unknown` in app code. Generated files are exempt.
- Arrays that are required in OpenAPI are non-nullable in domain types (e.g., `Meal.recipes`). - Arrays that are required in OpenAPI are non-nullable in domain types (e.g., `Meal.recipes`).
- Disallow runtime type checks in app code; acceptable exceptions: DOM event narrowing, error/env handling in the boundary. - Disallow runtime type checks in app code; acceptable exceptions: DOM event narrowing, error/env handling in the boundary.
- Let the type system prevent mistakes: encode intent in function signatures. Prefer explicit option objects to loose primitives, make required fields non-optional, and avoid permissive overloads that widen the error surface.
- Navigation is slug-scoped and helper-driven: only use `src/router/links.ts` helpers and named routes. For non-id pages pass `{ slug }` or omit to infer; for id pages pass `id` or `{ id, slug }`. Never build path strings or read slugs from route params in components.
Layout Layout
- `src/api/` — Typed client and SDK boundary - `src/api/` — Typed client and SDK boundary
- `src/domain/` — Domain types and decoders - `src/domain/` — Domain types and decoders
- `src/composables/` — Reusable app logic (auth, meals, shopping, pagination, alert) - `src/composables/` — Reusable app logic (auth, meals, shopping, pagination, alert)
- `src/components/` — UI components and pages - `src/components/` — UI components and pages
- `src/router/` — Routes and helpers (`parseRouteId`, `parseQueryString`) - `src/router/` — Routes and helpers (`links.ts` for slug-scoped navigation, plus `parseRouteId`, `parseQueryString`)
Testing and tooling Testing and tooling
- Vitest + MSW under `tests/` - Vitest + MSW under `tests/`