pasika 0.10.161 → 0.10.163
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 +19 -4
- package/package.json +1 -1
|
@@ -10321,12 +10321,13 @@ var colorLiteralUsageRule = {
|
|
|
10321
10321
|
};
|
|
10322
10322
|
|
|
10323
10323
|
// eslint/rules/color-role.ts
|
|
10324
|
+
function nonterminalColorRole(name) {
|
|
10325
|
+
return /-(?<role>canvas|ink|edge)-/u.exec(name)?.groups?.role;
|
|
10326
|
+
}
|
|
10324
10327
|
function colorRoleUsageMessage(className) {
|
|
10325
10328
|
const segments = className.replace(/!+$/u, "").split(":");
|
|
10326
10329
|
const utility = ((segments[segments.length - 1] ?? "").split("/")[0] ?? "").replace(/^!/u, "");
|
|
10327
10330
|
if (utility.includes("[") || utility.includes("(")) return void 0;
|
|
10328
|
-
const role = /-(?<role>canvas|ink|edge)$/u.exec(utility)?.groups?.role;
|
|
10329
|
-
if (!role) return void 0;
|
|
10330
10331
|
let expected;
|
|
10331
10332
|
let purpose;
|
|
10332
10333
|
if (/^(?:bg|from|via|to|fill|ring-offset)-/u.test(utility)) {
|
|
@@ -10339,12 +10340,18 @@ function colorRoleUsageMessage(className) {
|
|
|
10339
10340
|
expected = "edge";
|
|
10340
10341
|
purpose = "borders, outlines, rings, dividers, or strokes";
|
|
10341
10342
|
}
|
|
10342
|
-
if (!expected || !purpose
|
|
10343
|
+
if (!expected || !purpose) return void 0;
|
|
10344
|
+
const nonterminalRole = nonterminalColorRole(utility);
|
|
10345
|
+
if (nonterminalRole) {
|
|
10346
|
+
return `Color utility "${className}" places semantic role "-${nonterminalRole}" before the end of its name; move the role to the end or omit it for shared colors.`;
|
|
10347
|
+
}
|
|
10348
|
+
const role = /-(?<role>canvas|ink|edge)$/u.exec(utility)?.groups?.role;
|
|
10349
|
+
if (!role || role === expected) return void 0;
|
|
10343
10350
|
return `Color utility "${className}" uses a "${role}" token for ${purpose}; use a "${expected}" token instead.`;
|
|
10344
10351
|
}
|
|
10345
10352
|
|
|
10346
10353
|
// eslint/rules/tailwind/color-role-usage.ts
|
|
10347
|
-
var COLOR_TOKEN = /^--color-[a-z][a-z0-9-]
|
|
10354
|
+
var COLOR_TOKEN = /^--color-[a-z][a-z0-9-]*$/u;
|
|
10348
10355
|
var BACKGROUND_IMAGE_TOKEN = /^--background-image-[a-z][a-z0-9-]*-canvas$/u;
|
|
10349
10356
|
var colorRoleUsageRule = {
|
|
10350
10357
|
meta: {
|
|
@@ -10376,6 +10383,14 @@ var colorRoleUsageRule = {
|
|
|
10376
10383
|
node: theme,
|
|
10377
10384
|
message: `Color token "${token}" must use a valid --color-* name, optionally ending in -canvas, -ink, or -edge.`
|
|
10378
10385
|
});
|
|
10386
|
+
} else {
|
|
10387
|
+
const nonterminalRole = nonterminalColorRole(token);
|
|
10388
|
+
if (nonterminalRole) {
|
|
10389
|
+
context.report({
|
|
10390
|
+
node: theme,
|
|
10391
|
+
message: `Color token "${token}" places semantic role "-${nonterminalRole}" before the end of its name; move the role to the end or omit it for shared colors.`
|
|
10392
|
+
});
|
|
10393
|
+
}
|
|
10379
10394
|
}
|
|
10380
10395
|
}
|
|
10381
10396
|
}
|