# vue/no-child-content

disallow element's child contents which would be overwritten by a directive like v-html or v-text

  • ⚙️ This rule is included in all of "plugin:vue/vue3-essential", "plugin:vue/essential", "plugin:vue/vue3-strongly-recommended", "plugin:vue/strongly-recommended", "plugin:vue/vue3-recommended" and "plugin:vue/recommended".
  • 💡 Some problems reported by this rule are manually fixable by editor suggestions (opens new window).

# 📖 Rule Details

This rule reports child content of elements that have a directive which overwrites that child content. By default, those are v-html and v-text, additional ones (e.g. Vue I18n's v-t directive (opens new window)) can be configured manually.

<template> <!-- ✓ GOOD --> <div>child content</div> <div v-html="replacesChildContent"></div> <!-- ✗ BAD --> <div v-html="replacesChildContent">child content</div> </template>
Now loading...

# 🔧 Options

  "vue/no-child-content": ["error", {
    "additionalDirectives": ["foo"] // checks v-foo directive
  • additionalDirectives ... An array of additional directives to check, without the v- prefix. Empty by default; v-html and v-text are always checked.

# 📚 Further Reading

# 🚀 Version

This rule was introduced in eslint-plugin-vue v8.1.0

# 🔍 Implementation

Last Updated: 5/11/2022, 11:50:07 PM