Skip to content

Latest commit

 

History

History
54 lines (35 loc) · 1.41 KB

attribute-hyphenation.md

File metadata and controls

54 lines (35 loc) · 1.41 KB

enforce attribute naming style on custom components in template (vue/attribute-hyphenation)

  • ⚙️ This rule is included in "plugin:vue/strongly-recommended" and "plugin:vue/recommended".
  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

🔧 Options

Default casing is set to always with ['data-', 'aria-', 'slot-scope'] set to be ignored

'vue/attribute-hyphenation': [2, 'always'|'never', { 'ignore': ['custom-prop'] }]

[2, "always"] - Use hyphenated name. (It errors on upper case letters.)

👍 Examples of correct code`:

<MyComponent my-prop="prop"/>

👎 Examples of incorrect code`:

<MyComponent myProp="prop"/>

[2, "never"] - Don't use hyphenated name. (It errors on hyphens except data-, aria- and slot-scope-.)

👍 Examples of correct code`:

<MyComponent myProp="prop"/>

👎 Examples of incorrect code`:

<MyComponent my-prop="prop"/>

[2, "never", { 'ignore': ['custom-prop'] }] - Don't use hyphenated name but allow custom attributes

👍 Examples of correct code`:

<MyComponent myProp="prop" custom-prop="foo" data-id="1"/>

👎 Examples of incorrect code`:

<MyComponent my-prop="prop" custom-prop="foo" data-id="1"/>