-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathvue-best-practices.mdc
More file actions
40 lines (33 loc) · 1.16 KB
/
Copy pathvue-best-practices.mdc
File metadata and controls
40 lines (33 loc) · 1.16 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
---
description: Vue 3 and NuxtJS specific standards and optimizations
globs: *.vue, *.js, *.ts
---
# Vue 3 and NuxtJS Best Practices
Ensures Vue 3 and NuxtJS code follows recommended patterns and optimizations.
<rule>
name: vue_nuxt_best_practices
description: Enforce Vue 3 and NuxtJS coding standards and optimizations
filters:
- type: file_extension
pattern: "\\.(vue|js|ts)$"
actions:
- type: enforce
conditions:
- pattern: "(?<!defineProps|interface|type)\\{\\s*[a-zA-Z]+\\s*:\\s*[a-zA-Z]+\\s*\\}"
message: "Use TypeScript interfaces for prop definitions"
- pattern: "watch\\(.*,.*\\{\\s*immediate:\\s*true\\s*\\}"
message: "Consider using computed property instead of immediate watch"
- pattern: "v-if.*v-for"
message: "Avoid using v-if with v-for on the same element"
- type: suggest
message: |
Vue 3 Best Practices:
- Use Composition API for complex components
- Implement proper prop validation
- Use TypeScript for better type safety
- Leverage Vue 3's reactivity system effectively
- Consider using <script setup> syntax
metadata:
priority: high
version: 1.0
</rule>