src/content/docs/linter/rules/no-missing-var-function.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="CSS" icon="seti:css"> ## Summary - Rule available since: `v1.9.2` - Diagnostic Category: [`lint/correctness/noMissingVarFunction`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule doesn't have a fix. - The default severity of this rule is [**error**](/reference/diagnostics#error). - Sources: - Same as [`custom-property-no-missing-var-function`](https://github.com/stylelint/stylelint/blob/main/lib/rules/custom-property-no-missing-var-function/README.md){
"linter": {
"rules": {
"correctness": {
"noMissingVarFunction": "error"
}
}
}
}
Disallow missing var function for css variables.
This rule has the following limitations:
animationanimation-namecounter-incrementcounter-resetcounter-setgrid-columngrid-column-endgrid-column-startgrid-rowgrid-row-endgrid-row-startlist-stylelist-style-typetransitiontransition-propertyview-transition-namewill-changea {
--foo: red;
color: --foo;
}
.parent {
--foo: red;
.child {
color: --foo;
}
}
@property --bar {}
a {
color: --bar;
}
:root {
--baz: 0;
}
a {
--foo: --baz;
}
p {
color: var(--foo);
}
p {
--foo: red;
color: var(--foo);
}
p {
color: --foo;
}
*:root {
--global: red;
}
a {
color: var(--global);
}
@property --global-value {}
a {
color: var(--global-value);
}
a {
view-transition-name: --bbb;
}