vue/component-name-in-template-casing
Enforce specific casing for component names in templates.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
nuxt, opinionated |
Yes | Rule options |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
The component is written in kebab-case and camelCase under the PascalCase convention.
<script setup>
import MyComponent from "./MyComponent.vue";
</script>
<template>
<my-component />
<myComponent />
</template>
Good
MyComponent uses PascalCase; native slot syntax remains lowercase.
<script setup>
import MyComponent from "./MyComponent.vue";
</script>
<template>
<MyComponent />
<RouterView />
<slot />
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/component-name-in-template-casing": "warn"
}
},
});
Then run vp run lint.