Skip to content

useVueHyphenatedAttributes

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

Enforce hyphenated (kebab-case) attribute names in Vue templates.

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.

This rule flags attributes that are detected as camelCase, PascalCase, CONSTANT_CASE, snake_case or that contain any uppercase ASCII letter. It uses Biome’s internal Case::identify helper.

Allowed:

  • kebab-case attributes (e.g. data-test-id)
  • pure lowercase single word attributes (e.g. class, id)
<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" />

The rule supports the following options:

A list of attribute names that should be ignored by the rule (they won’t be required to be hyphenated). 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 skipped entirely. This is useful for third-party or internal components that deliberately expose non‑hyphenated prop names.

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