vue/component-name-in-template-casing
enforce specific casing for the component naming style in template
- 🔧 The
--fixoption on the command line can automatically fix some of the problems reported by this rule.
Define a style for the component name in template casing for consistency purposes.
📖 Rule Details
This rule aims to warn the tag names other than the configured casing in Vue.js template.
🔧 Options
json
{
"vue/component-name-in-template-casing": ["error", "PascalCase" | "kebab-case", {
"registeredComponentsOnly": true,
"ignores": []
}]
}"PascalCase"(default) ... enforce tag names to pascal case. E.g.<CoolComponent>. This is consistent with the JSX practice."kebab-case"... enforce tag names to kebab case: E.g.<cool-component>. This is consistent with the HTML practice which is case-insensitive originally.registeredComponentsOnly... Iftrue, only registered components (in PascalCase) are checked. Iffalse, check all. defaulttrueignores(string[]) ... The element names to ignore. Sets the element name to allow. For example, custom elements or Vue components with special name. You can set the regexp by writing it like"/^name/".globals(string[]) ... Globally registered component names to check. For example,RouterViewandRouterLinkare globally registered byvue-routerand can't be detected as registered in a SFC file. You can set the regexp by writing it like"/^c-/"to match component names with patterns.
"PascalCase", { registeredComponentsOnly: true } (default)
"kebab-case"
"PascalCase", { registeredComponentsOnly: false }
"PascalCase", { ignores: ["/^custom-/"], registeredComponentsOnly: false }
"PascalCase", { globals: ["RouterView", "/^c-/"] }
📚 Further Reading
🚀 Version
This rule was introduced in eslint-plugin-vue v5.0.0