Skip to content

custom-property-no-missing-var-function

Reports a custom property that the file declares, used in a value without var() (calc(--x * 2)), on the property name. Properties that take names (transition, will-change, …) are not reported.

--x in a value is a plain identifier, not the value of the custom property, so the declaration is invalid or means something else.

To fix, write var(--x).

Reported
:root { --x: 1; --y: 2 }
a { width: calc(--x * 2); transition: --y 1s; margin: var(--x); height: --z }
...
d { grid-template-areas: "a b" "c d" }
css:
lint:
rules:
custom-property-no-missing-var-function: warn # off (default), warn, error
less:
lint:
rules:
custom-property-no-missing-var-function: warn # off (default), warn, error
scss:
lint:
rules:
custom-property-no-missing-var-function: warn # off (default), warn, error

Enabled by the presets: css/stylelint-recommended.

Suppress one line with sudsy-disable-next-line custom-property-no-missing-var-function in a comment of the file’s language.

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

Tool Rule Match
stylelint custom-property-no-missing-var-function full