diff --git a/rules/vue/coding-style.md b/rules/vue/coding-style.md new file mode 100644 index 00000000..c95efbca --- /dev/null +++ b/rules/vue/coding-style.md @@ -0,0 +1,214 @@ +--- +paths: + - "**/*.vue" + - "**/components/**/*.ts" + - "**/components/**/*.js" + - "**/composables/**/*.ts" + - "**/composables/**/*.js" +--- +# Vue Coding Style + +> This file extends [typescript/coding-style.md](../typescript/coding-style.md) and [common/coding-style.md](../common/coding-style.md) with Vue-specific conventions. For composable rules see [hooks.md](./hooks.md). + +## API Style + +- Use ` + + +``` + +## Single-File Component Structure + +Enforce this order inside `.vue` files: + +1. ` + + + +``` + +## Emits + +- Use type-based `defineEmits<>()` with TypeScript payload signatures. +- Keep event names in kebab-case in templates, camelCase in script. + +```vue + +``` + +## Slots + +- Type slots explicitly with `defineSlots<>()` for TypeScript projects. +- Document slot purpose and expected props in a comment above template usage. + +```vue + +``` + +## Template Conventions + +- Self-close tags with no children: `` +- Use `