Skip to content

no-v-html

Reports an element with v-html.

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.

Reported
<template>
<div v-html="comment"></div>
<div>{{ comment }}</div>
</template>
angular:
lint:
rules:
no-v-html: warn # off (default), warn, error
html:
lint:
rules:
no-v-html: warn # off (default), warn, error
svelte:
lint:
rules:
no-v-html: warn # off (default), warn, error
vue:
lint:
rules:
no-v-html: warn # off (default), warn, error

Enabled 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.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint-plugin-vue no-v-html full