attribute-allowed-values
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: warnhtml/html-validate-standard
What it does
Section titled “What it does”Reports an attribute whose value is not one of the values HTML allows for it on that element, for attributes with a fixed list such as type of <button> (button, submit, reset) and method of <form>.
Why it matters
Section titled “Why it matters”A browser that meets a value it does not know falls back to a default, which is not what the author wrote: type="foo" on a button makes a submit button, and the typo is never shown.
To fix, use one of the allowed values.
Example
Section titled “Example”...<p hidden>x</p><button type="send">Go</button><form method="put"></form><svg><foo></foo></svg></body></html>Configuration
Section titled “Configuration”angular: lint: rules: attribute-allowed-values: warn # off, warn (default), errorhtml: lint: rules: attribute-allowed-values: warn # off, warn (default), errorsvelte: lint: rules: attribute-allowed-values: warn # off, warn (default), errorvue: lint: rules: attribute-allowed-values: warn # off, warn (default), errorEnabled by the presets: html/html-validate-standard.
Suppress one line with sudsy-disable-next-line attribute-allowed-values 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 | no-invalid-attr-value |
partial | the values html-validate lists for an attribute; id and other pattern values are not checked |
| html-validate | attribute-allowed-values |
partial | values given as a pattern in the metadata (id) are not checked |