attr-quotes
What it does
Section titled “What it does”Reports an attribute value that is not quoted with ": a value with no quotes (class=a), and a value in ' unless it holds a " (class='a'). In Svelte, name={expression} is not reported, because the braces are the syntax.
Why it matters
Section titled “Why it matters”An unquoted value ends at the first space or >, so a later edit that adds a word to the value changes the markup. One quote style keeps the files uniform and the diffs small.
To fix, quote the value with ".
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: attr-quotes: warn # off (default), warn, errorhtml: lint: rules: attr-quotes: warn # off (default), warn, errorsvelte: lint: rules: attr-quotes: warn # off (default), warn, errorvue: lint: rules: attr-quotes: warn # off (default), warn, errorEnabled by the presets: html/html-validate-recommended, html/htmlhint, html/html-eslint-recommended, html/eslint-plugin-vue-recommended.
Suppress one line with sudsy-disable-next-line attr-quotes 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 |
|---|---|---|---|
| eslint-plugin-svelte | html-quotes |
full | |
| eslint-plugin-vue | html-quotes |
full | |
| html-eslint | quotes |
partial | a single-quoted value that holds a double quote is allowed; unquoted values are reported |
| html-validate | attr-quotes |
partial | the auto style only, without the style and unquoted options |
| htmlhint | attr-value-double-quotes |
partial | a single-quoted value that holds a double quote is allowed |