Style guide:
https://vuejs.org/v2/style-guide/#Component-name-casing-in-templates-strongly-recommended
Description:
This rule would ensure proper component names in templates. As we only check .vue files in terms of templates we can provide both options: kebab-case and PascalCase
Good examples:
<the-component />
<TheComponent />
Bad examples:
<theComponent />
<Thecomponent />
<The-component />
and obviously with kebab-case option it would warn about PascalCase and vice-versa.
Default option would be PascalCase.
I'm sorry. I made a mistake in refs at PR 402 m(_ _)m
Default option would be PascalCase.
It shouldn't be the default:
@Mouvedia, It should https://vuejs.org/v2/style-guide/#Component-name-casing-in-templates-strongly-recommended
And vue components are not custom elements
@probil The rule is called component-name-in-template-casing and the style guide that you have linked just above support the kebab-case for DOM templates and "everywhere" else _but_ single file components. It concludes with:
using kebab-case everywhere is also acceptable
Why? Because using PascalCase in SFC and kebab-case everywhere else would be inconsistent: we should recommend and support a solution that doesn't require to make that distinction.
@Mouvedia Agree with you. PascalCase is not the best option for everyone. But the same for kebab-case.
I don't think this eslint plugin is able to parse DOM templates at all. Because currently it relies on *.vue extension and // @vue/component comment so only SFC will be checked. But DOM templates are usually hidden somewhere in the back-end templates. _Correct me please, if I'm wrong here._
In most projects, component names should always be PascalCase in single-file components
This plugin tries to follow official Vue Style Guide so PascalCase should be default. But of course. there should be configuration for this rule. So you can easily configure it to use kebab-case or both if you like
It depends on what matters the most to you:
Both are valid options and have CONs/PROs.
One reason we should go with one or the other is if a convention exists on the React side: it would be detrimental to not follow their lead.
Most helpful comment
@Mouvedia Agree with you.
PascalCaseis not the best option for everyone. But the same forkebab-case.I don't think this eslint plugin is able to parse DOM templates at all. Because currently it relies on
*.vueextension and// @vue/componentcomment so only SFC will be checked. But DOM templates are usually hidden somewhere in the back-end templates. _Correct me please, if I'm wrong here._This plugin tries to follow official Vue Style Guide so
PascalCaseshould be default. But of course. there should be configuration for this rule. So you can easily configure it to usekebab-caseor both if you like