Skip to content

Commit

Permalink
Fix regex caching
Browse files Browse the repository at this point in the history
  • Loading branch information
jeddy3 committed Jun 30, 2023
1 parent 56813ce commit a50a8dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 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,7 +59,7 @@ const rule = (primary, secondaryOptions, context) => {
* @param {import('postcss').Declaration} decl
*/
function checkDeclParams(decl) {
if (!/url\(/i.test(decl.value)) return;
if (!URL_FUNC_REGEX.test(decl.value)) return;

if (!isStandardSyntaxDeclaration(decl)) return;

Expand Down

0 comments on commit a50a8dd

Please sign in to comment.