|
10 | 10 | declarations (e.g., `function handleClick() {}` over |
11 | 11 | `const handleClick = () => {}`). Arrow functions within function scope are |
12 | 12 | fine. |
13 | | -- Imports are sorted using ESLint, which can be invoked for a single file using |
14 | | - `pnpm eslint --fix <path-to-file>` |
| 13 | +- Every commit should have no type errors, lint errors, or failing tests |
| 14 | +- When possible, create failing tests first then implement the logic to make the |
| 15 | + tests pass |
| 16 | +- Add or update tests for the code you change, even if nobody asked |
15 | 17 |
|
16 | 18 | ### React Rules |
17 | 19 |
|
|
20 | 22 | - Avoid prop drilling - use context or state management |
21 | 23 | - Follow principle of least privilege for component props |
22 | 24 |
|
| 25 | +### Tailwind Rules |
| 26 | + |
| 27 | +- Use Tailwind v4 CSS syntax |
| 28 | +- The `tailwind.config.ts` file remains for legacy reasons |
| 29 | + |
23 | 30 | ## Project Commands |
24 | 31 |
|
| 32 | +- This project uses `pnpm` only, never use `npm` |
25 | 33 | - All commands should be run from the root of the project repository |
| 34 | +- Assume dev server is always running |
26 | 35 |
|
27 | 36 | ### Development |
28 | 37 |
|
|
32 | 41 |
|
33 | 42 | ### Quality Checks |
34 | 43 |
|
35 | | -- `pnpm lint` - Fix linting issues |
36 | | -- `pnpm check:lint` - Check linting only |
37 | | -- `pnpm format` - Format code |
38 | | -- `pnpm check:format` - Check formatting only |
39 | | -- `pnpm check:types` - Type checking |
40 | | -- `pnpm checks` - Run all checks |
| 44 | +- `pnpm checks` - Run checks for linting, types, and formatting in parallel |
| 45 | +- `pnpm check:types` - Check for TypeScript type errors |
| 46 | +- `pnpm check:lint` - Check for lint errors |
| 47 | +- `pnpm check:format` - Check for formatting errors |
| 48 | +- `pnpm lint` - Fix any fixable linting errors |
| 49 | +- `pnpm lint <path-to-file>` - Fix any fixable linting errors for a specific |
| 50 | + file |
| 51 | +- `pnpm format` - Format all files |
41 | 52 |
|
42 | 53 | ### Testing |
43 | 54 |
|
44 | | -- `pnpm test` - Run tests |
45 | | -- `pnpm test:watch` - Watch mode |
46 | | -- `pnpm coverage` - Test coverage |
47 | | -- `pnpm vitest --run <path-to-file>` - Run tests for specific file |
48 | | - |
49 | | -### Maintenance |
50 | | - |
51 | | -- `pnpm clean` - Clean build artifacts |
52 | | -- `pnpm clean:dep` - Remove node_modules |
| 55 | +- `pnpm test` - Run all tests |
| 56 | +- `pnpm test <path-to-file>` - Run tests for specific file |
| 57 | +- `pnpm coverage` - Check test coverage |
53 | 58 |
|
54 | 59 | ### Git |
55 | 60 |
|
56 | 61 | - `git --no-pager` - Disable pager for git commands |
57 | 62 |
|
58 | 63 | ### Dependency Management |
59 | 64 |
|
60 | | -Add dependency to specific package |
| 65 | +Add dependency to specific workspace |
61 | 66 |
|
62 | 67 | ```bash |
63 | 68 | pnpm add <package> --filter <workspace-name> |
@@ -118,15 +123,15 @@ src/ |
118 | 123 | ### Frontend (graph-explorer) |
119 | 124 |
|
120 | 125 | - React 19 + TypeScript |
| 126 | +- React Compiler (no manual useMemo/useCallback needed) |
121 | 127 | - Vite build tool |
122 | 128 | - TailwindCSS + Radix UI components |
123 | 129 | - React Router for routing |
124 | 130 | - Cytoscape.js for graph visualization |
125 | | -- React Query for data fetching |
| 131 | +- TanStack Query (formerly called React Query) for data fetching |
126 | 132 | - Jotai for state management |
127 | | -- React Hook Form + Zod validation |
128 | 133 | - LocalForage for persistent app state |
129 | | -- React Compiler (no manual useMemo/useCallback needed) |
| 134 | +- React Hook Form + Zod validation |
130 | 135 |
|
131 | 136 | ### Backend (proxy-server) |
132 | 137 |
|
@@ -155,39 +160,4 @@ src/ |
155 | 160 |
|
156 | 161 | ### Testing |
157 | 162 |
|
158 | | -- From the package root you can just call `pnpm test`. The commit should pass |
159 | | - all tests before you merge. |
160 | | -- To focus on one step, add the Vitest pattern: |
161 | | - `pnpm vitest run -t "<test name>"`. |
162 | | -- Fix any test or type errors until the whole suite is green. |
163 | | -- After moving files or changing imports, run |
164 | | - `pnpm lint --filter <project_name>` to be sure ESLint and TypeScript rules |
165 | | - still pass. |
166 | | -- Add or update tests for the code you change, even if nobody asked. |
167 | | - |
168 | 163 | See `.kiro/steering/testing.md` for testing patterns and examples. |
169 | | - |
170 | | -### Branded Types |
171 | | - |
172 | | -The project uses branded types from `@/utils` for type safety. These prevent |
173 | | -accidental mixing of similar types at compile time. |
174 | | - |
175 | | -| Type | Creator Function | Location | |
176 | | -| ------------------ | ---------------------------- | --------------------------------------- | |
177 | | -| `VertexId` | `createVertexId()` | `@/core/entities/vertex` | |
178 | | -| `VertexType` | `createVertexType()` | `@/core/entities/vertex` | |
179 | | -| `EdgeId` | `createEdgeId()` | `@/core/entities/edge` | |
180 | | -| `EdgeType` | `createEdgeType()` | `@/core/entities/edge` | |
181 | | -| `ConfigurationId` | `createNewConfigurationId()` | `@/core/ConfigurationProvider/types` | |
182 | | -| `RenderedVertexId` | `toRenderedVertexId()` | `@/core/StateProvider/renderedEntities` | |
183 | | -| `RenderedEdgeId` | `toRenderedEdgeId()` | `@/core/StateProvider/renderedEntities` | |
184 | | - |
185 | | -Always use the appropriate branded type instead of `string` when working with |
186 | | -these identifiers. |
187 | | - |
188 | | -### Database Queries |
189 | | - |
190 | | -- Use the `query` template tag from `@/utils` for all query strings (Gremlin, |
191 | | - openCypher, SPARQL) to ensure consistent formatting |
192 | | -- For Gremlin queries, use `escapeString()` from `@/utils` to escape special |
193 | | - characters in string literals |
0 commit comments