|
8 | 8 | - `pnpm --filter www dev` - Start single app |
9 | 9 | - `pnpm build` - Build all packages/apps |
10 | 10 | - `pnpm test` - Run all tests (Vitest) |
11 | | -- `pnpm --filter www test` - Run www tests, use `vitest run <file>` for single test |
| 11 | +- `pnpm --filter www test` - Run www tests |
| 12 | +- `pnpm --filter www exec vitest run <file-path>` - Run single test file |
12 | 13 | - `pnpm lint` - Ultracite check |
13 | 14 | - `pnpm format` - Ultracite fix |
14 | 15 |
|
|
27 | 28 |
|
28 | 29 | - Check existing patterns before creating new components |
29 | 30 | - Use shared packages (`@repo/design-system`, `@repo/ai`, etc.) instead of duplicating code |
30 | | -- For MDX content: use `InlineMath` for numbers and math, inline code for programming elements |
| 31 | +- For MDX content: use `InlineMath` for numbers/math, inline code for programming |
31 | 32 | - Convex backend in `packages/backend/convex/`, use auth helpers never `ctx.auth` directly, see `packages/backend/convex/lib` folder for shared utils functions |
| 33 | +- MDX components available without import: `BlockMath`, `InlineMath`, `CodeBlock`, `MathContainer`, `Mermaid` |
| 34 | +- Import required for: `NumberLine`, `LineEquation` from `@repo/design-system/components/contents/*` |
| 35 | +- Import aliases: `@/` for app-level imports, `@repo/*` for workspace packages |
| 36 | +- Allowed Biome exceptions: namespace imports, barrel files, higher cognitive complexity (40) |
32 | 37 | - Run lint/test after all changes |
33 | 38 |
|
34 | | -# TypeScript Style |
| 39 | +## MDX Content Guidelines |
| 40 | + |
| 41 | +- Headings: start from h2 only, max h3 depth, descriptive (not "Step 1"), no symbols, no InlineMath |
| 42 | +- Code vs Math: inline code (`print()`, `const x`) for programming, InlineMath (`<InlineMath math="5" />`) for math |
| 43 | +- Math formatting: all math in InlineMath/BlockMath, use `MathContainer` to wrap consecutive blocks, units in `\text{}` |
| 44 | +- CodeBlock: required `data` prop with unique languages per component, supports multiple file tabs |
| 45 | +- NumberLine: import required, use InlineMath for all numbers, `startLabel`/`endLabel` for fractions |
| 46 | +- 3D visualizations: generate points via Array.from() with math calculations (never hard-code), use `getColor()` for colors (not randomColor) |
| 47 | +- Lists: use hyphens `-`, no nested lists, proper indentation |
| 48 | +- Line breaks: blank line between text paragraphs and math blocks |
| 49 | + |
| 50 | +## TypeScript Style |
35 | 51 |
|
36 | 52 | NEVER USE ASSERTION! Good typescript is when you can write code like javascript but still type safe. |
37 | 53 |
|
38 | | -# Ultracite Code Standards |
| 54 | +## Ultracite Code Standards |
39 | 55 |
|
40 | 56 | This project uses **Ultracite**, a zero-config Biome preset that enforces strict code quality standards through automated formatting and linting. |
41 | 57 |
|
@@ -124,28 +140,20 @@ Write code that is **accessible, performant, type-safe, and maintainable**. Focu |
124 | 140 |
|
125 | 141 | ### Framework-Specific Guidance |
126 | 142 |
|
127 | | -**Next.js:** |
128 | | - |
129 | | -- Use Next.js `<Image>` component for images |
130 | | -- Use `next/head` or App Router metadata API for head elements |
131 | | -- Use Server Components for async data fetching instead of async Client Components |
132 | | - |
133 | | -**React 19+:** |
134 | | - |
135 | | -- Use ref as a prop instead of `React.forwardRef` |
136 | | - |
137 | | -**Solid/Svelte/Vue/Qwik:** |
138 | | - |
139 | | -- Use `class` and `for` attributes (not `className` or `htmlFor`) |
| 143 | +- **Next.js**: Use `<Image>` component, App Router metadata API, Server Components for async data |
| 144 | +- **React 19+**: Use ref as prop instead of `React.forwardRef` |
140 | 145 |
|
141 | 146 | --- |
142 | 147 |
|
143 | 148 | ## Testing |
144 | 149 |
|
| 150 | +- Framework: Vitest with shared config from `@repo/testing` |
145 | 151 | - Write assertions inside `it()` or `test()` blocks |
| 152 | +- Use `describe()` for grouping related tests |
146 | 153 | - Avoid done callbacks in async tests - use async/await instead |
147 | 154 | - Don't use `.only` or `.skip` in committed code |
148 | 155 | - Keep test suites reasonably flat - avoid excessive `describe` nesting |
| 156 | +- Test files: `__tests__/` directories or `.test.ts`/.tsx naming |
149 | 157 |
|
150 | 158 | ## When Biome Can't Help |
151 | 159 |
|
|
0 commit comments