-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy path.cursorrules
More file actions
27 lines (20 loc) · 1.14 KB
/
.cursorrules
File metadata and controls
27 lines (20 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# react-simplikit Cursor Rules
> Full coding standards with examples: see AGENTS.md
## Project
React hooks/components library. Monorepo: `packages/core` + `packages/mobile`.
## Architecture
Unidirectional layers: `components → hooks → utils → _internal`
Core and mobile are independent packages. No cross-package dependencies.
## Code Style
- `type` over `interface` for type aliases
- Named functions in useEffect: `useEffect(function handleResize() { ... }, [])`
- Named exports only, no default exports
- No `any` — strict TypeScript
- `.ts`/`.tsx` extensions in source imports (tsup converts to `.js`)
- No implicit boolean coercion: `if (value)` → `if (value != null)` (enforced by `strict-boolean-expressions`)
- Nullish checks: `== null` for both null and undefined, `!== undefined` only when distinction matters
- Zero runtime dependencies
- Always return cleanup in useEffect to remove listeners
- Early returns (guard clauses) over nested if-else blocks
- Function declarations use `function` keyword, not arrow: `function toggle(state: boolean) { return !state; }`
- Short inline callbacks (map, filter args) are OK with arrow functions