Skip to content

Commit

Permalink
Merge branch 'main' into fix-selector-anb-no-unmatchable-performance-…
Browse files Browse the repository at this point in the history
…-ambitious-binturong-c1809ae8a8
  • Loading branch information
romainmenke committed Jun 17, 2023
2 parents 81d4125 + 0e4d302 commit e0efd17
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-pandas-cheer.md
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `custom-property-no-missing-var-function` performance
5 changes: 5 additions & 0 deletions .changeset/wet-countries-think.md
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `function-calc-no-unspaced-operator` performance
8 changes: 5 additions & 3 deletions lib/rules/custom-property-no-missing-var-function/index.js
Expand Up @@ -3,7 +3,6 @@
const valueParser = require('postcss-value-parser');

const declarationValueIndex = require('../../utils/declarationValueIndex');
const isCustomProperty = require('../../utils/isCustomProperty');
const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');
Expand Down Expand Up @@ -32,12 +31,15 @@ const rule = (primary) => {
knownCustomProperties.add(atRule.params);
});

root.walkDecls(({ prop }) => {
if (isCustomProperty(prop)) knownCustomProperties.add(prop);
root.walkDecls(/^--/, ({ prop }) => {
knownCustomProperties.add(prop);
});

root.walkDecls((decl) => {
const { value } = decl;

if (!value.includes('--')) return;

const parsedValue = valueParser(value);

parsedValue.walk((node) => {
Expand Down
6 changes: 5 additions & 1 deletion lib/rules/function-calc-no-unspaced-operator/index.js
Expand Up @@ -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
Expand Down

0 comments on commit e0efd17

Please sign in to comment.