pasika 0.10.108 → 0.10.109
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 +38 -4
- package/package.json +1 -1
|
@@ -9938,6 +9938,20 @@ var BOUNDARY_PROPERTY_WORDS = /* @__PURE__ */ new Set(["border", "outline", "rin
|
|
|
9938
9938
|
function violatesBoundaryColorRole(token) {
|
|
9939
9939
|
return !token.endsWith("-edge") && token.split("-").some((word) => BOUNDARY_PROPERTY_WORDS.has(word));
|
|
9940
9940
|
}
|
|
9941
|
+
var BACKGROUND_COLOR_UTILITIES = /* @__PURE__ */ new Set(["bg", "from", "via", "to"]);
|
|
9942
|
+
var TEXT_COLOR_UTILITIES = /* @__PURE__ */ new Set(["text"]);
|
|
9943
|
+
var BOUNDARY_COLOR_UTILITIES = /* @__PURE__ */ new Set(["border", "divide", "outline", "ring", "stroke"]);
|
|
9944
|
+
function incompatibleColorUtilityRole(prefix, token) {
|
|
9945
|
+
let role;
|
|
9946
|
+
if (token.endsWith("-canvas")) role = "canvas";
|
|
9947
|
+
else if (token.endsWith("-ink")) role = "ink";
|
|
9948
|
+
else if (token.endsWith("-edge")) role = "edge";
|
|
9949
|
+
if (!role) return void 0;
|
|
9950
|
+
if (BACKGROUND_COLOR_UTILITIES.has(prefix)) return role === "canvas" ? void 0 : role;
|
|
9951
|
+
if (TEXT_COLOR_UTILITIES.has(prefix)) return role === "ink" ? void 0 : role;
|
|
9952
|
+
if (BOUNDARY_COLOR_UTILITIES.has(prefix)) return role === "edge" ? void 0 : role;
|
|
9953
|
+
return void 0;
|
|
9954
|
+
}
|
|
9941
9955
|
|
|
9942
9956
|
// eslint/rules/tailwind/css-variable-naming.ts
|
|
9943
9957
|
var EDGE_PROPERTY_WORDS = /* @__PURE__ */ new Set(["border", "outline", "ring", "stroke"]);
|
|
@@ -10954,17 +10968,23 @@ function isColorToken(token, inventory) {
|
|
|
10954
10968
|
if (hyphen === -1) return false;
|
|
10955
10969
|
return DEFAULT_PALETTE_FAMILIES.has(token.slice(0, hyphen)) && DEFAULT_PALETTE_SHADES.has(token.slice(hyphen + 1));
|
|
10956
10970
|
}
|
|
10957
|
-
function
|
|
10958
|
-
if (className.includes("[") || className.includes("(")) return
|
|
10971
|
+
function definedThemeColorClass(className, inventory) {
|
|
10972
|
+
if (className.includes("[") || className.includes("(")) return void 0;
|
|
10959
10973
|
const utility = (className.replace(/!+$/, "").split(":").pop() ?? "").split("/")[0] ?? "";
|
|
10960
10974
|
const compound = Object.keys(PREFIX_NAMESPACES).find(
|
|
10961
10975
|
(prefix2) => prefix2.includes("-") && utility.startsWith(`${prefix2}-`)
|
|
10962
10976
|
);
|
|
10963
10977
|
const dash = utility.indexOf("-");
|
|
10964
|
-
if (dash === -1) return
|
|
10978
|
+
if (dash === -1) return void 0;
|
|
10965
10979
|
const prefix = compound ?? utility.slice(0, dash);
|
|
10966
10980
|
const token = utility.slice(prefix.length + 1);
|
|
10967
|
-
|
|
10981
|
+
if (!(PREFIX_NAMESPACES[prefix]?.includes("color") ?? false)) return void 0;
|
|
10982
|
+
if (!(inventory.themeTokens.get("color")?.has(token) ?? false)) return void 0;
|
|
10983
|
+
return { prefix, token };
|
|
10984
|
+
}
|
|
10985
|
+
function isInvalidBoundaryColorClass(className, inventory) {
|
|
10986
|
+
const themeColor = definedThemeColorClass(className, inventory);
|
|
10987
|
+
return themeColor !== void 0 && violatesBoundaryColorRole(themeColor.token);
|
|
10968
10988
|
}
|
|
10969
10989
|
function isKnown(className, inventory) {
|
|
10970
10990
|
if (className.includes("[") || className.includes("(")) return true;
|
|
@@ -11033,6 +11053,20 @@ var unknownUtilityRule = {
|
|
|
11033
11053
|
});
|
|
11034
11054
|
continue;
|
|
11035
11055
|
}
|
|
11056
|
+
const themeColor = definedThemeColorClass(candidate, inventory);
|
|
11057
|
+
const incompatibleRole = themeColor ? incompatibleColorUtilityRole(themeColor.prefix, themeColor.token) : void 0;
|
|
11058
|
+
if (incompatibleRole) {
|
|
11059
|
+
const expected = {
|
|
11060
|
+
canvas: "bg-<role>-canvas",
|
|
11061
|
+
ink: "text-<role>-ink",
|
|
11062
|
+
edge: "border-<role>-edge"
|
|
11063
|
+
}[incompatibleRole];
|
|
11064
|
+
context.report({
|
|
11065
|
+
node,
|
|
11066
|
+
message: `Utility class "${candidate}" applies a -${incompatibleRole} color token to an incompatible property; use ${expected} for that role or define a token for the intended property.`
|
|
11067
|
+
});
|
|
11068
|
+
continue;
|
|
11069
|
+
}
|
|
11036
11070
|
if (isKnown(candidate, inventory)) continue;
|
|
11037
11071
|
const plainBase = candidate.replace(/!+$/, "").split(":").pop() ?? "";
|
|
11038
11072
|
if (inventory.plainClasses.has(plainBase)) {
|