pasika 0.10.139 → 0.10.141
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 +192 -51
- 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
|
|
@@ -11847,7 +11986,7 @@ var uniqueCssTokenValueRule = {
|
|
|
11847
11986
|
start: { line: definition.line, column: 1 },
|
|
11848
11987
|
end: { line: definition.line, column: 2 }
|
|
11849
11988
|
},
|
|
11850
|
-
message: `Token "${definition.name}" duplicates the value of "${original.name}" in ${
|
|
11989
|
+
message: `Token "${definition.name}" duplicates the value of "${original.name}" in ${path79.relative(
|
|
11851
11990
|
sourceRoot,
|
|
11852
11991
|
original.file
|
|
11853
11992
|
)}:${String(original.line)}; reuse one design token.`
|
|
@@ -11860,7 +11999,7 @@ var uniqueCssTokenValueRule = {
|
|
|
11860
11999
|
|
|
11861
12000
|
// eslint/rules/tailwind/unused-css-definition.ts
|
|
11862
12001
|
import { statSync as statSync5 } from "fs";
|
|
11863
|
-
import
|
|
12002
|
+
import path80 from "path";
|
|
11864
12003
|
function isImplicitThemeToken(name) {
|
|
11865
12004
|
return name === "--spacing" || name === "--radius" || name === "--font-sans" || name === "--font-mono" || name.startsWith("--breakpoint-") || name.startsWith("--default-");
|
|
11866
12005
|
}
|
|
@@ -11912,7 +12051,7 @@ var unusedCssDefinitionRule = {
|
|
|
11912
12051
|
} catch {
|
|
11913
12052
|
return {};
|
|
11914
12053
|
}
|
|
11915
|
-
const current =
|
|
12054
|
+
const current = path80.normalize(path80.resolve(context.filename));
|
|
11916
12055
|
const textOf = cachedTextReader();
|
|
11917
12056
|
const cssFiles = findFiles(sourceRoot, CSS_EXTENSIONS);
|
|
11918
12057
|
const moduleContents = findFiles(sourceRoot, MODULE_EXTENSIONS4).map((file) => ({
|
|
@@ -11923,7 +12062,7 @@ var unusedCssDefinitionRule = {
|
|
|
11923
12062
|
sourceRoot,
|
|
11924
12063
|
css: cssFiles.map((file) => ({
|
|
11925
12064
|
path: file,
|
|
11926
|
-
content:
|
|
12065
|
+
content: path80.normalize(file) === current ? context.sourceCode.text : textOf(file)
|
|
11927
12066
|
})),
|
|
11928
12067
|
modules: moduleContents
|
|
11929
12068
|
});
|
|
@@ -11951,7 +12090,7 @@ var unusedCssDefinitionRule = {
|
|
|
11951
12090
|
// eslint/rules/tailwind/utility-mapping.ts
|
|
11952
12091
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
11953
12092
|
import { existsSync as existsSync12 } from "fs";
|
|
11954
|
-
import
|
|
12093
|
+
import path81 from "path";
|
|
11955
12094
|
function applyOperationCount(utility, textOf) {
|
|
11956
12095
|
let count = 0;
|
|
11957
12096
|
for (const apply of atrulesNamed(utility, "apply")) {
|
|
@@ -12306,13 +12445,13 @@ var utilityMappingRule = {
|
|
|
12306
12445
|
},
|
|
12307
12446
|
create(context) {
|
|
12308
12447
|
const sourceRoot = sourceRootOf(context);
|
|
12309
|
-
const current =
|
|
12448
|
+
const current = path81.normalize(path81.resolve(context.filename));
|
|
12310
12449
|
const textOf = cachedTextReader();
|
|
12311
12450
|
const graph = buildCssDependencyGraph({
|
|
12312
12451
|
sourceRoot,
|
|
12313
12452
|
css: findFiles(sourceRoot, CSS_EXTENSIONS).map((file) => ({
|
|
12314
12453
|
path: file,
|
|
12315
|
-
content:
|
|
12454
|
+
content: path81.normalize(file) === current ? context.sourceCode.text : textOf(file)
|
|
12316
12455
|
})),
|
|
12317
12456
|
modules: [],
|
|
12318
12457
|
includeReferences: false
|
|
@@ -12465,8 +12604,8 @@ var utilityMappingRule = {
|
|
|
12465
12604
|
const generatorCandidates = utilities.map(
|
|
12466
12605
|
(utility) => themeCandidate(preludeIdentifiers(utility)[0] ?? "unknown", context.sourceCode.getText(utility))
|
|
12467
12606
|
).filter((candidate) => Boolean(candidate && requiresGeneratorProbe(candidate)));
|
|
12468
|
-
const physicalDir =
|
|
12469
|
-
const tailwindCwd =
|
|
12607
|
+
const physicalDir = path81.dirname(context.physicalFilename);
|
|
12608
|
+
const tailwindCwd = path81.isAbsolute(physicalDir) && existsSync12(physicalDir) ? physicalDir : context.cwd;
|
|
12470
12609
|
const themeGenerators = themeSupportedGenerators(generatorCandidates, tailwindCwd);
|
|
12471
12610
|
for (const utility of utilities) {
|
|
12472
12611
|
const name = preludeIdentifiers(utility)[0] ?? "unknown";
|
|
@@ -12576,7 +12715,7 @@ var utilityMappingRule = {
|
|
|
12576
12715
|
// eslint/rules/tailwind/utility-name-parity.ts
|
|
12577
12716
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
12578
12717
|
import { existsSync as existsSync13 } from "fs";
|
|
12579
|
-
import
|
|
12718
|
+
import path82 from "path";
|
|
12580
12719
|
import { generate as generate6, parse as parse7, toPlainObject as toPlainObject2 } from "@eslint/css-tree";
|
|
12581
12720
|
function numericPart(value) {
|
|
12582
12721
|
const match = /^(?<negative>-?)(?<number>(?:\d+(?:\.\d+)?|\.\d+))(?<unit>%|px|rem|em|vw|vh|dvw|dvh|ch|fr|s|ms|deg|turn)?$/u.exec(
|
|
@@ -12588,7 +12727,7 @@ function numericPart(value) {
|
|
|
12588
12727
|
return sign + number + (match.groups.unit === "%" ? "pct" : match.groups.unit ?? "");
|
|
12589
12728
|
}
|
|
12590
12729
|
function simpleValueSlug(value) {
|
|
12591
|
-
const words = value.trim().replace(/,/gu, "
|
|
12730
|
+
const words = value.trim().replace(/,/gu, "_").split(/[_\s]+/u).filter(Boolean);
|
|
12592
12731
|
if (words.length === 0 || words.length > 8) return void 0;
|
|
12593
12732
|
const parts = [];
|
|
12594
12733
|
for (const word of words) {
|
|
@@ -12720,8 +12859,8 @@ var utilityNameParityRule = {
|
|
|
12720
12859
|
return apply ? [{ utility, name, apply }] : [];
|
|
12721
12860
|
});
|
|
12722
12861
|
if (candidates.length === 0) return;
|
|
12723
|
-
const physicalDir =
|
|
12724
|
-
const cwd =
|
|
12862
|
+
const physicalDir = path82.dirname(context.physicalFilename);
|
|
12863
|
+
const cwd = path82.isAbsolute(physicalDir) && existsSync13(physicalDir) ? physicalDir : context.cwd;
|
|
12725
12864
|
const compiled = compileApplies(
|
|
12726
12865
|
candidates.map((candidate) => candidate.apply),
|
|
12727
12866
|
cwd
|
|
@@ -12769,6 +12908,7 @@ var utilityNameParityRule = {
|
|
|
12769
12908
|
var tailwindRules = {
|
|
12770
12909
|
"at-rule-spacing": atRuleSpacingRule,
|
|
12771
12910
|
"theme-reset": themeResetRule,
|
|
12911
|
+
"theme-token-order": themeTokenOrderRule,
|
|
12772
12912
|
"theme-mode": themeModeRule,
|
|
12773
12913
|
"color-role-usage": colorRoleUsageRule,
|
|
12774
12914
|
"color-literal-usage": colorLiteralUsageRule,
|
|
@@ -12789,7 +12929,7 @@ var tailwindRules = {
|
|
|
12789
12929
|
};
|
|
12790
12930
|
|
|
12791
12931
|
// eslint/rules/type-extraction.ts
|
|
12792
|
-
import
|
|
12932
|
+
import path83 from "path";
|
|
12793
12933
|
var typeExtractionRule = {
|
|
12794
12934
|
meta: {
|
|
12795
12935
|
schema: [],
|
|
@@ -12800,7 +12940,7 @@ var typeExtractionRule = {
|
|
|
12800
12940
|
},
|
|
12801
12941
|
create(context) {
|
|
12802
12942
|
const sourceRoot = sourceRootOf(context);
|
|
12803
|
-
const file =
|
|
12943
|
+
const file = path83.resolve(context.filename);
|
|
12804
12944
|
const segments = segmentsOf(file, sourceRoot);
|
|
12805
12945
|
if (segments.length === 0) return {};
|
|
12806
12946
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -12941,7 +13081,7 @@ var uiStateRule = {
|
|
|
12941
13081
|
// eslint/rules/unknown-utility.ts
|
|
12942
13082
|
import { existsSync as existsSync14, readdirSync as readdirSync6, readFileSync as readFileSync16, statSync as statSync6 } from "fs";
|
|
12943
13083
|
import { createRequire } from "module";
|
|
12944
|
-
import
|
|
13084
|
+
import path84 from "path";
|
|
12945
13085
|
var PREFIX_NAMESPACES = {
|
|
12946
13086
|
bg: ["color", "background-image"],
|
|
12947
13087
|
text: ["color", "text"],
|
|
@@ -13229,7 +13369,7 @@ function stylesheetFiles(dir) {
|
|
|
13229
13369
|
}
|
|
13230
13370
|
return entries.flatMap((entry) => {
|
|
13231
13371
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
13232
|
-
const entryPath =
|
|
13372
|
+
const entryPath = path84.join(dir, entry);
|
|
13233
13373
|
let stats;
|
|
13234
13374
|
try {
|
|
13235
13375
|
stats = statSync6(entryPath);
|
|
@@ -13237,7 +13377,7 @@ function stylesheetFiles(dir) {
|
|
|
13237
13377
|
return [];
|
|
13238
13378
|
}
|
|
13239
13379
|
if (stats.isDirectory()) return stylesheetFiles(entryPath);
|
|
13240
|
-
return
|
|
13380
|
+
return path84.extname(entry) === ".css" ? [entryPath] : [];
|
|
13241
13381
|
});
|
|
13242
13382
|
}
|
|
13243
13383
|
function packageNameOf(specifier) {
|
|
@@ -13248,10 +13388,10 @@ function packageNameOf(specifier) {
|
|
|
13248
13388
|
function resolvePackageStylesheet(fromFile, specifier) {
|
|
13249
13389
|
const packageName = packageNameOf(specifier);
|
|
13250
13390
|
if (!packageName || packageName === "tailwindcss") return void 0;
|
|
13251
|
-
let directory =
|
|
13252
|
-
while (directory !==
|
|
13253
|
-
const packageRoot =
|
|
13254
|
-
const manifestPath =
|
|
13391
|
+
let directory = path84.dirname(fromFile);
|
|
13392
|
+
while (directory !== path84.dirname(directory)) {
|
|
13393
|
+
const packageRoot = path84.join(directory, "node_modules", packageName);
|
|
13394
|
+
const manifestPath = path84.join(packageRoot, "package.json");
|
|
13255
13395
|
if (existsSync14(manifestPath)) {
|
|
13256
13396
|
try {
|
|
13257
13397
|
const manifest = readFileSync16(manifestPath, "utf8");
|
|
@@ -13259,13 +13399,13 @@ function resolvePackageStylesheet(fromFile, specifier) {
|
|
|
13259
13399
|
const main = /"main"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
13260
13400
|
const target = stylesheet ?? main;
|
|
13261
13401
|
if (!target) return void 0;
|
|
13262
|
-
const resolved =
|
|
13402
|
+
const resolved = path84.resolve(packageRoot, target);
|
|
13263
13403
|
return existsSync14(resolved) ? resolved : void 0;
|
|
13264
13404
|
} catch {
|
|
13265
13405
|
return void 0;
|
|
13266
13406
|
}
|
|
13267
13407
|
}
|
|
13268
|
-
directory =
|
|
13408
|
+
directory = path84.dirname(directory);
|
|
13269
13409
|
}
|
|
13270
13410
|
return void 0;
|
|
13271
13411
|
}
|
|
@@ -13355,9 +13495,10 @@ function readInventory(files) {
|
|
|
13355
13495
|
}
|
|
13356
13496
|
for (const plainClass of classSelectors(css2)) plainClasses.add(plainClass);
|
|
13357
13497
|
for (const block of themeBlocks(css2)) {
|
|
13358
|
-
|
|
13359
|
-
if (
|
|
13360
|
-
|
|
13498
|
+
const declarations = block.replace(/\/\*[\s\S]*?\*\//gu, "");
|
|
13499
|
+
if (/--\*\s*:\s*initial\b/.test(declarations)) defaultsReset = true;
|
|
13500
|
+
if (/(?:^|[;{])\s*--spacing\s*:/.test(declarations)) baseSpacing = true;
|
|
13501
|
+
for (const decl of declarations.matchAll(/--(?<namespace>[a-z][a-z0-9]*)-(?<token>[a-z0-9][a-z0-9_-]*)\s*:/g)) {
|
|
13361
13502
|
let namespace = decl.groups?.namespace;
|
|
13362
13503
|
let token = decl.groups?.token;
|
|
13363
13504
|
if (namespace === "background" && token?.startsWith("image-")) {
|
|
@@ -13546,7 +13687,7 @@ var unknownUtilityRule = {
|
|
|
13546
13687
|
};
|
|
13547
13688
|
|
|
13548
13689
|
// eslint/rules/util-file-name.ts
|
|
13549
|
-
import
|
|
13690
|
+
import path85 from "path";
|
|
13550
13691
|
function toKebabCase2(value) {
|
|
13551
13692
|
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();
|
|
13552
13693
|
}
|
|
@@ -13559,7 +13700,7 @@ var utilFileNameRule = {
|
|
|
13559
13700
|
}
|
|
13560
13701
|
},
|
|
13561
13702
|
create(context) {
|
|
13562
|
-
const filename =
|
|
13703
|
+
const filename = path85.resolve(context.filename);
|
|
13563
13704
|
const segments = filename.replace(/\\/g, "/").split("/");
|
|
13564
13705
|
if (!segments.includes("utils")) return {};
|
|
13565
13706
|
let module;
|
|
@@ -13573,13 +13714,13 @@ var utilFileNameRule = {
|
|
|
13573
13714
|
const functionName = functions[0]?.name;
|
|
13574
13715
|
if (!functionName) return {};
|
|
13575
13716
|
const expected = toKebabCase2(functionName);
|
|
13576
|
-
const actual =
|
|
13717
|
+
const actual = path85.basename(filename, path85.extname(filename));
|
|
13577
13718
|
if (!expected || actual === expected) return {};
|
|
13578
13719
|
return {
|
|
13579
13720
|
Program(node) {
|
|
13580
13721
|
context.report({
|
|
13581
13722
|
node,
|
|
13582
|
-
message: `A utility file exporting ${functionName} must be named ${expected}.${
|
|
13723
|
+
message: `A utility file exporting ${functionName} must be named ${expected}.${path85.extname(filename).slice(1)}.`
|
|
13583
13724
|
});
|
|
13584
13725
|
}
|
|
13585
13726
|
};
|
|
@@ -13587,7 +13728,7 @@ var utilFileNameRule = {
|
|
|
13587
13728
|
};
|
|
13588
13729
|
|
|
13589
13730
|
// eslint/rules/value-extraction.ts
|
|
13590
|
-
import
|
|
13731
|
+
import path86 from "path";
|
|
13591
13732
|
var valueExtractionRule = {
|
|
13592
13733
|
meta: {
|
|
13593
13734
|
schema: [],
|
|
@@ -13598,7 +13739,7 @@ var valueExtractionRule = {
|
|
|
13598
13739
|
},
|
|
13599
13740
|
create(context) {
|
|
13600
13741
|
const sourceRoot = sourceRootOf(context);
|
|
13601
|
-
const file =
|
|
13742
|
+
const file = path86.resolve(context.filename);
|
|
13602
13743
|
const segments = segmentsOf(file, sourceRoot);
|
|
13603
13744
|
if (segments.length === 0 || segments[0] !== "app") return {};
|
|
13604
13745
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -13620,7 +13761,7 @@ var valueExtractionRule = {
|
|
|
13620
13761
|
|
|
13621
13762
|
// eslint/rules/vulyk/tracked-docs.ts
|
|
13622
13763
|
import { existsSync as existsSync15, readFileSync as readFileSync17 } from "fs";
|
|
13623
|
-
import
|
|
13764
|
+
import path87 from "path";
|
|
13624
13765
|
var PASIKA_REPO = "Bredansky/pasika";
|
|
13625
13766
|
var BASE_REQUIRED_TRACKED_DOCS = [
|
|
13626
13767
|
{ name: "documentation-guide", path: "docs/documentation-guide" },
|
|
@@ -13653,8 +13794,8 @@ var trackedDocsRule = {
|
|
|
13653
13794
|
if (!context.filename.endsWith("package.json")) return;
|
|
13654
13795
|
const root = node.body;
|
|
13655
13796
|
if (root.type !== "Object") return;
|
|
13656
|
-
const projectRoot =
|
|
13657
|
-
const configPath =
|
|
13797
|
+
const projectRoot = path87.dirname(path87.resolve(context.filename));
|
|
13798
|
+
const configPath = path87.join(projectRoot, "vulyk.config.ts");
|
|
13658
13799
|
if (!existsSync15(configPath)) {
|
|
13659
13800
|
context.report({
|
|
13660
13801
|
node,
|
|
@@ -13679,7 +13820,7 @@ var trackedDocsRule = {
|
|
|
13679
13820
|
});
|
|
13680
13821
|
}
|
|
13681
13822
|
}
|
|
13682
|
-
const agentsPath =
|
|
13823
|
+
const agentsPath = path87.join(projectRoot, "AGENTS.md");
|
|
13683
13824
|
if (!existsSync15(agentsPath)) {
|
|
13684
13825
|
context.report({
|
|
13685
13826
|
node,
|
|
@@ -13779,7 +13920,7 @@ var withResponseHelperRule = {
|
|
|
13779
13920
|
|
|
13780
13921
|
// eslint/rules/zirka-baseline.ts
|
|
13781
13922
|
import fs7 from "fs";
|
|
13782
|
-
import
|
|
13923
|
+
import path88 from "path";
|
|
13783
13924
|
var ESLINT_CONFIG = /^eslint\.config\.(?:ts|mts|cts|js|mjs|cjs)$/;
|
|
13784
13925
|
var PRETTIER_CONFIGS = [
|
|
13785
13926
|
"prettier.config.mjs",
|
|
@@ -13798,10 +13939,10 @@ var zirkaBaselineRule = {
|
|
|
13798
13939
|
}
|
|
13799
13940
|
},
|
|
13800
13941
|
create(context) {
|
|
13801
|
-
const filename =
|
|
13802
|
-
const basename =
|
|
13942
|
+
const filename = path88.resolve(context.filename);
|
|
13943
|
+
const basename = path88.basename(filename);
|
|
13803
13944
|
if (!ESLINT_CONFIG.test(basename)) return {};
|
|
13804
|
-
const projectRoot =
|
|
13945
|
+
const projectRoot = path88.dirname(filename);
|
|
13805
13946
|
const report3 = (message) => {
|
|
13806
13947
|
context.report({
|
|
13807
13948
|
node: context.sourceCode.ast,
|
|
@@ -13816,7 +13957,7 @@ var zirkaBaselineRule = {
|
|
|
13816
13957
|
'ESLint config must take its configuration from zirka (import { styleguide } from "zirka") instead of restating rules locally.'
|
|
13817
13958
|
);
|
|
13818
13959
|
}
|
|
13819
|
-
const tsconfigPath =
|
|
13960
|
+
const tsconfigPath = path88.join(projectRoot, "tsconfig.json");
|
|
13820
13961
|
if (!fs7.existsSync(tsconfigPath)) {
|
|
13821
13962
|
report3('No tsconfig.json found. Create one extending the zirka TypeScript base config ("zirka/typescript").');
|
|
13822
13963
|
} else {
|
|
@@ -13834,13 +13975,13 @@ var zirkaBaselineRule = {
|
|
|
13834
13975
|
report3('tsconfig.json must extend the zirka TypeScript base config ("zirka/typescript").');
|
|
13835
13976
|
}
|
|
13836
13977
|
}
|
|
13837
|
-
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(
|
|
13978
|
+
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(path88.join(projectRoot, name)));
|
|
13838
13979
|
if (!prettierConfigFile) {
|
|
13839
13980
|
report3(
|
|
13840
13981
|
"No prettier config found. Create one that takes its configuration from zirka (styleguide({ prettier: true }).prettierConfig)."
|
|
13841
13982
|
);
|
|
13842
13983
|
} else {
|
|
13843
|
-
const content = fs7.readFileSync(
|
|
13984
|
+
const content = fs7.readFileSync(path88.join(projectRoot, prettierConfigFile), "utf8");
|
|
13844
13985
|
if (!content.includes("zirka")) {
|
|
13845
13986
|
report3(
|
|
13846
13987
|
"The prettier config must take its configuration from zirka (styleguide({ prettier: true }).prettierConfig) instead of restating it locally."
|