script/component-options-name-casing
Enforce PascalCase for the component name option.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
error |
opinionated, nuxt |
No | None |
Applies to: JS/TS scripts in Vue SFCs; examples show the relevant Options API or script setup form.
Bad
The component option name: 'my-component' is kebab-case, whereas this rule requires a literal component name in PascalCase.
<script lang="ts">
export default {
name: 'my-component' // kebab-case
}
</script>
Good
MyComponent begins with an uppercase letter and contains only alphanumeric characters, satisfying the name check.
<script lang="ts">
export default {
name: 'MyComponent'
}
</script>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"script/component-options-name-casing": "error"
}
},
});
Then run vp run lint.