pasika 0.10.141 → 0.10.142
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 +21 -0
- package/package.json +1 -1
|
@@ -11966,6 +11966,16 @@ var uniqueCssTokenValueRule = {
|
|
|
11966
11966
|
group.push(definition);
|
|
11967
11967
|
byValue.set(value, group);
|
|
11968
11968
|
}
|
|
11969
|
+
const fixedHslPrimitives = new Map(
|
|
11970
|
+
graph.definitions.filter((symbol) => symbol.kind === "theme-token" && symbol.value !== void 0).filter((symbol) => /^\s*\d+(?:\.\d+)?\s+\d+(?:\.\d+)?%\s+\d+(?:\.\d+)?%\s*$/u.test(symbol.value ?? "")).map((symbol) => [symbol.name, symbol])
|
|
11971
|
+
);
|
|
11972
|
+
const wrappedPrimitives = /* @__PURE__ */ new Map();
|
|
11973
|
+
for (const symbol of graph.definitions) {
|
|
11974
|
+
if (symbol.kind !== "theme-token" || !symbol.name.startsWith("--color-")) continue;
|
|
11975
|
+
const primitive = /^hsl\(\s*var\(\s*(?<name>--[\w-]+)\s*\)\s*\)$/u.exec(symbol.value ?? "")?.groups?.name;
|
|
11976
|
+
const original = primitive ? fixedHslPrimitives.get(primitive) : void 0;
|
|
11977
|
+
if (original && original.name !== symbol.name) wrappedPrimitives.set(symbol, original);
|
|
11978
|
+
}
|
|
11969
11979
|
const redundant = /* @__PURE__ */ new Map();
|
|
11970
11980
|
for (const group of byValue.values()) {
|
|
11971
11981
|
group.sort(compareLocations);
|
|
@@ -11978,6 +11988,17 @@ var uniqueCssTokenValueRule = {
|
|
|
11978
11988
|
}
|
|
11979
11989
|
return {
|
|
11980
11990
|
"StyleSheet:exit"(node) {
|
|
11991
|
+
for (const [definition, primitive] of wrappedPrimitives) {
|
|
11992
|
+
if (definition.file !== current) continue;
|
|
11993
|
+
context.report({
|
|
11994
|
+
node,
|
|
11995
|
+
loc: {
|
|
11996
|
+
start: { line: definition.line, column: 1 },
|
|
11997
|
+
end: { line: definition.line, column: 2 }
|
|
11998
|
+
},
|
|
11999
|
+
message: `Color token "${definition.name}" unnecessarily wraps fixed HSL primitive "${primitive.name}"; define a single --color-* token with hsl(...) directly and reuse it across utility roles.`
|
|
12000
|
+
});
|
|
12001
|
+
}
|
|
11981
12002
|
for (const [definition, original] of redundant) {
|
|
11982
12003
|
if (definition.file !== current) continue;
|
|
11983
12004
|
context.report({
|