commit 210f382cd8f6d9d46ee11ded3369f4df03ebfcb9
parent 0edb7c391b8bf4891677ccb487393f11d07821f7
Author: hannajones <hjones@mozilla.com>
Date: Mon, 3 Nov 2025 18:27:52 +0000
Bug 1995422 - ensure isValidLocalProperty can handle shorthand properties r=frontend-codestyle-reviewers,tgiles
Differential Revision: https://phabricator.services.mozilla.com/D269300
Diffstat:
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/tools/lint/stylelint/stylelint-plugin-mozilla/helpers.mjs b/tools/lint/stylelint/stylelint-plugin-mozilla/helpers.mjs
@@ -344,7 +344,12 @@ export const isValidLocalProperty = (value, cssCustomProperties, tokenCSS) => {
});
if (customProperty && cssCustomProperties[customProperty]) {
- return isToken(cssCustomProperties[customProperty].trim(), tokenCSS);
+ return isValidTokenUsage(
+ cssCustomProperties[customProperty],
+ tokenCSS,
+ cssCustomProperties,
+ ALLOW_LIST
+ );
}
return false;
};
diff --git a/tools/lint/stylelint/stylelint-plugin-mozilla/tests/use-border-color-tokens.tests.mjs b/tools/lint/stylelint/stylelint-plugin-mozilla/tests/use-border-color-tokens.tests.mjs
@@ -123,6 +123,12 @@ testRule({
code: "outline: var(--focus-outline);",
description: "Using a focus-outline token in outline is valid.",
},
+ {
+ code: `
+ :root { --custom-token: var(--border-width) solid var(--border-color); }
+ .a { border: var(--custom-token); }
+ `,
+ },
],
reject: [