empty-heading
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: offhtml/html-validate-recommended
What it does
Section titled “What it does”Reports a heading (<h1> to <h6>) with no text. White space is not text. An image with an alt or an <svg> inside counts as content.
Why it matters
Section titled “Why it matters”Screen reader users move through a page by its headings, and an empty one is announced as a heading with nothing in it. It is usually a leftover or a heading whose text comes from a script that did not run.
To fix, put text in the heading, or remove it.
Example
Section titled “Example”...</head>...<h1></h1><h2><img src="a.png" alt="x"></h2><h3>text</h3>...Configuration
Section titled “Configuration”angular: lint: rules: empty-heading: warn # off (default), warn, errorhtml: lint: rules: empty-heading: warn # off (default), warn, errorsvelte: lint: rules: empty-heading: warn # off (default), warn, errorvue: lint: rules: empty-heading: warn # off (default), warn, errorEnabled by the presets: html/html-validate-recommended.
Suppress one line with sudsy-disable-next-line empty-heading 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 |
|---|---|---|
| html-eslint | no-empty-headings |
full |
| html-validate | empty-heading |
full |