no-v-text-v-html-on-component
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: warnhtml/eslint-plugin-vue-recommended
What it does
Section titled “What it does”Reports v-html and v-text on a component. Only in .vue files.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”... <MyCard v-for="x in xs" /> <MyCard v-html="h" />... <template v-for="x in xs" :key="x"><li /></template>...Configuration
Section titled “Configuration”angular: lint: rules: no-v-text-v-html-on-component: warn # off, warn (default), errorhtml: lint: rules: no-v-text-v-html-on-component: warn # off, warn (default), errorsvelte: lint: rules: no-v-text-v-html-on-component: warn # off, warn (default), errorvue: lint: rules: no-v-text-v-html-on-component: warn # off, warn (default), errorEnabled 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.
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-text-v-html-on-component |
full |