pasika 0.10.131 → 0.10.132
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 +45 -16
- package/package.json +1 -1
|
@@ -11542,6 +11542,27 @@ function singleCssFunction(value) {
|
|
|
11542
11542
|
const args = value.slice(match[0].length, -1).trim();
|
|
11543
11543
|
return args ? { name, args } : void 0;
|
|
11544
11544
|
}
|
|
11545
|
+
function gradientOnlyBackground(value) {
|
|
11546
|
+
if (!value || /[;{}'"\\]/u.test(value)) return false;
|
|
11547
|
+
const layers = [];
|
|
11548
|
+
let depth = 0;
|
|
11549
|
+
let start = 0;
|
|
11550
|
+
for (let index = 0; index < value.length; index++) {
|
|
11551
|
+
if (value[index] === "(") depth++;
|
|
11552
|
+
if (value[index] === ")") depth--;
|
|
11553
|
+
if (depth < 0) return false;
|
|
11554
|
+
if (value[index] === "," && depth === 0) {
|
|
11555
|
+
layers.push(value.slice(start, index).trim());
|
|
11556
|
+
start = index + 1;
|
|
11557
|
+
}
|
|
11558
|
+
}
|
|
11559
|
+
if (depth !== 0) return false;
|
|
11560
|
+
layers.push(value.slice(start).trim());
|
|
11561
|
+
return layers.every((layer) => {
|
|
11562
|
+
const fn = singleCssFunction(layer);
|
|
11563
|
+
return fn !== void 0 && /^(?:repeating-)?(?:linear|radial|conic)-gradient$/u.test(fn.name);
|
|
11564
|
+
});
|
|
11565
|
+
}
|
|
11545
11566
|
function boxShadowNamespace(value) {
|
|
11546
11567
|
const layers = [];
|
|
11547
11568
|
let depth = 0;
|
|
@@ -11604,7 +11625,9 @@ function themeCandidate(name, utilityText) {
|
|
|
11604
11625
|
if (!cssValue) return void 0;
|
|
11605
11626
|
const namedOperation = arbitraryApply?.groups?.prefix ? arbitraryApplyOperation(arbitraryApply.groups.prefix, cssValue) : void 0;
|
|
11606
11627
|
if (arbitraryApply && !namedOperation) return void 0;
|
|
11607
|
-
const
|
|
11628
|
+
const declaredProperty = arbitrary?.groups?.property ?? direct?.groups?.property ?? namedOperation?.property;
|
|
11629
|
+
const gradientShorthand = declaredProperty === "background" && gradientOnlyBackground(cssValue);
|
|
11630
|
+
const property = gradientShorthand ? "background-image" : declaredProperty;
|
|
11608
11631
|
const functionValue = property === "filter" || property === "backdrop-filter" ? singleCssFunction(cssValue) : void 0;
|
|
11609
11632
|
const shadowNamespace = property === "box-shadow" ? boxShadowNamespace(cssValue) : void 0;
|
|
11610
11633
|
if (property === "box-shadow" && !shadowNamespace) return void 0;
|
|
@@ -11640,7 +11663,8 @@ function themeCandidate(name, utilityText) {
|
|
|
11640
11663
|
value,
|
|
11641
11664
|
prefix: matched.prefix,
|
|
11642
11665
|
namespace: matched.namespace,
|
|
11643
|
-
probe: Boolean(arbitraryApply) || matched.property === "transition-property"
|
|
11666
|
+
probe: Boolean(arbitraryApply) || matched.property === "transition-property",
|
|
11667
|
+
gradientShorthand
|
|
11644
11668
|
};
|
|
11645
11669
|
}
|
|
11646
11670
|
var builtInTextSizes = /* @__PURE__ */ new Set([
|
|
@@ -11679,6 +11703,9 @@ function isTypographySize(name) {
|
|
|
11679
11703
|
return /^--text-(?!.*--)(?:[a-z0-9]+-)*[a-z0-9]+$/u.test(name);
|
|
11680
11704
|
}
|
|
11681
11705
|
function suggestedThemeToken(candidate) {
|
|
11706
|
+
if (candidate.namespace === "background-image") {
|
|
11707
|
+
return candidate.token.endsWith("-canvas") ? candidate.token : `${candidate.token}-canvas`;
|
|
11708
|
+
}
|
|
11682
11709
|
if (candidate.namespace !== "color") return candidate.token;
|
|
11683
11710
|
let role = "edge";
|
|
11684
11711
|
if (["bg", "fill"].includes(candidate.prefix)) {
|
|
@@ -11696,7 +11723,8 @@ function themeMigrationGuidance(candidate, utilityName) {
|
|
|
11696
11723
|
const runtimeDependent = /\bvar\s*\(/iu.test(candidate.value);
|
|
11697
11724
|
const action = runtimeDependent ? `only use a self-named @theme inline token "${token}" with an unconditional :root default and a detected runtime override; otherwise resolve the fixed value directly in @theme. ` : `define a direct @theme token "${token}" with value "${candidate.value}" rather than adding a :root bridge. `;
|
|
11698
11725
|
const classGuidance = generatedClass === utilityName ? "Preserve the generated class name" : `Update class usages to "${generatedClass}"`;
|
|
11699
|
-
|
|
11726
|
+
const resetWarning = candidate.gradientShorthand ? " Replacing the background shorthand with background-image stops resetting other background properties; verify cascade and rendering." : "";
|
|
11727
|
+
return `${action}${classGuidance} and compare compiled CSS before removing the utility.${resetWarning}`;
|
|
11700
11728
|
}
|
|
11701
11729
|
var utilityMappingRule = {
|
|
11702
11730
|
meta: {
|
|
@@ -11889,7 +11917,7 @@ var utilityMappingRule = {
|
|
|
11889
11917
|
if (candidate && equivalent && nameCounts.get(name) === 1) {
|
|
11890
11918
|
context.report({
|
|
11891
11919
|
node: utility,
|
|
11892
|
-
message: `Custom utility "${name}" duplicates theme-generated "${equivalent}" (${candidate.property}: ${candidate.value}); reuse "${equivalent}" instead
|
|
11920
|
+
message: `Custom utility "${name}" duplicates theme-generated "${equivalent}" (${candidate.property}: ${candidate.value}); reuse "${equivalent}" instead.${candidate.gradientShorthand ? " Check background shorthand reset behavior before switching to background-image." : ""}`
|
|
11893
11921
|
});
|
|
11894
11922
|
continue;
|
|
11895
11923
|
}
|
|
@@ -11905,7 +11933,7 @@ var utilityMappingRule = {
|
|
|
11905
11933
|
if (!candidate.token) {
|
|
11906
11934
|
context.report({
|
|
11907
11935
|
node: utility,
|
|
11908
|
-
message: `Custom utility "${name}" only maps ${candidate.property} (${candidate.value}); define an @theme token in the "--${candidate.namespace}
|
|
11936
|
+
message: `Custom utility "${name}" only maps ${candidate.property} (${candidate.value}); define ${candidate.gradientShorthand ? "a semantic" : "an"} @theme token in the "--${candidate.namespace}-*${candidate.gradientShorthand ? "-canvas" : ""}" namespace and use its generated "${candidate.prefix}-*" class instead.${candidate.property === "box-shadow" ? " Compare compiled CSS and ring/inset-shadow composition before migration." : ""}${candidate.gradientShorthand ? " Check background shorthand reset behavior before switching to background-image." : ""}`
|
|
11909
11937
|
});
|
|
11910
11938
|
continue;
|
|
11911
11939
|
}
|
|
@@ -11972,7 +12000,6 @@ var utilityMappingRule = {
|
|
|
11972
12000
|
|
|
11973
12001
|
// eslint/rules/tailwind/utility-name-parity.ts
|
|
11974
12002
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
11975
|
-
import { createHash } from "crypto";
|
|
11976
12003
|
import { existsSync as existsSync13 } from "fs";
|
|
11977
12004
|
import path80 from "path";
|
|
11978
12005
|
import { generate as generate7, parse as parse7, toPlainObject as toPlainObject2 } from "@eslint/css-tree";
|
|
@@ -12014,14 +12041,6 @@ function readableValue(value) {
|
|
|
12014
12041
|
const slug = parts.join("-");
|
|
12015
12042
|
return slug.length <= 70 ? slug : void 0;
|
|
12016
12043
|
}
|
|
12017
|
-
function compoundValue(value) {
|
|
12018
|
-
const readable = readableValue(value);
|
|
12019
|
-
if (readable) return readable;
|
|
12020
|
-
const candidate = /^(?<fn>[a-z][a-z0-9-]*)\(/iu.exec(value.trim())?.groups?.fn?.toLowerCase();
|
|
12021
|
-
const hint = candidate?.endsWith("-") ? void 0 : candidate;
|
|
12022
|
-
const digest = createHash("sha256").update(value.trim()).digest("hex").slice(0, 12);
|
|
12023
|
-
return [hint, "hash", digest].filter(Boolean).join("-");
|
|
12024
|
-
}
|
|
12025
12044
|
var TAILWIND_WORKER = String.raw`
|
|
12026
12045
|
import { readFileSync } from "node:fs";
|
|
12027
12046
|
import { compile } from "tailwindcss";
|
|
@@ -12095,7 +12114,8 @@ function compiledOperation(compiled, index) {
|
|
|
12095
12114
|
return { property: declaration.property, value: generate7(declaration.value).trim() };
|
|
12096
12115
|
}
|
|
12097
12116
|
function expectedName(operation) {
|
|
12098
|
-
const value =
|
|
12117
|
+
const value = readableValue(operation.value);
|
|
12118
|
+
if (!value) return void 0;
|
|
12099
12119
|
const property = operation.property.replace(/^-+/u, "").replace(/^background-/u, "bg-");
|
|
12100
12120
|
return `${property}-${value}`;
|
|
12101
12121
|
}
|
|
@@ -12111,7 +12131,7 @@ var utilityNameParityRule = {
|
|
|
12111
12131
|
schema: [],
|
|
12112
12132
|
type: "problem",
|
|
12113
12133
|
docs: {
|
|
12114
|
-
description: "
|
|
12134
|
+
description: "Use property/value-derived names for readable values and semantic names for complex values."
|
|
12115
12135
|
}
|
|
12116
12136
|
},
|
|
12117
12137
|
create(context) {
|
|
@@ -12141,6 +12161,15 @@ var utilityNameParityRule = {
|
|
|
12141
12161
|
continue;
|
|
12142
12162
|
}
|
|
12143
12163
|
const expected = expectedName(operation);
|
|
12164
|
+
if (!expected) {
|
|
12165
|
+
if (/-hash-[a-f0-9]{12}$/u.test(candidate.name)) {
|
|
12166
|
+
context.report({
|
|
12167
|
+
node: candidate.utility,
|
|
12168
|
+
message: `Custom utility "${candidate.name}" uses an opaque hash for a complex ${operation.property} value; use a semantic name, or prefer a theme-generated utility where supported.`
|
|
12169
|
+
});
|
|
12170
|
+
}
|
|
12171
|
+
continue;
|
|
12172
|
+
}
|
|
12144
12173
|
if (candidate.name === expected) continue;
|
|
12145
12174
|
context.report({
|
|
12146
12175
|
node: candidate.utility,
|