Skip to content

useVueValidVHtml

  • Rule available since: v2.3.6
  • Diagnostic Category: lint/correctness/useVueValidVHtml
  • This rule is recommended, meaning it is enabled by default.
  • This rule doesn’t have a fix.
  • The default severity of this rule is error.
  • This rule belongs to the following domains:
  • Sources:
biome.json
{
"linter": {
"rules": {
"correctness": {
"useVueValidVHtml": "error"
}
}
}
}

Enforce valid v-html directives.

This rule reports v-html directives in the following cases:

  • The directive has an argument. E.g. <div v-html:aaa></div>
  • The directive has a modifier. E.g. <div v-html.bbb></div>
  • The directive does not have an attribute value. E.g. <div v-html></div>
<div v-html:aaa="foo"></div>
code-block.vue:1:12 lint/correctness/useVueValidVHtml ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The v-html directive does not accept an argument.

> 1 │ <div v-html:aaa=“foo”></div>
^^^^
2 │

v-html directives should be used without arguments, like v-html=“content”.

<div v-html.bbb="foo"></div>
code-block.vue:1:12 lint/correctness/useVueValidVHtml ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The v-html directive does not support modifiers.

> 1 │ <div v-html.bbb=“foo”></div>
^^^^
2 │

v-html directives do not support any modifiers. Remove the modifier.

<div v-html></div>
code-block.vue:1:6 lint/correctness/useVueValidVHtml ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The v-html directive is missing a value.

> 1 │ <div v-html></div>
^^^^^^
2 │

v-html directives require a value containing the HTML content to render.

For example, use v-html=“htmlContent” to render the content of the htmlContent variable.

<div v-html="htmlContent"></div>