Skip to content

no-unknown-style-directive-property

Reports a style: directive that names a property CSS does not know (style:marginLeft). Custom properties (style:--x) and vendor-prefixed ones are not reported. The property table is the CSS language’s.

CSS properties are lowercase and hyphenated; a camelCase name is ignored by the browser, so the style does not apply.

To fix, write the property name in CSS form (style:margin-left).

Reported
...
<C>{#snippet children(x)}{x}{/snippet}</C>
<p style:marginLeft="1px" style:margin-left="1px" style:--x="1"></p>
...
After the fix
...
<C>{#snippet children(x)}{x}{/snippet}</C>
<p style:marginLeft="1px" style:margin-left="1px" style:--x="1"></p>
...
angular:
lint:
rules:
no-unknown-style-directive-property: warn # off, warn (default), error
html:
lint:
rules:
no-unknown-style-directive-property: warn # off, warn (default), error
svelte:
lint:
rules:
no-unknown-style-directive-property: warn # off, warn (default), error
vue:
lint:
rules:
no-unknown-style-directive-property: warn # off, warn (default), error

Enabled by the presets: html/eslint-plugin-svelte-recommended.

Suppress one line with sudsy-disable-next-line no-unknown-style-directive-property in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint-plugin-svelte no-unknown-style-directive-property full