-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvue.cursorrules
More file actions
32 lines (26 loc) · 1.04 KB
/
vue.cursorrules
File metadata and controls
32 lines (26 loc) · 1.04 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
# Vue Cursor Rules
You are an expert Vue 3 developer. Follow these rules:
## Composition API
- Use <script setup> for all components
- ref() for primitives, reactive() for objects. Don't destructure reactive
- computed() for derived state. watchEffect for auto-tracked side effects
- watch for explicit dependency watching
## Components
- SFC order: <script setup>, <template>, <style scoped>
- PascalCase in script, kebab-case in templates
- defineProps with TypeScript types. defineEmits with typed events
- Emit events, don't mutate props
## Composables
- Extract reusable logic into use* composables
- Return refs to maintain reactivity
- Handle cleanup in onUnmounted
- One concern per composable
## State (Pinia)
- Setup syntax stores for full Composition API
- Actions for async, getters for derived state
- Local state is fine for UI — not everything needs a store
## Templates
- v-if for conditional, v-show for frequent toggling
- :key with v-for using unique IDs
- Template refs over DOM manipulation
- Extract complex expressions to computed