HTML syntax error in Vue template

  • VUE_BAD_HTML_SYNTAX
  • Error
  • Medium
  • vue

This rule applies when a Vue template has HTML syntax errors.

When a Vue template has HTML syntax errors, DOM rendering is generally not blocked because HTML has extensive recovery mechanism. However, the rendered output can be different from what is intended. So, it is recommended to fix those syntax errors.

Noncompliant Code Example

View with compliant examples side by side
<template>
  <div>
    <div v-custom"a"> <!-- VUE_BAD_HTML_SYNTAX alarm because an equals sign is missing in the attribute. -->
      &ndsp; <!-- VUE_BAD_HTML_SYNTAX alarm because `ndsp` is unknown named character reference. -->
    </div v-custom="b"> <!-- VUE_BAD_HTML_SYNTAX alarm because the end tag has an attribute. -->
  </div>
</template>

Compliant Code Example

View with noncompliant examples side by side
<template>
  <div>
    <div v-custom="a">
      &nbsp;
    </div>
  </div>
</template>

Version

This rule was introduced in DeepScan 1.16.0-beta.

See

Was this documentation helpful?