element-case
What it does
Section titled “What it does”Reports an element name that is not in lowercase, on the name of a start or end tag (<DIV>). Everything inside <svg> and <math> keeps its case and is not reported, and so are .vue, .svelte and *.component.html files, where component names are capitalised.
Why it matters
Section titled “Why it matters”HTML reads element names without regard to case, so capitals only make the same element appear in two spellings. In component files a capital also tells a component from an element, so a mixed use hides which one it is.
To fix, write the name in lowercase.
Example
Section titled “Example”...<html lang="en"><head><title>x</title></head><body><P CLASS="a" id = "b" title='c' data-x=d>x</P>...<p style="display: none">ok</p>...Configuration
Section titled “Configuration”angular: lint: rules: element-case: warn # off (default), warn, errorhtml: lint: rules: element-case: warn # off (default), warn, errorsvelte: lint: rules: element-case: warn # off (default), warn, errorvue: lint: rules: element-case: warn # off (default), warn, errorEnabled by the presets: html/html-validate-recommended, html/htmlhint.
Suppress one line with sudsy-disable-next-line element-case 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 | lowercase |
partial | the case of attribute names is attr-case |
| html-validate | element-case |
partial | lowercase only, without the style and ignoreForeign options |
| htmlhint | tagname-lowercase |
full |