pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
vue/component-definition-name-casing |
enforce specific casing for component definition name |
v7.0.0 |
enforce specific casing for component definition name
- ⚙️ This rule is included in all of
"plugin:vue/vue3-strongly-recommended"
,"plugin:vue/strongly-recommended"
,"plugin:vue/vue3-recommended"
and"plugin:vue/recommended"
. - 🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
Define a style for component definition name casing for consistency purposes.
This rule aims to warn the component definition names other than the configured casing.
Default casing is set to PascalCase
.
{
"vue/component-definition-name-casing": ["error", "PascalCase" | "kebab-case"]
}
"PascalCase"
(default) ... enforce component definition names to pascal case."kebab-case"
... enforce component definition names to kebab case.
<script>
export default {
/* ✓ GOOD */
name: 'MyComponent'
}
</script>
<script>
export default {
/* ✗ BAD */
name: 'my-component'
}
</script>
/* ✓ GOOD */
Vue.component('MyComponent', {
})
/* ✗ BAD */
Vue.component('my-component', {
})
<script>
export default {
/* ✓ GOOD */
name: 'my-component'
}
</script>
<script>
export default {
/* ✗ BAD */
name: 'MyComponent'
}
</script>
/* ✓ GOOD */
Vue.component('my-component', {
})
/* ✗ BAD */
Vue.component('MyComponent', {
})
This rule was introduced in eslint-plugin-vue v7.0.0