useVueValidVHtml
Summary
Section titled “Summary”- 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:
- Same as
vue/valid-v-html
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "correctness": { "useVueValidVHtml": "error" } } }}Description
Section titled “Description”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>
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<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>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.