pasika 0.10.121 → 0.10.123
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.d.ts +0 -2
- package/dist/eslint/pasika/index.js +194 -142
- package/package.json +1 -1
|
@@ -136,7 +136,6 @@ declare const tailwindRules: {
|
|
|
136
136
|
"unique-css-definition": _eslint_css.CSSRuleDefinition;
|
|
137
137
|
"unique-css-token-value": _eslint_css.CSSRuleDefinition;
|
|
138
138
|
"no-utility-alias": _eslint_css.CSSRuleDefinition;
|
|
139
|
-
"global-selector-styling": _eslint_css.CSSRuleDefinition;
|
|
140
139
|
};
|
|
141
140
|
|
|
142
141
|
declare const vulykRules: {
|
|
@@ -177,7 +176,6 @@ declare const pasikaPlugin: {
|
|
|
177
176
|
"unique-css-definition": _eslint_css.CSSRuleDefinition;
|
|
178
177
|
"unique-css-token-value": _eslint_css.CSSRuleDefinition;
|
|
179
178
|
"no-utility-alias": _eslint_css.CSSRuleDefinition;
|
|
180
|
-
"global-selector-styling": _eslint_css.CSSRuleDefinition;
|
|
181
179
|
"doc-kind-suffix": _eslint_markdown.MarkdownRuleDefinition;
|
|
182
180
|
"title-matches-file-name": _eslint_markdown.MarkdownRuleDefinition;
|
|
183
181
|
overview: _eslint_markdown.MarkdownRuleDefinition;
|
|
@@ -9671,17 +9671,19 @@ function selectorNames(node) {
|
|
|
9671
9671
|
}
|
|
9672
9672
|
|
|
9673
9673
|
// eslint/rules/tailwind/apply-usage.ts
|
|
9674
|
-
function reportRawDeclarations(context, rule) {
|
|
9674
|
+
function reportRawDeclarations(context, rule, insideBase) {
|
|
9675
9675
|
for (const child of blockChildren2(rule)) {
|
|
9676
9676
|
if (child.type === "Declaration") {
|
|
9677
|
-
if (child.property.startsWith("--")) continue;
|
|
9677
|
+
if (!insideBase && child.property.startsWith("--")) continue;
|
|
9678
9678
|
context.report({
|
|
9679
9679
|
node: child,
|
|
9680
|
-
message: `Style declaration "${child.property}" inside a global selector must use @apply.`
|
|
9680
|
+
message: insideBase ? `Global selectors inside @layer base may only contain @apply directives; found "${child.property}".` : `Style declaration "${child.property}" inside a global selector must use @apply.`
|
|
9681
9681
|
});
|
|
9682
9682
|
continue;
|
|
9683
9683
|
}
|
|
9684
|
-
if (child.type === "Rule"
|
|
9684
|
+
if (child.type === "Rule" || child.type === "Atrule" && child.name !== "apply") {
|
|
9685
|
+
reportRawDeclarations(context, child, insideBase);
|
|
9686
|
+
}
|
|
9685
9687
|
}
|
|
9686
9688
|
}
|
|
9687
9689
|
var applyUsageRule = {
|
|
@@ -9689,19 +9691,25 @@ var applyUsageRule = {
|
|
|
9689
9691
|
schema: [],
|
|
9690
9692
|
type: "problem",
|
|
9691
9693
|
docs: {
|
|
9692
|
-
description: "Require @apply
|
|
9694
|
+
description: "Require only @apply directives in global selectors inside @layer base."
|
|
9693
9695
|
}
|
|
9694
9696
|
},
|
|
9695
9697
|
create(context) {
|
|
9696
9698
|
return {
|
|
9697
9699
|
"StyleSheet:exit"(node) {
|
|
9698
|
-
|
|
9699
|
-
if (
|
|
9700
|
-
if (
|
|
9701
|
-
|
|
9702
|
-
|
|
9700
|
+
function visit(current, insideBase = false) {
|
|
9701
|
+
if (current.type === "Atrule" && ["theme", "utility", "keyframes"].includes(current.name)) return;
|
|
9702
|
+
if (current.type === "Rule") {
|
|
9703
|
+
reportRawDeclarations(context, current, insideBase);
|
|
9704
|
+
return;
|
|
9705
|
+
}
|
|
9706
|
+
const inBaseLayer = insideBase || current.type === "Atrule" && current.name === "layer" && preludeIdentifiers(current).includes("base");
|
|
9707
|
+
const children = current.type === "StyleSheet" ? current.children : blockChildren2(current);
|
|
9708
|
+
for (const child of children) {
|
|
9709
|
+
if (child.type === "Rule" || child.type === "Atrule") visit(child, inBaseLayer);
|
|
9703
9710
|
}
|
|
9704
9711
|
}
|
|
9712
|
+
visit(node);
|
|
9705
9713
|
}
|
|
9706
9714
|
};
|
|
9707
9715
|
}
|
|
@@ -9767,10 +9775,6 @@ function importedSpecifiers(text) {
|
|
|
9767
9775
|
(match) => match.groups?.spec ?? ""
|
|
9768
9776
|
);
|
|
9769
9777
|
}
|
|
9770
|
-
function moduleImports(text, fileName) {
|
|
9771
|
-
const escaped = fileName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
9772
|
-
return new RegExp(`(?:import|require)\\s*\\(?\\s*["'][^"']*${escaped}["']`, "i").test(text);
|
|
9773
|
-
}
|
|
9774
9778
|
function resolveSpecifier2(fromFile, spec, sourceRoot) {
|
|
9775
9779
|
if (spec.startsWith("/")) return path65.resolve(spec);
|
|
9776
9780
|
if (spec.startsWith("./") || spec.startsWith("../")) return path65.resolve(path65.dirname(fromFile), spec);
|
|
@@ -9781,22 +9785,6 @@ function buildStylesheetGraph(options) {
|
|
|
9781
9785
|
const { cssFiles, sourceRoot, textOf } = options;
|
|
9782
9786
|
const cssSet = new Set(cssFiles.map((file) => path65.normalize(file)));
|
|
9783
9787
|
const globals = cssFiles.filter((file) => registersTailwind(textOf(file)));
|
|
9784
|
-
const reachable = /* @__PURE__ */ new Set();
|
|
9785
|
-
const queue = [...globals];
|
|
9786
|
-
for (const global of globals) reachable.add(path65.normalize(global));
|
|
9787
|
-
while (queue.length > 0) {
|
|
9788
|
-
const from = queue.shift();
|
|
9789
|
-
if (!from) continue;
|
|
9790
|
-
for (const spec of importedSpecifiers(textOf(from))) {
|
|
9791
|
-
const target = resolveSpecifier2(from, spec, sourceRoot);
|
|
9792
|
-
if (!target) continue;
|
|
9793
|
-
const normalized = path65.normalize(target);
|
|
9794
|
-
if (cssSet.has(normalized) && !reachable.has(normalized)) {
|
|
9795
|
-
reachable.add(normalized);
|
|
9796
|
-
queue.push(normalized);
|
|
9797
|
-
}
|
|
9798
|
-
}
|
|
9799
|
-
}
|
|
9800
9788
|
const directChildren = /* @__PURE__ */ new Set();
|
|
9801
9789
|
for (const global of globals) {
|
|
9802
9790
|
for (const spec of importedSpecifiers(textOf(global))) {
|
|
@@ -9806,7 +9794,7 @@ function buildStylesheetGraph(options) {
|
|
|
9806
9794
|
if (cssSet.has(normalized)) directChildren.add(normalized);
|
|
9807
9795
|
}
|
|
9808
9796
|
}
|
|
9809
|
-
return { globals,
|
|
9797
|
+
return { globals, directChildren };
|
|
9810
9798
|
}
|
|
9811
9799
|
|
|
9812
9800
|
// eslint/rules/tailwind/base-layer-pair.ts
|
|
@@ -9945,7 +9933,7 @@ var cssEntryPointRule = {
|
|
|
9945
9933
|
schema: [],
|
|
9946
9934
|
type: "problem",
|
|
9947
9935
|
docs: {
|
|
9948
|
-
description: "Require the app/styles CSS root, one global entry point, and direct project
|
|
9936
|
+
description: "Require the app/styles CSS root, one global entry point, and direct imports for every project stylesheet."
|
|
9949
9937
|
}
|
|
9950
9938
|
},
|
|
9951
9939
|
create(context) {
|
|
@@ -9961,7 +9949,7 @@ var cssEntryPointRule = {
|
|
|
9961
9949
|
}
|
|
9962
9950
|
const textOf = cachedTextReader();
|
|
9963
9951
|
const graph = buildStylesheetGraph({ cssFiles, sourceRoot, textOf });
|
|
9964
|
-
const { globals,
|
|
9952
|
+
const { globals, directChildren } = graph;
|
|
9965
9953
|
return {
|
|
9966
9954
|
"StyleSheet:exit"(node) {
|
|
9967
9955
|
if (globals.length === 0) return;
|
|
@@ -9982,13 +9970,33 @@ var cssEntryPointRule = {
|
|
|
9982
9970
|
});
|
|
9983
9971
|
return;
|
|
9984
9972
|
}
|
|
9985
|
-
const
|
|
9986
|
-
|
|
9973
|
+
const importers = moduleFiles.filter((modulePath) => {
|
|
9974
|
+
const source = textOf(modulePath);
|
|
9975
|
+
for (const match of source.matchAll(
|
|
9976
|
+
/\b(?:import\s*(?:[^"'`;]*?\bfrom\s*)?|require\s*\(\s*)["'](?<specifier>[^"']+\.css)["']/gu
|
|
9977
|
+
)) {
|
|
9978
|
+
const specifier = match.groups?.specifier;
|
|
9979
|
+
if (!specifier) continue;
|
|
9980
|
+
const resolved = resolveSpecifier2(modulePath, specifier, sourceRoot);
|
|
9981
|
+
if (resolved && path67.normalize(resolved) === current) return true;
|
|
9982
|
+
}
|
|
9983
|
+
return false;
|
|
9984
|
+
});
|
|
9985
|
+
const importCount = importers.length;
|
|
9987
9986
|
if (importCount !== 1) {
|
|
9988
9987
|
context.report({
|
|
9989
9988
|
node,
|
|
9990
9989
|
message: `The global stylesheet entry point must be imported by exactly one module (the root layout), but it is imported by ${String(importCount)} module(s).`
|
|
9991
9990
|
});
|
|
9991
|
+
} else {
|
|
9992
|
+
const importer = importers[0];
|
|
9993
|
+
const isRootLayout = importer !== void 0 && path67.dirname(importer) === path67.join(sourceRoot, "app") && /^layout\.(?:[cm]?[jt]sx?)$/u.test(path67.basename(importer));
|
|
9994
|
+
if (!isRootLayout) {
|
|
9995
|
+
context.report({
|
|
9996
|
+
node,
|
|
9997
|
+
message: "The global stylesheet entry point must be imported by src/app/layout, not another module."
|
|
9998
|
+
});
|
|
9999
|
+
}
|
|
9992
10000
|
}
|
|
9993
10001
|
return;
|
|
9994
10002
|
}
|
|
@@ -10000,22 +10008,10 @@ var cssEntryPointRule = {
|
|
|
10000
10008
|
});
|
|
10001
10009
|
return;
|
|
10002
10010
|
}
|
|
10003
|
-
|
|
10004
|
-
if (child.type === "Atrule" && child.name === "import") return false;
|
|
10005
|
-
if (child.type === "Comment") return false;
|
|
10006
|
-
return true;
|
|
10007
|
-
});
|
|
10008
|
-
if (hasProjectCss && !directChildren.has(current)) {
|
|
10011
|
+
if (!directChildren.has(current)) {
|
|
10009
10012
|
context.report({
|
|
10010
10013
|
node,
|
|
10011
|
-
message: "
|
|
10012
|
-
});
|
|
10013
|
-
return;
|
|
10014
|
-
}
|
|
10015
|
-
if (!reachable.has(current)) {
|
|
10016
|
-
context.report({
|
|
10017
|
-
node,
|
|
10018
|
-
message: "This stylesheet must be imported by the global stylesheet entry point via @import, so CSS arrives through one door."
|
|
10014
|
+
message: "Every project stylesheet must be imported directly by src/app/styles/globals.css."
|
|
10019
10015
|
});
|
|
10020
10016
|
}
|
|
10021
10017
|
}
|
|
@@ -10516,7 +10512,6 @@ var featureCssPlacementRule = {
|
|
|
10516
10512
|
const basename = path70.basename(current);
|
|
10517
10513
|
const featureName = basename.slice(0, -".css".length);
|
|
10518
10514
|
const isFeatureFile = path70.dirname(current) === styles && FEATURE_CSS.test(basename) && existsSync9(path70.join(sourceRoot, "features", featureName));
|
|
10519
|
-
if (basename !== GLOBALS && !isFeatureFile) return {};
|
|
10520
10515
|
const read = cachedTextReader();
|
|
10521
10516
|
const css2 = findFiles(sourceRoot, CSS_EXTENSIONS).map((file) => ({ path: file, content: read(file) }));
|
|
10522
10517
|
const modules = findFiles(sourceRoot, MODULE_EXTENSIONS4).map((file) => ({ path: file, content: read(file) }));
|
|
@@ -10529,7 +10524,9 @@ var featureCssPlacementRule = {
|
|
|
10529
10524
|
const owner = owners.get(symbolId(definition));
|
|
10530
10525
|
if (!owner) continue;
|
|
10531
10526
|
const expected = owner === GLOBALS ? GLOBALS : `${owner}.css`;
|
|
10532
|
-
if (
|
|
10527
|
+
if (owner !== GLOBALS && (basename === GLOBALS || !isFeatureFile) && !existsSync9(path70.join(styles, expected))) {
|
|
10528
|
+
continue;
|
|
10529
|
+
}
|
|
10533
10530
|
if (basename === expected) continue;
|
|
10534
10531
|
const kind = LABELS[definition.kind] ?? definition.kind;
|
|
10535
10532
|
context.report({
|
|
@@ -10546,38 +10543,6 @@ var featureCssPlacementRule = {
|
|
|
10546
10543
|
}
|
|
10547
10544
|
};
|
|
10548
10545
|
|
|
10549
|
-
// eslint/rules/tailwind/global-selector-styling.ts
|
|
10550
|
-
function hasStyling(node) {
|
|
10551
|
-
for (const child of blockChildren2(node)) {
|
|
10552
|
-
if (child.type === "Declaration" && !child.property.startsWith("--")) return true;
|
|
10553
|
-
if (child.type === "Atrule" && child.name === "apply") return true;
|
|
10554
|
-
if (child.type === "Rule" && hasStyling(child)) return true;
|
|
10555
|
-
}
|
|
10556
|
-
return false;
|
|
10557
|
-
}
|
|
10558
|
-
var globalSelectorStylingRule = {
|
|
10559
|
-
meta: {
|
|
10560
|
-
schema: [],
|
|
10561
|
-
type: "problem",
|
|
10562
|
-
docs: {
|
|
10563
|
-
description: "Forbid element/component styling in global selectors outside @layer base."
|
|
10564
|
-
}
|
|
10565
|
-
},
|
|
10566
|
-
create(context) {
|
|
10567
|
-
return {
|
|
10568
|
-
"StyleSheet:exit"(node) {
|
|
10569
|
-
for (const child of node.children) {
|
|
10570
|
-
if (child.type !== "Rule" || !hasStyling(child)) continue;
|
|
10571
|
-
context.report({
|
|
10572
|
-
node: child,
|
|
10573
|
-
message: "Global selectors outside @layer base may only override CSS variables; keep element/component styling as Tailwind classes in the consumer."
|
|
10574
|
-
});
|
|
10575
|
-
}
|
|
10576
|
-
}
|
|
10577
|
-
};
|
|
10578
|
-
}
|
|
10579
|
-
};
|
|
10580
|
-
|
|
10581
10546
|
// eslint/rules/tailwind/global-stylesheet.ts
|
|
10582
10547
|
import { existsSync as existsSync10 } from "fs";
|
|
10583
10548
|
import path71 from "path";
|
|
@@ -10662,13 +10627,24 @@ import path72 from "path";
|
|
|
10662
10627
|
import { generate as generate3, parse as parse6, walk as walk3 } from "@eslint/css-tree";
|
|
10663
10628
|
var INLINE_MESSAGE = "Define design tokens with direct values in @theme, not @theme inline.";
|
|
10664
10629
|
var INDIRECT_MESSAGE = "Define design tokens that reference CSS variables via var() in @theme inline.";
|
|
10630
|
+
var MIXED_THEME_MESSAGE = "Use either @theme or @theme inline across the project; external font-loader mappings with valid fallbacks are the only exception.";
|
|
10665
10631
|
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.`;
|
|
10632
|
+
var EXTERNAL_FONT_FALLBACK_MESSAGE = (name, variable) => `Tailwind font token "${name}" references external font "${variable}" without a fallback inside var(); use var(${variable}, Arial) or another font-family fallback.`;
|
|
10633
|
+
function hasVarFallback(source, variable) {
|
|
10634
|
+
for (const match of source.matchAll(/\bvar\s*\(\s*(?<name>--[\w-]+)\s*,/gu)) {
|
|
10635
|
+
if (match.groups?.name !== variable) continue;
|
|
10636
|
+
const start = match.index + match[0].length;
|
|
10637
|
+
const close = source.indexOf(")", start);
|
|
10638
|
+
if (close !== -1 && /[^,\s]/u.test(source.slice(start, close))) return true;
|
|
10639
|
+
}
|
|
10640
|
+
return false;
|
|
10641
|
+
}
|
|
10666
10642
|
var rootVariablesRule = {
|
|
10667
10643
|
meta: {
|
|
10668
10644
|
schema: [],
|
|
10669
10645
|
type: "problem",
|
|
10670
10646
|
docs: {
|
|
10671
|
-
description: "Require @theme for fixed tokens, matching :root variables for @theme inline tokens, and no other token redeclarations."
|
|
10647
|
+
description: "Require @theme for fixed tokens and fixed-token aliases, matching :root variables for @theme inline tokens, and no other token redeclarations."
|
|
10672
10648
|
}
|
|
10673
10649
|
},
|
|
10674
10650
|
create(context) {
|
|
@@ -10685,15 +10661,54 @@ var rootVariablesRule = {
|
|
|
10685
10661
|
modules: [],
|
|
10686
10662
|
includeReferences: false
|
|
10687
10663
|
});
|
|
10664
|
+
const themeValues = new Map(
|
|
10665
|
+
graph.definitions.filter((symbol) => symbol.kind === "theme-token" && symbol.value !== void 0).map((symbol) => [symbol.name, symbol.value ?? ""])
|
|
10666
|
+
);
|
|
10688
10667
|
const names = new Set(
|
|
10689
10668
|
graph.definitions.filter((symbol) => symbol.kind === "theme-token").map((symbol) => symbol.name)
|
|
10690
10669
|
);
|
|
10670
|
+
function isFixedThemeAlias(name, value, visited = /* @__PURE__ */ new Set()) {
|
|
10671
|
+
const match = /^var\(\s*(?<target>--[a-z][\w-]*)\s*\)$/u.exec(value.trim());
|
|
10672
|
+
const target = match?.groups?.target;
|
|
10673
|
+
if (!target || target === name || visited.has(target)) return false;
|
|
10674
|
+
const next = themeValues.get(target);
|
|
10675
|
+
if (!next) return false;
|
|
10676
|
+
if (!/\bvar\s*\(/u.test(next)) return true;
|
|
10677
|
+
visited.add(target);
|
|
10678
|
+
return isFixedThemeAlias(name, next, visited);
|
|
10679
|
+
}
|
|
10691
10680
|
const mirroredTokens = /* @__PURE__ */ new Set();
|
|
10681
|
+
let hasPlainThemeBlocks = false;
|
|
10682
|
+
let hasInlineThemeBlocks = false;
|
|
10683
|
+
let inlineBlocksAreExternalFonts = true;
|
|
10692
10684
|
for (const file of [...stylesheets.filter((candidate) => path72.normalize(candidate) !== current), current]) {
|
|
10693
10685
|
const source = (path72.normalize(file) === current ? context.sourceCode.text : textOf(file)).replace(
|
|
10694
10686
|
/\/\*[\s\S]*?\*\//gu,
|
|
10695
10687
|
" "
|
|
10696
10688
|
);
|
|
10689
|
+
for (const header of source.matchAll(/@theme(?<options>(?:\s+[\w-]+)*)\s*\{/gu)) {
|
|
10690
|
+
if (/\binline\b/u.test(header.groups?.options ?? "")) hasInlineThemeBlocks = true;
|
|
10691
|
+
else hasPlainThemeBlocks = true;
|
|
10692
|
+
}
|
|
10693
|
+
const inlineHeaders = [...source.matchAll(/@theme\s+inline\s*\{/gu)];
|
|
10694
|
+
const inlineBlocks = [...source.matchAll(/@theme\s+inline\s*\{(?<body>[^{}]*)\}/gu)];
|
|
10695
|
+
if (inlineHeaders.length !== inlineBlocks.length) inlineBlocksAreExternalFonts = false;
|
|
10696
|
+
for (const block of inlineBlocks) {
|
|
10697
|
+
const declarations = (block.groups?.body ?? "").split(";").map((part) => part.trim()).filter(Boolean);
|
|
10698
|
+
if (declarations.length === 0) inlineBlocksAreExternalFonts = false;
|
|
10699
|
+
for (const declaration of declarations) {
|
|
10700
|
+
const match = /^(?<token>--font-[a-z][\w-]*)\s*:\s*(?<value>.+)$/u.exec(declaration);
|
|
10701
|
+
const name = match?.groups?.token;
|
|
10702
|
+
const value = match?.groups?.value ?? "";
|
|
10703
|
+
const references = [...value.matchAll(/\bvar\s*\(\s*(?<name>--[\w-]+)/gu)].map(
|
|
10704
|
+
(reference) => reference.groups?.name
|
|
10705
|
+
);
|
|
10706
|
+
const runtime = references[0];
|
|
10707
|
+
if (!name || references.length !== 1 || !runtime?.startsWith("--font-") || runtime === name || names.has(runtime) || !hasVarFallback(value, runtime)) {
|
|
10708
|
+
inlineBlocksAreExternalFonts = false;
|
|
10709
|
+
}
|
|
10710
|
+
}
|
|
10711
|
+
}
|
|
10697
10712
|
for (const theme of source.matchAll(/@theme(?<options>(?:\s+[\w-]+)*)\s*\{(?<body>[^{}]*)\}/gu)) {
|
|
10698
10713
|
const inline = /\binline\b/u.test(theme.groups?.options ?? "");
|
|
10699
10714
|
for (const declaration of (theme.groups?.body ?? "").matchAll(
|
|
@@ -10732,7 +10747,11 @@ var rootVariablesRule = {
|
|
|
10732
10747
|
);
|
|
10733
10748
|
return {
|
|
10734
10749
|
"StyleSheet:exit"(node) {
|
|
10735
|
-
|
|
10750
|
+
const localThemes = atrulesNamed(node, "theme");
|
|
10751
|
+
if (hasPlainThemeBlocks && hasInlineThemeBlocks && !inlineBlocksAreExternalFonts && localThemes[0]) {
|
|
10752
|
+
context.report({ node: localThemes[0], message: MIXED_THEME_MESSAGE });
|
|
10753
|
+
}
|
|
10754
|
+
for (const theme of localThemes) {
|
|
10736
10755
|
const inline = preludeIdentifiers(theme).includes("inline");
|
|
10737
10756
|
const source = context.sourceCode.getText(theme).replace(/\/\*[\s\S]*?\*\//gu, (comment) => comment.replace(/[^\r\n]/gu, " "));
|
|
10738
10757
|
for (const match of source.matchAll(
|
|
@@ -10746,8 +10765,10 @@ var rootVariablesRule = {
|
|
|
10746
10765
|
for (const reference of unquoted.matchAll(/\bvar\(\s*(?<variable>--[\w-]+)/gu)) {
|
|
10747
10766
|
const runtime = reference.groups?.variable;
|
|
10748
10767
|
if (runtime && runtime !== name) {
|
|
10749
|
-
const externalFont = name.startsWith("--font-") && runtime.startsWith("--font-")
|
|
10750
|
-
if (
|
|
10768
|
+
const externalFont = name.startsWith("--font-") && runtime.startsWith("--font-");
|
|
10769
|
+
if (externalFont && !hasVarFallback(value, runtime)) {
|
|
10770
|
+
context.report({ node: theme, message: EXTERNAL_FONT_FALLBACK_MESSAGE(name, runtime) });
|
|
10771
|
+
} else if (!externalFont) {
|
|
10751
10772
|
context.report({
|
|
10752
10773
|
node: theme,
|
|
10753
10774
|
message: `Tailwind token "${name}" must reference its same-named CSS variable, not "${runtime}".`
|
|
@@ -10769,7 +10790,7 @@ var rootVariablesRule = {
|
|
|
10769
10790
|
context.report({ node: theme, message: REDUNDANT_INLINE_MESSAGE(name) });
|
|
10770
10791
|
}
|
|
10771
10792
|
}
|
|
10772
|
-
if (inline === referencesVariable) continue;
|
|
10793
|
+
if (inline === referencesVariable || !inline && isFixedThemeAlias(name, unquoted)) continue;
|
|
10773
10794
|
const offset = (theme.loc?.start.offset ?? 0) + match.index + match[0].indexOf(name);
|
|
10774
10795
|
const preceding = context.sourceCode.text.slice(0, offset);
|
|
10775
10796
|
const line = preceding.split("\n").length;
|
|
@@ -10828,7 +10849,14 @@ var rootVariablesRule = {
|
|
|
10828
10849
|
};
|
|
10829
10850
|
|
|
10830
10851
|
// eslint/rules/tailwind/stylesheet-ordering.ts
|
|
10852
|
+
import path73 from "path";
|
|
10831
10853
|
var SECTION_ORDER = ["imports", "custom-variant", "root", "theme", "utility", "base styles", "keyframes"];
|
|
10854
|
+
function scopesCustomProperties(node) {
|
|
10855
|
+
if (node.type === "Declaration") return node.property.startsWith("--");
|
|
10856
|
+
if (node.type === "Atrule" && !["media", "supports", "container"].includes(node.name)) return false;
|
|
10857
|
+
if (node.type !== "Atrule" && node.type !== "Rule") return false;
|
|
10858
|
+
return blockChildren2(node).some(scopesCustomProperties);
|
|
10859
|
+
}
|
|
10832
10860
|
var stylesheetOrderingRule = {
|
|
10833
10861
|
meta: {
|
|
10834
10862
|
schema: [],
|
|
@@ -10838,6 +10866,9 @@ var stylesheetOrderingRule = {
|
|
|
10838
10866
|
}
|
|
10839
10867
|
},
|
|
10840
10868
|
create(context) {
|
|
10869
|
+
const sourceRoot = sourceRootOf(context);
|
|
10870
|
+
const entryPoint = path73.normalize(path73.join(sourceRoot, "app", "styles", "globals.css"));
|
|
10871
|
+
if (path73.normalize(path73.resolve(context.filename)) !== entryPoint) return {};
|
|
10841
10872
|
return {
|
|
10842
10873
|
"StyleSheet:exit"(node) {
|
|
10843
10874
|
const sections = [];
|
|
@@ -10857,7 +10888,9 @@ var stylesheetOrderingRule = {
|
|
|
10857
10888
|
if (preludeIdentifiers(child).includes("base")) {
|
|
10858
10889
|
sections.push({ name: "base styles", at: index });
|
|
10859
10890
|
}
|
|
10860
|
-
} else if (child.type === "Rule" && selectorNames(child).includes("root")) {
|
|
10891
|
+
} else if (child.type === "Rule" && (selectorNames(child).includes("root") || scopesCustomProperties(child))) {
|
|
10892
|
+
sections.push({ name: "root", at: index });
|
|
10893
|
+
} else if (child.type === "Atrule" && scopesCustomProperties(child)) {
|
|
10861
10894
|
sections.push({ name: "root", at: index });
|
|
10862
10895
|
}
|
|
10863
10896
|
index += 1;
|
|
@@ -10902,7 +10935,7 @@ var stylesheetOrderingRule = {
|
|
|
10902
10935
|
|
|
10903
10936
|
// eslint/rules/tailwind/theme-reset.ts
|
|
10904
10937
|
import { existsSync as existsSync11 } from "fs";
|
|
10905
|
-
import
|
|
10938
|
+
import path74 from "path";
|
|
10906
10939
|
import { generate as generate4, parse as parse7, toPlainObject as toPlainObject2 } from "@eslint/css-tree";
|
|
10907
10940
|
function isThemeReset(node) {
|
|
10908
10941
|
if (!node) return false;
|
|
@@ -10930,8 +10963,8 @@ var themeResetRule = {
|
|
|
10930
10963
|
},
|
|
10931
10964
|
create(context) {
|
|
10932
10965
|
const sourceRoot = sourceRootOf(context);
|
|
10933
|
-
const current =
|
|
10934
|
-
const entryPoint =
|
|
10966
|
+
const current = path74.normalize(path74.resolve(context.filename));
|
|
10967
|
+
const entryPoint = path74.normalize(path74.join(sourceRoot, "app", "styles", "globals.css"));
|
|
10935
10968
|
if (current !== entryPoint) return {};
|
|
10936
10969
|
return {
|
|
10937
10970
|
"StyleSheet:exit"(node) {
|
|
@@ -10944,8 +10977,8 @@ var themeResetRule = {
|
|
|
10944
10977
|
if (!from) continue;
|
|
10945
10978
|
for (const specifier of importedSpecifiers(from.source)) {
|
|
10946
10979
|
const target = resolveSpecifier2(from.file, specifier, sourceRoot);
|
|
10947
|
-
if (!target ||
|
|
10948
|
-
const filename =
|
|
10980
|
+
if (!target || path74.extname(target) !== ".css") continue;
|
|
10981
|
+
const filename = path74.normalize(target);
|
|
10949
10982
|
if (seen.has(filename) || !existsSync11(filename)) continue;
|
|
10950
10983
|
seen.add(filename);
|
|
10951
10984
|
const source = textOf(filename);
|
|
@@ -10964,7 +10997,7 @@ var themeResetRule = {
|
|
|
10964
10997
|
};
|
|
10965
10998
|
|
|
10966
10999
|
// eslint/rules/tailwind/unique-css-definition.ts
|
|
10967
|
-
import
|
|
11000
|
+
import path75 from "path";
|
|
10968
11001
|
function ownershipKey(symbol) {
|
|
10969
11002
|
if (symbol.kind === "selector") return void 0;
|
|
10970
11003
|
if (symbol.kind === "root-variable" && symbol.scope !== "default") return void 0;
|
|
@@ -10996,7 +11029,7 @@ var uniqueCssDefinitionRule = {
|
|
|
10996
11029
|
},
|
|
10997
11030
|
create(context) {
|
|
10998
11031
|
const sourceRoot = sourceRootOf(context);
|
|
10999
|
-
const current =
|
|
11032
|
+
const current = path75.normalize(path75.resolve(context.filename));
|
|
11000
11033
|
const cssFiles = findFiles(sourceRoot, CSS_EXTENSIONS);
|
|
11001
11034
|
if (cssFiles.length === 0) return {};
|
|
11002
11035
|
const textOf = cachedTextReader();
|
|
@@ -11004,7 +11037,7 @@ var uniqueCssDefinitionRule = {
|
|
|
11004
11037
|
sourceRoot,
|
|
11005
11038
|
css: cssFiles.map((file) => ({
|
|
11006
11039
|
path: file,
|
|
11007
|
-
content:
|
|
11040
|
+
content: path75.normalize(file) === current ? context.sourceCode.text : textOf(file)
|
|
11008
11041
|
})),
|
|
11009
11042
|
modules: [],
|
|
11010
11043
|
includeReferences: false
|
|
@@ -11026,7 +11059,7 @@ var uniqueCssDefinitionRule = {
|
|
|
11026
11059
|
if (!canonical) continue;
|
|
11027
11060
|
for (const symbol of definitions.slice(1)) {
|
|
11028
11061
|
if (symbol.file !== current) continue;
|
|
11029
|
-
const message = symbol.file === canonical.file ? `${symbolLabel(symbol)} "${symbol.name}" is defined more than once in this CSS file; define it only once.` : `${symbolLabel(symbol)} "${symbol.name}" is also defined in ${
|
|
11062
|
+
const message = symbol.file === canonical.file ? `${symbolLabel(symbol)} "${symbol.name}" is defined more than once in this CSS file; define it only once.` : `${symbolLabel(symbol)} "${symbol.name}" is also defined in ${path75.relative(sourceRoot, canonical.file)}; define it in only one CSS file.`;
|
|
11030
11063
|
context.report({
|
|
11031
11064
|
node,
|
|
11032
11065
|
loc: {
|
|
@@ -11043,7 +11076,7 @@ var uniqueCssDefinitionRule = {
|
|
|
11043
11076
|
};
|
|
11044
11077
|
|
|
11045
11078
|
// eslint/rules/tailwind/unique-css-token-value.ts
|
|
11046
|
-
import
|
|
11079
|
+
import path76 from "path";
|
|
11047
11080
|
function valueIdentity(value) {
|
|
11048
11081
|
const text = value.trim();
|
|
11049
11082
|
const hex = /^#(?<digits>[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu.exec(text)?.groups?.digits;
|
|
@@ -11071,14 +11104,14 @@ var uniqueCssTokenValueRule = {
|
|
|
11071
11104
|
},
|
|
11072
11105
|
create(context) {
|
|
11073
11106
|
const sourceRoot = sourceRootOf(context);
|
|
11074
|
-
const current =
|
|
11107
|
+
const current = path76.normalize(path76.resolve(context.filename));
|
|
11075
11108
|
const textOf = cachedTextReader();
|
|
11076
11109
|
const cssFiles = findFiles(sourceRoot, CSS_EXTENSIONS);
|
|
11077
11110
|
const graph = buildCssDependencyGraph({
|
|
11078
11111
|
sourceRoot,
|
|
11079
11112
|
css: cssFiles.map((file) => ({
|
|
11080
11113
|
path: file,
|
|
11081
|
-
content:
|
|
11114
|
+
content: path76.normalize(file) === current ? context.sourceCode.text : textOf(file)
|
|
11082
11115
|
})),
|
|
11083
11116
|
modules: [],
|
|
11084
11117
|
includeReferences: false
|
|
@@ -11110,7 +11143,7 @@ var uniqueCssTokenValueRule = {
|
|
|
11110
11143
|
start: { line: definition.line, column: 1 },
|
|
11111
11144
|
end: { line: definition.line, column: 2 }
|
|
11112
11145
|
},
|
|
11113
|
-
message: `Token "${definition.name}" duplicates the value of "${original.name}" in ${
|
|
11146
|
+
message: `Token "${definition.name}" duplicates the value of "${original.name}" in ${path76.relative(
|
|
11114
11147
|
sourceRoot,
|
|
11115
11148
|
original.file
|
|
11116
11149
|
)}:${String(original.line)}; reuse one design token.`
|
|
@@ -11123,7 +11156,7 @@ var uniqueCssTokenValueRule = {
|
|
|
11123
11156
|
|
|
11124
11157
|
// eslint/rules/tailwind/unused-utility.ts
|
|
11125
11158
|
import { statSync as statSync5 } from "fs";
|
|
11126
|
-
import
|
|
11159
|
+
import path77 from "path";
|
|
11127
11160
|
var unusedUtilityRule = {
|
|
11128
11161
|
meta: {
|
|
11129
11162
|
schema: [],
|
|
@@ -11139,7 +11172,7 @@ var unusedUtilityRule = {
|
|
|
11139
11172
|
} catch {
|
|
11140
11173
|
return {};
|
|
11141
11174
|
}
|
|
11142
|
-
const current =
|
|
11175
|
+
const current = path77.normalize(path77.resolve(context.filename));
|
|
11143
11176
|
const textOf = cachedTextReader();
|
|
11144
11177
|
const cssFiles = findFiles(sourceRoot, CSS_EXTENSIONS);
|
|
11145
11178
|
const moduleFiles = findFiles(sourceRoot, MODULE_EXTENSIONS4);
|
|
@@ -11147,7 +11180,7 @@ var unusedUtilityRule = {
|
|
|
11147
11180
|
sourceRoot,
|
|
11148
11181
|
css: cssFiles.map((file) => ({
|
|
11149
11182
|
path: file,
|
|
11150
|
-
content:
|
|
11183
|
+
content: path77.normalize(file) === current ? context.sourceCode.text : textOf(file)
|
|
11151
11184
|
})),
|
|
11152
11185
|
modules: moduleFiles.map((file) => ({ path: file, content: textOf(file) }))
|
|
11153
11186
|
});
|
|
@@ -11168,7 +11201,7 @@ var unusedUtilityRule = {
|
|
|
11168
11201
|
};
|
|
11169
11202
|
|
|
11170
11203
|
// eslint/rules/tailwind/utility-mapping.ts
|
|
11171
|
-
import
|
|
11204
|
+
import path78 from "path";
|
|
11172
11205
|
function applyOperationCount(utility) {
|
|
11173
11206
|
let count = 0;
|
|
11174
11207
|
for (const apply of atrulesNamed(utility, "apply")) {
|
|
@@ -11294,6 +11327,26 @@ function canonicalToken(name) {
|
|
|
11294
11327
|
function isTypographySize(name) {
|
|
11295
11328
|
return /^--text-(?!.*--)(?:[a-z0-9]+-)*[a-z0-9]+$/u.test(name);
|
|
11296
11329
|
}
|
|
11330
|
+
function suggestedThemeToken(candidate) {
|
|
11331
|
+
if (candidate.namespace !== "color") return candidate.token;
|
|
11332
|
+
let role = "edge";
|
|
11333
|
+
if (["bg", "fill"].includes(candidate.prefix)) {
|
|
11334
|
+
role = "canvas";
|
|
11335
|
+
} else if (["text", "caret", "decoration"].includes(candidate.prefix)) {
|
|
11336
|
+
role = "ink";
|
|
11337
|
+
}
|
|
11338
|
+
const semantic = /^--color-(?<domain>[a-z][a-z0-9-]*)-(?:canvas|ink|edge)$/u.exec(candidate.token);
|
|
11339
|
+
const domain = semantic?.groups?.domain;
|
|
11340
|
+
return domain ? `--color-${domain}-${role}` : `${candidate.token}-${role}`;
|
|
11341
|
+
}
|
|
11342
|
+
function themeMigrationGuidance(candidate, utilityName) {
|
|
11343
|
+
const token = suggestedThemeToken(candidate);
|
|
11344
|
+
const generatedClass = `${candidate.prefix}-${token.slice(`--${candidate.namespace}-`.length)}`;
|
|
11345
|
+
const runtimeDependent = /\bvar\s*\(/iu.test(candidate.value);
|
|
11346
|
+
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. `;
|
|
11347
|
+
const classGuidance = generatedClass === utilityName ? "Preserve the generated class name" : `Update class usages to "${generatedClass}"`;
|
|
11348
|
+
return `${action}${classGuidance} and compare compiled CSS before removing the utility.`;
|
|
11349
|
+
}
|
|
11297
11350
|
var utilityMappingRule = {
|
|
11298
11351
|
meta: {
|
|
11299
11352
|
schema: [],
|
|
@@ -11304,13 +11357,13 @@ var utilityMappingRule = {
|
|
|
11304
11357
|
},
|
|
11305
11358
|
create(context) {
|
|
11306
11359
|
const sourceRoot = sourceRootOf(context);
|
|
11307
|
-
const current =
|
|
11360
|
+
const current = path78.normalize(path78.resolve(context.filename));
|
|
11308
11361
|
const textOf = cachedTextReader();
|
|
11309
11362
|
const graph = buildCssDependencyGraph({
|
|
11310
11363
|
sourceRoot,
|
|
11311
11364
|
css: findFiles(sourceRoot, CSS_EXTENSIONS).map((file) => ({
|
|
11312
11365
|
path: file,
|
|
11313
|
-
content:
|
|
11366
|
+
content: path78.normalize(file) === current ? context.sourceCode.text : textOf(file)
|
|
11314
11367
|
})),
|
|
11315
11368
|
modules: [],
|
|
11316
11369
|
includeReferences: false
|
|
@@ -11503,7 +11556,7 @@ var utilityMappingRule = {
|
|
|
11503
11556
|
if (candidate.property === "font-size" && themeTokens.has(`--color-${name.slice(5)}`)) continue;
|
|
11504
11557
|
context.report({
|
|
11505
11558
|
node: utility,
|
|
11506
|
-
message: `Custom utility "${name}" only maps ${candidate.property} (${candidate.value});
|
|
11559
|
+
message: `Custom utility "${name}" only maps ${candidate.property} (${candidate.value}); ${themeMigrationGuidance(candidate, name)}`
|
|
11507
11560
|
});
|
|
11508
11561
|
}
|
|
11509
11562
|
function checkClass(cssNode) {
|
|
@@ -11563,7 +11616,7 @@ var utilityMappingRule = {
|
|
|
11563
11616
|
import { spawnSync } from "child_process";
|
|
11564
11617
|
import { createHash } from "crypto";
|
|
11565
11618
|
import { existsSync as existsSync12 } from "fs";
|
|
11566
|
-
import
|
|
11619
|
+
import path79 from "path";
|
|
11567
11620
|
import { generate as generate5, parse as parse8, toPlainObject as toPlainObject3 } from "@eslint/css-tree";
|
|
11568
11621
|
function numericPart(value) {
|
|
11569
11622
|
const match = /^(?<negative>-?)(?<number>(?:\d+(?:\.\d+)?|\.\d+))(?<unit>%|px|rem|em|vw|vh|dvw|dvh|ch|fr|s|ms|deg|turn)?$/u.exec(
|
|
@@ -11713,8 +11766,8 @@ var utilityNameParityRule = {
|
|
|
11713
11766
|
return apply ? [{ utility, name, apply }] : [];
|
|
11714
11767
|
});
|
|
11715
11768
|
if (candidates.length === 0) return;
|
|
11716
|
-
const physicalDir =
|
|
11717
|
-
const cwd =
|
|
11769
|
+
const physicalDir = path79.dirname(context.physicalFilename);
|
|
11770
|
+
const cwd = path79.isAbsolute(physicalDir) && existsSync12(physicalDir) ? physicalDir : context.cwd;
|
|
11718
11771
|
const compiled = compileApplies(
|
|
11719
11772
|
candidates.map((candidate) => candidate.apply),
|
|
11720
11773
|
cwd
|
|
@@ -11758,12 +11811,11 @@ var tailwindRules = {
|
|
|
11758
11811
|
"unused-utility": unusedUtilityRule,
|
|
11759
11812
|
"unique-css-definition": uniqueCssDefinitionRule,
|
|
11760
11813
|
"unique-css-token-value": uniqueCssTokenValueRule,
|
|
11761
|
-
"no-utility-alias": noUtilityAliasRule
|
|
11762
|
-
"global-selector-styling": globalSelectorStylingRule
|
|
11814
|
+
"no-utility-alias": noUtilityAliasRule
|
|
11763
11815
|
};
|
|
11764
11816
|
|
|
11765
11817
|
// eslint/rules/type-extraction.ts
|
|
11766
|
-
import
|
|
11818
|
+
import path80 from "path";
|
|
11767
11819
|
var typeExtractionRule = {
|
|
11768
11820
|
meta: {
|
|
11769
11821
|
schema: [],
|
|
@@ -11774,7 +11826,7 @@ var typeExtractionRule = {
|
|
|
11774
11826
|
},
|
|
11775
11827
|
create(context) {
|
|
11776
11828
|
const sourceRoot = sourceRootOf(context);
|
|
11777
|
-
const file =
|
|
11829
|
+
const file = path80.resolve(context.filename);
|
|
11778
11830
|
const segments = segmentsOf(file, sourceRoot);
|
|
11779
11831
|
if (segments.length === 0) return {};
|
|
11780
11832
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -11915,7 +11967,7 @@ var uiStateRule = {
|
|
|
11915
11967
|
// eslint/rules/unknown-utility.ts
|
|
11916
11968
|
import { existsSync as existsSync13, readdirSync as readdirSync6, readFileSync as readFileSync15, statSync as statSync6 } from "fs";
|
|
11917
11969
|
import { createRequire } from "module";
|
|
11918
|
-
import
|
|
11970
|
+
import path81 from "path";
|
|
11919
11971
|
var PREFIX_NAMESPACES = {
|
|
11920
11972
|
bg: ["color", "background-image"],
|
|
11921
11973
|
text: ["color", "text"],
|
|
@@ -12196,7 +12248,7 @@ function stylesheetFiles(dir) {
|
|
|
12196
12248
|
}
|
|
12197
12249
|
return entries.flatMap((entry) => {
|
|
12198
12250
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
12199
|
-
const entryPath =
|
|
12251
|
+
const entryPath = path81.join(dir, entry);
|
|
12200
12252
|
let stats;
|
|
12201
12253
|
try {
|
|
12202
12254
|
stats = statSync6(entryPath);
|
|
@@ -12204,7 +12256,7 @@ function stylesheetFiles(dir) {
|
|
|
12204
12256
|
return [];
|
|
12205
12257
|
}
|
|
12206
12258
|
if (stats.isDirectory()) return stylesheetFiles(entryPath);
|
|
12207
|
-
return
|
|
12259
|
+
return path81.extname(entry) === ".css" ? [entryPath] : [];
|
|
12208
12260
|
});
|
|
12209
12261
|
}
|
|
12210
12262
|
function packageNameOf(specifier) {
|
|
@@ -12215,10 +12267,10 @@ function packageNameOf(specifier) {
|
|
|
12215
12267
|
function resolvePackageStylesheet(fromFile, specifier) {
|
|
12216
12268
|
const packageName = packageNameOf(specifier);
|
|
12217
12269
|
if (!packageName || packageName === "tailwindcss") return void 0;
|
|
12218
|
-
let directory =
|
|
12219
|
-
while (directory !==
|
|
12220
|
-
const packageRoot =
|
|
12221
|
-
const manifestPath =
|
|
12270
|
+
let directory = path81.dirname(fromFile);
|
|
12271
|
+
while (directory !== path81.dirname(directory)) {
|
|
12272
|
+
const packageRoot = path81.join(directory, "node_modules", packageName);
|
|
12273
|
+
const manifestPath = path81.join(packageRoot, "package.json");
|
|
12222
12274
|
if (existsSync13(manifestPath)) {
|
|
12223
12275
|
try {
|
|
12224
12276
|
const manifest = readFileSync15(manifestPath, "utf8");
|
|
@@ -12226,13 +12278,13 @@ function resolvePackageStylesheet(fromFile, specifier) {
|
|
|
12226
12278
|
const main = /"main"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
12227
12279
|
const target = stylesheet ?? main;
|
|
12228
12280
|
if (!target) return void 0;
|
|
12229
|
-
const resolved =
|
|
12281
|
+
const resolved = path81.resolve(packageRoot, target);
|
|
12230
12282
|
return existsSync13(resolved) ? resolved : void 0;
|
|
12231
12283
|
} catch {
|
|
12232
12284
|
return void 0;
|
|
12233
12285
|
}
|
|
12234
12286
|
}
|
|
12235
|
-
directory =
|
|
12287
|
+
directory = path81.dirname(directory);
|
|
12236
12288
|
}
|
|
12237
12289
|
return void 0;
|
|
12238
12290
|
}
|
|
@@ -12492,7 +12544,7 @@ var unknownUtilityRule = {
|
|
|
12492
12544
|
};
|
|
12493
12545
|
|
|
12494
12546
|
// eslint/rules/util-file-name.ts
|
|
12495
|
-
import
|
|
12547
|
+
import path82 from "path";
|
|
12496
12548
|
function toKebabCase2(value) {
|
|
12497
12549
|
return value.replace(/(?<lower>[a-z0-9])(?<upper>[A-Z])/g, "$<lower>-$<upper>").replace(/(?<first>[A-Z])(?<rest>[A-Z][a-z])/g, "$<first>-$<rest>").toLowerCase();
|
|
12498
12550
|
}
|
|
@@ -12505,7 +12557,7 @@ var utilFileNameRule = {
|
|
|
12505
12557
|
}
|
|
12506
12558
|
},
|
|
12507
12559
|
create(context) {
|
|
12508
|
-
const filename =
|
|
12560
|
+
const filename = path82.resolve(context.filename);
|
|
12509
12561
|
const segments = filename.replace(/\\/g, "/").split("/");
|
|
12510
12562
|
if (!segments.includes("utils")) return {};
|
|
12511
12563
|
let module;
|
|
@@ -12519,13 +12571,13 @@ var utilFileNameRule = {
|
|
|
12519
12571
|
const functionName = functions[0]?.name;
|
|
12520
12572
|
if (!functionName) return {};
|
|
12521
12573
|
const expected = toKebabCase2(functionName);
|
|
12522
|
-
const actual =
|
|
12574
|
+
const actual = path82.basename(filename, path82.extname(filename));
|
|
12523
12575
|
if (!expected || actual === expected) return {};
|
|
12524
12576
|
return {
|
|
12525
12577
|
Program(node) {
|
|
12526
12578
|
context.report({
|
|
12527
12579
|
node,
|
|
12528
|
-
message: `A utility file exporting ${functionName} must be named ${expected}.${
|
|
12580
|
+
message: `A utility file exporting ${functionName} must be named ${expected}.${path82.extname(filename).slice(1)}.`
|
|
12529
12581
|
});
|
|
12530
12582
|
}
|
|
12531
12583
|
};
|
|
@@ -12533,7 +12585,7 @@ var utilFileNameRule = {
|
|
|
12533
12585
|
};
|
|
12534
12586
|
|
|
12535
12587
|
// eslint/rules/value-extraction.ts
|
|
12536
|
-
import
|
|
12588
|
+
import path83 from "path";
|
|
12537
12589
|
var valueExtractionRule = {
|
|
12538
12590
|
meta: {
|
|
12539
12591
|
schema: [],
|
|
@@ -12544,7 +12596,7 @@ var valueExtractionRule = {
|
|
|
12544
12596
|
},
|
|
12545
12597
|
create(context) {
|
|
12546
12598
|
const sourceRoot = sourceRootOf(context);
|
|
12547
|
-
const file =
|
|
12599
|
+
const file = path83.resolve(context.filename);
|
|
12548
12600
|
const segments = segmentsOf(file, sourceRoot);
|
|
12549
12601
|
if (segments.length === 0 || segments[0] !== "app") return {};
|
|
12550
12602
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -12566,7 +12618,7 @@ var valueExtractionRule = {
|
|
|
12566
12618
|
|
|
12567
12619
|
// eslint/rules/vulyk/tracked-docs.ts
|
|
12568
12620
|
import { existsSync as existsSync14, readFileSync as readFileSync16 } from "fs";
|
|
12569
|
-
import
|
|
12621
|
+
import path84 from "path";
|
|
12570
12622
|
var PASIKA_REPO = "Bredansky/pasika";
|
|
12571
12623
|
var BASE_REQUIRED_TRACKED_DOCS = [
|
|
12572
12624
|
{ name: "documentation-guide", path: "docs/documentation-guide" },
|
|
@@ -12599,8 +12651,8 @@ var trackedDocsRule = {
|
|
|
12599
12651
|
if (!context.filename.endsWith("package.json")) return;
|
|
12600
12652
|
const root = node.body;
|
|
12601
12653
|
if (root.type !== "Object") return;
|
|
12602
|
-
const projectRoot =
|
|
12603
|
-
const configPath =
|
|
12654
|
+
const projectRoot = path84.dirname(path84.resolve(context.filename));
|
|
12655
|
+
const configPath = path84.join(projectRoot, "vulyk.config.ts");
|
|
12604
12656
|
if (!existsSync14(configPath)) {
|
|
12605
12657
|
context.report({
|
|
12606
12658
|
node,
|
|
@@ -12625,7 +12677,7 @@ var trackedDocsRule = {
|
|
|
12625
12677
|
});
|
|
12626
12678
|
}
|
|
12627
12679
|
}
|
|
12628
|
-
const agentsPath =
|
|
12680
|
+
const agentsPath = path84.join(projectRoot, "AGENTS.md");
|
|
12629
12681
|
if (!existsSync14(agentsPath)) {
|
|
12630
12682
|
context.report({
|
|
12631
12683
|
node,
|
|
@@ -12725,7 +12777,7 @@ var withResponseHelperRule = {
|
|
|
12725
12777
|
|
|
12726
12778
|
// eslint/rules/zirka-baseline.ts
|
|
12727
12779
|
import fs7 from "fs";
|
|
12728
|
-
import
|
|
12780
|
+
import path85 from "path";
|
|
12729
12781
|
var ESLINT_CONFIG = /^eslint\.config\.(?:ts|mts|cts|js|mjs|cjs)$/;
|
|
12730
12782
|
var PRETTIER_CONFIGS = [
|
|
12731
12783
|
"prettier.config.mjs",
|
|
@@ -12744,10 +12796,10 @@ var zirkaBaselineRule = {
|
|
|
12744
12796
|
}
|
|
12745
12797
|
},
|
|
12746
12798
|
create(context) {
|
|
12747
|
-
const filename =
|
|
12748
|
-
const basename =
|
|
12799
|
+
const filename = path85.resolve(context.filename);
|
|
12800
|
+
const basename = path85.basename(filename);
|
|
12749
12801
|
if (!ESLINT_CONFIG.test(basename)) return {};
|
|
12750
|
-
const projectRoot =
|
|
12802
|
+
const projectRoot = path85.dirname(filename);
|
|
12751
12803
|
const report3 = (message) => {
|
|
12752
12804
|
context.report({
|
|
12753
12805
|
node: context.sourceCode.ast,
|
|
@@ -12762,7 +12814,7 @@ var zirkaBaselineRule = {
|
|
|
12762
12814
|
'ESLint config must take its configuration from zirka (import { styleguide } from "zirka") instead of restating rules locally.'
|
|
12763
12815
|
);
|
|
12764
12816
|
}
|
|
12765
|
-
const tsconfigPath =
|
|
12817
|
+
const tsconfigPath = path85.join(projectRoot, "tsconfig.json");
|
|
12766
12818
|
if (!fs7.existsSync(tsconfigPath)) {
|
|
12767
12819
|
report3('No tsconfig.json found. Create one extending the zirka TypeScript base config ("zirka/typescript").');
|
|
12768
12820
|
} else {
|
|
@@ -12780,13 +12832,13 @@ var zirkaBaselineRule = {
|
|
|
12780
12832
|
report3('tsconfig.json must extend the zirka TypeScript base config ("zirka/typescript").');
|
|
12781
12833
|
}
|
|
12782
12834
|
}
|
|
12783
|
-
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(
|
|
12835
|
+
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(path85.join(projectRoot, name)));
|
|
12784
12836
|
if (!prettierConfigFile) {
|
|
12785
12837
|
report3(
|
|
12786
12838
|
"No prettier config found. Create one that takes its configuration from zirka (styleguide({ prettier: true }).prettierConfig)."
|
|
12787
12839
|
);
|
|
12788
12840
|
} else {
|
|
12789
|
-
const content = fs7.readFileSync(
|
|
12841
|
+
const content = fs7.readFileSync(path85.join(projectRoot, prettierConfigFile), "utf8");
|
|
12790
12842
|
if (!content.includes("zirka")) {
|
|
12791
12843
|
report3(
|
|
12792
12844
|
"The prettier config must take its configuration from zirka (styleguide({ prettier: true }).prettierConfig) instead of restating it locally."
|