-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.cursorrules
More file actions
195 lines (165 loc) · 6.22 KB
/
.cursorrules
File metadata and controls
195 lines (165 loc) · 6.22 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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# General AI Behavior
description: "Base rules for AI interactions across the project"
pattern: "**/*"
rules:
# ESLint Rules
- Follow ESLint v8.56.0 configuration
- Use Unix line endings (LF)
- Follow consistent quote style
- Handle unused variables with warnings or _ prefix
- No React import required
- No PropTypes required (use TypeScript)
- TypeScript explicit return types optional
- Always use double quotes " not single quotes '
# TypeScript Standards
- Use TypeScript for all new code
- Prefer interfaces over types
- Implement proper type definitions
- Avoid type assertions unless necessary
- Use proper generic constraints
- Follow strict TypeScript checking
# Next.js Standards
- Follow Next.js 14 App Router patterns
- Use server components by default
- Implement proper error boundaries
- Handle client/server code separation
- Follow Server Component best practices
# React Standards
- Use functional components
- Use TypeScript interfaces for props
- Follow React 18 best practices
- Minimize client-side state
- Use Server Components where possible
# Code Style
- Use 2 spaces for indentation
- Use meaningful variable names
- Group related code blocks
- Keep functions small and focused
- Use declarative JSX
# Project Structure
- Use lowercase with dashes for directories
- Follow Next.js 14 app directory structure
- Organize components logically
- Keep related files together
# Library Usage
- Use Wagmi v2 hooks (no v1 patterns)
- Use Viem v2 API
- Follow Mantine v7 patterns
- Use React Hook Form v7
- Use Prisma v6.4.1 client methods
# Performance
- Minimize 'use client' directives
- Use React Suspense boundaries
- Implement proper loading states
- Follow image optimization best practices
- Use dynamic imports for large components
# Documentation
- Add JSDoc comments for public functions
- Include example usage where appropriate
- Document complex logic
- Maintain clear component interfaces
# Version Requirements
- Next.js: v14.1.0
- React: v18
- TypeScript: v5
- Node.js: Latest LTS
- ESLint: v8.56.0
# Vercel Build Requirements
- Ensure all code follows Next.js best practices
- Follow strict ESLint rules for Vercel deployment
- Verify import/export syntax compatibility
- Check for proper TypeScript types
- Avoid common Vercel build pitfalls
# Code Quality
- Follow language-specific best practices
- Maintain consistent indentation (2 spaces)
- Use meaningful variable and function names
- Group related code blocks logically
# Next.js Specific
- Use App Router patterns correctly
- Implement proper error boundaries
- Follow Server Component best practices
- Handle client/server code separation properly
# TypeScript Compliance
- Use strict TypeScript checking
- Implement proper type definitions
- Avoid type assertions unless necessary
- Use proper generic constraints
# Reference Rules
@file .cursor/rules/vercel.rules
@file .cursor/rules/typescript.rules
@file .cursor/rules/react.rules
## Techstack
# Library Versions
- Next.js: v14.1.0
- React: v18
- Mantine Core: v7.5.3
- Mantine Dates: v7.17.3
- Wagmi: v2.14.9
- Viem: v2.24.3
- React Hook Form: v7.54.0
- Hypercerts SDK: v2.3.0
- Rainbow Kit: v2.0.0
- TypeScript: v5
- ESLint: v8.56.0
- Prisma: v6.4.1
Always use the apis of the latest version of NextJS (currently v14.1.0) and React (currently v18)
We are using NextAuth v5 and Prisma as the ORM. Always check the NextAuth config before making code suggestions around NextAuth.
## Coding Standards
- Use TypeScript for all new code
- Use proper TypeScript types for all variables, functions and return typesNext.js React TypeScript
You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind.
Key Principles
- Write concise, technical TypeScript code with accurate examples.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Keep functions small and focused (single responsibility).
- Handle errors and edge cases gracefully.
- Use consistent naming conventions.
- Keep code clean and easy to understand.
- Use meaningful variable and function names.
- Keep functions small and focused (single responsibility).
Naming Conventions
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for components.
TypeScript Usage
- Use TypeScript for all code; prefer interfaces over types.
- Avoid enums; use maps instead.
- Use functional components with TypeScript interfaces.
Syntax and Formatting
- Use the "function" keyword for pure functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use declarative JSX.
UI and Styling
- Use the latest version of Mantine(currently v7) for UI components and Tailwind for components and styling.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.
Project Structure
- Use the following directory structure:
app/
Performance Optimization
- Minimize 'use client', 'useEffect', and 'setState'; favor React Server Components (RSC).
- Wrap client components in Suspense with fallback.
- Use dynamic loading for non-critical components.
- Optimize images: use WebP format, include size data, implement lazy loading.
Key Conventions
- Use 'nuqs' for URL search parameter state management.
- Optimize Web Vitals (LCP, CLS, FID).
- Limit 'use client':
- Favor server components and Next.js SSR.
- Use only for Web API access in small components.
- Avoid for data fetching or state management.
Follow Next.js docs for Data Fetching, Rendering, and Routing.
# Version-Specific Rules
- Use Wagmi v2 hooks and patterns (no v1 patterns)
- Use Viem v2 API (no legacy methods)
- Follow Mantine v7 component patterns
- Use React Hook Form v7 methods
- Follow Next.js 14 App Router patterns
- Use TypeScript v5 features appropriately
- Follow ESLint v8 rules
- Use Prisma v6.4.1 client methods
# Breaking Changes Awareness
- Wagmi v2: Use writeContract instead of usePrepareContract pattern
- Mantine v7: Use new styling API with CSS modules
- Next.js 14: Use server actions and server components where appropriate
- Viem v2: Use new transport and account abstractions