Fix `declaration-property-value-no-unknown` false negatives for values containing known custom properties
What minimal example or steps are needed to reproduce the bug?
:root {
--foo: red;
}
a {
padding: var(--foo);
}What minimal configuration is needed to reproduce the bug?
export default {
rules: {
"declaration-property-value-no-unknown": true,
}
};How did you run Stylelint?
Which Stylelint-related dependencies are you using?
{
"stylelint": "17.14.1",
"stylelint-config-standard": "40.0.0"
}What did you expect to happen?
The linter to report a problem for:
padding: var(--foo);As the value of var(--foo) is a <color> not a <length>.
What actually happened?
No problems reported.
Do you have a proposal to fix the bug?
We can substitute in the values of known custom properties before the lexer.matchProperty check.
Before we added referenceFiles, most custom properties were unknown (unless they were defined in the same file). Now that most, if not all, are known, adding this check has become worthwhile.
We'd continue to ignore values that contain unknown custom properties.
I suggest we also add the substitution value as a new message arg, as we do with our resolved selectors, e.g.:
Unknown value "var(--foo)" ("red") for property "padding" (where red is the new arg).
Unknown value "red" for property "padding", via "var(--foo)"
Source: stylelint/stylelint