diff --git a/.changeset/olive-candles-fry.md b/.changeset/olive-candles-fry.md new file mode 100644 index 0000000000..73de26dadb --- /dev/null +++ b/.changeset/olive-candles-fry.md @@ -0,0 +1,5 @@ +--- +"stylelint": patch +--- + +Fixed: `selector-anb-no-unmatchable` performance diff --git a/lib/rules/selector-anb-no-unmatchable/index.js b/lib/rules/selector-anb-no-unmatchable/index.js index 0a78998b4f..c4c494ebd7 100644 --- a/lib/rules/selector-anb-no-unmatchable/index.js +++ b/lib/rules/selector-anb-no-unmatchable/index.js @@ -46,13 +46,11 @@ const rule = (primary) => { } root.walkRules((ruleNode) => { - if (!isStandardSyntaxRule(ruleNode)) { - return; - } + if (!hasANPlusBNotationPseudoClasses(ruleNode.selector)) return; - ruleNode.selectors.forEach((selector) => { - if (!hasANPlusBNotationPseudoClasses(selector)) return; + if (!isStandardSyntaxRule(ruleNode)) return; + ruleNode.selectors.forEach((selector) => { let cssTreeSelector; try {