pasika 0.10.123 → 0.10.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eslint/pasika/index.js +16 -3
- package/package.json +1 -1
|
@@ -9889,20 +9889,33 @@ function colorRoleUsageMessage(className) {
|
|
|
9889
9889
|
|
|
9890
9890
|
// eslint/rules/tailwind/color-role-usage.ts
|
|
9891
9891
|
var COLOR_TOKEN = /^--color-[a-z][a-z0-9-]*-(?:canvas|ink|edge)$/u;
|
|
9892
|
+
var BACKGROUND_IMAGE_TOKEN = /^--background-image-[a-z][a-z0-9-]*-canvas$/u;
|
|
9892
9893
|
var colorRoleUsageRule = {
|
|
9893
9894
|
meta: {
|
|
9894
9895
|
schema: [],
|
|
9895
9896
|
type: "problem",
|
|
9896
|
-
docs: {
|
|
9897
|
+
docs: {
|
|
9898
|
+
description: "Require semantic color and background-image token names and matching Tailwind color utilities."
|
|
9899
|
+
}
|
|
9897
9900
|
},
|
|
9898
9901
|
create(context) {
|
|
9899
9902
|
return {
|
|
9900
9903
|
"StyleSheet:exit"(node) {
|
|
9901
9904
|
for (const theme of atrulesNamed(node, "theme")) {
|
|
9902
9905
|
const source = context.sourceCode.getText(theme).replace(/\/\*[\s\S]*?\*\//gu, " ");
|
|
9903
|
-
for (const match of source.matchAll(
|
|
9906
|
+
for (const match of source.matchAll(
|
|
9907
|
+
/(?:^|[{;\r\n])\s*(?<token>--(?:color|background-image)-[a-z][a-z0-9-]*)\s*:/gu
|
|
9908
|
+
)) {
|
|
9904
9909
|
const token = match.groups?.token;
|
|
9905
|
-
if (
|
|
9910
|
+
if (!token) continue;
|
|
9911
|
+
if (token.startsWith("--background-image-")) {
|
|
9912
|
+
if (!BACKGROUND_IMAGE_TOKEN.test(token)) {
|
|
9913
|
+
context.report({
|
|
9914
|
+
node: theme,
|
|
9915
|
+
message: `Background-image token "${token}" needs a semantic role ending in -canvas.`
|
|
9916
|
+
});
|
|
9917
|
+
}
|
|
9918
|
+
} else if (!COLOR_TOKEN.test(token)) {
|
|
9906
9919
|
context.report({
|
|
9907
9920
|
node: theme,
|
|
9908
9921
|
message: `Color token "${token}" needs a semantic role ending in -canvas, -ink, or -edge.`
|