custom-property-no-missing-var-function
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesscorrectnessno fixdefault: offcss/stylelint-recommended
What it does
Section titled “What it does”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.
Why it matters
Section titled “Why it matters”--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).
Example
Section titled “Example”: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" }Configuration
Section titled “Configuration”css: lint: rules: custom-property-no-missing-var-function: warn # off (default), warn, errorless: lint: rules: custom-property-no-missing-var-function: warn # off (default), warn, errorscss: lint: rules: custom-property-no-missing-var-function: warn # off (default), warn, errorEnabled 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.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint | custom-property-no-missing-var-function |
full |