From 2887c6eb7b998ea75182140eb4a533b00fc76d41 Mon Sep 17 00:00:00 2001 From: David Ding Date: Fri, 19 Jun 2026 16:29:16 +0100 Subject: [PATCH] fix: allow modifier classes inside :is()/:not()/:where() with a base class The selector-disallowed-list regex was a false positive on patterns like .base:is(.-mod-a, .-mod-b) because the second argument appeared after a comma-space, which matched the combinator pattern. Added a negative lookbehind to exclude matches inside :is()/:not()/:where()/:matches() when a base class precedes the pseudo-class. Also added a second pattern to flag :is(.-modifier) when used without any base class (i.e. :is() itself starts the selector or follows a combinator), which is a genuine violation the original regex missed. --- .stylelintrc.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.stylelintrc.json b/.stylelintrc.json index f3c908f..b22c849 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -50,7 +50,10 @@ } ], "selector-disallowed-list": [ - ["/(?:^|[\\s>+~])\\s*\\.-[a-z]/i"], + [ + "/(?+~])\\s*\\.-[a-z]/i", + "/(?:^|[\\s>+~])\\s*:(?:is|not|where|matches)\\(\\s*\\.-[a-z]/i" + ], { "message": "Modifier classes (starting with '-') must not be standalone selectors; always combine with a base class (e.g., .prefix-element.-modifier or &.-modifier in nested rules)", "severity": "error"