Bujidao
|
ff8b1c4b37
|
feat(rules): add Vue architecture patterns and security rules
Add rules/vue/patterns.md:
- Presentational vs Container component design
- Provide/Inject, Scoped Slots, Teleport (with 3.5+ defer prop)
- State management decision tree and Pinia Setup Store patterns
- Vue Router navigation guards, lazy loading, reactive route params
- v-for/v-if patterns, v-model (Vue 3.4+ defineModel)
- Scoped CSS (:deep, :slotted), KeepAlive with max, Dynamic Components
- Vue 3.5+ new APIs: useId(), data-allow-mismatch, Suspense
- Nuxt-specific patterns and Vue 2 migration notes
Add rules/vue/security.md:
- v-html XSS audit (DOMPurify sanitization checklist)
- Unsafe URL binding validation (javascript:/data: scheme prevention)
- Custom directive innerHTML injection
- Secret exposure via VITE_ prefix and Nuxt runtimeConfig
- Nuxt Nitro server API input validation with zod
- localStorage/sessionStorage token risks, SSR browser API guards
- target=_blank rel=noopener, CSP minimum policy
- Prototype pollution, source maps in production
- Vue 3.5+ SSR hydration mismatch security notes
|
2026-06-12 17:53:49 +08:00 |
|
Bujidao
|
57386e156d
|
feat(rules): add Vue coding-style and composables/reactivity rules
Add rules/vue/coding-style.md:
- <script setup> Composition API enforcement
- Naming conventions (PascalCase components, useCamelCase composables)
- SFC structure order, props/emits/slots patterns
- Vue 3.5+ reactive props destructure with native default values
- Template conventions, import ordering
Add rules/vue/hooks.md:
- ref() vs reactive() guidance and replacement pitfalls
- Vue 3.5+ reactive props destructure (version-specific: Vue<3.5 loses reactivity, 3.5+ reactive by default with watch limitation)
- computed() purity rules, watch vs watchEffect comparison
- Watcher cleanup with onWatcherCleanup() (Vue 3.5+) and onCleanup callback
- useTemplateRef() (Vue 3.5+) replacing name-matched plain refs
- Composable conventions (use prefix, reactive returns, MaybeRef inputs)
- shallowRef/shallowReactive for large data structures
|
2026-06-12 17:53:28 +08:00 |
|