-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.cursorrules
105 lines (82 loc) · 2.79 KB
/
.cursorrules
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Next.js 15 & React 19 Development Guidelines
## Core Technologies
- Next.js 15 App Router
- React 19
- TypeScript
- daisyUI 4.12.22
- Tailwind CSS
- PNPM Package Manager
## Code Style & Structure
### Component Patterns
- Use functional components with TypeScript interfaces
- Avoid classes; prefer functional and declarative patterns
- One component per file with named exports
- Structure: exports, subcomponents, helpers, types, static content
### TypeScript Usage
- Prefer interfaces over types
- Use maps instead of enums
- Strong typing with explicit interfaces
- Avoid 'any' and 'unknown' types
### Naming Conventions
- Directories: lowercase with dashes (e.g., auth-wizard)
- Components: PascalCase
- Functions: camelCase with verb prefixes (e.g., handleSubmit)
- Variables: descriptive with auxiliary verbs (e.g., isLoading)
### File Structure
/src
├── app/ # Next.js App Router pages
├── components/ # React components
│ ├── ui/ # Reusable UI components
│ ├── sections/ # Page sections
│ ├── animations/ # Animation components
│ ├── layouts/ # Layout components
│ └── forms/ # Form components
├── content/ # Static content
├── lib/ # Utilities
├── types/ # TypeScript types
└── utils/ # Helper functions
## UI & Styling
- Use Shadcn UI components with Radix UI primitives
- Tailwind CSS for styling (mobile-first approach)
- Maintain consistent component interfaces
- Follow accessibility best practices
## Performance Guidelines
- Default to React Server Components
- Minimize client-side JavaScript:
- Limit 'use client' directives
- Reduce useEffect and setState usage
- Use Server Actions where possible
- Image optimization:
- WebP format
- Include size attributes
- Implement lazy loading
- Dynamic imports for non-critical components
- Wrap client components in Suspense
## State Management
- URL state: Use 'nuqs' for search parameters
- Server state: Prefer Server Components
- Client state: Minimal, only when necessary
- Forms: React Hook Form with Zod validation
## Package Management
- Use PNPM exclusively
- React 19 installation:
- pnpm install --force
- Handle peer dependencies appropriately
- Shadcn UI setup:
- Use CLI with React 19 flags
- Follow component installation guidelines
## Development Workflow
- Follow Next.js documentation for:
- Data fetching patterns
- Routing conventions
- Rendering strategies
- Optimize for Core Web Vitals (LCP, CLS, FID)
- Maintain existing configuration files:
- eslintrc.json
- prettierrc
- vscode settings
## Code Quality
- Write concise, self-documenting code
- Modularize and avoid duplication
- Use declarative patterns
- Maintain consistent formatting