useVueHyphenatedAttributes
Цей контент ще не доступний вашою мовою.
Summary
Section titled “Summary”- Rule available since:
v2.3.6 - Diagnostic Category:
lint/nursery/useVueHyphenatedAttributes - This rule has an unsafe fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
- Same as
vue/attribute-hyphenation
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useVueHyphenatedAttributes": "error" } } }}Description
Section titled “Description”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)
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<div fooBar="x"></div><MyComp :someProp="x" /><div data-test-id="x"></div><div class="foo"></div><MyComp :some-prop="x" />Options
Section titled “Options”The rule supports the following options:
ignore
Section titled “ignore”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.
{ "linter": { "rules": { "nursery": { "useVueHyphenatedAttributes": { "options": { "ignore": [ "someProp", "fooBar" ] } } } } }}Valid (using ignore)
Section titled “Valid (using ignore)”<div fooBar="x"></div>ignoreTags
Section titled “ignoreTags”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.
{ "linter": { "rules": { "nursery": { "useVueHyphenatedAttributes": { "options": { "ignoreTags": [ "MyComp", "AnotherWidget" ] } } } } }}Valid (using ignoreTags)
Section titled “Valid (using ignoreTags)”<MyComp :someProp="x" />Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.