diff --git a/.changeset/wet-countries-think.md b/.changeset/wet-countries-think.md new file mode 100644 index 0000000000..7dd9a539de --- /dev/null +++ b/.changeset/wet-countries-think.md @@ -0,0 +1,5 @@ +--- +"stylelint": patch +--- + +Fixed: `function-calc-no-unspaced-operator` performance diff --git a/lib/rules/function-calc-no-unspaced-operator/index.js b/lib/rules/function-calc-no-unspaced-operator/index.js index 57f42f2603..0e7c00f07e 100644 --- a/lib/rules/function-calc-no-unspaced-operator/index.js +++ b/lib/rules/function-calc-no-unspaced-operator/index.js @@ -48,9 +48,13 @@ const rule = (primary, _secondaryOptions, context) => { } root.walkDecls((decl) => { + const value = getDeclarationValue(decl); + + if (!OPERATOR_REGEX.test(value)) return; + let needsFix = false; const valueIndex = declarationValueIndex(decl); - const parsedValue = valueParser(getDeclarationValue(decl)); + const parsedValue = valueParser(value); /** * @param {import('postcss-value-parser').Node} operatorNode