mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-01 13:55:01 +01:00
Merge branch 'main' into data-driven
This commit is contained in:
34 files changed
+986
-992
No files matched your search
@@ -16,9 +16,11 @@ Pages that are not migrated yet are named `_index.astro` so Astro skips them. Mi
|
||||
|
||||
- Components live flat at `src/components/Name/index.tsx` with `index.module.css` beside it. No flat `Name.tsx` files and no nested `components/Parent/components/Child` folders: a sub-component becomes its own top-level folder prefixed with its feature, e.g. `MixerScene/components/Model.tsx` becomes `components/MixerModel/index.tsx`.
|
||||
- Pages keep their styles in `_index.module.css` next to `_index.tsx`.
|
||||
- Hooks live in `src/hooks/useName.ts` (`.tsx` if they render JSX), one hook per file named after it, never inside a component's folder.
|
||||
|
||||
## TypeScript
|
||||
|
||||
- When an `if`/`else if` chain checks one value against several candidates (`x === "a"`, `x === b`, ...), use a `switch` on that value instead. Inside a loop, end each case with `continue`, and put the checks a `switch` can't express (`startsWith`, ranges, ...) as an `if` after it, not in `default`.
|
||||
- No return type annotations. Put `satisfies Type` on the returned expression instead.
|
||||
- Wrap functions defined inside React components in `useCallback`.
|
||||
- Never inline a complex type (a union of object shapes, etc.) in a signature; name it as an interface or type.
|
||||
|
||||
Reference in new issue
Block a user