empty-content
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: offhtml/angular-eslint-recommended
What it does
Section titled “What it does”Reports a link, button or heading with nothing in it and no aria-label, title or binding to innerHTML, innerText, outerHTML or textContent. Text, an interpolation, a block or an element inside counts as content, whatever the element is.
Why it matters
Section titled “Why it matters”A link, button or heading with no accessible name is announced as just “link”, “button” or “heading”, so a screen reader user cannot tell what it does or where it leads, and a heading adds an empty entry to the outline of the page.
Example
Section titled “Example”...<div (click)="a()" (keydown.enter)="a()" tabindex="0"></div><div on-click="a()" role="presentation"></div><button (click)="a()"></button><a (click)="a()" routerLink="/x">x</a>...<app-card (click)="a()"></app-card>...<div (mouseout)="a()" (blur)="b()"></div>...<input id="a" /> <label for="a">Name</label> <label [for]="id">Name</label> <label><input /></label>@if (ok) { <a></a> }<h2></h2><a [innerHTML]="html"></a> <a><img alt="x" /></a> <a aria-label="x"></a> <a>{{ x }}</a>...<dialog><input autofocus /></dialog>...Configuration
Section titled “Configuration”angular: lint: rules: empty-content: warn # off (default), warn, errorhtml: lint: rules: empty-content: warn # off (default), warn, errorsvelte: lint: rules: empty-content: warn # off (default), warn, errorvue: lint: rules: empty-content: warn # off (default), warn, errorEnabled by the presets: html/angular-eslint-recommended.
Suppress one line with sudsy-disable-next-line empty-content 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 |
|---|---|---|
| angular-eslint | elements-content |
full |