src/content/docs/linter/rules/use-vue-valid-template-root.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="HTML" icon="seti:html"> :::caution This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time. ::: ## Summary - Rule available since: `v2.3.11` - Diagnostic Category: [`lint/nursery/useVueValidTemplateRoot`](/reference/diagnostics#diagnostic-category) - This rule has an [**unsafe**](/linter/#unsafe-fixes) fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - This rule belongs to the following domains: - [`vue`](/linter/domains#vue) - Sources: - Same as [`vue/valid-template-root`](https://eslint.vuejs.org/rules/valid-template-root){
"linter": {
"rules": {
"nursery": {
"useVueValidTemplateRoot": "error"
}
}
}
}
Enforce valid Vue <template> root usage.
This rule reports only root-level <template> elements. If the
<template> has a src attribute, the element must be empty. Otherwise,
the element must contain content.
<template src="./foo.html">content</template>
<template></template>
<template>content</template>
<template src="./foo.html"></template>