Skip to content

Files

Latest commit

 

History

History
41 lines (28 loc) · 1.15 KB

no-child-content.md

File metadata and controls

41 lines (28 loc) · 1.15 KB

Pattern: Use of overridden child content

Issue: -

Description

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) can be configured manually.

<template>
  <!-- ✓ GOOD -->
  <div>child content</div>
  <div v-html="replacesChildContent"></div>

  <!-- ✗ BAD -->
  <div v-html="replacesChildContent">child content</div>
</template>

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