Repository navigation
Expand file tree
/
Copy path.cursorrules
More file actions
63 lines (43 loc) · 2.1 KB
/
Copy path.cursorrules
File metadata and controls
63 lines (43 loc) · 2.1 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# SnapLog Cursor Rules
## Project Overview
SnapLog is a local-first photo journal built with Expo (React Native) and TypeScript. It uses SQLite for persistence, Zustand for state, and Expo Router for navigation.
## Code Style
- TypeScript strict mode. No `any` types.
- Functional components only. No class components (exception: `ErrorBoundary` requires a class component - React has no hook equivalent).
- Use `StyleSheet.create()` for all styles. No inline style objects.
- Active voice in comments. Short sentences.
- No em dashes. Use hyphens, commas, or periods.
## Architecture
- **Screens** live in `app/` using Expo Router file-based routing
- **Reusable components** live in `components/`
- **Business logic** (database, store, API clients) lives in `lib/`
- **Design tokens** (colors, spacing, typography) live in `constants/theme.ts`
- The Zustand store in `lib/store.ts` is the single source of truth. SQLite is the persistence layer.
## Dependencies
- Prefer Expo SDK libraries over community packages
- Install with `npx expo install` to get compatible versions
- Do not add packages without a clear reason
## State Management
- Global state: Zustand (`lib/store.ts`)
- DB operations: `lib/database.ts` (SQLite)
- No Redux, no Context API for app state
## Naming
- Components: PascalCase (`EntryCard.tsx`)
- Utilities/hooks: camelCase (`usePhotoCapture.ts`)
- Constants: camelCase file, UPPER_CASE for values if truly constant
- Database columns: snake_case
- TypeScript interfaces: PascalCase, no `I` prefix
## Accessibility
- Every interactive element needs `accessibilityLabel`
- Touchable areas minimum 44x44 points
- Do not rely on color alone to convey state
## Performance
- Use `React.memo` for list item components
- FlatList over ScrollView for lists
- Avoid re-renders: no inline functions in render, no object literals in props
## Security
- Never commit `.env` files
- API keys go in `.env` with `EXPO_PUBLIC_` prefix
- No secrets in `app.json` or source code
## Built With
This app was built using the [Mobile App Developer Tools](https://github.com/TMHSDigital/Mobile-App-Developer-Tools) Cursor plugin.