no-lone-template
Angular templatesHTMLVue / SvelteVue / Sveltesuspiciousno fixdefault: warnhtml/eslint-plugin-vue-recommended
What it does
Section titled “What it does”Reports a nested <template> that has no directive (v-if, v-for, v-slot, …). Only in .vue files.
Why it matters
Section titled “Why it matters”A <template> with no directive is a wrapper that Vue renders without its own element, so it does nothing and only adds a level.
To fix, remove the tag and keep its content, or add the directive that was meant.
Example
Section titled “Example”<template> <div> <template><p>lone</p></template> <template v-if="a"><p>ok</p></template> <template #head><p>ok</p></template>...Configuration
Section titled “Configuration”angular: lint: rules: no-lone-template: warn # off, warn (default), errorhtml: lint: rules: no-lone-template: warn # off, warn (default), errorsvelte: lint: rules: no-lone-template: warn # off, warn (default), errorvue: lint: rules: no-lone-template: warn # off, warn (default), errorEnabled by the presets: html/eslint-plugin-vue-recommended.
Suppress one line with sudsy-disable-next-line no-lone-template in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| eslint-plugin-vue | no-lone-template |
full |