# svelte/no-unknown-style-directive-property
disallow unknown
style:property
- βοΈ This rule is included in
"plugin:svelte/recommended"
.
# π Rule Details
This rule reports an unknown CSS property in style directive.
This rule was inspired by Stylelintβs property-no-unknown rule.
Note that this rule only checks the style:property
directive. If you want to check inside the style
attribute and style
element, consider introducing Stylelint.
<script>
/* eslint svelte/no-unknown-style-directive-property: "error" */
let red = 'red';
let color = red;
</script>
<!-- β GOOD -->
<div style:color={red}>...</div>
<div style:color>...</div>
<!-- β BAD -->
<div style:Unexpected unknown style directive property 'unknown-color'. (svelte/no-unknown-style-directive-property)unknown-color={red}>...</div>
<div style:Unexpected unknown style directive property 'red'. (svelte/no-unknown-style-directive-property)red>...</div>
# π§ Options
{
"svelte/no-unknown-style-directive-property": [
"error",
{
"ignoreProperties": [],
"ignorePrefixed": true
}
]
}
ignoreProperties
β¦ You can specify property names or patterns that you want to ignore from checking. When specifying a pattern, specify a string like a regex literal. e.g."/pattern/i"
ignorePrefixed
β¦ Iftrue
, ignores properties with vendor prefix from checking. Default istrue
.
# π Further reading
# π Version
This rule was introduced in eslint-plugin-svelte v0.31.0