Vue · VUE0044

Do not put attributes on a structural <template>

Reports attributes and directives Vue does not apply on a <template> with v-if, v-else-if, v-else, v-for or v-slot.
VUE0044vite-doctor/vuetemplatewarnNo fix

Run this rule

pnpm vite-doctor . --framework vue --rules vue/template/no-useless-template-attributes

Why it matters

A structural <template> does not render an element. Attributes such as id, class, slot, listeners and refs never reach a rendered element, and key and caching directives only work on certain structural templates.

Apply the attribute or directive to an intended rendered target that supports it. Preserve branch selection when adding visibility, and keep working list keys on a non-slot <template v-for>.

Example

Put the id on a rendered element

Before

<template>
  <template v-if="open" id="panel">
    <section>{{ details }}</section>
  </template>
</template>

After

<template>
  <template v-if="open">
    <section id="panel">{{ details }}</section>
  </template>
</template>
Copyright © 2026