Skip to content

Commit

Permalink
Fix function-url-quotes performance (#7011)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeddy3 committed Jun 30, 2023
1 parent 7255ede commit c49290a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tender-apes-count.md
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `function-url-quotes` performance
4 changes: 4 additions & 0 deletions lib/rules/function-url-quotes/index.js
Expand Up @@ -24,6 +24,8 @@ const meta = {
fixable: true,
};

const URL_FUNC_REGEX = /url\(/i;

/** @type {import('stylelint').Rule} */
const rule = (primary, secondaryOptions, context) => {
return (root, result) => {
Expand Down Expand Up @@ -57,6 +59,8 @@ const rule = (primary, secondaryOptions, context) => {
* @param {import('postcss').Declaration} decl
*/
function checkDeclParams(decl) {
if (!URL_FUNC_REGEX.test(decl.value)) return;

if (!isStandardSyntaxDeclaration(decl)) return;

const value = getDeclarationValue(decl);
Expand Down

0 comments on commit c49290a

Please sign in to comment.