pasika 0.10.140 → 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.d.ts +2 -0
- package/dist/eslint/pasika/index.js +208 -47
- package/package.json +1 -1
|
@@ -122,6 +122,7 @@ declare const nextjsPackageJsonRules: {
|
|
|
122
122
|
declare const tailwindRules: {
|
|
123
123
|
"at-rule-spacing": _eslint_css.CSSRuleDefinition;
|
|
124
124
|
"theme-reset": _eslint_css.CSSRuleDefinition;
|
|
125
|
+
"theme-token-order": _eslint_css.CSSRuleDefinition;
|
|
125
126
|
"theme-mode": _eslint_css.CSSRuleDefinition;
|
|
126
127
|
"color-role-usage": _eslint_css.CSSRuleDefinition;
|
|
127
128
|
"color-literal-usage": _eslint_css.CSSRuleDefinition;
|
|
@@ -165,6 +166,7 @@ declare const pasikaPlugin: {
|
|
|
165
166
|
"vitest-coverage": _eslint_json.JSONRuleDefinition;
|
|
166
167
|
"at-rule-spacing": _eslint_css.CSSRuleDefinition;
|
|
167
168
|
"theme-reset": _eslint_css.CSSRuleDefinition;
|
|
169
|
+
"theme-token-order": _eslint_css.CSSRuleDefinition;
|
|
168
170
|
"theme-mode": _eslint_css.CSSRuleDefinition;
|
|
169
171
|
"color-role-usage": _eslint_css.CSSRuleDefinition;
|
|
170
172
|
"color-literal-usage": _eslint_css.CSSRuleDefinition;
|
|
@@ -4704,10 +4704,19 @@ var localeKeyShapeRule = {
|
|
|
4704
4704
|
const dictionary = dictionaryName(context.filename) ?? "";
|
|
4705
4705
|
if (!dictionary) return {};
|
|
4706
4706
|
function visitObject(node) {
|
|
4707
|
+
let previousKey;
|
|
4707
4708
|
for (const property of node.properties) {
|
|
4708
4709
|
if (property.type !== "Property") continue;
|
|
4709
4710
|
const name = keyName(property.key);
|
|
4710
4711
|
if (name === void 0) continue;
|
|
4712
|
+
if (previousKey && name.toLowerCase() < previousKey.toLowerCase()) {
|
|
4713
|
+
reportFor(
|
|
4714
|
+
context,
|
|
4715
|
+
property,
|
|
4716
|
+
`Locale dictionary keys must be alphabetical: "${name}" belongs before "${previousKey}". See docs/next-codebase-guide/rules/locales-rule.md`
|
|
4717
|
+
);
|
|
4718
|
+
}
|
|
4719
|
+
previousKey = name;
|
|
4711
4720
|
const nested = localeObject(property.value);
|
|
4712
4721
|
if (nested) {
|
|
4713
4722
|
reportFor(
|
|
@@ -11486,8 +11495,138 @@ var themeResetRule = {
|
|
|
11486
11495
|
}
|
|
11487
11496
|
};
|
|
11488
11497
|
|
|
11489
|
-
// eslint/rules/tailwind/
|
|
11498
|
+
// eslint/rules/tailwind/theme-token-order.ts
|
|
11490
11499
|
import path77 from "path";
|
|
11500
|
+
var THEME_GROUPS = [
|
|
11501
|
+
"Color primitives",
|
|
11502
|
+
"Semantic colors",
|
|
11503
|
+
"Fixed and brand colors",
|
|
11504
|
+
"Font families",
|
|
11505
|
+
"Typography",
|
|
11506
|
+
"Spacing and sizing",
|
|
11507
|
+
"Breakpoints, containers, and aspect ratios",
|
|
11508
|
+
"Border radii",
|
|
11509
|
+
"Shadows and visual effects",
|
|
11510
|
+
"Background images",
|
|
11511
|
+
"Transitions and easing",
|
|
11512
|
+
"Animations",
|
|
11513
|
+
"Blur",
|
|
11514
|
+
"Other tokens"
|
|
11515
|
+
];
|
|
11516
|
+
var primitiveColors = /* @__PURE__ */ new Set([
|
|
11517
|
+
"--accent",
|
|
11518
|
+
"--base-canvas",
|
|
11519
|
+
"--base-edge",
|
|
11520
|
+
"--base-ink",
|
|
11521
|
+
"--card",
|
|
11522
|
+
"--destructive",
|
|
11523
|
+
"--magenta",
|
|
11524
|
+
"--muted",
|
|
11525
|
+
"--muted-ink",
|
|
11526
|
+
"--primary",
|
|
11527
|
+
"--rainbow-ink",
|
|
11528
|
+
"--retro-edge",
|
|
11529
|
+
"--retro-shadow",
|
|
11530
|
+
"--secondary",
|
|
11531
|
+
"--violet"
|
|
11532
|
+
]);
|
|
11533
|
+
function themeGroupName(name, value) {
|
|
11534
|
+
if (primitiveColors.has(name)) return "Color primitives";
|
|
11535
|
+
if (name.startsWith("--color-")) {
|
|
11536
|
+
return value.includes("var(") ? "Semantic colors" : "Fixed and brand colors";
|
|
11537
|
+
}
|
|
11538
|
+
if (name.startsWith("--font-") && !name.startsWith("--font-weight-")) return "Font families";
|
|
11539
|
+
if (/^--(?:font-weight|text-|tracking-|leading-)/u.test(name)) return "Typography";
|
|
11540
|
+
if (name.startsWith("--spacing")) return "Spacing and sizing";
|
|
11541
|
+
if (/^--(?:breakpoint|container|aspect)-/u.test(name)) return "Breakpoints, containers, and aspect ratios";
|
|
11542
|
+
if (name.startsWith("--radius")) return "Border radii";
|
|
11543
|
+
if (/^--(?:shadow|inset-shadow|drop-shadow|text-shadow)-/u.test(name)) return "Shadows and visual effects";
|
|
11544
|
+
if (name.startsWith("--background-image-")) return "Background images";
|
|
11545
|
+
if (/^--(?:default-transition|transition|ease)-/u.test(name)) return "Transitions and easing";
|
|
11546
|
+
if (name.startsWith("--animate-")) return "Animations";
|
|
11547
|
+
if (name.startsWith("--blur-")) return "Blur";
|
|
11548
|
+
return "Other tokens";
|
|
11549
|
+
}
|
|
11550
|
+
var themeTokenOrderRule = {
|
|
11551
|
+
meta: {
|
|
11552
|
+
schema: [],
|
|
11553
|
+
type: "problem",
|
|
11554
|
+
docs: {
|
|
11555
|
+
description: "Require global Tailwind theme tokens to follow purpose groups and alphabetical order."
|
|
11556
|
+
}
|
|
11557
|
+
},
|
|
11558
|
+
create(context) {
|
|
11559
|
+
const root = sourceRootOf(context);
|
|
11560
|
+
const entry = path77.normalize(path77.join(root, "app", "styles", "globals.css"));
|
|
11561
|
+
if (path77.normalize(path77.resolve(context.filename)) !== entry) return {};
|
|
11562
|
+
return {
|
|
11563
|
+
"StyleSheet:exit"(sheet) {
|
|
11564
|
+
const theme = [...sheet.children].find(
|
|
11565
|
+
(child) => child.type === "Atrule" && child.name === "theme" && child.loc
|
|
11566
|
+
);
|
|
11567
|
+
if (!theme?.loc) return;
|
|
11568
|
+
const raw = context.sourceCode.text.slice(theme.loc.start.offset, theme.loc.end.offset);
|
|
11569
|
+
const opening = raw.indexOf("{");
|
|
11570
|
+
const closing = raw.lastIndexOf("}");
|
|
11571
|
+
if (opening === -1 || closing <= opening) return;
|
|
11572
|
+
const lines = raw.slice(opening + 1, closing).split(/\r?\n/u);
|
|
11573
|
+
const firstLine = theme.loc.start.line + (raw.slice(0, opening + 1).match(/\n/gu)?.length ?? 0);
|
|
11574
|
+
const tokens = [];
|
|
11575
|
+
let activeHeading;
|
|
11576
|
+
let hasGroupHeadings = false;
|
|
11577
|
+
for (const [index, line] of lines.entries()) {
|
|
11578
|
+
const heading = /^\s*\/\*\s*(?<heading>.*?)\s*\*\/\s*$/u.exec(line)?.groups?.heading;
|
|
11579
|
+
if (heading && THEME_GROUPS.includes(heading)) {
|
|
11580
|
+
activeHeading = heading;
|
|
11581
|
+
hasGroupHeadings = true;
|
|
11582
|
+
}
|
|
11583
|
+
const declaration = /^ {2}(?<name>--[a-z][a-z0-9-]*)\s*:\s*(?<value>.*)$/u.exec(line);
|
|
11584
|
+
const { name, value } = declaration?.groups ?? {};
|
|
11585
|
+
if (!name || value === void 0) continue;
|
|
11586
|
+
tokens.push({
|
|
11587
|
+
name,
|
|
11588
|
+
group: themeGroupName(name, value),
|
|
11589
|
+
activeHeading,
|
|
11590
|
+
line: firstLine + index
|
|
11591
|
+
});
|
|
11592
|
+
}
|
|
11593
|
+
if (tokens.length > 1 && !hasGroupHeadings) {
|
|
11594
|
+
context.report({
|
|
11595
|
+
node: sheet,
|
|
11596
|
+
message: "Global theme tokens must use named purpose-group section comments."
|
|
11597
|
+
});
|
|
11598
|
+
}
|
|
11599
|
+
let previous;
|
|
11600
|
+
for (const token of tokens) {
|
|
11601
|
+
let message;
|
|
11602
|
+
const groupIndex = THEME_GROUPS.indexOf(token.group);
|
|
11603
|
+
const previousIndex = previous ? THEME_GROUPS.indexOf(previous.group) : -1;
|
|
11604
|
+
if (previous && groupIndex < previousIndex) {
|
|
11605
|
+
message = `Theme token "${token.name}" belongs to "${token.group}", which must appear before "${previous.group}".`;
|
|
11606
|
+
} else if (previous && groupIndex === previousIndex && token.name.toLowerCase() < previous.name.toLowerCase()) {
|
|
11607
|
+
message = `Theme tokens in "${token.group}" must be alphabetical: "${token.name}" goes before "${previous.name}".`;
|
|
11608
|
+
} else if (hasGroupHeadings && token.activeHeading !== token.group) {
|
|
11609
|
+
message = `Theme token "${token.name}" belongs under the "${token.group}" section comment.`;
|
|
11610
|
+
}
|
|
11611
|
+
if (message) {
|
|
11612
|
+
context.report({
|
|
11613
|
+
node: sheet,
|
|
11614
|
+
loc: {
|
|
11615
|
+
start: { line: token.line, column: 1 },
|
|
11616
|
+
end: { line: token.line, column: 2 }
|
|
11617
|
+
},
|
|
11618
|
+
message
|
|
11619
|
+
});
|
|
11620
|
+
}
|
|
11621
|
+
previous = token;
|
|
11622
|
+
}
|
|
11623
|
+
}
|
|
11624
|
+
};
|
|
11625
|
+
}
|
|
11626
|
+
};
|
|
11627
|
+
|
|
11628
|
+
// eslint/rules/tailwind/unique-css-definition.ts
|
|
11629
|
+
import path78 from "path";
|
|
11491
11630
|
function ownershipKey(symbol) {
|
|
11492
11631
|
if (symbol.kind === "selector") return void 0;
|
|
11493
11632
|
if (symbol.kind === "root-variable" && symbol.scope !== "default") return void 0;
|
|
@@ -11519,7 +11658,7 @@ var uniqueCssDefinitionRule = {
|
|
|
11519
11658
|
},
|
|
11520
11659
|
create(context) {
|
|
11521
11660
|
const sourceRoot = sourceRootOf(context);
|
|
11522
|
-
const current =
|
|
11661
|
+
const current = path78.normalize(path78.resolve(context.filename));
|
|
11523
11662
|
const cssFiles = findFiles(sourceRoot, CSS_EXTENSIONS);
|
|
11524
11663
|
if (cssFiles.length === 0) return {};
|
|
11525
11664
|
const textOf = cachedTextReader();
|
|
@@ -11527,7 +11666,7 @@ var uniqueCssDefinitionRule = {
|
|
|
11527
11666
|
sourceRoot,
|
|
11528
11667
|
css: cssFiles.map((file) => ({
|
|
11529
11668
|
path: file,
|
|
11530
|
-
content:
|
|
11669
|
+
content: path78.normalize(file) === current ? context.sourceCode.text : textOf(file)
|
|
11531
11670
|
})),
|
|
11532
11671
|
modules: [],
|
|
11533
11672
|
includeReferences: false
|
|
@@ -11549,7 +11688,7 @@ var uniqueCssDefinitionRule = {
|
|
|
11549
11688
|
if (!canonical) continue;
|
|
11550
11689
|
for (const symbol of definitions.slice(1)) {
|
|
11551
11690
|
if (symbol.file !== current) continue;
|
|
11552
|
-
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 ${
|
|
11691
|
+
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 ${path78.relative(sourceRoot, canonical.file)}; define it in only one CSS file.`;
|
|
11553
11692
|
context.report({
|
|
11554
11693
|
node,
|
|
11555
11694
|
loc: {
|
|
@@ -11566,7 +11705,7 @@ var uniqueCssDefinitionRule = {
|
|
|
11566
11705
|
};
|
|
11567
11706
|
|
|
11568
11707
|
// eslint/rules/tailwind/unique-css-token-value.ts
|
|
11569
|
-
import
|
|
11708
|
+
import path79 from "path";
|
|
11570
11709
|
|
|
11571
11710
|
// eslint/rules/tailwind/css-named-colors.ts
|
|
11572
11711
|
var CSS_NAMED_COLORS = {
|
|
@@ -11807,14 +11946,14 @@ var uniqueCssTokenValueRule = {
|
|
|
11807
11946
|
},
|
|
11808
11947
|
create(context) {
|
|
11809
11948
|
const sourceRoot = sourceRootOf(context);
|
|
11810
|
-
const current =
|
|
11949
|
+
const current = path79.normalize(path79.resolve(context.filename));
|
|
11811
11950
|
const textOf = cachedTextReader();
|
|
11812
11951
|
const cssFiles = findFiles(sourceRoot, CSS_EXTENSIONS);
|
|
11813
11952
|
const graph = buildCssDependencyGraph({
|
|
11814
11953
|
sourceRoot,
|
|
11815
11954
|
css: cssFiles.map((file) => ({
|
|
11816
11955
|
path: file,
|
|
11817
|
-
content:
|
|
11956
|
+
content: path79.normalize(file) === current ? context.sourceCode.text : textOf(file)
|
|
11818
11957
|
})),
|
|
11819
11958
|
modules: [],
|
|
11820
11959
|
includeReferences: false
|
|
@@ -11827,6 +11966,16 @@ var uniqueCssTokenValueRule = {
|
|
|
11827
11966
|
group.push(definition);
|
|
11828
11967
|
byValue.set(value, group);
|
|
11829
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
|
+
}
|
|
11830
11979
|
const redundant = /* @__PURE__ */ new Map();
|
|
11831
11980
|
for (const group of byValue.values()) {
|
|
11832
11981
|
group.sort(compareLocations);
|
|
@@ -11839,6 +11988,17 @@ var uniqueCssTokenValueRule = {
|
|
|
11839
11988
|
}
|
|
11840
11989
|
return {
|
|
11841
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
|
+
}
|
|
11842
12002
|
for (const [definition, original] of redundant) {
|
|
11843
12003
|
if (definition.file !== current) continue;
|
|
11844
12004
|
context.report({
|
|
@@ -11847,7 +12007,7 @@ var uniqueCssTokenValueRule = {
|
|
|
11847
12007
|
start: { line: definition.line, column: 1 },
|
|
11848
12008
|
end: { line: definition.line, column: 2 }
|
|
11849
12009
|
},
|
|
11850
|
-
message: `Token "${definition.name}" duplicates the value of "${original.name}" in ${
|
|
12010
|
+
message: `Token "${definition.name}" duplicates the value of "${original.name}" in ${path79.relative(
|
|
11851
12011
|
sourceRoot,
|
|
11852
12012
|
original.file
|
|
11853
12013
|
)}:${String(original.line)}; reuse one design token.`
|
|
@@ -11860,7 +12020,7 @@ var uniqueCssTokenValueRule = {
|
|
|
11860
12020
|
|
|
11861
12021
|
// eslint/rules/tailwind/unused-css-definition.ts
|
|
11862
12022
|
import { statSync as statSync5 } from "fs";
|
|
11863
|
-
import
|
|
12023
|
+
import path80 from "path";
|
|
11864
12024
|
function isImplicitThemeToken(name) {
|
|
11865
12025
|
return name === "--spacing" || name === "--radius" || name === "--font-sans" || name === "--font-mono" || name.startsWith("--breakpoint-") || name.startsWith("--default-");
|
|
11866
12026
|
}
|
|
@@ -11912,7 +12072,7 @@ var unusedCssDefinitionRule = {
|
|
|
11912
12072
|
} catch {
|
|
11913
12073
|
return {};
|
|
11914
12074
|
}
|
|
11915
|
-
const current =
|
|
12075
|
+
const current = path80.normalize(path80.resolve(context.filename));
|
|
11916
12076
|
const textOf = cachedTextReader();
|
|
11917
12077
|
const cssFiles = findFiles(sourceRoot, CSS_EXTENSIONS);
|
|
11918
12078
|
const moduleContents = findFiles(sourceRoot, MODULE_EXTENSIONS4).map((file) => ({
|
|
@@ -11923,7 +12083,7 @@ var unusedCssDefinitionRule = {
|
|
|
11923
12083
|
sourceRoot,
|
|
11924
12084
|
css: cssFiles.map((file) => ({
|
|
11925
12085
|
path: file,
|
|
11926
|
-
content:
|
|
12086
|
+
content: path80.normalize(file) === current ? context.sourceCode.text : textOf(file)
|
|
11927
12087
|
})),
|
|
11928
12088
|
modules: moduleContents
|
|
11929
12089
|
});
|
|
@@ -11951,7 +12111,7 @@ var unusedCssDefinitionRule = {
|
|
|
11951
12111
|
// eslint/rules/tailwind/utility-mapping.ts
|
|
11952
12112
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
11953
12113
|
import { existsSync as existsSync12 } from "fs";
|
|
11954
|
-
import
|
|
12114
|
+
import path81 from "path";
|
|
11955
12115
|
function applyOperationCount(utility, textOf) {
|
|
11956
12116
|
let count = 0;
|
|
11957
12117
|
for (const apply of atrulesNamed(utility, "apply")) {
|
|
@@ -12306,13 +12466,13 @@ var utilityMappingRule = {
|
|
|
12306
12466
|
},
|
|
12307
12467
|
create(context) {
|
|
12308
12468
|
const sourceRoot = sourceRootOf(context);
|
|
12309
|
-
const current =
|
|
12469
|
+
const current = path81.normalize(path81.resolve(context.filename));
|
|
12310
12470
|
const textOf = cachedTextReader();
|
|
12311
12471
|
const graph = buildCssDependencyGraph({
|
|
12312
12472
|
sourceRoot,
|
|
12313
12473
|
css: findFiles(sourceRoot, CSS_EXTENSIONS).map((file) => ({
|
|
12314
12474
|
path: file,
|
|
12315
|
-
content:
|
|
12475
|
+
content: path81.normalize(file) === current ? context.sourceCode.text : textOf(file)
|
|
12316
12476
|
})),
|
|
12317
12477
|
modules: [],
|
|
12318
12478
|
includeReferences: false
|
|
@@ -12465,8 +12625,8 @@ var utilityMappingRule = {
|
|
|
12465
12625
|
const generatorCandidates = utilities.map(
|
|
12466
12626
|
(utility) => themeCandidate(preludeIdentifiers(utility)[0] ?? "unknown", context.sourceCode.getText(utility))
|
|
12467
12627
|
).filter((candidate) => Boolean(candidate && requiresGeneratorProbe(candidate)));
|
|
12468
|
-
const physicalDir =
|
|
12469
|
-
const tailwindCwd =
|
|
12628
|
+
const physicalDir = path81.dirname(context.physicalFilename);
|
|
12629
|
+
const tailwindCwd = path81.isAbsolute(physicalDir) && existsSync12(physicalDir) ? physicalDir : context.cwd;
|
|
12470
12630
|
const themeGenerators = themeSupportedGenerators(generatorCandidates, tailwindCwd);
|
|
12471
12631
|
for (const utility of utilities) {
|
|
12472
12632
|
const name = preludeIdentifiers(utility)[0] ?? "unknown";
|
|
@@ -12576,7 +12736,7 @@ var utilityMappingRule = {
|
|
|
12576
12736
|
// eslint/rules/tailwind/utility-name-parity.ts
|
|
12577
12737
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
12578
12738
|
import { existsSync as existsSync13 } from "fs";
|
|
12579
|
-
import
|
|
12739
|
+
import path82 from "path";
|
|
12580
12740
|
import { generate as generate6, parse as parse7, toPlainObject as toPlainObject2 } from "@eslint/css-tree";
|
|
12581
12741
|
function numericPart(value) {
|
|
12582
12742
|
const match = /^(?<negative>-?)(?<number>(?:\d+(?:\.\d+)?|\.\d+))(?<unit>%|px|rem|em|vw|vh|dvw|dvh|ch|fr|s|ms|deg|turn)?$/u.exec(
|
|
@@ -12720,8 +12880,8 @@ var utilityNameParityRule = {
|
|
|
12720
12880
|
return apply ? [{ utility, name, apply }] : [];
|
|
12721
12881
|
});
|
|
12722
12882
|
if (candidates.length === 0) return;
|
|
12723
|
-
const physicalDir =
|
|
12724
|
-
const cwd =
|
|
12883
|
+
const physicalDir = path82.dirname(context.physicalFilename);
|
|
12884
|
+
const cwd = path82.isAbsolute(physicalDir) && existsSync13(physicalDir) ? physicalDir : context.cwd;
|
|
12725
12885
|
const compiled = compileApplies(
|
|
12726
12886
|
candidates.map((candidate) => candidate.apply),
|
|
12727
12887
|
cwd
|
|
@@ -12769,6 +12929,7 @@ var utilityNameParityRule = {
|
|
|
12769
12929
|
var tailwindRules = {
|
|
12770
12930
|
"at-rule-spacing": atRuleSpacingRule,
|
|
12771
12931
|
"theme-reset": themeResetRule,
|
|
12932
|
+
"theme-token-order": themeTokenOrderRule,
|
|
12772
12933
|
"theme-mode": themeModeRule,
|
|
12773
12934
|
"color-role-usage": colorRoleUsageRule,
|
|
12774
12935
|
"color-literal-usage": colorLiteralUsageRule,
|
|
@@ -12789,7 +12950,7 @@ var tailwindRules = {
|
|
|
12789
12950
|
};
|
|
12790
12951
|
|
|
12791
12952
|
// eslint/rules/type-extraction.ts
|
|
12792
|
-
import
|
|
12953
|
+
import path83 from "path";
|
|
12793
12954
|
var typeExtractionRule = {
|
|
12794
12955
|
meta: {
|
|
12795
12956
|
schema: [],
|
|
@@ -12800,7 +12961,7 @@ var typeExtractionRule = {
|
|
|
12800
12961
|
},
|
|
12801
12962
|
create(context) {
|
|
12802
12963
|
const sourceRoot = sourceRootOf(context);
|
|
12803
|
-
const file =
|
|
12964
|
+
const file = path83.resolve(context.filename);
|
|
12804
12965
|
const segments = segmentsOf(file, sourceRoot);
|
|
12805
12966
|
if (segments.length === 0) return {};
|
|
12806
12967
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -12941,7 +13102,7 @@ var uiStateRule = {
|
|
|
12941
13102
|
// eslint/rules/unknown-utility.ts
|
|
12942
13103
|
import { existsSync as existsSync14, readdirSync as readdirSync6, readFileSync as readFileSync16, statSync as statSync6 } from "fs";
|
|
12943
13104
|
import { createRequire } from "module";
|
|
12944
|
-
import
|
|
13105
|
+
import path84 from "path";
|
|
12945
13106
|
var PREFIX_NAMESPACES = {
|
|
12946
13107
|
bg: ["color", "background-image"],
|
|
12947
13108
|
text: ["color", "text"],
|
|
@@ -13229,7 +13390,7 @@ function stylesheetFiles(dir) {
|
|
|
13229
13390
|
}
|
|
13230
13391
|
return entries.flatMap((entry) => {
|
|
13231
13392
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
13232
|
-
const entryPath =
|
|
13393
|
+
const entryPath = path84.join(dir, entry);
|
|
13233
13394
|
let stats;
|
|
13234
13395
|
try {
|
|
13235
13396
|
stats = statSync6(entryPath);
|
|
@@ -13237,7 +13398,7 @@ function stylesheetFiles(dir) {
|
|
|
13237
13398
|
return [];
|
|
13238
13399
|
}
|
|
13239
13400
|
if (stats.isDirectory()) return stylesheetFiles(entryPath);
|
|
13240
|
-
return
|
|
13401
|
+
return path84.extname(entry) === ".css" ? [entryPath] : [];
|
|
13241
13402
|
});
|
|
13242
13403
|
}
|
|
13243
13404
|
function packageNameOf(specifier) {
|
|
@@ -13248,10 +13409,10 @@ function packageNameOf(specifier) {
|
|
|
13248
13409
|
function resolvePackageStylesheet(fromFile, specifier) {
|
|
13249
13410
|
const packageName = packageNameOf(specifier);
|
|
13250
13411
|
if (!packageName || packageName === "tailwindcss") return void 0;
|
|
13251
|
-
let directory =
|
|
13252
|
-
while (directory !==
|
|
13253
|
-
const packageRoot =
|
|
13254
|
-
const manifestPath =
|
|
13412
|
+
let directory = path84.dirname(fromFile);
|
|
13413
|
+
while (directory !== path84.dirname(directory)) {
|
|
13414
|
+
const packageRoot = path84.join(directory, "node_modules", packageName);
|
|
13415
|
+
const manifestPath = path84.join(packageRoot, "package.json");
|
|
13255
13416
|
if (existsSync14(manifestPath)) {
|
|
13256
13417
|
try {
|
|
13257
13418
|
const manifest = readFileSync16(manifestPath, "utf8");
|
|
@@ -13259,13 +13420,13 @@ function resolvePackageStylesheet(fromFile, specifier) {
|
|
|
13259
13420
|
const main = /"main"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
13260
13421
|
const target = stylesheet ?? main;
|
|
13261
13422
|
if (!target) return void 0;
|
|
13262
|
-
const resolved =
|
|
13423
|
+
const resolved = path84.resolve(packageRoot, target);
|
|
13263
13424
|
return existsSync14(resolved) ? resolved : void 0;
|
|
13264
13425
|
} catch {
|
|
13265
13426
|
return void 0;
|
|
13266
13427
|
}
|
|
13267
13428
|
}
|
|
13268
|
-
directory =
|
|
13429
|
+
directory = path84.dirname(directory);
|
|
13269
13430
|
}
|
|
13270
13431
|
return void 0;
|
|
13271
13432
|
}
|
|
@@ -13547,7 +13708,7 @@ var unknownUtilityRule = {
|
|
|
13547
13708
|
};
|
|
13548
13709
|
|
|
13549
13710
|
// eslint/rules/util-file-name.ts
|
|
13550
|
-
import
|
|
13711
|
+
import path85 from "path";
|
|
13551
13712
|
function toKebabCase2(value) {
|
|
13552
13713
|
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();
|
|
13553
13714
|
}
|
|
@@ -13560,7 +13721,7 @@ var utilFileNameRule = {
|
|
|
13560
13721
|
}
|
|
13561
13722
|
},
|
|
13562
13723
|
create(context) {
|
|
13563
|
-
const filename =
|
|
13724
|
+
const filename = path85.resolve(context.filename);
|
|
13564
13725
|
const segments = filename.replace(/\\/g, "/").split("/");
|
|
13565
13726
|
if (!segments.includes("utils")) return {};
|
|
13566
13727
|
let module;
|
|
@@ -13574,13 +13735,13 @@ var utilFileNameRule = {
|
|
|
13574
13735
|
const functionName = functions[0]?.name;
|
|
13575
13736
|
if (!functionName) return {};
|
|
13576
13737
|
const expected = toKebabCase2(functionName);
|
|
13577
|
-
const actual =
|
|
13738
|
+
const actual = path85.basename(filename, path85.extname(filename));
|
|
13578
13739
|
if (!expected || actual === expected) return {};
|
|
13579
13740
|
return {
|
|
13580
13741
|
Program(node) {
|
|
13581
13742
|
context.report({
|
|
13582
13743
|
node,
|
|
13583
|
-
message: `A utility file exporting ${functionName} must be named ${expected}.${
|
|
13744
|
+
message: `A utility file exporting ${functionName} must be named ${expected}.${path85.extname(filename).slice(1)}.`
|
|
13584
13745
|
});
|
|
13585
13746
|
}
|
|
13586
13747
|
};
|
|
@@ -13588,7 +13749,7 @@ var utilFileNameRule = {
|
|
|
13588
13749
|
};
|
|
13589
13750
|
|
|
13590
13751
|
// eslint/rules/value-extraction.ts
|
|
13591
|
-
import
|
|
13752
|
+
import path86 from "path";
|
|
13592
13753
|
var valueExtractionRule = {
|
|
13593
13754
|
meta: {
|
|
13594
13755
|
schema: [],
|
|
@@ -13599,7 +13760,7 @@ var valueExtractionRule = {
|
|
|
13599
13760
|
},
|
|
13600
13761
|
create(context) {
|
|
13601
13762
|
const sourceRoot = sourceRootOf(context);
|
|
13602
|
-
const file =
|
|
13763
|
+
const file = path86.resolve(context.filename);
|
|
13603
13764
|
const segments = segmentsOf(file, sourceRoot);
|
|
13604
13765
|
if (segments.length === 0 || segments[0] !== "app") return {};
|
|
13605
13766
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -13621,7 +13782,7 @@ var valueExtractionRule = {
|
|
|
13621
13782
|
|
|
13622
13783
|
// eslint/rules/vulyk/tracked-docs.ts
|
|
13623
13784
|
import { existsSync as existsSync15, readFileSync as readFileSync17 } from "fs";
|
|
13624
|
-
import
|
|
13785
|
+
import path87 from "path";
|
|
13625
13786
|
var PASIKA_REPO = "Bredansky/pasika";
|
|
13626
13787
|
var BASE_REQUIRED_TRACKED_DOCS = [
|
|
13627
13788
|
{ name: "documentation-guide", path: "docs/documentation-guide" },
|
|
@@ -13654,8 +13815,8 @@ var trackedDocsRule = {
|
|
|
13654
13815
|
if (!context.filename.endsWith("package.json")) return;
|
|
13655
13816
|
const root = node.body;
|
|
13656
13817
|
if (root.type !== "Object") return;
|
|
13657
|
-
const projectRoot =
|
|
13658
|
-
const configPath =
|
|
13818
|
+
const projectRoot = path87.dirname(path87.resolve(context.filename));
|
|
13819
|
+
const configPath = path87.join(projectRoot, "vulyk.config.ts");
|
|
13659
13820
|
if (!existsSync15(configPath)) {
|
|
13660
13821
|
context.report({
|
|
13661
13822
|
node,
|
|
@@ -13680,7 +13841,7 @@ var trackedDocsRule = {
|
|
|
13680
13841
|
});
|
|
13681
13842
|
}
|
|
13682
13843
|
}
|
|
13683
|
-
const agentsPath =
|
|
13844
|
+
const agentsPath = path87.join(projectRoot, "AGENTS.md");
|
|
13684
13845
|
if (!existsSync15(agentsPath)) {
|
|
13685
13846
|
context.report({
|
|
13686
13847
|
node,
|
|
@@ -13780,7 +13941,7 @@ var withResponseHelperRule = {
|
|
|
13780
13941
|
|
|
13781
13942
|
// eslint/rules/zirka-baseline.ts
|
|
13782
13943
|
import fs7 from "fs";
|
|
13783
|
-
import
|
|
13944
|
+
import path88 from "path";
|
|
13784
13945
|
var ESLINT_CONFIG = /^eslint\.config\.(?:ts|mts|cts|js|mjs|cjs)$/;
|
|
13785
13946
|
var PRETTIER_CONFIGS = [
|
|
13786
13947
|
"prettier.config.mjs",
|
|
@@ -13799,10 +13960,10 @@ var zirkaBaselineRule = {
|
|
|
13799
13960
|
}
|
|
13800
13961
|
},
|
|
13801
13962
|
create(context) {
|
|
13802
|
-
const filename =
|
|
13803
|
-
const basename =
|
|
13963
|
+
const filename = path88.resolve(context.filename);
|
|
13964
|
+
const basename = path88.basename(filename);
|
|
13804
13965
|
if (!ESLINT_CONFIG.test(basename)) return {};
|
|
13805
|
-
const projectRoot =
|
|
13966
|
+
const projectRoot = path88.dirname(filename);
|
|
13806
13967
|
const report3 = (message) => {
|
|
13807
13968
|
context.report({
|
|
13808
13969
|
node: context.sourceCode.ast,
|
|
@@ -13817,7 +13978,7 @@ var zirkaBaselineRule = {
|
|
|
13817
13978
|
'ESLint config must take its configuration from zirka (import { styleguide } from "zirka") instead of restating rules locally.'
|
|
13818
13979
|
);
|
|
13819
13980
|
}
|
|
13820
|
-
const tsconfigPath =
|
|
13981
|
+
const tsconfigPath = path88.join(projectRoot, "tsconfig.json");
|
|
13821
13982
|
if (!fs7.existsSync(tsconfigPath)) {
|
|
13822
13983
|
report3('No tsconfig.json found. Create one extending the zirka TypeScript base config ("zirka/typescript").');
|
|
13823
13984
|
} else {
|
|
@@ -13835,13 +13996,13 @@ var zirkaBaselineRule = {
|
|
|
13835
13996
|
report3('tsconfig.json must extend the zirka TypeScript base config ("zirka/typescript").');
|
|
13836
13997
|
}
|
|
13837
13998
|
}
|
|
13838
|
-
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(
|
|
13999
|
+
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(path88.join(projectRoot, name)));
|
|
13839
14000
|
if (!prettierConfigFile) {
|
|
13840
14001
|
report3(
|
|
13841
14002
|
"No prettier config found. Create one that takes its configuration from zirka (styleguide({ prettier: true }).prettierConfig)."
|
|
13842
14003
|
);
|
|
13843
14004
|
} else {
|
|
13844
|
-
const content = fs7.readFileSync(
|
|
14005
|
+
const content = fs7.readFileSync(path88.join(projectRoot, prettierConfigFile), "utf8");
|
|
13845
14006
|
if (!content.includes("zirka")) {
|
|
13846
14007
|
report3(
|
|
13847
14008
|
"The prettier config must take its configuration from zirka (styleguide({ prettier: true }).prettierConfig) instead of restating it locally."
|