pasika 0.10.120 → 0.10.121
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 +43 -11
- package/package.json +1 -1
|
@@ -10659,8 +10659,10 @@ var noUtilityAliasRule = {
|
|
|
10659
10659
|
|
|
10660
10660
|
// eslint/rules/tailwind/root-variables.ts
|
|
10661
10661
|
import path72 from "path";
|
|
10662
|
+
import { generate as generate3, parse as parse6, walk as walk3 } from "@eslint/css-tree";
|
|
10662
10663
|
var INLINE_MESSAGE = "Define design tokens with direct values in @theme, not @theme inline.";
|
|
10663
10664
|
var INDIRECT_MESSAGE = "Define design tokens that reference CSS variables via var() in @theme inline.";
|
|
10665
|
+
var REDUNDANT_INLINE_MESSAGE = (name) => `Tailwind token "${name}" has no runtime overrides; define its value directly in @theme instead of using :root and @theme inline.`;
|
|
10664
10666
|
var rootVariablesRule = {
|
|
10665
10667
|
meta: {
|
|
10666
10668
|
schema: [],
|
|
@@ -10706,6 +10708,25 @@ var rootVariablesRule = {
|
|
|
10706
10708
|
}
|
|
10707
10709
|
}
|
|
10708
10710
|
}
|
|
10711
|
+
const overriddenNames = new Set(
|
|
10712
|
+
graph.definitions.filter((symbol) => symbol.kind === "root-variable" && symbol.scope === "conditional").map((symbol) => symbol.name)
|
|
10713
|
+
);
|
|
10714
|
+
for (const file of [...stylesheets.filter((candidate) => path72.normalize(candidate) !== current), current]) {
|
|
10715
|
+
const css2 = path72.normalize(file) === current ? context.sourceCode.text : textOf(file);
|
|
10716
|
+
const tree = parse6(css2, { parseAtrulePrelude: false });
|
|
10717
|
+
walk3(tree, {
|
|
10718
|
+
enter(node) {
|
|
10719
|
+
if (node.type !== "Declaration" || !node.property.startsWith("--")) return;
|
|
10720
|
+
if (this.rule?.type !== "Rule") return;
|
|
10721
|
+
if (generate3(this.rule.prelude).trim() !== ":root") overriddenNames.add(node.property);
|
|
10722
|
+
}
|
|
10723
|
+
});
|
|
10724
|
+
}
|
|
10725
|
+
for (const file of findFiles(sourceRoot, MODULE_EXTENSIONS4)) {
|
|
10726
|
+
for (const found of textOf(file).matchAll(/\.setProperty\s*\(\s*["'\x60](?<name>--[\w-]+)["'\x60]/gu)) {
|
|
10727
|
+
if (found.groups?.name) overriddenNames.add(found.groups.name);
|
|
10728
|
+
}
|
|
10729
|
+
}
|
|
10709
10730
|
const defaultRootNames = new Set(
|
|
10710
10731
|
graph.definitions.filter((symbol) => symbol.kind === "root-variable" && symbol.scope === "default").map((symbol) => symbol.name)
|
|
10711
10732
|
);
|
|
@@ -10725,10 +10746,13 @@ var rootVariablesRule = {
|
|
|
10725
10746
|
for (const reference of unquoted.matchAll(/\bvar\(\s*(?<variable>--[\w-]+)/gu)) {
|
|
10726
10747
|
const runtime = reference.groups?.variable;
|
|
10727
10748
|
if (runtime && runtime !== name) {
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10749
|
+
const externalFont = name.startsWith("--font-") && runtime.startsWith("--font-") && /,\s*[^\s,)]+/u.test(unquoted);
|
|
10750
|
+
if (!names.has(runtime) && !externalFont) {
|
|
10751
|
+
context.report({
|
|
10752
|
+
node: theme,
|
|
10753
|
+
message: `Tailwind token "${name}" must reference its same-named CSS variable, not "${runtime}".`
|
|
10754
|
+
});
|
|
10755
|
+
}
|
|
10732
10756
|
} else if (runtime && !defaultRootNames.has(runtime)) {
|
|
10733
10757
|
context.report({
|
|
10734
10758
|
node: theme,
|
|
@@ -10737,6 +10761,14 @@ var rootVariablesRule = {
|
|
|
10737
10761
|
}
|
|
10738
10762
|
}
|
|
10739
10763
|
}
|
|
10764
|
+
if (inline && referencesVariable && defaultRootNames.has(name) && !overriddenNames.has(name)) {
|
|
10765
|
+
const references = [...unquoted.matchAll(/\bvar\(\s*(?<variable>--[\w-]+)/gu)].map(
|
|
10766
|
+
(reference) => reference.groups?.variable
|
|
10767
|
+
);
|
|
10768
|
+
if (references.length > 0 && references.every((variable) => variable === name)) {
|
|
10769
|
+
context.report({ node: theme, message: REDUNDANT_INLINE_MESSAGE(name) });
|
|
10770
|
+
}
|
|
10771
|
+
}
|
|
10740
10772
|
if (inline === referencesVariable) continue;
|
|
10741
10773
|
const offset = (theme.loc?.start.offset ?? 0) + match.index + match[0].indexOf(name);
|
|
10742
10774
|
const preceding = context.sourceCode.text.slice(0, offset);
|
|
@@ -10871,10 +10903,10 @@ var stylesheetOrderingRule = {
|
|
|
10871
10903
|
// eslint/rules/tailwind/theme-reset.ts
|
|
10872
10904
|
import { existsSync as existsSync11 } from "fs";
|
|
10873
10905
|
import path73 from "path";
|
|
10874
|
-
import { generate as
|
|
10906
|
+
import { generate as generate4, parse as parse7, toPlainObject as toPlainObject2 } from "@eslint/css-tree";
|
|
10875
10907
|
function isThemeReset(node) {
|
|
10876
10908
|
if (!node) return false;
|
|
10877
|
-
if (node.type === "Declaration") return node.property === "--*" &&
|
|
10909
|
+
if (node.type === "Declaration") return node.property === "--*" && generate4(node.value).trim() === "initial";
|
|
10878
10910
|
if (node.type === "Raw") return /--\*\s*:\s*initial\s*;/u.test(node.value);
|
|
10879
10911
|
return false;
|
|
10880
10912
|
}
|
|
@@ -10917,7 +10949,7 @@ var themeResetRule = {
|
|
|
10917
10949
|
if (seen.has(filename) || !existsSync11(filename)) continue;
|
|
10918
10950
|
seen.add(filename);
|
|
10919
10951
|
const source = textOf(filename);
|
|
10920
|
-
const parsed = toPlainObject2(
|
|
10952
|
+
const parsed = toPlainObject2(parse7(source, { parseAtrulePrelude: false }));
|
|
10921
10953
|
if (parsed.type === "StyleSheet" && hasThemeReset(parsed)) return;
|
|
10922
10954
|
queue.push({ file: filename, source });
|
|
10923
10955
|
}
|
|
@@ -11532,7 +11564,7 @@ import { spawnSync } from "child_process";
|
|
|
11532
11564
|
import { createHash } from "crypto";
|
|
11533
11565
|
import { existsSync as existsSync12 } from "fs";
|
|
11534
11566
|
import path78 from "path";
|
|
11535
|
-
import { generate as
|
|
11567
|
+
import { generate as generate5, parse as parse8, toPlainObject as toPlainObject3 } from "@eslint/css-tree";
|
|
11536
11568
|
function numericPart(value) {
|
|
11537
11569
|
const match = /^(?<negative>-?)(?<number>(?:\d+(?:\.\d+)?|\.\d+))(?<unit>%|px|rem|em|vw|vh|dvw|dvh|ch|fr|s|ms|deg|turn)?$/u.exec(
|
|
11538
11570
|
value
|
|
@@ -11632,7 +11664,7 @@ function compileApplies(applies, cwd) {
|
|
|
11632
11664
|
}
|
|
11633
11665
|
function compiledOperation(compiled, index) {
|
|
11634
11666
|
if (!compiled.css) return void 0;
|
|
11635
|
-
const sheet = toPlainObject3(
|
|
11667
|
+
const sheet = toPlainObject3(parse8(compiled.css, { parseValue: false }));
|
|
11636
11668
|
const probe = rules(sheet).find((candidate) => selectorNames(candidate).includes(`pasika-probe-${String(index)}`));
|
|
11637
11669
|
if (!probe) return void 0;
|
|
11638
11670
|
const declarations = blockChildren2(probe).filter(
|
|
@@ -11646,10 +11678,10 @@ function compiledOperation(compiled, index) {
|
|
|
11646
11678
|
(child) => child.type === "Declaration" && child.property === "--tw-shadow"
|
|
11647
11679
|
);
|
|
11648
11680
|
if (shadow?.type === "Declaration") {
|
|
11649
|
-
return { property: "box-shadow", value:
|
|
11681
|
+
return { property: "box-shadow", value: generate5(shadow.value).trim() };
|
|
11650
11682
|
}
|
|
11651
11683
|
}
|
|
11652
|
-
return { property: declaration.property, value:
|
|
11684
|
+
return { property: declaration.property, value: generate5(declaration.value).trim() };
|
|
11653
11685
|
}
|
|
11654
11686
|
function expectedName(operation) {
|
|
11655
11687
|
const value = compoundValue(operation.value);
|