no-nested-style-tag
What it does
Section titled “What it does”Reports a <style> that is inside an element.
Why it matters
Section titled “Why it matters”Only the <style> at the top level of a component is compiled as its CSS; a nested one is put into the page as an ordinary element, and its rules are not scoped to the component.
To fix, move the <style> to the top level.
Example
Section titled “Example”...<div><style>a { color: red }</style></div>...<a href="https://x.org" target="_blank" rel="noopener noreferrer">x</a>......<div><style>a { color: red }</style></div>...<a href="https://x.org" target="_blank" rel="noopener noreferrer">x</a>...Configuration
Section titled “Configuration”angular: lint: rules: no-nested-style-tag: warn # off (default), warn, errorhtml: lint: rules: no-nested-style-tag: warn # off (default), warn, errorsvelte: lint: rules: no-nested-style-tag: warn # off (default), warn, errorvue: lint: rules: no-nested-style-tag: warn # off (default), warn, errorSuppress one line with sudsy-disable-next-line no-nested-style-tag 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 |
|---|---|---|
| eslint-plugin-svelte | no-nested-style-tag |
full |