Eslint-plugin-vue: Rule Proposition: Props Casing

Created on 18 Jul 2017  路  4Comments  路  Source: vuejs/eslint-plugin-vue

Per feedback in https://github.com/vuejs/eslint-plugin-vue/issues/77#issuecomment-316057943:

Rule proposition:

Props Casing

Define a style for the props casing in templates

We (at GitLab) often see inconsistency in the way we provide props through templates:

<component myProp="prop"></component>

or

<component my-prop="prop"></component>

Configuration

'vue/props-casing': ['camelCase'|'kebab-case'|'PascalCase']

camelCase
<component myProp="prop"></component>
kebab-case
<component my-prop="prop"></component>
PascalCase
<component MyProp="prop"></component>

cc @armano2

in consideration new rule proposition

Most helpful comment

@filipalacerda i think better name for this rule is html-attributes-casing

All 4 comments

@filipalacerda i think better name for this rule is html-attributes-casing

@armano2 they can be vue props tho 馃

yes but we don't know if they are props or regular attributes and even if they are props they are still attributes

Thank you for the proposal!

Sounds good to me, but I have some notes.

  • This rule should apply to only HTML context; should not apply to SVG/MathML context because XML is case-sensitive.
  • I'm not sure the three options are proper. Because we are using all small letters in the attributes of HTML in practice. E.g. onclick, contenteditable, etc...
  • There are the - character which we cannot remove: HTML data-* attributes.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

lichnow picture lichnow  路  3Comments

sqal picture sqal  路  3Comments

chrisvfritz picture chrisvfritz  路  3Comments

rodneyrehm picture rodneyrehm  路  4Comments

rodrigoabb picture rodrigoabb  路  3Comments