Skip to content

useVueHyphenatedAttributes (HTML)

Language HTML
biome.json
{
"linter": {
"rules": {
"style": {
"useVueHyphenatedAttributes": "error"
}
}
}
}

Disallow uppercase letters in Vue template attribute names.

Vue style guide recommends using hyphenated attribute (and prop) names in templates to keep them consistent and distinguish them from JavaScript identifiers written in camelCase/PascalCase.

Like the upstream ESLint rule, this rule flags attribute names that contain uppercase letters. It doesn’t require exact kebab-case, so punctuation such as colons and underscores is allowed.

Allowed:

  • names without uppercase letters (e.g. data-test-id, pt:header:id, some_attr)
<div fooBar="x"></div>
code-block.vue:1:6 lint/style/useVueHyphenatedAttributes  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Attribute fooBar should be hyphenated (kebab-case).

> 1 │ <div fooBar="x"></div>
^^^^^^^^^^
2 │

The Vue style guide recommends using hyphenated attribute (and prop) names in templates to keep them consistent.

Unsafe fix: Rename the attribute to foo-bar.

1 - <div·fooBar="x"></div>
1+ <div·foo-bar="x"></div>
2 2

<MyComp :someProp="x" />
code-block.vue:1:9 lint/style/useVueHyphenatedAttributes  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Attribute someProp should be hyphenated (kebab-case).

> 1 │ <MyComp :someProp="x" />
^^^^^^^^^^^^^
2 │

The Vue style guide recommends using hyphenated attribute (and prop) names in templates to keep them consistent.

Unsafe fix: Rename the attribute to some-prop.

1 - <MyComp·:someProp="x"·/>
1+ <MyComp·:some-prop="x"·/>
2 2

<div data-test-id="x"></div>
<div class="foo"></div>
<MyComp :some-prop="x" />
<MyComp pt:header:data-test-id="x" />

The rule supports the following options:

A list of attribute names that should be exempt from the uppercase-letter check. Use this when you have a fixed set of camelCase / PascalCase prop names you intentionally allow.

biome.json
{
"linter": {
"rules": {
"style": {
"useVueHyphenatedAttributes": {
"level": "on",
"options": {
"ignore": [
"someProp",
"fooBar"
]
}
}
}
}
}
}
<div fooBar="x"></div>

A list of tag names whose attributes should be exempt from the uppercase-letter check. This is useful for third-party or internal components that deliberately expose camelCase or PascalCase prop names.

biome.json
{
"linter": {
"rules": {
"style": {
"useVueHyphenatedAttributes": {
"level": "on",
"options": {
"ignoreTags": [
"MyComp",
"AnotherWidget"
]
}
}
}
}
}
}
<MyComp :someProp="x" />