no-inline-style
Angular templatesHTMLVue / SvelteVue / Sveltestyleno fixdefault: offhtml/html-validate-recommendedhtml/htmlhint
What it does
Section titled “What it does”Reports a style attribute, and a Svelte style:property directive. A style that sets only display is not reported, because scripts toggle it.
Why it matters
Section titled “Why it matters”Styles in attributes cannot be shared between elements and pages, outweigh every rule of a stylesheet, and are blocked by a strict content security policy.
To fix, use a class and a stylesheet.
Example
Section titled “Example”...<body>...<p title='say "hi"' style="color: red">ok</p><p style="display: none">ok</p>...<br>...Configuration
Section titled “Configuration”angular: lint: rules: no-inline-style: warn # off (default), warn, errorhtml: lint: rules: no-inline-style: warn # off (default), warn, errorsvelte: lint: rules: no-inline-style: warn # off (default), warn, errorvue: lint: rules: no-inline-style: warn # off (default), warn, errorEnabled by the presets: html/html-validate-recommended, html/htmlhint.
Suppress one line with sudsy-disable-next-line no-inline-style 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 |
|---|---|---|---|
| angular-eslint | no-inline-styles |
full | |
| eslint-plugin-svelte | no-inline-styles |
full | |
| html-eslint | no-inline-styles |
partial | a style that sets only display is allowed |
| html-validate | no-inline-style |
partial | a style that sets only display is allowed; the allowedProperties and allowVariables options are not available |
| htmlhint | inline-style-disabled |
partial | a style that sets only display is allowed |