pasika 0.10.108 → 0.10.110
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 -5
- package/package.json +1 -1
|
@@ -4268,7 +4268,6 @@ var NEXT_ROUTING_FILES3 = /* @__PURE__ */ new Set([
|
|
|
4268
4268
|
"loading",
|
|
4269
4269
|
"middleware",
|
|
4270
4270
|
"not-found",
|
|
4271
|
-
"page",
|
|
4272
4271
|
"route",
|
|
4273
4272
|
"template",
|
|
4274
4273
|
// File conventions Next.js requires to keep their exact names in src/app/
|
|
@@ -9938,6 +9937,20 @@ var BOUNDARY_PROPERTY_WORDS = /* @__PURE__ */ new Set(["border", "outline", "rin
|
|
|
9938
9937
|
function violatesBoundaryColorRole(token) {
|
|
9939
9938
|
return !token.endsWith("-edge") && token.split("-").some((word) => BOUNDARY_PROPERTY_WORDS.has(word));
|
|
9940
9939
|
}
|
|
9940
|
+
var BACKGROUND_COLOR_UTILITIES = /* @__PURE__ */ new Set(["bg", "from", "via", "to"]);
|
|
9941
|
+
var TEXT_COLOR_UTILITIES = /* @__PURE__ */ new Set(["text"]);
|
|
9942
|
+
var BOUNDARY_COLOR_UTILITIES = /* @__PURE__ */ new Set(["border", "divide", "outline", "ring", "stroke"]);
|
|
9943
|
+
function incompatibleColorUtilityRole(prefix, token) {
|
|
9944
|
+
let role;
|
|
9945
|
+
if (token.endsWith("-canvas")) role = "canvas";
|
|
9946
|
+
else if (token.endsWith("-ink")) role = "ink";
|
|
9947
|
+
else if (token.endsWith("-edge")) role = "edge";
|
|
9948
|
+
if (!role) return void 0;
|
|
9949
|
+
if (BACKGROUND_COLOR_UTILITIES.has(prefix)) return role === "canvas" ? void 0 : role;
|
|
9950
|
+
if (TEXT_COLOR_UTILITIES.has(prefix)) return role === "ink" ? void 0 : role;
|
|
9951
|
+
if (BOUNDARY_COLOR_UTILITIES.has(prefix)) return role === "edge" ? void 0 : role;
|
|
9952
|
+
return void 0;
|
|
9953
|
+
}
|
|
9941
9954
|
|
|
9942
9955
|
// eslint/rules/tailwind/css-variable-naming.ts
|
|
9943
9956
|
var EDGE_PROPERTY_WORDS = /* @__PURE__ */ new Set(["border", "outline", "ring", "stroke"]);
|
|
@@ -10954,17 +10967,23 @@ function isColorToken(token, inventory) {
|
|
|
10954
10967
|
if (hyphen === -1) return false;
|
|
10955
10968
|
return DEFAULT_PALETTE_FAMILIES.has(token.slice(0, hyphen)) && DEFAULT_PALETTE_SHADES.has(token.slice(hyphen + 1));
|
|
10956
10969
|
}
|
|
10957
|
-
function
|
|
10958
|
-
if (className.includes("[") || className.includes("(")) return
|
|
10970
|
+
function definedThemeColorClass(className, inventory) {
|
|
10971
|
+
if (className.includes("[") || className.includes("(")) return void 0;
|
|
10959
10972
|
const utility = (className.replace(/!+$/, "").split(":").pop() ?? "").split("/")[0] ?? "";
|
|
10960
10973
|
const compound = Object.keys(PREFIX_NAMESPACES).find(
|
|
10961
10974
|
(prefix2) => prefix2.includes("-") && utility.startsWith(`${prefix2}-`)
|
|
10962
10975
|
);
|
|
10963
10976
|
const dash = utility.indexOf("-");
|
|
10964
|
-
if (dash === -1) return
|
|
10977
|
+
if (dash === -1) return void 0;
|
|
10965
10978
|
const prefix = compound ?? utility.slice(0, dash);
|
|
10966
10979
|
const token = utility.slice(prefix.length + 1);
|
|
10967
|
-
|
|
10980
|
+
if (!(PREFIX_NAMESPACES[prefix]?.includes("color") ?? false)) return void 0;
|
|
10981
|
+
if (!(inventory.themeTokens.get("color")?.has(token) ?? false)) return void 0;
|
|
10982
|
+
return { prefix, token };
|
|
10983
|
+
}
|
|
10984
|
+
function isInvalidBoundaryColorClass(className, inventory) {
|
|
10985
|
+
const themeColor = definedThemeColorClass(className, inventory);
|
|
10986
|
+
return themeColor !== void 0 && violatesBoundaryColorRole(themeColor.token);
|
|
10968
10987
|
}
|
|
10969
10988
|
function isKnown(className, inventory) {
|
|
10970
10989
|
if (className.includes("[") || className.includes("(")) return true;
|
|
@@ -11033,6 +11052,20 @@ var unknownUtilityRule = {
|
|
|
11033
11052
|
});
|
|
11034
11053
|
continue;
|
|
11035
11054
|
}
|
|
11055
|
+
const themeColor = definedThemeColorClass(candidate, inventory);
|
|
11056
|
+
const incompatibleRole = themeColor ? incompatibleColorUtilityRole(themeColor.prefix, themeColor.token) : void 0;
|
|
11057
|
+
if (incompatibleRole) {
|
|
11058
|
+
const expected = {
|
|
11059
|
+
canvas: "bg-<role>-canvas",
|
|
11060
|
+
ink: "text-<role>-ink",
|
|
11061
|
+
edge: "border-<role>-edge"
|
|
11062
|
+
}[incompatibleRole];
|
|
11063
|
+
context.report({
|
|
11064
|
+
node,
|
|
11065
|
+
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.`
|
|
11066
|
+
});
|
|
11067
|
+
continue;
|
|
11068
|
+
}
|
|
11036
11069
|
if (isKnown(candidate, inventory)) continue;
|
|
11037
11070
|
const plainBase = candidate.replace(/!+$/, "").split(":").pop() ?? "";
|
|
11038
11071
|
if (inventory.plainClasses.has(plainBase)) {
|