element-required-content
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: offhtml/html-validate-standardhtml/html-eslint-recommended
What it does
Section titled “What it does”Reports an element that lacks a child it requires: <title> in <head>, <summary> in <details>, <head> and <body> in <html>.
Why it matters
Section titled “Why it matters”A page with no <title> has no name in tabs, history and search results, and a <details> with no <summary> shows a label the browser invents.
To fix, add the missing child.
Example
Section titled “Example”...<details><div></div></details><a href="x"><img alt="logo" src="a"></a><a href="x">text</a><a href="x" aria-label="n"><i></i></a>...Configuration
Section titled “Configuration”angular: lint: rules: element-required-content: warn # off (default), warn, errorhtml: lint: rules: element-required-content: warn # off (default), warn, errorsvelte: lint: rules: element-required-content: warn # off (default), warn, errorvue: lint: rules: element-required-content: warn # off (default), warn, errorEnabled by the presets: html/html-validate-standard, html/html-eslint-recommended.
Suppress one line with sudsy-disable-next-line element-required-content in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| html-eslint | require-title |
partial | also requires the other children it lists (<summary> in <details>) |
| html-validate | element-required-content |
partial | the content model of html-validate (data/model.txt); elements that no model row names are not judged |