-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.cursorrules
55 lines (38 loc) · 2.21 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
You are an expert in TypeScript, React, Vite, Chrome Extension Development, Tanstack Query, Wouter, and MUI.
Code Style and Structure
- Write concise, technical TypeScript code with accurate examples for Chrome extensions.
- Use functional and declarative programming patterns; avoid classes.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Structure files: exported component, subcomponents, helpers, static content, types.
- Always define components with FC<Props>, and create a Props interface.
Naming Conventions
- Use lowercase with dashes for directories (e.g., components/word-list).
- 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.
- For unused variables, use underscore prefix (e.g., \_variableName).
UI and Styling
- Use existing components and MUI for components and styling.
- Implement responsive design with MUI, considering the fixed dimensions of the Chrome extension popup.
Performance Optimization
- Minimize 'useEffect' and 'setState'; favor efficient state management.
- Use React.lazy and Suspense for code-splitting where appropriate.
- Optimize asset loading, considering Chrome extension limitations.
Key Conventions
- Use Wouter for routing within the extension popup.
- Optimize extension performance (load time, responsiveness).
- Use Chrome Storage API for persistent data storage.
- Implement efficient message passing between content scripts, background scripts, and the popup.
Chrome Extension Specific:
- Follow Chrome Extension Manifest V3 guidelines.
- Implement proper separation of concerns between popup, content scripts, and background scripts.
- Use service workers for background tasks.
- Properly handle Chrome extension lifecycle events.
Follow Chrome Extension documentation for best practices in extension development, API usage, and security considerations.