Skip to content

no-v-text-v-html-on-component

Reports v-html and v-text on a component. Only in .vue files.

The directive replaces the content of the component, which does not render its children as HTML or text, so nothing shows.

To fix, pass the value as a prop or as a slot.

Reported
...
<MyCard v-for="x in xs" />
<MyCard v-html="h" />
...
<template v-for="x in xs" :key="x"><li /></template>
...
angular:
lint:
rules:
no-v-text-v-html-on-component: warn # off, warn (default), error
html:
lint:
rules:
no-v-text-v-html-on-component: warn # off, warn (default), error
svelte:
lint:
rules:
no-v-text-v-html-on-component: warn # off, warn (default), error
vue:
lint:
rules:
no-v-text-v-html-on-component: warn # off, warn (default), error

Enabled by the presets: html/eslint-plugin-vue-recommended.

Suppress one line with sudsy-disable-next-line no-v-text-v-html-on-component 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-text-v-html-on-component full