no-v-html
Angular templatesHTMLVue / SvelteVue / Sveltesuspiciousno fixdefault: offhtml/eslint-plugin-vue-recommended
What it does
Section titled “What it does”Reports an element with v-html.
Why it matters
Section titled “Why it matters”v-html inserts the text as markup, so a value that a user wrote can carry a script and runs it in the page: a cross-site scripting hole.
To fix, render the text with {{ }}, or sanitize the value first.
Example
Section titled “Example”<template> <div v-html="comment"></div> <div>{{ comment }}</div></template>Configuration
Section titled “Configuration”angular: lint: rules: no-v-html: warn # off (default), warn, errorhtml: lint: rules: no-v-html: warn # off (default), warn, errorsvelte: lint: rules: no-v-html: warn # off (default), warn, errorvue: lint: rules: no-v-html: warn # off (default), warn, errorEnabled by the presets: html/eslint-plugin-vue-recommended.
Suppress one line with sudsy-disable-next-line no-v-html in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| eslint-plugin-vue | no-v-html |
full |