cursor vue3 rules

  1. vue-3-typescript-guidelines
js 复制代码
---
description: Enforces the use of TypeScript for type safety in Vue 3 projects, especially for .ts files.
globs: src/**/*.ts
---
- Use TypeScript for type safety
- Implement proper props and emits definitions
  1. vue-3-additional-instructions
js 复制代码
---
description: Additional instructions for Vue 3 development, covering areas like error handling, styling and best practices.
globs: src/**/*
---
- Utilize Vue 3's Teleport component when needed
- Use Suspense for async components
- Implement proper error handling
- Follow Vue 3 style guide and naming conventions
- Use Vite for fast development and building
  1. vue-3-composition-api---composables
js 复制代码
---
description: Specific rules for composables in the Vue 3 Composition API. This focuses on how to structure and implement reusable logic using composables.
globs: src/composables/**/*.js
---
- Use setup() function for component logic
- Utilize ref and reactive for reactive state
  1. vue-3-composition-api---general
js 复制代码
---
description: General guidelines for Vue 3 components using the Composition API. This includes best practices and recommendations for component structure and reactive state management.
globs: src/**/*.vue
---
- Use setup() function for component logic
- Utilize ref and reactive for reactive state
- Implement computed properties with computed()
- Use watch and watchEffect for side effects
- Implement lifecycle hooks with onMounted, onUpdated, etc.
- Utilize provide/inject for dependency injection

5.vue-3-project-structure

js 复制代码
---
description: Defines the recommended folder structure for a Vue 3 project to maintain consistency and organization.
globs: src/**/*
---
- Recommended folder structure:
  - src/
    - components/
    - composables/
    - views/
    - router/
    - store/
    - assets/
    - App.vue
    - main.js
  1. vue-nuxt-general-rules
js 复制代码
---
description: Applies to Vue 3 and Nuxt 3 projects, enforcing best practices for frontend development including TypeScript, TailwindCSS, and Composition API.
globs: **/*.{vue,ts,js,jsx,tsx}
---
- You are a Senior Frontend Developer and an Expert in Vue 3, Nuxt 3, JavaScript, TypeScript, TailwindCSS, HTML and CSS.
- Always write correct, best practice, DRY principle (Dont Repeat Yourself), bug free, fully functional and working code.
- Focus on easy and readability code, over being performant.
- Fully implement all requested functionality. Ensure code is complete!
- Verify thoroughly finalised.
- Use early returns whenever possible to make the code more readable.
- Always use Tailwind classes for styling HTML elements; avoid using CSS or <style> tags.
- Always use composition api.
- Use descriptive variable and function/const names. Also, event functions should be named with a "handle" prefix, like "handleClick" for onClick and "handleKeyDown" for onKeyDown.
- Implement accessibility features on elements. For example, a tag should have a tabindex="0", aria-label, on:click, and on:keydown, and similar attributes.
- Use consts instead of functions, for example, "const toggle = () =>". Also, define a type if possible.

7.vue-js-conventions

js 复制代码
---
description: Specific conventions for Vue.js components. Follow Vue.js docs where appropriate.
globs: src/components/**/*.vue
---
- Follow Vue.js documentation for best practices.
- Organize component options in a consistent order (e.g., data, computed, methods, watch, lifecycle hooks).
- Use `v-bind` and `v-on` directives for data binding and event handling.
- Prefer using single file components (.vue files).
  1. vueuse-library-rule
js 复制代码
---
description: Encourages leveraging VueUse functions throughout the project to enhance reactivity and performance.
globs: src/**/*.*
---
- Leverage VueUse functions where applicable to enhance reactivity and performance.
  1. vue-js-component-rule
js 复制代码
---
description: Defines the style and structure for Vue.js components, including naming conventions, composition API usage, and UI library preferences.
globs: src/components/**/*.vue
---
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for functions.
- Always use the Vue Composition API script setup style.
- Use DaisyUI, and Tailwind for components and styling.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.
相关推荐
陈随易4 分钟前
VSCode v1.102发布,AI体验大幅提升
前端·后端·程序员
ma778 分钟前
JavaScript 获取短链接原始地址的解决方案
前端
该用户已不存在8 分钟前
关于我把Mac Mini托管到机房,后续来了,还有更多玩法
服务器·前端·mac
tianchang11 分钟前
SSR 深度解析:从原理到实践的完整指南
前端·vue.js·设计模式
闲蛋小超人笑嘻嘻12 分钟前
前端面试十一之TS
前端
摆烂为不摆烂13 分钟前
😁深入JS(四): 一文让你完全了解Iterator+Generator 实现async await
前端
DoraBigHead25 分钟前
🧠 别急着传!大文件上传里,藏着 Promise 的高级用法
前端·javascript·面试
嘉琪00128 分钟前
封装一个有最小化的dialog组件
前端·javascript·css
水果里面有苹果31 分钟前
20-C#构造函数--虚方法
java·前端·c#
Zachery Pole31 分钟前
BootStrap
前端·bootstrap·html