Skip to content

Commit f0da12c

Browse files
Merge pull request #151 from Webperf-se/fix/custom-property-rules-as-warning
Report unknown custom properties/media as warning, not error
2 parents fe67aa2 + c10d16f commit f0da12c

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

configurations/standard.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@
156156
"no-unknown-custom-media": [
157157
true,
158158
{
159-
"severity": "error",
159+
"severity": "warning",
160160
"message": "Unknown custom media query \u201c%s\u201d"
161161
}
162162
],
163163
"no-unknown-custom-properties": [
164164
true,
165165
{
166-
"severity": "error",
166+
"severity": "warning",
167167
"message": "Unknown custom property \u201c%s\u201d"
168168
}
169169
],

tools/update_stylelint.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ def update_stylelint_rules():
4343
break
4444

4545
if 'no-unknown' in rule_name:
46+
# Unknown custom properties/media reference values that are
47+
# frequently defined where static analysis can't see them (set at
48+
# runtime via JS, in inline style attributes, on a page that wasn't
49+
# crawled, or built at compile time by PostCSS). A missing one
50+
# degrades gracefully to the initial/inherited value rather than
51+
# producing invalid CSS, so report it as a warning, not an error.
52+
if rule_name in ('no-unknown-custom-properties', 'no-unknown-custom-media'):
53+
rule_config["severity"] = "warning"
4654
rules[rule_name] = [rule_enable, rule_config]
4755
elif 'no-deprecated' in rule_name:
4856
rule_config["severity"] = "warning"

0 commit comments

Comments
 (0)