Stylelint 15 adds an optional new rule declaration-property-value-no-unknown to check for invalid property/value combinations such as:
.govuk-link--example {
top: red;
}
The new rule looks very useful, but may require careful configuration to ensure it works across the different projects using stylelint-config-gds and accepts things like functions for projects using Sass.
For example, turning it on by default will throw errors for unknown values govuk-colour("green")
// Disallow unknown property and value pairs
// https://stylelint.io/user-guide/rules/declaration-property-value-no-unknown/
'declaration-property-value-no-unknown': true
For which we might ignore all govuk-* values:
'declaration-property-value-no-unknown': [
true, {
ignoreProperties: {
'/.+/': '/govuk\\-/'
}
}
]
Or alternatively investigate the newer stylelint-scss rules instead
Stylelint 15 adds an optional new rule
declaration-property-value-no-unknownto check for invalid property/value combinations such as:The new rule looks very useful, but may require careful configuration to ensure it works across the different projects using
stylelint-config-gdsand accepts things like functions for projects using Sass.For example, turning it on by default will throw errors for unknown values
govuk-colour("green")For which we might ignore all
govuk-*values:Or alternatively investigate the newer
stylelint-scssrules instead