-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy path.cursorrules
20 lines (17 loc) · 1.1 KB
/
.cursorrules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Always output the code comment in English.
Always use tailwind css to style the component.
Always use optional chaining (?.) when accessing object properties.
Always use nullish coalescing (??) or default values for potentially undefined values.
Always check array existence before using array methods.
Always validate object properties before destructuring.
// JavaScript/TypeScript Code Style Rules
Always use single quotes for string literals in JavaScript/TypeScript code.
// React Performance Optimization Rules
Always wrap pure components with React.memo to prevent unnecessary re-renders.
Always use useMemo for expensive computations or complex object creation.
Always use useCallback for function props to maintain referential equality.
Always specify proper dependency arrays in useEffect to prevent infinite loops.
Always avoid inline object/array creation in render to prevent unnecessary re-renders.
Always use proper key props when rendering lists.
// Component Structure Rules
Always split nested components with closures into separate components to avoid performance issues and improve code maintainability.