pasika 0.10.104 → 0.10.106
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 +1 -0
- package/dist/eslint/pasika/index.js +444 -275
- package/package.json +1 -1
|
@@ -5379,13 +5379,148 @@ var noArbitraryTailwindRule = {
|
|
|
5379
5379
|
}
|
|
5380
5380
|
};
|
|
5381
5381
|
|
|
5382
|
-
// eslint/rules/no-
|
|
5383
|
-
import
|
|
5382
|
+
// eslint/rules/no-duplicate-jsx-classes.ts
|
|
5383
|
+
import path40 from "path";
|
|
5384
5384
|
|
|
5385
|
-
// eslint/project/
|
|
5385
|
+
// eslint/project/jsx-class-reuse.ts
|
|
5386
5386
|
import { readFileSync as readFileSync9 } from "fs";
|
|
5387
|
-
import path40 from "path";
|
|
5388
5387
|
import ts8 from "typescript";
|
|
5388
|
+
var MIN_SHARED_CLASSES = 5;
|
|
5389
|
+
var cache3 = /* @__PURE__ */ new WeakMap();
|
|
5390
|
+
function staticClassText(expression) {
|
|
5391
|
+
if (ts8.isStringLiteral(expression) || ts8.isNoSubstitutionTemplateLiteral(expression)) {
|
|
5392
|
+
return expression.text;
|
|
5393
|
+
}
|
|
5394
|
+
if (ts8.isParenthesizedExpression(expression)) return staticClassText(expression.expression);
|
|
5395
|
+
if (!ts8.isCallExpression(expression) || !ts8.isIdentifier(expression.expression)) return void 0;
|
|
5396
|
+
if (expression.expression.text !== "cn") return void 0;
|
|
5397
|
+
const chunks = [];
|
|
5398
|
+
for (const arg of expression.arguments) {
|
|
5399
|
+
if (ts8.isSpreadElement(arg)) return void 0;
|
|
5400
|
+
const text = staticClassText(arg);
|
|
5401
|
+
if (text === void 0) return void 0;
|
|
5402
|
+
chunks.push(text);
|
|
5403
|
+
}
|
|
5404
|
+
return chunks.join(" ");
|
|
5405
|
+
}
|
|
5406
|
+
function occurrencesInFile(file) {
|
|
5407
|
+
const source = ts8.createSourceFile(file, readFileSync9(file, "utf8"), ts8.ScriptTarget.Latest, true, ts8.ScriptKind.TSX);
|
|
5408
|
+
const result = [];
|
|
5409
|
+
const visit = (node) => {
|
|
5410
|
+
if (ts8.isJsxOpeningElement(node) || ts8.isJsxSelfClosingElement(node)) {
|
|
5411
|
+
const tag = node.tagName.getText(source);
|
|
5412
|
+
if (/^[a-z][a-z0-9-]*$/.test(tag)) {
|
|
5413
|
+
const attribute = node.attributes.properties.find(
|
|
5414
|
+
(item) => ts8.isJsxAttribute(item) && ts8.isIdentifier(item.name) && item.name.text === "className"
|
|
5415
|
+
);
|
|
5416
|
+
if (attribute && ts8.isJsxAttribute(attribute)) {
|
|
5417
|
+
const initializer = attribute.initializer;
|
|
5418
|
+
let text;
|
|
5419
|
+
if (initializer && ts8.isStringLiteral(initializer)) {
|
|
5420
|
+
text = initializer.text;
|
|
5421
|
+
} else if (initializer && ts8.isJsxExpression(initializer) && initializer.expression) {
|
|
5422
|
+
text = staticClassText(initializer.expression);
|
|
5423
|
+
}
|
|
5424
|
+
if (text !== void 0) {
|
|
5425
|
+
const classes = [...new Set(text.split(/\s+/).filter(Boolean))].sort();
|
|
5426
|
+
if (classes.length >= MIN_SHARED_CLASSES) {
|
|
5427
|
+
const location = source.getLineAndCharacterOfPosition(attribute.getStart(source));
|
|
5428
|
+
result.push({
|
|
5429
|
+
file,
|
|
5430
|
+
line: location.line + 1,
|
|
5431
|
+
column: location.character,
|
|
5432
|
+
tag,
|
|
5433
|
+
classes
|
|
5434
|
+
});
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
}
|
|
5440
|
+
ts8.forEachChild(node, visit);
|
|
5441
|
+
};
|
|
5442
|
+
visit(source);
|
|
5443
|
+
return result;
|
|
5444
|
+
}
|
|
5445
|
+
function reuseIndex(index) {
|
|
5446
|
+
const byTagAndClasses = /* @__PURE__ */ new Map();
|
|
5447
|
+
for (const file of [...index.modules.keys()].sort()) {
|
|
5448
|
+
if (!/\.(?:tsx|jsx)$/.test(file) || /\.(?:test|spec)\.(?:tsx|jsx)$/.test(file)) continue;
|
|
5449
|
+
try {
|
|
5450
|
+
for (const occurrence of occurrencesInFile(file)) {
|
|
5451
|
+
const key = JSON.stringify([occurrence.tag, occurrence.classes]);
|
|
5452
|
+
const members = byTagAndClasses.get(key) ?? [];
|
|
5453
|
+
members.push(occurrence);
|
|
5454
|
+
byTagAndClasses.set(key, members);
|
|
5455
|
+
}
|
|
5456
|
+
} catch {
|
|
5457
|
+
}
|
|
5458
|
+
}
|
|
5459
|
+
const matches = /* @__PURE__ */ new Map();
|
|
5460
|
+
const groups = [];
|
|
5461
|
+
for (const members of byTagAndClasses.values()) {
|
|
5462
|
+
if (new Set(members.map((member) => member.file)).size < 2) continue;
|
|
5463
|
+
const first = members[0];
|
|
5464
|
+
if (!first) continue;
|
|
5465
|
+
groups.push({ tag: first.tag, members, commonClasses: first.classes });
|
|
5466
|
+
for (const occurrence of members.slice(1)) {
|
|
5467
|
+
const original = members.find((member) => member.file !== occurrence.file);
|
|
5468
|
+
if (!original) continue;
|
|
5469
|
+
const entries = matches.get(occurrence.file) ?? [];
|
|
5470
|
+
entries.push({ occurrence, original, commonClasses: first.classes });
|
|
5471
|
+
matches.set(occurrence.file, entries);
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
return { matches, groups };
|
|
5475
|
+
}
|
|
5476
|
+
function getJsxReuseAnalysis(sourceRoot) {
|
|
5477
|
+
const index = getProjectIndex(sourceRoot);
|
|
5478
|
+
if (!index) return { matches: /* @__PURE__ */ new Map(), groups: [] };
|
|
5479
|
+
const existing = cache3.get(index);
|
|
5480
|
+
if (existing) return existing;
|
|
5481
|
+
const result = reuseIndex(index);
|
|
5482
|
+
cache3.set(index, result);
|
|
5483
|
+
return result;
|
|
5484
|
+
}
|
|
5485
|
+
function getJsxClassReuses(sourceRoot) {
|
|
5486
|
+
return getJsxReuseAnalysis(sourceRoot).matches;
|
|
5487
|
+
}
|
|
5488
|
+
|
|
5489
|
+
// eslint/rules/no-duplicate-jsx-classes.ts
|
|
5490
|
+
var noDuplicateJsxClassesRule = {
|
|
5491
|
+
meta: {
|
|
5492
|
+
schema: [],
|
|
5493
|
+
type: "problem",
|
|
5494
|
+
docs: { description: "Extract identical static JSX class sets into reusable components." }
|
|
5495
|
+
},
|
|
5496
|
+
create(context) {
|
|
5497
|
+
const file = path40.resolve(context.filename);
|
|
5498
|
+
if (!/\.(?:jsx|tsx)$/.test(file) || /\.(?:test|spec)\.(?:jsx|tsx)$/.test(file)) return {};
|
|
5499
|
+
const root = sourceRootOf(context);
|
|
5500
|
+
const matches = getJsxClassReuses(root).get(file) ?? [];
|
|
5501
|
+
if (matches.length === 0) return {};
|
|
5502
|
+
return {
|
|
5503
|
+
Program(node) {
|
|
5504
|
+
for (const { occurrence, original, commonClasses } of matches) {
|
|
5505
|
+
const reference = path40.relative(path40.dirname(root), original.file).split(path40.sep).join("/");
|
|
5506
|
+
context.report({
|
|
5507
|
+
node,
|
|
5508
|
+
loc: { line: occurrence.line, column: occurrence.column },
|
|
5509
|
+
message: `<${occurrence.tag}> repeats the same set of ${String(commonClasses.length)} classes as ${reference}:${String(original.line)}. Extract a shared component. See docs/next-tailwind-guide/rules/tailwind-class-reuse-rule.md`
|
|
5510
|
+
});
|
|
5511
|
+
}
|
|
5512
|
+
}
|
|
5513
|
+
};
|
|
5514
|
+
}
|
|
5515
|
+
};
|
|
5516
|
+
|
|
5517
|
+
// eslint/rules/no-inline-runtime-literal.ts
|
|
5518
|
+
import path42 from "path";
|
|
5519
|
+
|
|
5520
|
+
// eslint/project/semantic-literals.ts
|
|
5521
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
5522
|
+
import path41 from "path";
|
|
5523
|
+
import ts9 from "typescript";
|
|
5389
5524
|
var excludedProperties = /* @__PURE__ */ new Set([
|
|
5390
5525
|
"label",
|
|
5391
5526
|
"title",
|
|
@@ -5423,33 +5558,33 @@ var columnMethods = /* @__PURE__ */ new Set([
|
|
|
5423
5558
|
var eventMethods = /* @__PURE__ */ new Set(["emit", "on", "off", "once", "addListener", "removeListener"]);
|
|
5424
5559
|
var ignoredNumbers = /* @__PURE__ */ new Set([-1, 0, 1]);
|
|
5425
5560
|
function isProductionSource(file, root) {
|
|
5426
|
-
const parts =
|
|
5427
|
-
return !(/\.(?:test|spec|mock)\.[^.]+$/.test(
|
|
5561
|
+
const parts = path41.relative(root, file).split(path41.sep);
|
|
5562
|
+
return !(/\.(?:test|spec|mock)\.[^.]+$/.test(path41.basename(file)) || parts.some((part) => part === "__tests__" || part === "__mocks__" || part === "mocks"));
|
|
5428
5563
|
}
|
|
5429
5564
|
function featureOf(file, root) {
|
|
5430
|
-
const parts =
|
|
5565
|
+
const parts = path41.relative(root, file).split(path41.sep);
|
|
5431
5566
|
if (parts[0] === "features" && parts[1]) return `feature:${parts[1]}`;
|
|
5432
5567
|
return `layer:${parts[0] ?? "src"}`;
|
|
5433
5568
|
}
|
|
5434
5569
|
function nameOf(property) {
|
|
5435
|
-
if (
|
|
5570
|
+
if (ts9.isIdentifier(property) || ts9.isStringLiteral(property)) return property.text;
|
|
5436
5571
|
return void 0;
|
|
5437
5572
|
}
|
|
5438
5573
|
function literalOf(node) {
|
|
5439
|
-
if (
|
|
5440
|
-
if (
|
|
5441
|
-
if (
|
|
5574
|
+
if (ts9.isStringLiteral(node)) return node.text;
|
|
5575
|
+
if (ts9.isNumericLiteral(node)) return Number(node.text.replaceAll("_", ""));
|
|
5576
|
+
if (ts9.isPrefixUnaryExpression(node) && node.operator === ts9.SyntaxKind.MinusToken && ts9.isNumericLiteral(node.operand)) {
|
|
5442
5577
|
return -Number(node.operand.text.replaceAll("_", ""));
|
|
5443
5578
|
}
|
|
5444
5579
|
return void 0;
|
|
5445
5580
|
}
|
|
5446
5581
|
function isLiteralRoot(node) {
|
|
5447
|
-
if (
|
|
5448
|
-
return (
|
|
5582
|
+
if (ts9.isPrefixUnaryExpression(node)) return literalOf(node) !== void 0;
|
|
5583
|
+
return (ts9.isStringLiteral(node) || ts9.isNumericLiteral(node)) && !(ts9.isPrefixUnaryExpression(node.parent) && node.parent.operand === node);
|
|
5449
5584
|
}
|
|
5450
5585
|
function invocation(node) {
|
|
5451
|
-
if (
|
|
5452
|
-
if (
|
|
5586
|
+
if (ts9.isIdentifier(node.expression)) return { method: node.expression.text };
|
|
5587
|
+
if (ts9.isPropertyAccessExpression(node.expression)) {
|
|
5453
5588
|
const receiver = node.expression.expression.getText();
|
|
5454
5589
|
if (!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)?$/.test(receiver)) return void 0;
|
|
5455
5590
|
return { method: node.expression.name.text, receiver };
|
|
@@ -5457,7 +5592,7 @@ function invocation(node) {
|
|
|
5457
5592
|
return void 0;
|
|
5458
5593
|
}
|
|
5459
5594
|
function isPathname(node) {
|
|
5460
|
-
return
|
|
5595
|
+
return ts9.isPropertyAccessExpression(node) && node.name.text === "pathname";
|
|
5461
5596
|
}
|
|
5462
5597
|
function contextFor(node, value, file, root) {
|
|
5463
5598
|
if (typeof value === "number" && ignoredNumbers.has(value)) return void 0;
|
|
@@ -5466,7 +5601,7 @@ function contextFor(node, value, file, root) {
|
|
|
5466
5601
|
const scope = featureOf(file, root);
|
|
5467
5602
|
const isApiRoute = typeof value === "string" && value.startsWith("/api/") && !/[?&#\s]/.test(value);
|
|
5468
5603
|
const route = () => ({ role: "api-route", family: "api-route" });
|
|
5469
|
-
if (
|
|
5604
|
+
if (ts9.isPropertyAssignment(parent) && parent.initializer === node) {
|
|
5470
5605
|
const name = nameOf(parent.name);
|
|
5471
5606
|
if (!name) return void 0;
|
|
5472
5607
|
if (name === "path" && isApiRoute) return route();
|
|
@@ -5475,14 +5610,14 @@ function contextFor(node, value, file, root) {
|
|
|
5475
5610
|
if (isApiRoute && /route|path|endpoint/i.test(name)) return route();
|
|
5476
5611
|
return { role: `property:${name}:${scope}`, family: `property:${name}` };
|
|
5477
5612
|
}
|
|
5478
|
-
if (
|
|
5613
|
+
if (ts9.isVariableDeclaration(parent) && parent.initializer === node && ts9.isIdentifier(parent.name)) {
|
|
5479
5614
|
if (typeof value === "number") return void 0;
|
|
5480
5615
|
const name = parent.name.text;
|
|
5481
5616
|
if (excludedProperties.has(name) || !semanticVariableName.test(name)) return void 0;
|
|
5482
5617
|
if (isApiRoute && /route|path|endpoint/i.test(name)) return route();
|
|
5483
5618
|
return { role: `variable:${name}:${scope}`, family: `variable:${name}` };
|
|
5484
5619
|
}
|
|
5485
|
-
if (
|
|
5620
|
+
if (ts9.isCallExpression(parent)) {
|
|
5486
5621
|
const position = parent.arguments.findIndex((argument) => argument === node);
|
|
5487
5622
|
if (position < 0) return void 0;
|
|
5488
5623
|
const call = invocation(parent);
|
|
@@ -5501,29 +5636,29 @@ function contextFor(node, value, file, root) {
|
|
|
5501
5636
|
return { role: `column:${scope}`, family: "column" };
|
|
5502
5637
|
}
|
|
5503
5638
|
}
|
|
5504
|
-
if (isApiRoute &&
|
|
5639
|
+
if (isApiRoute && ts9.isBinaryExpression(parent) && (parent.operatorToken.kind === ts9.SyntaxKind.EqualsEqualsEqualsToken || parent.operatorToken.kind === ts9.SyntaxKind.ExclamationEqualsEqualsToken) && (parent.left === node && isPathname(parent.right) || parent.right === node && isPathname(parent.left))) {
|
|
5505
5640
|
return route();
|
|
5506
5641
|
}
|
|
5507
|
-
if (isApiRoute &&
|
|
5642
|
+
if (isApiRoute && ts9.isCallExpression(parent) && parent.arguments[0] === node && ts9.isPropertyAccessExpression(parent.expression) && parent.expression.name.text === "startsWith" && isPathname(parent.expression.expression)) {
|
|
5508
5643
|
return route();
|
|
5509
5644
|
}
|
|
5510
5645
|
return void 0;
|
|
5511
5646
|
}
|
|
5512
5647
|
function isExported2(node) {
|
|
5513
|
-
return
|
|
5648
|
+
return ts9.canHaveModifiers(node) && (ts9.getModifiers(node) ?? []).some((modifier) => modifier.kind === ts9.SyntaxKind.ExportKeyword);
|
|
5514
5649
|
}
|
|
5515
5650
|
function parse(file, root, output) {
|
|
5516
5651
|
if (!isProductionSource(file, root)) return;
|
|
5517
|
-
const source =
|
|
5652
|
+
const source = ts9.createSourceFile(
|
|
5518
5653
|
file,
|
|
5519
|
-
|
|
5520
|
-
|
|
5654
|
+
readFileSync10(file, "utf8"),
|
|
5655
|
+
ts9.ScriptTarget.Latest,
|
|
5521
5656
|
true,
|
|
5522
|
-
file.endsWith(".tsx") || file.endsWith(".jsx") ?
|
|
5657
|
+
file.endsWith(".tsx") || file.endsWith(".jsx") ? ts9.ScriptKind.TSX : ts9.ScriptKind.TS
|
|
5523
5658
|
);
|
|
5524
|
-
const inConstants =
|
|
5659
|
+
const inConstants = path41.relative(root, file).split(path41.sep).includes("constants");
|
|
5525
5660
|
for (const statement of source.statements) {
|
|
5526
|
-
if (inConstants &&
|
|
5661
|
+
if (inConstants && ts9.isEnumDeclaration(statement) && isExported2(statement)) {
|
|
5527
5662
|
for (const member of statement.members) {
|
|
5528
5663
|
const value = member.initializer && literalOf(member.initializer);
|
|
5529
5664
|
const memberName10 = nameOf(member.name);
|
|
@@ -5537,9 +5672,9 @@ function parse(file, root, output) {
|
|
|
5537
5672
|
});
|
|
5538
5673
|
}
|
|
5539
5674
|
}
|
|
5540
|
-
if (inConstants &&
|
|
5675
|
+
if (inConstants && ts9.isVariableStatement(statement) && isExported2(statement)) {
|
|
5541
5676
|
for (const declaration of statement.declarationList.declarations) {
|
|
5542
|
-
if (!
|
|
5677
|
+
if (!ts9.isIdentifier(declaration.name) || !declaration.initializer) continue;
|
|
5543
5678
|
const value = literalOf(declaration.initializer);
|
|
5544
5679
|
if (value === void 0) continue;
|
|
5545
5680
|
output.canonicals.push({
|
|
@@ -5558,7 +5693,7 @@ function parse(file, root, output) {
|
|
|
5558
5693
|
const semantic = contextFor(node, value, file, root);
|
|
5559
5694
|
if (semantic) {
|
|
5560
5695
|
const declaration = node.parent;
|
|
5561
|
-
const isCanonicalDefinition = inConstants && (
|
|
5696
|
+
const isCanonicalDefinition = inConstants && (ts9.isVariableDeclaration(declaration) && ts9.isVariableStatement(declaration.parent.parent) && isExported2(declaration.parent.parent) || ts9.isEnumMember(declaration));
|
|
5562
5697
|
if ((!inConstants || semantic.family === "api-route") && !isCanonicalDefinition) {
|
|
5563
5698
|
const position = source.getLineAndCharacterOfPosition(node.getStart(source));
|
|
5564
5699
|
output.uses.push({
|
|
@@ -5573,13 +5708,13 @@ function parse(file, root, output) {
|
|
|
5573
5708
|
}
|
|
5574
5709
|
}
|
|
5575
5710
|
}
|
|
5576
|
-
|
|
5711
|
+
ts9.forEachChild(node, visit);
|
|
5577
5712
|
};
|
|
5578
5713
|
visit(source);
|
|
5579
5714
|
}
|
|
5580
|
-
var
|
|
5715
|
+
var cache4 = /* @__PURE__ */ new WeakMap();
|
|
5581
5716
|
function getSemanticLiteralIndex(index) {
|
|
5582
|
-
const previous =
|
|
5717
|
+
const previous = cache4.get(index);
|
|
5583
5718
|
if (previous) return previous;
|
|
5584
5719
|
const result = { uses: [], canonicals: [] };
|
|
5585
5720
|
for (const file of index.modules.keys()) {
|
|
@@ -5588,7 +5723,7 @@ function getSemanticLiteralIndex(index) {
|
|
|
5588
5723
|
} catch {
|
|
5589
5724
|
}
|
|
5590
5725
|
}
|
|
5591
|
-
|
|
5726
|
+
cache4.set(index, result);
|
|
5592
5727
|
return result;
|
|
5593
5728
|
}
|
|
5594
5729
|
|
|
@@ -5614,7 +5749,7 @@ function isStaticDataComponentMarker(node) {
|
|
|
5614
5749
|
return typeof name === "object" && name !== null && "name" in name && name.name === "data-component";
|
|
5615
5750
|
}
|
|
5616
5751
|
function isStaticMatcherValue(node, root, file) {
|
|
5617
|
-
const relativeFile =
|
|
5752
|
+
const relativeFile = path42.relative(root, file);
|
|
5618
5753
|
if (relativeFile !== "middleware.ts" && relativeFile !== "proxy.ts") return false;
|
|
5619
5754
|
let current = node;
|
|
5620
5755
|
while (current.parent) {
|
|
@@ -5677,11 +5812,11 @@ function isSyntacticString(node) {
|
|
|
5677
5812
|
return false;
|
|
5678
5813
|
}
|
|
5679
5814
|
function isRuntimeMockSource(file, root) {
|
|
5680
|
-
const parts =
|
|
5681
|
-
return parts.includes("mocks") && !parts.some((part) => part === "__tests__" || part === "__mocks__") && !/\.(?:test|spec|mock)\.[^.]+$/.test(
|
|
5815
|
+
const parts = path42.relative(root, file).split(path42.sep);
|
|
5816
|
+
return parts.includes("mocks") && !parts.some((part) => part === "__tests__" || part === "__mocks__") && !/\.(?:test|spec|mock)\.[^.]+$/.test(path42.basename(file));
|
|
5682
5817
|
}
|
|
5683
5818
|
function isCanonicalLocaleString(node, root, file) {
|
|
5684
|
-
const relative =
|
|
5819
|
+
const relative = path42.relative(root, file).split(path42.sep);
|
|
5685
5820
|
let namespace;
|
|
5686
5821
|
if (relative.length === 2 && relative[0] === "locales" && relative[1] !== "index.ts" && /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*\.ts$/.test(relative[1] ?? "")) {
|
|
5687
5822
|
namespace = (relative[1] ?? "").slice(0, -3).replace(/-[a-z]/g, (match) => match.slice(1).toUpperCase());
|
|
@@ -5705,8 +5840,8 @@ var noInlineRuntimeLiteralRule = {
|
|
|
5705
5840
|
},
|
|
5706
5841
|
create(context) {
|
|
5707
5842
|
const root = sourceRootOf(context);
|
|
5708
|
-
const file =
|
|
5709
|
-
if (!file.startsWith(root +
|
|
5843
|
+
const file = path42.resolve(context.filename);
|
|
5844
|
+
if (!file.startsWith(root + path42.sep) || !isProductionSource(file, root) && !isRuntimeMockSource(file, root)) {
|
|
5710
5845
|
return {};
|
|
5711
5846
|
}
|
|
5712
5847
|
return {
|
|
@@ -5803,8 +5938,8 @@ var noLiteralInlineStyleRule = {
|
|
|
5803
5938
|
};
|
|
5804
5939
|
|
|
5805
5940
|
// eslint/rules/no-mixed-concerns.ts
|
|
5806
|
-
import { readFileSync as
|
|
5807
|
-
import
|
|
5941
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
5942
|
+
import path43 from "path";
|
|
5808
5943
|
function isComponentSupportKind(kind) {
|
|
5809
5944
|
return kind === "constant" || kind === "type" || kind === "schema";
|
|
5810
5945
|
}
|
|
@@ -5814,7 +5949,7 @@ function componentSupportExport(file, name, index, visited = /* @__PURE__ */ new
|
|
|
5814
5949
|
visited.add(key);
|
|
5815
5950
|
const module = index.modules.get(file);
|
|
5816
5951
|
if (!module) return void 0;
|
|
5817
|
-
const supportFolder =
|
|
5952
|
+
const supportFolder = path43.basename(path43.dirname(file));
|
|
5818
5953
|
if (["constants", "types", "schemas"].includes(supportFolder)) {
|
|
5819
5954
|
const exported = module.exports.find((item) => item.name === name && isComponentSupportKind(item.kind));
|
|
5820
5955
|
if (exported && isComponentSupportKind(exported.kind)) {
|
|
@@ -5853,7 +5988,7 @@ var noMixedConcernsRule = {
|
|
|
5853
5988
|
if (components.length > 1) return;
|
|
5854
5989
|
const componentName = components[0]?.name;
|
|
5855
5990
|
if (!componentName) return;
|
|
5856
|
-
const file =
|
|
5991
|
+
const file = path43.resolve(context.filename);
|
|
5857
5992
|
const sourceRoot = sourceRootOf(context);
|
|
5858
5993
|
const index = getProjectIndex(sourceRoot);
|
|
5859
5994
|
const componentConsumers = index?.symbolConsumers.get(symbolKey(file, componentName)) ?? /* @__PURE__ */ new Set();
|
|
@@ -5927,7 +6062,7 @@ var noMixedConcernsRule = {
|
|
|
5927
6062
|
continue;
|
|
5928
6063
|
}
|
|
5929
6064
|
const target = typeof statement.source?.value === "string" ? resolveSpecifier(file, statement.source.value, sourceRoot) : void 0;
|
|
5930
|
-
const forwardedComponents = target?.endsWith(".tsx") ? parseComponentInfo(
|
|
6065
|
+
const forwardedComponents = target?.endsWith(".tsx") ? parseComponentInfo(readFileSync11(target, "utf8"), target).map((component) => component.name) : [];
|
|
5931
6066
|
for (const specifier of statement.specifiers) {
|
|
5932
6067
|
if (/^type\b/.test(context.sourceCode.getText(specifier))) continue;
|
|
5933
6068
|
if (specifier.local.type !== "Identifier") continue;
|
|
@@ -5961,11 +6096,11 @@ var noMixedConcernsRule = {
|
|
|
5961
6096
|
};
|
|
5962
6097
|
|
|
5963
6098
|
// eslint/rules/no-redundant-alias.ts
|
|
5964
|
-
import
|
|
6099
|
+
import path45 from "path";
|
|
5965
6100
|
|
|
5966
6101
|
// eslint/rules/contract-ownership.ts
|
|
5967
|
-
import
|
|
5968
|
-
import
|
|
6102
|
+
import path44 from "path";
|
|
6103
|
+
import ts10 from "typescript";
|
|
5969
6104
|
function isTsProgram(value) {
|
|
5970
6105
|
return typeof value === "object" && value !== null && "getTypeChecker" in value && typeof value.getTypeChecker === "function" && "getSourceFiles" in value && typeof value.getSourceFiles === "function";
|
|
5971
6106
|
}
|
|
@@ -5983,8 +6118,8 @@ function normalizePath(value) {
|
|
|
5983
6118
|
return value.replaceAll("\\", "/").toLowerCase();
|
|
5984
6119
|
}
|
|
5985
6120
|
function isWithin2(root, file) {
|
|
5986
|
-
const relative =
|
|
5987
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
6121
|
+
const relative = path44.relative(root, file);
|
|
6122
|
+
return relative === "" || !relative.startsWith("..") && !path44.isAbsolute(relative);
|
|
5988
6123
|
}
|
|
5989
6124
|
function mergeOwnership(values) {
|
|
5990
6125
|
if (values.length === 0 || values.includes("unknown")) return "unknown";
|
|
@@ -5999,11 +6134,11 @@ function endpointOwnership(pathValue) {
|
|
|
5999
6134
|
return "unknown";
|
|
6000
6135
|
}
|
|
6001
6136
|
function resolvedSymbol(checker, symbol) {
|
|
6002
|
-
return symbol.flags ===
|
|
6137
|
+
return symbol.flags === ts10.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
|
|
6003
6138
|
}
|
|
6004
6139
|
function propertyName4(node) {
|
|
6005
6140
|
if (!node) return void 0;
|
|
6006
|
-
if (
|
|
6141
|
+
if (ts10.isIdentifier(node) || ts10.isStringLiteral(node) || ts10.isNumericLiteral(node)) return node.text;
|
|
6007
6142
|
return void 0;
|
|
6008
6143
|
}
|
|
6009
6144
|
var ContractOwnershipIndex = class {
|
|
@@ -6027,7 +6162,7 @@ var ContractOwnershipIndex = class {
|
|
|
6027
6162
|
}
|
|
6028
6163
|
if (declarations.length > 0) return this.endpointFromDeclarations(declarations);
|
|
6029
6164
|
let object;
|
|
6030
|
-
if (
|
|
6165
|
+
if (ts10.isPropertyAccessExpression(node) || ts10.isElementAccessExpression(node)) object = node.expression;
|
|
6031
6166
|
if (!object) return { kind: "missing", ownership: "unknown" };
|
|
6032
6167
|
const type = this.checker.getTypeAtLocation(object);
|
|
6033
6168
|
const typeDeclarations = this.typeDeclarations(type);
|
|
@@ -6035,7 +6170,7 @@ var ContractOwnershipIndex = class {
|
|
|
6035
6170
|
return this.endpointFromDeclarations(typeDeclarations);
|
|
6036
6171
|
}
|
|
6037
6172
|
sourceBinding(node, name) {
|
|
6038
|
-
if (!
|
|
6173
|
+
if (!ts10.isVariableDeclaration(node) || !node.initializer) {
|
|
6039
6174
|
return { kind: "missing", ownership: "unknown" };
|
|
6040
6175
|
}
|
|
6041
6176
|
const sourceType = this.checker.getTypeAtLocation(node.initializer);
|
|
@@ -6044,11 +6179,11 @@ var ContractOwnershipIndex = class {
|
|
|
6044
6179
|
return this.endpointFromDeclarations(declarations);
|
|
6045
6180
|
}
|
|
6046
6181
|
targetProperty(node, name) {
|
|
6047
|
-
if (!
|
|
6182
|
+
if (!ts10.isPropertyAssignment(node) && !ts10.isShorthandPropertyAssignment(node)) {
|
|
6048
6183
|
return { kind: "missing", ownership: "unknown" };
|
|
6049
6184
|
}
|
|
6050
6185
|
const object = node.parent;
|
|
6051
|
-
if (!
|
|
6186
|
+
if (!ts10.isObjectLiteralExpression(object)) return { kind: "missing", ownership: "unknown" };
|
|
6052
6187
|
const contextualType = this.checker.getContextualType(object);
|
|
6053
6188
|
if (!contextualType) return { kind: "missing", ownership: "unknown" };
|
|
6054
6189
|
const declarations = this.propertyDeclarations(contextualType, name);
|
|
@@ -6056,8 +6191,8 @@ var ContractOwnershipIndex = class {
|
|
|
6056
6191
|
return this.endpointFromDeclarations(declarations);
|
|
6057
6192
|
}
|
|
6058
6193
|
memberNameSymbol(node) {
|
|
6059
|
-
if (
|
|
6060
|
-
if (
|
|
6194
|
+
if (ts10.isPropertyAccessExpression(node)) return this.checker.getSymbolAtLocation(node.name);
|
|
6195
|
+
if (ts10.isElementAccessExpression(node)) return this.checker.getSymbolAtLocation(node.argumentExpression);
|
|
6061
6196
|
return void 0;
|
|
6062
6197
|
}
|
|
6063
6198
|
propertyDeclarations(type, name) {
|
|
@@ -6087,14 +6222,14 @@ var ContractOwnershipIndex = class {
|
|
|
6087
6222
|
if (declarations.some((declaration) => this.isDataContractField(declaration))) {
|
|
6088
6223
|
return { kind: "data-contract", ownership };
|
|
6089
6224
|
}
|
|
6090
|
-
if (declarations.some((declaration) =>
|
|
6225
|
+
if (declarations.some((declaration) => ts10.isPropertySignature(declaration) || ts10.isPropertyDeclaration(declaration))) {
|
|
6091
6226
|
return { kind: "typed-local", ownership };
|
|
6092
6227
|
}
|
|
6093
6228
|
return { kind: "non-contract", ownership };
|
|
6094
6229
|
}
|
|
6095
6230
|
isDataContractField(declaration) {
|
|
6096
6231
|
if (this.isZodSchemaField(declaration)) return true;
|
|
6097
|
-
if (!
|
|
6232
|
+
if (!ts10.isPropertySignature(declaration) && !ts10.isPropertyDeclaration(declaration)) return false;
|
|
6098
6233
|
const fileName = normalizePath(declaration.getSourceFile().fileName);
|
|
6099
6234
|
return /(?:^|\/)database(?:[-.]generated)?\.ts$/u.test(fileName);
|
|
6100
6235
|
}
|
|
@@ -6103,10 +6238,10 @@ var ContractOwnershipIndex = class {
|
|
|
6103
6238
|
return this.checker.getPropertyOfType(type, "_zod") !== void 0 && this.checker.getPropertyOfType(type, "parse") !== void 0 && this.checker.getPropertyOfType(type, "safeParse") !== void 0;
|
|
6104
6239
|
}
|
|
6105
6240
|
isZodSchemaField(declaration) {
|
|
6106
|
-
if (!
|
|
6241
|
+
if (!ts10.isPropertyAssignment(declaration)) return false;
|
|
6107
6242
|
let current = declaration.parent;
|
|
6108
|
-
while (!
|
|
6109
|
-
if (
|
|
6243
|
+
while (!ts10.isSourceFile(current)) {
|
|
6244
|
+
if (ts10.isVariableDeclaration(current) && ts10.isIdentifier(current.name) && current.name.text.endsWith("Schema")) {
|
|
6110
6245
|
return true;
|
|
6111
6246
|
}
|
|
6112
6247
|
current = current.parent;
|
|
@@ -6124,12 +6259,12 @@ var ContractOwnershipIndex = class {
|
|
|
6124
6259
|
const normalized = normalizePath(fileName);
|
|
6125
6260
|
if (/\/typescript\/lib\/lib\.[^/]+\.d\.ts$/u.test(normalized)) return "platform";
|
|
6126
6261
|
if (normalized.includes("/node_modules/")) return "third-party";
|
|
6127
|
-
if (isWithin2(this.cwd,
|
|
6262
|
+
if (isWithin2(this.cwd, path44.resolve(fileName))) return "first-party";
|
|
6128
6263
|
return "unknown";
|
|
6129
6264
|
}
|
|
6130
6265
|
schemaOwnership(declaration) {
|
|
6131
6266
|
let current = declaration;
|
|
6132
|
-
while (!
|
|
6267
|
+
while (!ts10.isSourceFile(current)) {
|
|
6133
6268
|
const ownership = this.schemaNodeOwnership.get(current);
|
|
6134
6269
|
if (ownership !== void 0) return ownership;
|
|
6135
6270
|
current = current.parent;
|
|
@@ -6138,31 +6273,31 @@ var ContractOwnershipIndex = class {
|
|
|
6138
6273
|
}
|
|
6139
6274
|
indexApiContracts() {
|
|
6140
6275
|
for (const sourceFile of this.program.getSourceFiles()) {
|
|
6141
|
-
if (sourceFile.isDeclarationFile || !isWithin2(this.cwd,
|
|
6276
|
+
if (sourceFile.isDeclarationFile || !isWithin2(this.cwd, path44.resolve(sourceFile.fileName))) continue;
|
|
6142
6277
|
const visit = (node) => {
|
|
6143
|
-
if (
|
|
6144
|
-
|
|
6278
|
+
if (ts10.isCallExpression(node) && this.isDefineApiContractCall(node)) this.indexApiContractCall(node);
|
|
6279
|
+
ts10.forEachChild(node, visit);
|
|
6145
6280
|
};
|
|
6146
6281
|
visit(sourceFile);
|
|
6147
6282
|
}
|
|
6148
6283
|
}
|
|
6149
6284
|
isDefineApiContractCall(node) {
|
|
6150
|
-
if (
|
|
6151
|
-
return
|
|
6285
|
+
if (ts10.isIdentifier(node.expression)) return node.expression.text === "defineApiContract";
|
|
6286
|
+
return ts10.isPropertyAccessExpression(node.expression) && node.expression.name.text === "defineApiContract";
|
|
6152
6287
|
}
|
|
6153
6288
|
indexApiContractCall(node) {
|
|
6154
6289
|
const argument = node.arguments[0];
|
|
6155
|
-
if (!argument || !
|
|
6290
|
+
if (!argument || !ts10.isObjectLiteralExpression(argument)) return;
|
|
6156
6291
|
let pathExpression;
|
|
6157
6292
|
const schemaExpressions = [];
|
|
6158
6293
|
for (const property of argument.properties) {
|
|
6159
|
-
if (
|
|
6294
|
+
if (ts10.isPropertyAssignment(property)) {
|
|
6160
6295
|
const name = propertyName4(property.name);
|
|
6161
6296
|
if (name === "path") pathExpression = property.initializer;
|
|
6162
6297
|
if (name === "requestSchema" || name === "responseSchema") schemaExpressions.push(property.initializer);
|
|
6163
6298
|
continue;
|
|
6164
6299
|
}
|
|
6165
|
-
if (
|
|
6300
|
+
if (ts10.isShorthandPropertyAssignment(property)) {
|
|
6166
6301
|
const name = property.name.text;
|
|
6167
6302
|
if (name === "path") pathExpression = property.name;
|
|
6168
6303
|
if (name === "requestSchema" || name === "responseSchema") schemaExpressions.push(property.name);
|
|
@@ -6176,13 +6311,13 @@ var ContractOwnershipIndex = class {
|
|
|
6176
6311
|
}
|
|
6177
6312
|
staticString(node, seen) {
|
|
6178
6313
|
if (!node) return void 0;
|
|
6179
|
-
if (
|
|
6180
|
-
if (
|
|
6314
|
+
if (ts10.isStringLiteralLike(node)) return node.text;
|
|
6315
|
+
if (ts10.isIdentifier(node)) {
|
|
6181
6316
|
const symbol = this.checker.getSymbolAtLocation(node);
|
|
6182
6317
|
if (!symbol || seen.has(symbol)) return void 0;
|
|
6183
6318
|
seen.add(symbol);
|
|
6184
6319
|
for (const declaration of resolvedSymbol(this.checker, symbol).declarations ?? []) {
|
|
6185
|
-
if (
|
|
6320
|
+
if (ts10.isVariableDeclaration(declaration) && declaration.initializer) {
|
|
6186
6321
|
const value = this.staticString(declaration.initializer, seen);
|
|
6187
6322
|
if (value !== void 0) return value;
|
|
6188
6323
|
}
|
|
@@ -6200,20 +6335,20 @@ var ContractOwnershipIndex = class {
|
|
|
6200
6335
|
this.followSchemaDeclaration(declaration, ownership, seen);
|
|
6201
6336
|
}
|
|
6202
6337
|
}
|
|
6203
|
-
|
|
6338
|
+
ts10.forEachChild(node, (child) => {
|
|
6204
6339
|
this.markSchemaExpression(child, ownership, seen);
|
|
6205
6340
|
});
|
|
6206
6341
|
}
|
|
6207
6342
|
schemaReferenceSymbol(node) {
|
|
6208
|
-
if (
|
|
6343
|
+
if (ts10.isIdentifier(node)) {
|
|
6209
6344
|
if (!node.text.endsWith("Schema")) return void 0;
|
|
6210
6345
|
return this.checker.getSymbolAtLocation(node);
|
|
6211
6346
|
}
|
|
6212
|
-
if (
|
|
6347
|
+
if (ts10.isPropertyAccessExpression(node)) {
|
|
6213
6348
|
if (!node.name.text.endsWith("Schema")) return void 0;
|
|
6214
6349
|
return this.checker.getSymbolAtLocation(node.name);
|
|
6215
6350
|
}
|
|
6216
|
-
if (
|
|
6351
|
+
if (ts10.isElementAccessExpression(node) && ts10.isStringLiteralLike(node.argumentExpression)) {
|
|
6217
6352
|
if (!node.argumentExpression.text.endsWith("Schema")) return void 0;
|
|
6218
6353
|
return this.checker.getSymbolAtLocation(node.argumentExpression);
|
|
6219
6354
|
}
|
|
@@ -6221,15 +6356,15 @@ var ContractOwnershipIndex = class {
|
|
|
6221
6356
|
}
|
|
6222
6357
|
followSchemaDeclaration(declaration, ownership, seen) {
|
|
6223
6358
|
this.setSchemaOwnership(declaration, ownership);
|
|
6224
|
-
if (
|
|
6359
|
+
if (ts10.isVariableDeclaration(declaration) && declaration.initializer) {
|
|
6225
6360
|
this.markSchemaExpression(declaration.initializer, ownership, seen);
|
|
6226
6361
|
return;
|
|
6227
6362
|
}
|
|
6228
|
-
if (
|
|
6363
|
+
if (ts10.isPropertyAssignment(declaration)) {
|
|
6229
6364
|
this.markSchemaExpression(declaration.initializer, ownership, seen);
|
|
6230
6365
|
return;
|
|
6231
6366
|
}
|
|
6232
|
-
if (
|
|
6367
|
+
if (ts10.isShorthandPropertyAssignment(declaration)) {
|
|
6233
6368
|
const valueSymbol = this.checker.getShorthandAssignmentValueSymbol(declaration);
|
|
6234
6369
|
if (!valueSymbol || seen.has(valueSymbol)) return;
|
|
6235
6370
|
seen.add(valueSymbol);
|
|
@@ -6409,7 +6544,7 @@ var noRedundantAliasRule = {
|
|
|
6409
6544
|
if (declaration.type !== "VariableDeclaration" || declaration.kind !== "const") return;
|
|
6410
6545
|
if (node.init.type === "Identifier") {
|
|
6411
6546
|
const exported = declaration.parent.type === "ExportNamedDeclaration";
|
|
6412
|
-
const frameworkRouteAlias =
|
|
6547
|
+
const frameworkRouteAlias = path45.basename(context.filename) === "route.ts" && exported && HTTP_METHODS.has(node.id.name);
|
|
6413
6548
|
if (frameworkRouteAlias || VALUE_SENTINELS.has(node.init.name)) return;
|
|
6414
6549
|
context.report({
|
|
6415
6550
|
node,
|
|
@@ -6532,7 +6667,7 @@ var noRedundantAliasRule = {
|
|
|
6532
6667
|
const source = specifier.local.name;
|
|
6533
6668
|
const alias = specifier.exported.name;
|
|
6534
6669
|
if (source === alias) continue;
|
|
6535
|
-
const frameworkRouteAlias =
|
|
6670
|
+
const frameworkRouteAlias = path45.basename(context.filename) === "route.ts" && HTTP_METHODS.has(alias);
|
|
6536
6671
|
if (frameworkRouteAlias) continue;
|
|
6537
6672
|
context.report({
|
|
6538
6673
|
node: specifier,
|
|
@@ -6557,7 +6692,7 @@ var noRedundantAliasRule = {
|
|
|
6557
6692
|
};
|
|
6558
6693
|
|
|
6559
6694
|
// eslint/rules/no-util-barrel.ts
|
|
6560
|
-
import
|
|
6695
|
+
import path46 from "path";
|
|
6561
6696
|
var noUtilBarrelRule = {
|
|
6562
6697
|
meta: {
|
|
6563
6698
|
schema: [],
|
|
@@ -6567,7 +6702,7 @@ var noUtilBarrelRule = {
|
|
|
6567
6702
|
}
|
|
6568
6703
|
},
|
|
6569
6704
|
create(context) {
|
|
6570
|
-
const filename =
|
|
6705
|
+
const filename = path46.resolve(context.filename);
|
|
6571
6706
|
const sourceRoot = sourceRootOf3(context, filename);
|
|
6572
6707
|
return {
|
|
6573
6708
|
Program(node) {
|
|
@@ -6576,7 +6711,7 @@ var noUtilBarrelRule = {
|
|
|
6576
6711
|
if (!target) continue;
|
|
6577
6712
|
const segments = target.replace(/\\/g, "/").split("/");
|
|
6578
6713
|
const utilsIndex = segments.lastIndexOf("utils");
|
|
6579
|
-
if (utilsIndex < 0 || !
|
|
6714
|
+
if (utilsIndex < 0 || !path46.basename(target).startsWith("index.")) continue;
|
|
6580
6715
|
context.report({
|
|
6581
6716
|
node,
|
|
6582
6717
|
message: `Import utilities directly instead of through "${specifier}". See docs/next-codebase-guide/rules/utilities-rule.md`
|
|
@@ -6596,15 +6731,15 @@ function importSpecifiers2(source) {
|
|
|
6596
6731
|
return specifiers;
|
|
6597
6732
|
}
|
|
6598
6733
|
function sourceRootOf3(context, filename) {
|
|
6599
|
-
const marker = `${
|
|
6734
|
+
const marker = `${path46.sep}src${path46.sep}`;
|
|
6600
6735
|
const srcIndex = filename.lastIndexOf(marker);
|
|
6601
6736
|
if (srcIndex >= 0) return filename.slice(0, srcIndex + marker.length - 1);
|
|
6602
|
-
return
|
|
6737
|
+
return path46.resolve(context.cwd ?? process.cwd(), "src");
|
|
6603
6738
|
}
|
|
6604
6739
|
|
|
6605
6740
|
// eslint/rules/package-json/ci-checks.ts
|
|
6606
|
-
import { existsSync as existsSync6, readFileSync as
|
|
6607
|
-
import
|
|
6741
|
+
import { existsSync as existsSync6, readFileSync as readFileSync12, readdirSync as readdirSync4 } from "fs";
|
|
6742
|
+
import path47 from "path";
|
|
6608
6743
|
import { parse as parse2 } from "yaml";
|
|
6609
6744
|
function mapping(value) {
|
|
6610
6745
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? Object.fromEntries(Object.entries(value)) : void 0;
|
|
@@ -6662,7 +6797,7 @@ function readWorkflows(dir) {
|
|
|
6662
6797
|
const errors = [];
|
|
6663
6798
|
for (const file of readdirSync4(dir).filter((name) => /\.ya?ml$/i.test(name)).sort()) {
|
|
6664
6799
|
try {
|
|
6665
|
-
const parsed = parse2(
|
|
6800
|
+
const parsed = parse2(readFileSync12(path47.join(dir, file), "utf8"), { uniqueKeys: true });
|
|
6666
6801
|
const content = mapping(parsed);
|
|
6667
6802
|
if (!content) throw new Error("expected a YAML mapping");
|
|
6668
6803
|
workflows.push(content);
|
|
@@ -6684,7 +6819,7 @@ var ciChecksRule = {
|
|
|
6684
6819
|
return {
|
|
6685
6820
|
Document(node) {
|
|
6686
6821
|
if (!context.filename.endsWith("package.json")) return;
|
|
6687
|
-
const dir =
|
|
6822
|
+
const dir = path47.join(context.cwd, ".github", "workflows");
|
|
6688
6823
|
if (!existsSync6(dir)) return;
|
|
6689
6824
|
const report3 = (message) => {
|
|
6690
6825
|
context.report({ node, message });
|
|
@@ -6946,8 +7081,8 @@ var nextjsStackRule = {
|
|
|
6946
7081
|
};
|
|
6947
7082
|
|
|
6948
7083
|
// eslint/rules/package-json/vitest-coverage.ts
|
|
6949
|
-
import { existsSync as existsSync7, readFileSync as
|
|
6950
|
-
import
|
|
7084
|
+
import { existsSync as existsSync7, readFileSync as readFileSync13 } from "fs";
|
|
7085
|
+
import path48 from "path";
|
|
6951
7086
|
function memberName6(member) {
|
|
6952
7087
|
return member.name.type === "String" ? member.name.value : member.name.name;
|
|
6953
7088
|
}
|
|
@@ -7017,7 +7152,7 @@ var vitestCoverageRule = {
|
|
|
7017
7152
|
message: 'package.json must declare a "test:unit:coverage" script that runs Vitest with coverage.'
|
|
7018
7153
|
});
|
|
7019
7154
|
}
|
|
7020
|
-
const configName = VITEST_CONFIG_NAMES.find((name) => existsSync7(
|
|
7155
|
+
const configName = VITEST_CONFIG_NAMES.find((name) => existsSync7(path48.join(context.cwd, name)));
|
|
7021
7156
|
if (!configName) {
|
|
7022
7157
|
context.report({
|
|
7023
7158
|
node,
|
|
@@ -7025,7 +7160,7 @@ var vitestCoverageRule = {
|
|
|
7025
7160
|
});
|
|
7026
7161
|
return;
|
|
7027
7162
|
}
|
|
7028
|
-
const content =
|
|
7163
|
+
const content = readFileSync13(path48.join(context.cwd, configName), "utf8");
|
|
7029
7164
|
for (const metric of THRESHOLD_METRICS) {
|
|
7030
7165
|
if (!new RegExp(`\\b${metric}\\s*:\\s*[1-9]\\d*`).test(content)) {
|
|
7031
7166
|
context.report({ node, message: `${configName} must set a coverage threshold above zero for ${metric}.` });
|
|
@@ -7072,8 +7207,8 @@ var nextjsPackageJsonRules = {
|
|
|
7072
7207
|
};
|
|
7073
7208
|
|
|
7074
7209
|
// eslint/rules/prefer-enum.ts
|
|
7075
|
-
import
|
|
7076
|
-
import
|
|
7210
|
+
import path49 from "path";
|
|
7211
|
+
import ts11 from "typescript";
|
|
7077
7212
|
function isConstAssertion(node) {
|
|
7078
7213
|
const typeAnnotation = node.typeAnnotation;
|
|
7079
7214
|
return typeAnnotation?.type === "TSTypeReference" && typeAnnotation.typeName?.type === "Identifier" && typeAnnotation.typeName.name === "const";
|
|
@@ -7127,13 +7262,13 @@ function isLiteralTupleAssertion(node) {
|
|
|
7127
7262
|
return values.every((value) => value !== void 0) && new Set(values).size >= 2;
|
|
7128
7263
|
}
|
|
7129
7264
|
function isTsLiteralTupleDeclaration(declaration) {
|
|
7130
|
-
if (!
|
|
7265
|
+
if (!ts11.isVariableDeclaration(declaration) || !declaration.initializer) return false;
|
|
7131
7266
|
const init = declaration.initializer;
|
|
7132
|
-
if (!
|
|
7267
|
+
if (!ts11.isAsExpression(init) || !ts11.isTypeReferenceNode(init.type) || !ts11.isIdentifier(init.type.typeName) || init.type.typeName.text !== "const" || !ts11.isArrayLiteralExpression(init.expression) || init.expression.elements.length < 2) {
|
|
7133
7268
|
return false;
|
|
7134
7269
|
}
|
|
7135
7270
|
const values = init.expression.elements.map(
|
|
7136
|
-
(element) =>
|
|
7271
|
+
(element) => ts11.isStringLiteral(element) || ts11.isNumericLiteral(element) ? element.text : void 0
|
|
7137
7272
|
);
|
|
7138
7273
|
return values.every((value) => value !== void 0) && new Set(values).size >= 2;
|
|
7139
7274
|
}
|
|
@@ -7146,9 +7281,9 @@ var preferEnumRule = {
|
|
|
7146
7281
|
}
|
|
7147
7282
|
},
|
|
7148
7283
|
create(context) {
|
|
7149
|
-
const filename =
|
|
7284
|
+
const filename = path49.resolve(context.filename);
|
|
7150
7285
|
const sourceRoot = sourceRootOf(context);
|
|
7151
|
-
if (!filename.startsWith(sourceRoot +
|
|
7286
|
+
if (!filename.startsWith(sourceRoot + path49.sep)) return {};
|
|
7152
7287
|
const objectSchemas = /* @__PURE__ */ new Map();
|
|
7153
7288
|
const literalTuples = /* @__PURE__ */ new Set();
|
|
7154
7289
|
const enumTupleUses = [];
|
|
@@ -7162,7 +7297,7 @@ var preferEnumRule = {
|
|
|
7162
7297
|
const checker = services.program.getTypeChecker();
|
|
7163
7298
|
const symbol = checker.getSymbolAtLocation(tsNode);
|
|
7164
7299
|
if (!symbol) return false;
|
|
7165
|
-
const original = symbol.flags ===
|
|
7300
|
+
const original = symbol.flags === ts11.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
|
|
7166
7301
|
return (original.declarations ?? []).some(isTsLiteralTupleDeclaration);
|
|
7167
7302
|
}
|
|
7168
7303
|
return {
|
|
@@ -7257,7 +7392,7 @@ var preferEnumRule = {
|
|
|
7257
7392
|
};
|
|
7258
7393
|
|
|
7259
7394
|
// eslint/rules/prefer-object-destructuring.ts
|
|
7260
|
-
import
|
|
7395
|
+
import ts12 from "typescript";
|
|
7261
7396
|
var DOC7 = "See docs/next-codebase-guide/rules/redundant-aliases-rule.md";
|
|
7262
7397
|
function hasTypeAnnotation(identifier) {
|
|
7263
7398
|
return "typeAnnotation" in identifier && identifier.typeAnnotation !== void 0;
|
|
@@ -7350,8 +7485,8 @@ function enumValueResolver(context) {
|
|
|
7350
7485
|
const checker = services.program.getTypeChecker();
|
|
7351
7486
|
const { esTreeNodeToTSNodeMap: nodeMap } = services;
|
|
7352
7487
|
const isEnumSymbol = (symbol) => {
|
|
7353
|
-
const resolved = symbol.flags ===
|
|
7354
|
-
return (resolved.declarations ?? []).some((declaration) =>
|
|
7488
|
+
const resolved = symbol.flags === ts12.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
|
|
7489
|
+
return (resolved.declarations ?? []).some((declaration) => ts12.isEnumDeclaration(declaration));
|
|
7355
7490
|
};
|
|
7356
7491
|
return (node) => {
|
|
7357
7492
|
const tsNode = nodeMap.get(node);
|
|
@@ -7367,18 +7502,18 @@ function detachableCallResolver(context) {
|
|
|
7367
7502
|
if (!services) return () => false;
|
|
7368
7503
|
const checker = services.program.getTypeChecker();
|
|
7369
7504
|
const { esTreeNodeToTSNodeMap: nodeMap } = services;
|
|
7370
|
-
const isUnboundFunctionType = (type) =>
|
|
7505
|
+
const isUnboundFunctionType = (type) => ts12.isFunctionTypeNode(type) && !type.parameters.some((parameter) => ts12.isIdentifier(parameter.name) && parameter.name.text === "this");
|
|
7371
7506
|
return (member) => {
|
|
7372
7507
|
const node = nodeMap.get(member);
|
|
7373
|
-
if (!node || !
|
|
7508
|
+
if (!node || !ts12.isPropertyAccessExpression(node)) return false;
|
|
7374
7509
|
const symbol = checker.getSymbolAtLocation(node.name);
|
|
7375
7510
|
const declarations = symbol?.declarations;
|
|
7376
7511
|
if (!declarations?.length) return false;
|
|
7377
7512
|
return declarations.every((declaration) => {
|
|
7378
|
-
if (
|
|
7379
|
-
return declaration.type !== void 0 && isUnboundFunctionType(declaration.type) ||
|
|
7513
|
+
if (ts12.isPropertySignature(declaration) || ts12.isPropertyDeclaration(declaration)) {
|
|
7514
|
+
return declaration.type !== void 0 && isUnboundFunctionType(declaration.type) || ts12.isPropertyDeclaration(declaration) && declaration.initializer !== void 0 && ts12.isArrowFunction(declaration.initializer);
|
|
7380
7515
|
}
|
|
7381
|
-
if (
|
|
7516
|
+
if (ts12.isPropertyAssignment(declaration)) return ts12.isArrowFunction(declaration.initializer);
|
|
7382
7517
|
return false;
|
|
7383
7518
|
});
|
|
7384
7519
|
};
|
|
@@ -7798,7 +7933,7 @@ ${indentation}`;
|
|
|
7798
7933
|
};
|
|
7799
7934
|
|
|
7800
7935
|
// eslint/rules/pure-function-extract.ts
|
|
7801
|
-
import
|
|
7936
|
+
import path50 from "path";
|
|
7802
7937
|
var ROUTE_HANDLER_EXPORT_NAMES = /* @__PURE__ */ new Set([
|
|
7803
7938
|
"GET",
|
|
7804
7939
|
"POST",
|
|
@@ -7863,12 +7998,12 @@ var pureFunctionExtractRule = {
|
|
|
7863
7998
|
},
|
|
7864
7999
|
create(context) {
|
|
7865
8000
|
const filename = context.filename;
|
|
7866
|
-
const isRouteFile =
|
|
8001
|
+
const isRouteFile = path50.basename(filename) === "route.ts";
|
|
7867
8002
|
const isComponentFile = filename.endsWith(".tsx") || filename.endsWith(".jsx");
|
|
7868
8003
|
const sourceRoot = sourceRootOf(context);
|
|
7869
|
-
const relative =
|
|
8004
|
+
const relative = path50.relative(sourceRoot, filename);
|
|
7870
8005
|
if (relative.startsWith("..")) return {};
|
|
7871
|
-
const segments = relative.split(
|
|
8006
|
+
const segments = relative.split(path50.sep);
|
|
7872
8007
|
const folders = segments.slice(0, -1);
|
|
7873
8008
|
const isHookSupportFile = folders.includes("hooks") && /\.(?:[cm]?[jt]s)$/.test(filename);
|
|
7874
8009
|
if (!isComponentFile && !isRouteFile && !isHookSupportFile) return {};
|
|
@@ -7928,15 +8063,15 @@ var pureFunctionExtractRule = {
|
|
|
7928
8063
|
};
|
|
7929
8064
|
|
|
7930
8065
|
// eslint/rules/repeated-numeric-value.ts
|
|
7931
|
-
import
|
|
8066
|
+
import path51 from "path";
|
|
7932
8067
|
function isNonProductionFile(file, sourceRoot) {
|
|
7933
|
-
const relative =
|
|
7934
|
-
const segments = relative.split(
|
|
7935
|
-
const basename =
|
|
8068
|
+
const relative = path51.relative(sourceRoot, file);
|
|
8069
|
+
const segments = relative.split(path51.sep);
|
|
8070
|
+
const basename = path51.basename(file);
|
|
7936
8071
|
return /\.(?:test|spec|mock)\.[^.]+$/.test(basename) || segments.some((segment) => segment === "__tests__" || segment === "__mocks__" || segment === "mocks");
|
|
7937
8072
|
}
|
|
7938
8073
|
function isCanonicalConstantFile(file, sourceRoot) {
|
|
7939
|
-
const segments =
|
|
8074
|
+
const segments = path51.relative(sourceRoot, file).split(path51.sep);
|
|
7940
8075
|
return segments.includes("constants") || segments[0] === "config";
|
|
7941
8076
|
}
|
|
7942
8077
|
function groupKey(literal) {
|
|
@@ -7952,7 +8087,7 @@ var repeatedNumericValueRule = {
|
|
|
7952
8087
|
},
|
|
7953
8088
|
create(context) {
|
|
7954
8089
|
const sourceRoot = sourceRootOf(context);
|
|
7955
|
-
const file =
|
|
8090
|
+
const file = path51.resolve(context.filename);
|
|
7956
8091
|
if (isNonProductionFile(file, sourceRoot) || isCanonicalConstantFile(file, sourceRoot)) return {};
|
|
7957
8092
|
const index = getProjectIndex(sourceRoot);
|
|
7958
8093
|
if (!index) return {};
|
|
@@ -7989,11 +8124,11 @@ var repeatedNumericValueRule = {
|
|
|
7989
8124
|
};
|
|
7990
8125
|
|
|
7991
8126
|
// eslint/rules/repeated-semantic-literal.ts
|
|
7992
|
-
import
|
|
8127
|
+
import path53 from "path";
|
|
7993
8128
|
|
|
7994
8129
|
// eslint/rules/imported-enum-literals.ts
|
|
7995
|
-
import
|
|
7996
|
-
import
|
|
8130
|
+
import path52 from "path";
|
|
8131
|
+
import ts13 from "typescript";
|
|
7997
8132
|
var columnMethods2 = /* @__PURE__ */ new Set([
|
|
7998
8133
|
"eq",
|
|
7999
8134
|
"neq",
|
|
@@ -8010,12 +8145,12 @@ var columnMethods2 = /* @__PURE__ */ new Set([
|
|
|
8010
8145
|
"not"
|
|
8011
8146
|
]);
|
|
8012
8147
|
function memberName7(name) {
|
|
8013
|
-
if (
|
|
8148
|
+
if (ts13.isIdentifier(name) || ts13.isStringLiteral(name)) return name.text;
|
|
8014
8149
|
return void 0;
|
|
8015
8150
|
}
|
|
8016
8151
|
function isWithin3(root, file) {
|
|
8017
|
-
const relative =
|
|
8018
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
8152
|
+
const relative = path52.relative(root, file);
|
|
8153
|
+
return relative === "" || !relative.startsWith("..") && !path52.isAbsolute(relative);
|
|
8019
8154
|
}
|
|
8020
8155
|
function domainOf(name) {
|
|
8021
8156
|
if (name.endsWith("ColumnEnum")) return "column";
|
|
@@ -8025,22 +8160,22 @@ function domainOf(name) {
|
|
|
8025
8160
|
function importedEnums(file, checker, sourceRoot, importedNames) {
|
|
8026
8161
|
const matches = /* @__PURE__ */ new Map();
|
|
8027
8162
|
for (const statement of file.statements) {
|
|
8028
|
-
if (!
|
|
8163
|
+
if (!ts13.isImportDeclaration(statement) || !statement.importClause?.namedBindings || !ts13.isNamedImports(statement.importClause.namedBindings)) {
|
|
8029
8164
|
continue;
|
|
8030
8165
|
}
|
|
8031
8166
|
for (const specifier of statement.importClause.namedBindings.elements) {
|
|
8032
8167
|
if (!importedNames.has(specifier.name.text)) continue;
|
|
8033
8168
|
const symbol = checker.getSymbolAtLocation(specifier.name);
|
|
8034
8169
|
if (!symbol) continue;
|
|
8035
|
-
const resolved = symbol.flags ===
|
|
8170
|
+
const resolved = symbol.flags === ts13.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
|
|
8036
8171
|
for (const declaration of resolved.declarations ?? []) {
|
|
8037
|
-
if (!
|
|
8038
|
-
const declarationFile =
|
|
8172
|
+
if (!ts13.isEnumDeclaration(declaration)) continue;
|
|
8173
|
+
const declarationFile = path52.resolve(declaration.getSourceFile().fileName);
|
|
8039
8174
|
if (!isWithin3(sourceRoot, declarationFile)) continue;
|
|
8040
8175
|
const domain = domainOf(declaration.name.text);
|
|
8041
8176
|
if (!domain) continue;
|
|
8042
8177
|
for (const member of declaration.members) {
|
|
8043
|
-
if (!member.initializer || !
|
|
8178
|
+
if (!member.initializer || !ts13.isStringLiteral(member.initializer)) continue;
|
|
8044
8179
|
const name = memberName7(member.name);
|
|
8045
8180
|
if (!name) continue;
|
|
8046
8181
|
const entries = matches.get(member.initializer.text) ?? [];
|
|
@@ -8057,25 +8192,25 @@ function importedEnums(file, checker, sourceRoot, importedNames) {
|
|
|
8057
8192
|
return matches;
|
|
8058
8193
|
}
|
|
8059
8194
|
function isPathname2(node) {
|
|
8060
|
-
return
|
|
8195
|
+
return ts13.isPropertyAccessExpression(node) && node.name.text === "pathname";
|
|
8061
8196
|
}
|
|
8062
8197
|
function domainForUse(node) {
|
|
8063
8198
|
const parent = node.parent;
|
|
8064
|
-
if (
|
|
8199
|
+
if (ts13.isPropertyAssignment(parent) && parent.initializer === node && memberName7(parent.name) === "path") {
|
|
8065
8200
|
return "route";
|
|
8066
8201
|
}
|
|
8067
|
-
if (
|
|
8202
|
+
if (ts13.isCallExpression(parent) && parent.arguments[0] === node && ts13.isPropertyAccessExpression(parent.expression)) {
|
|
8068
8203
|
const { expression, name } = parent.expression;
|
|
8069
8204
|
if (columnMethods2.has(name.text)) return "column";
|
|
8070
8205
|
if (name.text === "startsWith" && isPathname2(expression)) return "route";
|
|
8071
8206
|
}
|
|
8072
|
-
if (
|
|
8207
|
+
if (ts13.isBinaryExpression(parent) && (parent.operatorToken.kind === ts13.SyntaxKind.EqualsEqualsEqualsToken || parent.operatorToken.kind === ts13.SyntaxKind.ExclamationEqualsEqualsToken) && (parent.left === node && isPathname2(parent.right) || parent.right === node && isPathname2(parent.left))) {
|
|
8073
8208
|
return "route";
|
|
8074
8209
|
}
|
|
8075
8210
|
return void 0;
|
|
8076
8211
|
}
|
|
8077
8212
|
function importedEnumLiteralUses(context, root) {
|
|
8078
|
-
const filename =
|
|
8213
|
+
const filename = path52.resolve(context.filename);
|
|
8079
8214
|
if (!isWithin3(root, filename)) return [];
|
|
8080
8215
|
const services = typedParserServices(context.sourceCode.parserServices);
|
|
8081
8216
|
if (!services) return [];
|
|
@@ -8091,7 +8226,7 @@ function importedEnumLiteralUses(context, root) {
|
|
|
8091
8226
|
if (matches.size === 0) return [];
|
|
8092
8227
|
const uses = [];
|
|
8093
8228
|
const visit = (node) => {
|
|
8094
|
-
if (
|
|
8229
|
+
if (ts13.isStringLiteral(node)) {
|
|
8095
8230
|
const domain = domainForUse(node);
|
|
8096
8231
|
const candidates = matches.get(node.text)?.filter((entry) => entry.domain === domain) ?? [];
|
|
8097
8232
|
if (candidates.length === 1) {
|
|
@@ -8108,7 +8243,7 @@ function importedEnumLiteralUses(context, root) {
|
|
|
8108
8243
|
}
|
|
8109
8244
|
}
|
|
8110
8245
|
}
|
|
8111
|
-
|
|
8246
|
+
ts13.forEachChild(node, visit);
|
|
8112
8247
|
};
|
|
8113
8248
|
visit(file);
|
|
8114
8249
|
return uses;
|
|
@@ -8129,7 +8264,7 @@ function canonicalMatches(use, canonical, sourceRoot) {
|
|
|
8129
8264
|
const semanticName2 = use.family.split(":")[1];
|
|
8130
8265
|
if (!semanticName2 || !name.toLowerCase().includes(semanticName2.toLowerCase())) return false;
|
|
8131
8266
|
const location = featureOf(canonical.file, sourceRoot);
|
|
8132
|
-
return location === featureOf(use.file, sourceRoot) ||
|
|
8267
|
+
return location === featureOf(use.file, sourceRoot) || path53.relative(sourceRoot, canonical.file).split(path53.sep)[0] === "constants";
|
|
8133
8268
|
}
|
|
8134
8269
|
return false;
|
|
8135
8270
|
}
|
|
@@ -8143,7 +8278,7 @@ function messageFor(use, matches, duplicateRouteDomains, existingRouteEnum, root
|
|
|
8143
8278
|
const count = new Set(matches.map((match) => match.file)).size;
|
|
8144
8279
|
const kind = use.kind === "string" ? "string" : "numeric";
|
|
8145
8280
|
if (use.family === "api-route" && existingRouteEnum?.owner) {
|
|
8146
|
-
const location =
|
|
8281
|
+
const location = path53.relative(root, existingRouteEnum.file).replaceAll(path53.sep, "/");
|
|
8147
8282
|
return `The route ${formatValue(use)} repeats; add a member to existing ${existingRouteEnum.owner} in src/${location} and reuse it. ${DOC8}`;
|
|
8148
8283
|
}
|
|
8149
8284
|
if (count === 1) {
|
|
@@ -8162,7 +8297,7 @@ var repeatedSemanticLiteralRule = {
|
|
|
8162
8297
|
},
|
|
8163
8298
|
create(context) {
|
|
8164
8299
|
const root = sourceRootOf(context);
|
|
8165
|
-
const file =
|
|
8300
|
+
const file = path53.resolve(context.filename);
|
|
8166
8301
|
if (!isProductionSource(file, root)) return {};
|
|
8167
8302
|
const project = getProjectIndex(root);
|
|
8168
8303
|
if (!project?.modules.has(file)) return {};
|
|
@@ -8207,7 +8342,7 @@ var repeatedSemanticLiteralRule = {
|
|
|
8207
8342
|
return {
|
|
8208
8343
|
Program(node) {
|
|
8209
8344
|
for (const use of imported) {
|
|
8210
|
-
const relative =
|
|
8345
|
+
const relative = path53.relative(root, use.sourceFile).replaceAll(path53.sep, "/");
|
|
8211
8346
|
context.report({
|
|
8212
8347
|
node,
|
|
8213
8348
|
loc: { line: use.line, column: use.column },
|
|
@@ -8222,7 +8357,7 @@ var repeatedSemanticLiteralRule = {
|
|
|
8222
8357
|
if (candidates.length === 1) {
|
|
8223
8358
|
const canonical = candidates[0];
|
|
8224
8359
|
if (!canonical) continue;
|
|
8225
|
-
const relative =
|
|
8360
|
+
const relative = path53.relative(root, canonical.file).replaceAll(path53.sep, "/");
|
|
8226
8361
|
context.report({
|
|
8227
8362
|
node,
|
|
8228
8363
|
loc: { line: use.line, column: use.column },
|
|
@@ -8235,7 +8370,7 @@ var repeatedSemanticLiteralRule = {
|
|
|
8235
8370
|
const peers = groups.get(key) ?? [];
|
|
8236
8371
|
if (peers.length < 2) {
|
|
8237
8372
|
if (use.family === "api-route" && existingRouteEnum?.owner) {
|
|
8238
|
-
const location =
|
|
8373
|
+
const location = path53.relative(root, existingRouteEnum.file).replaceAll(path53.sep, "/");
|
|
8239
8374
|
context.report({
|
|
8240
8375
|
node,
|
|
8241
8376
|
loc: { line: use.line, column: use.column },
|
|
@@ -8447,7 +8582,7 @@ var repeatedStructureRule = {
|
|
|
8447
8582
|
|
|
8448
8583
|
// eslint/rules/require-barrel-star-exports.ts
|
|
8449
8584
|
import fs5 from "fs";
|
|
8450
|
-
import
|
|
8585
|
+
import path54 from "path";
|
|
8451
8586
|
var SUPPORT_FOLDERS3 = /* @__PURE__ */ new Set(["constants", "types", "schemas"]);
|
|
8452
8587
|
var INDEX_NAMES = /* @__PURE__ */ new Set(["index.ts", "index.tsx", "index.mts", "index.cts"]);
|
|
8453
8588
|
var MODULE_EXTENSIONS3 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
@@ -8455,9 +8590,9 @@ function resolveSiblingModule(indexFile, specifier) {
|
|
|
8455
8590
|
if (!specifier.startsWith("./")) return void 0;
|
|
8456
8591
|
const relative = specifier.slice(2);
|
|
8457
8592
|
if (!relative || relative.includes("/")) return void 0;
|
|
8458
|
-
const directory =
|
|
8459
|
-
const direct =
|
|
8460
|
-
const candidates =
|
|
8593
|
+
const directory = path54.dirname(indexFile);
|
|
8594
|
+
const direct = path54.resolve(directory, relative);
|
|
8595
|
+
const candidates = path54.extname(direct) ? [direct] : MODULE_EXTENSIONS3.map((extension) => `${direct}${extension}`);
|
|
8461
8596
|
return candidates.find((candidate) => fs5.existsSync(candidate) && fs5.statSync(candidate).isFile());
|
|
8462
8597
|
}
|
|
8463
8598
|
var requireBarrelStarExportsRule = {
|
|
@@ -8470,9 +8605,9 @@ var requireBarrelStarExportsRule = {
|
|
|
8470
8605
|
fixable: "code"
|
|
8471
8606
|
},
|
|
8472
8607
|
create(context) {
|
|
8473
|
-
const filename =
|
|
8474
|
-
if (!INDEX_NAMES.has(
|
|
8475
|
-
if (!SUPPORT_FOLDERS3.has(
|
|
8608
|
+
const filename = path54.resolve(context.filename);
|
|
8609
|
+
if (!INDEX_NAMES.has(path54.basename(filename))) return {};
|
|
8610
|
+
if (!SUPPORT_FOLDERS3.has(path54.basename(path54.dirname(filename)))) return {};
|
|
8476
8611
|
return {
|
|
8477
8612
|
ExportNamedDeclaration(node) {
|
|
8478
8613
|
const sourceNode = node.source;
|
|
@@ -8525,7 +8660,7 @@ var requireBarrelStarExportsRule = {
|
|
|
8525
8660
|
};
|
|
8526
8661
|
|
|
8527
8662
|
// eslint/rules/root-support-placement.ts
|
|
8528
|
-
import
|
|
8663
|
+
import path55 from "path";
|
|
8529
8664
|
function isSupportFolder(value) {
|
|
8530
8665
|
return value === "utils" || value === "types" || value === "schemas" || value === "constants";
|
|
8531
8666
|
}
|
|
@@ -8558,7 +8693,7 @@ var rootSupportPlacementRule = {
|
|
|
8558
8693
|
},
|
|
8559
8694
|
create(context) {
|
|
8560
8695
|
const sourceRoot = sourceRootOf(context);
|
|
8561
|
-
const file =
|
|
8696
|
+
const file = path55.resolve(context.filename);
|
|
8562
8697
|
const segments = segmentsOf(file, sourceRoot);
|
|
8563
8698
|
const folderSegments = folderSegmentsOf(file, sourceRoot);
|
|
8564
8699
|
const supportFolder = folderSegments[folderSegments.length - 1];
|
|
@@ -8604,11 +8739,11 @@ var rootSupportPlacementRule = {
|
|
|
8604
8739
|
};
|
|
8605
8740
|
|
|
8606
8741
|
// eslint/rules/route-handler-shape.ts
|
|
8607
|
-
import
|
|
8608
|
-
import
|
|
8742
|
+
import path57 from "path";
|
|
8743
|
+
import ts14 from "typescript";
|
|
8609
8744
|
|
|
8610
8745
|
// eslint/rules/route-single-use-delegation.ts
|
|
8611
|
-
import
|
|
8746
|
+
import path56 from "path";
|
|
8612
8747
|
function responseCall(expression) {
|
|
8613
8748
|
if (!expression) return void 0;
|
|
8614
8749
|
if (expression.type === "AwaitExpression") return responseCall(expression.argument);
|
|
@@ -8650,7 +8785,7 @@ function soleDelegation(handler) {
|
|
|
8650
8785
|
return isData && property.value.type === "Identifier" && property.value.name === variable.id.name ? call : void 0;
|
|
8651
8786
|
}
|
|
8652
8787
|
function isTestFile2(file) {
|
|
8653
|
-
return /(?:\.test|\.spec)\.[cm]?[jt]sx?$/.test(file) ||
|
|
8788
|
+
return /(?:\.test|\.spec)\.[cm]?[jt]sx?$/.test(file) || path56.normalize(file).split(path56.sep).includes("__tests__");
|
|
8654
8789
|
}
|
|
8655
8790
|
function functionSource(index, file, name, sourceRoot, visited = /* @__PURE__ */ new Set()) {
|
|
8656
8791
|
if (visited.has(file)) return void 0;
|
|
@@ -8719,33 +8854,33 @@ function findHandler(node) {
|
|
|
8719
8854
|
return void 0;
|
|
8720
8855
|
}
|
|
8721
8856
|
function isLoop(node) {
|
|
8722
|
-
return
|
|
8857
|
+
return ts14.isForStatement(node) || ts14.isForOfStatement(node) || ts14.isForInStatement(node) || ts14.isWhileStatement(node) || ts14.isDoStatement(node);
|
|
8723
8858
|
}
|
|
8724
8859
|
function isFunctionBoundary(node) {
|
|
8725
|
-
return
|
|
8860
|
+
return ts14.isFunctionExpression(node) || ts14.isArrowFunction(node) || ts14.isFunctionDeclaration(node);
|
|
8726
8861
|
}
|
|
8727
8862
|
function analyzeHandlerBody(body, sourceText) {
|
|
8728
8863
|
const start = body.range?.[0] ?? 0;
|
|
8729
8864
|
const end = body.range?.[1] ?? sourceText.length;
|
|
8730
|
-
const sourceFile =
|
|
8865
|
+
const sourceFile = ts14.createSourceFile(
|
|
8731
8866
|
"route.ts",
|
|
8732
8867
|
sourceText.slice(start, end),
|
|
8733
|
-
|
|
8868
|
+
ts14.ScriptTarget.Latest,
|
|
8734
8869
|
true,
|
|
8735
|
-
|
|
8870
|
+
ts14.ScriptKind.TS
|
|
8736
8871
|
);
|
|
8737
8872
|
const kinds = /* @__PURE__ */ new Set();
|
|
8738
8873
|
const calledNames = /* @__PURE__ */ new Set();
|
|
8739
8874
|
const visit = (node) => {
|
|
8740
|
-
if (
|
|
8875
|
+
if (ts14.isTryStatement(node)) kinds.add("try");
|
|
8741
8876
|
if (isLoop(node)) kinds.add("loop");
|
|
8742
|
-
if (
|
|
8743
|
-
if (
|
|
8877
|
+
if (ts14.isIfStatement(node)) kinds.add("if");
|
|
8878
|
+
if (ts14.isCallExpression(node) && ts14.isPropertyAccessExpression(node.expression) && node.expression.name.text === "map") {
|
|
8744
8879
|
kinds.add("map");
|
|
8745
8880
|
}
|
|
8746
|
-
if (
|
|
8881
|
+
if (ts14.isCallExpression(node) && ts14.isIdentifier(node.expression)) calledNames.add(node.expression.text);
|
|
8747
8882
|
if (isFunctionBoundary(node)) return;
|
|
8748
|
-
|
|
8883
|
+
ts14.forEachChild(node, visit);
|
|
8749
8884
|
};
|
|
8750
8885
|
visit(sourceFile);
|
|
8751
8886
|
return { kinds, calledNames };
|
|
@@ -8785,7 +8920,7 @@ var routeHandlerShapeRule = {
|
|
|
8785
8920
|
}
|
|
8786
8921
|
},
|
|
8787
8922
|
create(context) {
|
|
8788
|
-
if (
|
|
8923
|
+
if (path57.basename(context.filename) !== "route.ts") return {};
|
|
8789
8924
|
const sourceText = context.sourceCode.text;
|
|
8790
8925
|
function reportUnwrapped(node, name) {
|
|
8791
8926
|
context.report({
|
|
@@ -8851,7 +8986,7 @@ var routeHandlerShapeRule = {
|
|
|
8851
8986
|
};
|
|
8852
8987
|
|
|
8853
8988
|
// eslint/rules/schema-casing.ts
|
|
8854
|
-
import
|
|
8989
|
+
import path58 from "path";
|
|
8855
8990
|
function isCamelCase(name) {
|
|
8856
8991
|
return /^[a-z][a-zA-Z0-9]*$/.test(name);
|
|
8857
8992
|
}
|
|
@@ -8879,9 +9014,9 @@ var schemaCasingRule = {
|
|
|
8879
9014
|
}
|
|
8880
9015
|
},
|
|
8881
9016
|
create(context) {
|
|
8882
|
-
const filename =
|
|
9017
|
+
const filename = path58.resolve(context.filename);
|
|
8883
9018
|
const sourceRoot = sourceRootOf(context);
|
|
8884
|
-
if (!filename.startsWith(sourceRoot +
|
|
9019
|
+
if (!filename.startsWith(sourceRoot + path58.sep)) return {};
|
|
8885
9020
|
let zodLocalName;
|
|
8886
9021
|
return {
|
|
8887
9022
|
ImportDeclaration(node) {
|
|
@@ -8913,39 +9048,39 @@ var schemaCasingRule = {
|
|
|
8913
9048
|
};
|
|
8914
9049
|
|
|
8915
9050
|
// eslint/rules/sole-state-owner.ts
|
|
8916
|
-
import
|
|
8917
|
-
import
|
|
9051
|
+
import path59 from "path";
|
|
9052
|
+
import ts15 from "typescript";
|
|
8918
9053
|
function findStateHooks(node) {
|
|
8919
9054
|
const hooks = [];
|
|
8920
9055
|
const visit = (child) => {
|
|
8921
|
-
if (
|
|
8922
|
-
if (
|
|
9056
|
+
if (ts15.isCallExpression(child) && ts15.isIdentifier(child.expression) && child.expression.text === "useState") {
|
|
9057
|
+
if (ts15.isVariableDeclaration(child.parent)) {
|
|
8923
9058
|
const { name } = child.parent;
|
|
8924
|
-
if (
|
|
9059
|
+
if (ts15.isArrayBindingPattern(name) && name.elements.length >= 2) {
|
|
8925
9060
|
const value = name.elements[0];
|
|
8926
9061
|
const updater = name.elements[1];
|
|
8927
|
-
if (value && updater &&
|
|
9062
|
+
if (value && updater && ts15.isBindingElement(value) && ts15.isBindingElement(updater)) {
|
|
8928
9063
|
const valueName = value.name;
|
|
8929
9064
|
const updaterName = updater.name;
|
|
8930
|
-
if (
|
|
9065
|
+
if (ts15.isIdentifier(valueName) && ts15.isIdentifier(updaterName)) {
|
|
8931
9066
|
hooks.push({ value: valueName.text, updater: updaterName.text });
|
|
8932
9067
|
}
|
|
8933
9068
|
}
|
|
8934
9069
|
}
|
|
8935
9070
|
}
|
|
8936
9071
|
}
|
|
8937
|
-
|
|
9072
|
+
ts15.forEachChild(child, visit);
|
|
8938
9073
|
};
|
|
8939
9074
|
visit(node);
|
|
8940
9075
|
return hooks;
|
|
8941
9076
|
}
|
|
8942
9077
|
function isHookUsage(node, hook) {
|
|
8943
|
-
if (
|
|
9078
|
+
if (ts15.isCallExpression(node) && ts15.isIdentifier(node.expression) && node.expression.text === hook.updater) {
|
|
8944
9079
|
return "updater";
|
|
8945
9080
|
}
|
|
8946
|
-
if (
|
|
9081
|
+
if (ts15.isIdentifier(node) && node.text === hook.value) {
|
|
8947
9082
|
const parent = node.parent;
|
|
8948
|
-
if (
|
|
9083
|
+
if (ts15.isBindingElement(parent) || ts15.isPropertyAccessExpression(parent) || ts15.isShorthandPropertyAssignment(parent)) {
|
|
8949
9084
|
return void 0;
|
|
8950
9085
|
}
|
|
8951
9086
|
return "value";
|
|
@@ -8955,16 +9090,16 @@ function isHookUsage(node, hook) {
|
|
|
8955
9090
|
function topLevelJsxChildren(initial) {
|
|
8956
9091
|
if (!initial) return void 0;
|
|
8957
9092
|
let expression = initial;
|
|
8958
|
-
while (
|
|
8959
|
-
if (
|
|
9093
|
+
while (ts15.isParenthesizedExpression(expression)) expression = expression.expression;
|
|
9094
|
+
if (ts15.isJsxFragment(expression)) {
|
|
8960
9095
|
const children = expression.children.filter(
|
|
8961
|
-
(c) => !
|
|
9096
|
+
(c) => !ts15.isJsxText(c) && !ts15.isJsxSpreadAttribute(c)
|
|
8962
9097
|
);
|
|
8963
9098
|
return { root: expression, children };
|
|
8964
9099
|
}
|
|
8965
|
-
if (
|
|
9100
|
+
if (ts15.isJsxElement(expression)) {
|
|
8966
9101
|
const children = expression.children.filter(
|
|
8967
|
-
(c) => !
|
|
9102
|
+
(c) => !ts15.isJsxText(c) && !ts15.isJsxSpreadAttribute(c)
|
|
8968
9103
|
);
|
|
8969
9104
|
return { root: expression, children };
|
|
8970
9105
|
}
|
|
@@ -8978,8 +9113,8 @@ function collectUsesIn(child, hook) {
|
|
|
8978
9113
|
positions.push(node);
|
|
8979
9114
|
count += 1;
|
|
8980
9115
|
}
|
|
8981
|
-
if (
|
|
8982
|
-
|
|
9116
|
+
if (ts15.isFunctionDeclaration(node) || ts15.isClassDeclaration(node)) return;
|
|
9117
|
+
ts15.forEachChild(node, visit);
|
|
8983
9118
|
};
|
|
8984
9119
|
visit(child);
|
|
8985
9120
|
return { positions, count };
|
|
@@ -8993,7 +9128,7 @@ var soleStateOwnerRule = {
|
|
|
8993
9128
|
}
|
|
8994
9129
|
},
|
|
8995
9130
|
create(context) {
|
|
8996
|
-
const filename =
|
|
9131
|
+
const filename = path59.resolve(context.filename);
|
|
8997
9132
|
if (!filename.endsWith(".tsx") && !filename.endsWith(".jsx")) return {};
|
|
8998
9133
|
const text = context.sourceCode.text;
|
|
8999
9134
|
const components = parseComponentInfo(text, filename);
|
|
@@ -9018,18 +9153,18 @@ var soleStateOwnerRule = {
|
|
|
9018
9153
|
}
|
|
9019
9154
|
};
|
|
9020
9155
|
function analyzeSoleOwner(declaration, hook) {
|
|
9021
|
-
const body =
|
|
9022
|
-
if (!body || !
|
|
9156
|
+
const body = ts15.isFunctionDeclaration(declaration) ? declaration.body : void 0;
|
|
9157
|
+
if (!body || !ts15.isBlock(body)) return void 0;
|
|
9023
9158
|
const returns = [];
|
|
9024
9159
|
const visit = (node) => {
|
|
9025
|
-
if (node !== body && (
|
|
9026
|
-
if (
|
|
9027
|
-
|
|
9160
|
+
if (node !== body && (ts15.isFunctionLike(node) || ts15.isClassLike(node))) return;
|
|
9161
|
+
if (ts15.isReturnStatement(node)) returns.push(node);
|
|
9162
|
+
ts15.forEachChild(node, visit);
|
|
9028
9163
|
};
|
|
9029
9164
|
visit(body);
|
|
9030
9165
|
if (returns.length !== 1) return void 0;
|
|
9031
9166
|
const single = returns[0];
|
|
9032
|
-
if (!single?.expression || !
|
|
9167
|
+
if (!single?.expression || !ts15.isExpression(single.expression)) return void 0;
|
|
9033
9168
|
const returnExpression = single.expression;
|
|
9034
9169
|
const root = topLevelJsxChildren(returnExpression);
|
|
9035
9170
|
if (!root || root.children.length === 0) return void 0;
|
|
@@ -9052,11 +9187,11 @@ function usesOutsideJsx(declaration, hook, children) {
|
|
|
9052
9187
|
let outside = false;
|
|
9053
9188
|
const visit = (node) => {
|
|
9054
9189
|
if (outside) return;
|
|
9055
|
-
if (node !== declaration && (
|
|
9190
|
+
if (node !== declaration && (ts15.isFunctionDeclaration(node) || ts15.isClassDeclaration(node))) return;
|
|
9056
9191
|
if (isHookUsage(node, hook)) {
|
|
9057
9192
|
let current = node;
|
|
9058
9193
|
let isInJsxChild = false;
|
|
9059
|
-
while (!
|
|
9194
|
+
while (!ts15.isSourceFile(current)) {
|
|
9060
9195
|
if (children.includes(current)) {
|
|
9061
9196
|
isInJsxChild = true;
|
|
9062
9197
|
break;
|
|
@@ -9065,14 +9200,14 @@ function usesOutsideJsx(declaration, hook, children) {
|
|
|
9065
9200
|
}
|
|
9066
9201
|
if (!isInJsxChild) outside = true;
|
|
9067
9202
|
}
|
|
9068
|
-
|
|
9203
|
+
ts15.forEachChild(node, visit);
|
|
9069
9204
|
};
|
|
9070
9205
|
visit(declaration);
|
|
9071
9206
|
return outside;
|
|
9072
9207
|
}
|
|
9073
9208
|
|
|
9074
9209
|
// eslint/rules/source-under-src.ts
|
|
9075
|
-
import
|
|
9210
|
+
import path60 from "path";
|
|
9076
9211
|
var NON_SOURCE_ROOT_DIRS = /* @__PURE__ */ new Set([
|
|
9077
9212
|
".agents",
|
|
9078
9213
|
".cache",
|
|
@@ -9113,14 +9248,14 @@ var sourceUnderSrcRule = {
|
|
|
9113
9248
|
}
|
|
9114
9249
|
},
|
|
9115
9250
|
create(context) {
|
|
9116
|
-
const filename =
|
|
9251
|
+
const filename = path60.resolve(context.filename);
|
|
9117
9252
|
if (!MODULE_EXTENSION.test(filename)) return {};
|
|
9118
|
-
const relative =
|
|
9253
|
+
const relative = path60.relative(context.cwd, filename).replace(/\\/g, "/");
|
|
9119
9254
|
if (relative === "src" || relative.startsWith("src/")) return {};
|
|
9120
9255
|
const topLevel = relative.split("/")[0] ?? "";
|
|
9121
9256
|
if (NON_SOURCE_ROOT_DIRS.has(topLevel)) return {};
|
|
9122
9257
|
if (!relative.includes("/")) {
|
|
9123
|
-
const basename =
|
|
9258
|
+
const basename = path60.basename(filename);
|
|
9124
9259
|
if (CONFIG_FILE.test(basename) || DECLARATION_FILE.test(basename) || basename.startsWith(".")) return {};
|
|
9125
9260
|
}
|
|
9126
9261
|
return {
|
|
@@ -9136,7 +9271,7 @@ var sourceUnderSrcRule = {
|
|
|
9136
9271
|
};
|
|
9137
9272
|
|
|
9138
9273
|
// eslint/rules/stay-flat.ts
|
|
9139
|
-
import
|
|
9274
|
+
import path61 from "path";
|
|
9140
9275
|
var stayFlatRule = {
|
|
9141
9276
|
meta: {
|
|
9142
9277
|
schema: [],
|
|
@@ -9147,7 +9282,7 @@ var stayFlatRule = {
|
|
|
9147
9282
|
},
|
|
9148
9283
|
create(context) {
|
|
9149
9284
|
const sourceRoot = sourceRootOf(context);
|
|
9150
|
-
const file =
|
|
9285
|
+
const file = path61.resolve(context.filename);
|
|
9151
9286
|
const segments = segmentsOf(file, sourceRoot);
|
|
9152
9287
|
if (segments.length !== 3 || segments[0] !== "features") return {};
|
|
9153
9288
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -9187,7 +9322,7 @@ var stayFlatRule = {
|
|
|
9187
9322
|
};
|
|
9188
9323
|
|
|
9189
9324
|
// eslint/rules/support-file-placement.ts
|
|
9190
|
-
import
|
|
9325
|
+
import path62 from "path";
|
|
9191
9326
|
var CONFIG_OWNED_FOLDERS = /* @__PURE__ */ new Set(["types", "constants"]);
|
|
9192
9327
|
var EXPORT_KIND_BY_SUPPORT_FOLDER = /* @__PURE__ */ new Map([
|
|
9193
9328
|
["constants", "constant"],
|
|
@@ -9212,7 +9347,7 @@ var supportFilePlacementRule = {
|
|
|
9212
9347
|
},
|
|
9213
9348
|
create(context) {
|
|
9214
9349
|
const sourceRoot = sourceRootOf(context);
|
|
9215
|
-
const supportFile =
|
|
9350
|
+
const supportFile = path62.resolve(context.filename);
|
|
9216
9351
|
const currentFolder = folderSegmentsOf(supportFile, sourceRoot);
|
|
9217
9352
|
const supportFolder = currentFolder[currentFolder.length - 1];
|
|
9218
9353
|
if (supportFolder === void 0 || !SUPPORT_FOLDERS.has(supportFolder)) return {};
|
|
@@ -9266,7 +9401,7 @@ var supportFilePlacementRule = {
|
|
|
9266
9401
|
|
|
9267
9402
|
// eslint/rules/support-folder-shape.ts
|
|
9268
9403
|
import fs6 from "fs";
|
|
9269
|
-
import
|
|
9404
|
+
import path63 from "path";
|
|
9270
9405
|
var SUPPORT_FOLDERS4 = /* @__PURE__ */ new Set(["constants", "types", "schemas"]);
|
|
9271
9406
|
var INDEX_NAMES2 = /* @__PURE__ */ new Set(["index.ts", "index.tsx", "index.mts", "index.cts"]);
|
|
9272
9407
|
var supportFolderShapeRule = {
|
|
@@ -9278,12 +9413,12 @@ var supportFolderShapeRule = {
|
|
|
9278
9413
|
}
|
|
9279
9414
|
},
|
|
9280
9415
|
create(context) {
|
|
9281
|
-
const filename =
|
|
9282
|
-
const baseName =
|
|
9416
|
+
const filename = path63.resolve(context.filename);
|
|
9417
|
+
const baseName = path63.basename(filename);
|
|
9283
9418
|
if (!INDEX_NAMES2.has(baseName)) return {};
|
|
9284
|
-
const folder =
|
|
9419
|
+
const folder = path63.basename(path63.dirname(filename));
|
|
9285
9420
|
if (!SUPPORT_FOLDERS4.has(folder)) return {};
|
|
9286
|
-
const directory =
|
|
9421
|
+
const directory = path63.dirname(filename);
|
|
9287
9422
|
let entries;
|
|
9288
9423
|
try {
|
|
9289
9424
|
entries = fs6.readdirSync(directory);
|
|
@@ -9301,7 +9436,7 @@ var supportFolderShapeRule = {
|
|
|
9301
9436
|
for (const match of source.matchAll(exportPattern)) {
|
|
9302
9437
|
hasAnyReExport = true;
|
|
9303
9438
|
const specifier = match.groups?.specifier;
|
|
9304
|
-
if (specifier?.startsWith(".")) exportedFiles.add(
|
|
9439
|
+
if (specifier?.startsWith(".")) exportedFiles.add(path63.basename(specifier));
|
|
9305
9440
|
}
|
|
9306
9441
|
const guide = `docs/next-codebase-guide/rules/${folder === "constants" ? "constants" : "types-and-schemas"}-rule.md`;
|
|
9307
9442
|
if (siblingModules.length === 0) {
|
|
@@ -9480,11 +9615,11 @@ var baseLayerPairRule = {
|
|
|
9480
9615
|
|
|
9481
9616
|
// eslint/rules/tailwind/css-entry-point.ts
|
|
9482
9617
|
import { statSync as statSync4 } from "fs";
|
|
9483
|
-
import
|
|
9618
|
+
import path66 from "path";
|
|
9484
9619
|
|
|
9485
9620
|
// eslint/rules/tailwind/source-files.ts
|
|
9486
|
-
import { readdirSync as readdirSync5, readFileSync as
|
|
9487
|
-
import
|
|
9621
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync14, statSync as statSync3 } from "fs";
|
|
9622
|
+
import path64 from "path";
|
|
9488
9623
|
var CSS_EXTENSIONS = [".css"];
|
|
9489
9624
|
var MODULE_EXTENSIONS4 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
9490
9625
|
var SOURCE_EXTENSIONS = [...MODULE_EXTENSIONS4, ...CSS_EXTENSIONS];
|
|
@@ -9497,7 +9632,7 @@ function findFiles(dir, extensions) {
|
|
|
9497
9632
|
}
|
|
9498
9633
|
return entries.flatMap((entry) => {
|
|
9499
9634
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
9500
|
-
const entryPath =
|
|
9635
|
+
const entryPath = path64.join(dir, entry);
|
|
9501
9636
|
let stats;
|
|
9502
9637
|
try {
|
|
9503
9638
|
stats = statSync3(entryPath);
|
|
@@ -9505,7 +9640,7 @@ function findFiles(dir, extensions) {
|
|
|
9505
9640
|
return [];
|
|
9506
9641
|
}
|
|
9507
9642
|
if (stats.isDirectory()) return findFiles(entryPath, extensions);
|
|
9508
|
-
return extensions.includes(
|
|
9643
|
+
return extensions.includes(path64.extname(entry)) ? [entryPath] : [];
|
|
9509
9644
|
});
|
|
9510
9645
|
}
|
|
9511
9646
|
function cachedTextReader() {
|
|
@@ -9514,7 +9649,7 @@ function cachedTextReader() {
|
|
|
9514
9649
|
let text = texts.get(file);
|
|
9515
9650
|
if (text === void 0) {
|
|
9516
9651
|
try {
|
|
9517
|
-
text =
|
|
9652
|
+
text = readFileSync14(file, "utf8");
|
|
9518
9653
|
} catch {
|
|
9519
9654
|
text = "";
|
|
9520
9655
|
}
|
|
@@ -9528,7 +9663,7 @@ function escapeRegExp(text) {
|
|
|
9528
9663
|
}
|
|
9529
9664
|
|
|
9530
9665
|
// eslint/rules/tailwind/stylesheet-graph.ts
|
|
9531
|
-
import
|
|
9666
|
+
import path65 from "path";
|
|
9532
9667
|
function registersTailwind(text) {
|
|
9533
9668
|
return /@import\s+(?:url\(\s*)?["']tailwindcss["']\s*\)?/i.test(text);
|
|
9534
9669
|
}
|
|
@@ -9542,25 +9677,25 @@ function moduleImports(text, fileName) {
|
|
|
9542
9677
|
return new RegExp(`(?:import|require)\\s*\\(?\\s*["'][^"']*${escaped}["']`, "i").test(text);
|
|
9543
9678
|
}
|
|
9544
9679
|
function resolveSpecifier2(fromFile, spec, sourceRoot) {
|
|
9545
|
-
if (spec.startsWith("/")) return
|
|
9546
|
-
if (spec.startsWith("./") || spec.startsWith("../")) return
|
|
9547
|
-
if (spec.startsWith("@/")) return
|
|
9680
|
+
if (spec.startsWith("/")) return path65.resolve(spec);
|
|
9681
|
+
if (spec.startsWith("./") || spec.startsWith("../")) return path65.resolve(path65.dirname(fromFile), spec);
|
|
9682
|
+
if (spec.startsWith("@/")) return path65.resolve(sourceRoot, spec.slice(2));
|
|
9548
9683
|
return void 0;
|
|
9549
9684
|
}
|
|
9550
9685
|
function buildStylesheetGraph(options) {
|
|
9551
9686
|
const { cssFiles, sourceRoot, textOf } = options;
|
|
9552
|
-
const cssSet = new Set(cssFiles.map((file) =>
|
|
9687
|
+
const cssSet = new Set(cssFiles.map((file) => path65.normalize(file)));
|
|
9553
9688
|
const globals = cssFiles.filter((file) => registersTailwind(textOf(file)));
|
|
9554
9689
|
const reachable = /* @__PURE__ */ new Set();
|
|
9555
9690
|
const queue = [...globals];
|
|
9556
|
-
for (const global of globals) reachable.add(
|
|
9691
|
+
for (const global of globals) reachable.add(path65.normalize(global));
|
|
9557
9692
|
while (queue.length > 0) {
|
|
9558
9693
|
const from = queue.shift();
|
|
9559
9694
|
if (!from) continue;
|
|
9560
9695
|
for (const spec of importedSpecifiers(textOf(from))) {
|
|
9561
9696
|
const target = resolveSpecifier2(from, spec, sourceRoot);
|
|
9562
9697
|
if (!target) continue;
|
|
9563
|
-
const normalized =
|
|
9698
|
+
const normalized = path65.normalize(target);
|
|
9564
9699
|
if (cssSet.has(normalized) && !reachable.has(normalized)) {
|
|
9565
9700
|
reachable.add(normalized);
|
|
9566
9701
|
queue.push(normalized);
|
|
@@ -9572,7 +9707,7 @@ function buildStylesheetGraph(options) {
|
|
|
9572
9707
|
for (const spec of importedSpecifiers(textOf(global))) {
|
|
9573
9708
|
const target = resolveSpecifier2(global, spec, sourceRoot);
|
|
9574
9709
|
if (!target) continue;
|
|
9575
|
-
const normalized =
|
|
9710
|
+
const normalized = path65.normalize(target);
|
|
9576
9711
|
if (cssSet.has(normalized)) directChildren.add(normalized);
|
|
9577
9712
|
}
|
|
9578
9713
|
}
|
|
@@ -9580,8 +9715,8 @@ function buildStylesheetGraph(options) {
|
|
|
9580
9715
|
}
|
|
9581
9716
|
|
|
9582
9717
|
// eslint/rules/tailwind/css-entry-point.ts
|
|
9583
|
-
var APP_STYLES_DIR =
|
|
9584
|
-
var GLOBAL_STYLESHEET_PATH =
|
|
9718
|
+
var APP_STYLES_DIR = path66.join("app", "styles");
|
|
9719
|
+
var GLOBAL_STYLESHEET_PATH = path66.join(APP_STYLES_DIR, "globals.css");
|
|
9585
9720
|
var cssEntryPointRule = {
|
|
9586
9721
|
meta: {
|
|
9587
9722
|
schema: [],
|
|
@@ -9607,8 +9742,8 @@ var cssEntryPointRule = {
|
|
|
9607
9742
|
return {
|
|
9608
9743
|
"StyleSheet:exit"(node) {
|
|
9609
9744
|
if (globals.length === 0) return;
|
|
9610
|
-
const current =
|
|
9611
|
-
const relative =
|
|
9745
|
+
const current = path66.normalize(path66.resolve(context.filename));
|
|
9746
|
+
const relative = path66.relative(sourceRoot, current);
|
|
9612
9747
|
if (globals.includes(current)) {
|
|
9613
9748
|
if (globals.length > 1) {
|
|
9614
9749
|
context.report({
|
|
@@ -9624,7 +9759,7 @@ var cssEntryPointRule = {
|
|
|
9624
9759
|
});
|
|
9625
9760
|
return;
|
|
9626
9761
|
}
|
|
9627
|
-
const basename =
|
|
9762
|
+
const basename = path66.basename(current);
|
|
9628
9763
|
const importCount = moduleFiles.filter((modulePath) => moduleImports(textOf(modulePath), basename)).length;
|
|
9629
9764
|
if (importCount !== 1) {
|
|
9630
9765
|
context.report({
|
|
@@ -9634,7 +9769,7 @@ var cssEntryPointRule = {
|
|
|
9634
9769
|
}
|
|
9635
9770
|
return;
|
|
9636
9771
|
}
|
|
9637
|
-
const isInAppStyles = relative === APP_STYLES_DIR || relative.startsWith(`${APP_STYLES_DIR}${
|
|
9772
|
+
const isInAppStyles = relative === APP_STYLES_DIR || relative.startsWith(`${APP_STYLES_DIR}${path66.sep}`);
|
|
9638
9773
|
if (!isInAppStyles) {
|
|
9639
9774
|
context.report({
|
|
9640
9775
|
node,
|
|
@@ -9665,6 +9800,12 @@ var cssEntryPointRule = {
|
|
|
9665
9800
|
}
|
|
9666
9801
|
};
|
|
9667
9802
|
|
|
9803
|
+
// eslint/project/semantic-color-role.ts
|
|
9804
|
+
var BOUNDARY_PROPERTY_WORDS = /* @__PURE__ */ new Set(["border", "outline", "ring", "stroke"]);
|
|
9805
|
+
function violatesBoundaryColorRole(token) {
|
|
9806
|
+
return !token.endsWith("-edge") && token.split("-").some((word) => BOUNDARY_PROPERTY_WORDS.has(word));
|
|
9807
|
+
}
|
|
9808
|
+
|
|
9668
9809
|
// eslint/rules/tailwind/css-variable-naming.ts
|
|
9669
9810
|
var EDGE_PROPERTY_WORDS = /* @__PURE__ */ new Set(["border", "outline", "ring", "stroke"]);
|
|
9670
9811
|
var NON_COLOR_WORDS = /* @__PURE__ */ new Set(["height", "leading", "offset", "radius", "size", "spacing", "style", "width"]);
|
|
@@ -9712,7 +9853,15 @@ var cssVariableNamingRule = {
|
|
|
9712
9853
|
Declaration(node) {
|
|
9713
9854
|
const property = node.property;
|
|
9714
9855
|
if (!property.startsWith("--")) return;
|
|
9715
|
-
if (isTailwindThemeVariable(property))
|
|
9856
|
+
if (isTailwindThemeVariable(property)) {
|
|
9857
|
+
if (property.startsWith("--color-") && violatesBoundaryColorRole(property.slice("--color-".length))) {
|
|
9858
|
+
context.report({
|
|
9859
|
+
node,
|
|
9860
|
+
message: `Theme color "${property}" names a boundary using a CSS property; use --color-<role>-edge and border-<role>-edge instead.`
|
|
9861
|
+
});
|
|
9862
|
+
}
|
|
9863
|
+
return;
|
|
9864
|
+
}
|
|
9716
9865
|
const lower = property.toLowerCase();
|
|
9717
9866
|
if ((lower.includes("bg") || lower.includes("background")) && !lower.endsWith("-canvas")) {
|
|
9718
9867
|
context.report({
|
|
@@ -10123,7 +10272,7 @@ var tailwindRules = {
|
|
|
10123
10272
|
};
|
|
10124
10273
|
|
|
10125
10274
|
// eslint/rules/type-extraction.ts
|
|
10126
|
-
import
|
|
10275
|
+
import path67 from "path";
|
|
10127
10276
|
var typeExtractionRule = {
|
|
10128
10277
|
meta: {
|
|
10129
10278
|
schema: [],
|
|
@@ -10134,7 +10283,7 @@ var typeExtractionRule = {
|
|
|
10134
10283
|
},
|
|
10135
10284
|
create(context) {
|
|
10136
10285
|
const sourceRoot = sourceRootOf(context);
|
|
10137
|
-
const file =
|
|
10286
|
+
const file = path67.resolve(context.filename);
|
|
10138
10287
|
const segments = segmentsOf(file, sourceRoot);
|
|
10139
10288
|
if (segments.length === 0) return {};
|
|
10140
10289
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -10273,9 +10422,9 @@ var uiStateRule = {
|
|
|
10273
10422
|
};
|
|
10274
10423
|
|
|
10275
10424
|
// eslint/rules/unknown-utility.ts
|
|
10276
|
-
import { existsSync as existsSync8, readdirSync as readdirSync6, readFileSync as
|
|
10425
|
+
import { existsSync as existsSync8, readdirSync as readdirSync6, readFileSync as readFileSync15, statSync as statSync6 } from "fs";
|
|
10277
10426
|
import { createRequire } from "module";
|
|
10278
|
-
import
|
|
10427
|
+
import path68 from "path";
|
|
10279
10428
|
var PREFIX_NAMESPACES = {
|
|
10280
10429
|
bg: ["color"],
|
|
10281
10430
|
text: ["color", "text"],
|
|
@@ -10515,7 +10664,7 @@ function stylesheetFiles(dir) {
|
|
|
10515
10664
|
}
|
|
10516
10665
|
return entries.flatMap((entry) => {
|
|
10517
10666
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
10518
|
-
const entryPath =
|
|
10667
|
+
const entryPath = path68.join(dir, entry);
|
|
10519
10668
|
let stats;
|
|
10520
10669
|
try {
|
|
10521
10670
|
stats = statSync6(entryPath);
|
|
@@ -10523,7 +10672,7 @@ function stylesheetFiles(dir) {
|
|
|
10523
10672
|
return [];
|
|
10524
10673
|
}
|
|
10525
10674
|
if (stats.isDirectory()) return stylesheetFiles(entryPath);
|
|
10526
|
-
return
|
|
10675
|
+
return path68.extname(entry) === ".css" ? [entryPath] : [];
|
|
10527
10676
|
});
|
|
10528
10677
|
}
|
|
10529
10678
|
function packageNameOf(specifier) {
|
|
@@ -10534,24 +10683,24 @@ function packageNameOf(specifier) {
|
|
|
10534
10683
|
function resolvePackageStylesheet(fromFile, specifier) {
|
|
10535
10684
|
const packageName = packageNameOf(specifier);
|
|
10536
10685
|
if (!packageName || packageName === "tailwindcss") return void 0;
|
|
10537
|
-
let directory =
|
|
10538
|
-
while (directory !==
|
|
10539
|
-
const packageRoot =
|
|
10540
|
-
const manifestPath =
|
|
10686
|
+
let directory = path68.dirname(fromFile);
|
|
10687
|
+
while (directory !== path68.dirname(directory)) {
|
|
10688
|
+
const packageRoot = path68.join(directory, "node_modules", packageName);
|
|
10689
|
+
const manifestPath = path68.join(packageRoot, "package.json");
|
|
10541
10690
|
if (existsSync8(manifestPath)) {
|
|
10542
10691
|
try {
|
|
10543
|
-
const manifest =
|
|
10692
|
+
const manifest = readFileSync15(manifestPath, "utf8");
|
|
10544
10693
|
const stylesheet = /"style"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
10545
10694
|
const main = /"main"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
10546
10695
|
const target = stylesheet ?? main;
|
|
10547
10696
|
if (!target) return void 0;
|
|
10548
|
-
const resolved =
|
|
10697
|
+
const resolved = path68.resolve(packageRoot, target);
|
|
10549
10698
|
return existsSync8(resolved) ? resolved : void 0;
|
|
10550
10699
|
} catch {
|
|
10551
10700
|
return void 0;
|
|
10552
10701
|
}
|
|
10553
10702
|
}
|
|
10554
|
-
directory =
|
|
10703
|
+
directory = path68.dirname(directory);
|
|
10555
10704
|
}
|
|
10556
10705
|
return void 0;
|
|
10557
10706
|
}
|
|
@@ -10560,7 +10709,7 @@ function inventoryStylesheetFiles(projectFiles) {
|
|
|
10560
10709
|
for (const file of projectFiles) {
|
|
10561
10710
|
let css2;
|
|
10562
10711
|
try {
|
|
10563
|
-
css2 =
|
|
10712
|
+
css2 = readFileSync15(file, "utf8");
|
|
10564
10713
|
} catch {
|
|
10565
10714
|
continue;
|
|
10566
10715
|
}
|
|
@@ -10626,7 +10775,7 @@ function readInventory(files) {
|
|
|
10626
10775
|
for (const file of files) {
|
|
10627
10776
|
let css2;
|
|
10628
10777
|
try {
|
|
10629
|
-
css2 =
|
|
10778
|
+
css2 = readFileSync15(file, "utf8");
|
|
10630
10779
|
} catch {
|
|
10631
10780
|
continue;
|
|
10632
10781
|
}
|
|
@@ -10672,6 +10821,18 @@ function isColorToken(token, inventory) {
|
|
|
10672
10821
|
if (hyphen === -1) return false;
|
|
10673
10822
|
return DEFAULT_PALETTE_FAMILIES.has(token.slice(0, hyphen)) && DEFAULT_PALETTE_SHADES.has(token.slice(hyphen + 1));
|
|
10674
10823
|
}
|
|
10824
|
+
function isInvalidBoundaryColorClass(className, inventory) {
|
|
10825
|
+
if (className.includes("[") || className.includes("(")) return false;
|
|
10826
|
+
const utility = (className.replace(/!+$/, "").split(":").pop() ?? "").split("/")[0] ?? "";
|
|
10827
|
+
const compound = Object.keys(PREFIX_NAMESPACES).find(
|
|
10828
|
+
(prefix2) => prefix2.includes("-") && utility.startsWith(`${prefix2}-`)
|
|
10829
|
+
);
|
|
10830
|
+
const dash = utility.indexOf("-");
|
|
10831
|
+
if (dash === -1) return false;
|
|
10832
|
+
const prefix = compound ?? utility.slice(0, dash);
|
|
10833
|
+
const token = utility.slice(prefix.length + 1);
|
|
10834
|
+
return (PREFIX_NAMESPACES[prefix]?.includes("color") ?? false) && (inventory.themeTokens.get("color")?.has(token) ?? false) && violatesBoundaryColorRole(token);
|
|
10835
|
+
}
|
|
10675
10836
|
function isKnown(className, inventory) {
|
|
10676
10837
|
if (className.includes("[") || className.includes("(")) return true;
|
|
10677
10838
|
const segments = className.replace(/!+$/, "").split(":");
|
|
@@ -10732,6 +10893,13 @@ var unknownUtilityRule = {
|
|
|
10732
10893
|
for (const candidate of value.split(/\s+/)) {
|
|
10733
10894
|
if (!candidate || seen.has(candidate)) continue;
|
|
10734
10895
|
seen.add(candidate);
|
|
10896
|
+
if (isInvalidBoundaryColorClass(candidate, inventory)) {
|
|
10897
|
+
context.report({
|
|
10898
|
+
node,
|
|
10899
|
+
message: `Utility class "${candidate}" uses a boundary color token named after a CSS property; use a semantic -edge color token instead (for example, border-control-edge).`
|
|
10900
|
+
});
|
|
10901
|
+
continue;
|
|
10902
|
+
}
|
|
10735
10903
|
if (isKnown(candidate, inventory)) continue;
|
|
10736
10904
|
const plainBase = candidate.replace(/!+$/, "").split(":").pop() ?? "";
|
|
10737
10905
|
if (inventory.plainClasses.has(plainBase)) {
|
|
@@ -10802,7 +10970,7 @@ var unknownUtilityRule = {
|
|
|
10802
10970
|
};
|
|
10803
10971
|
|
|
10804
10972
|
// eslint/rules/util-file-name.ts
|
|
10805
|
-
import
|
|
10973
|
+
import path69 from "path";
|
|
10806
10974
|
function toKebabCase2(value) {
|
|
10807
10975
|
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();
|
|
10808
10976
|
}
|
|
@@ -10815,7 +10983,7 @@ var utilFileNameRule = {
|
|
|
10815
10983
|
}
|
|
10816
10984
|
},
|
|
10817
10985
|
create(context) {
|
|
10818
|
-
const filename =
|
|
10986
|
+
const filename = path69.resolve(context.filename);
|
|
10819
10987
|
const segments = filename.replace(/\\/g, "/").split("/");
|
|
10820
10988
|
if (!segments.includes("utils")) return {};
|
|
10821
10989
|
let module;
|
|
@@ -10829,13 +10997,13 @@ var utilFileNameRule = {
|
|
|
10829
10997
|
const functionName = functions[0]?.name;
|
|
10830
10998
|
if (!functionName) return {};
|
|
10831
10999
|
const expected = toKebabCase2(functionName);
|
|
10832
|
-
const actual =
|
|
11000
|
+
const actual = path69.basename(filename, path69.extname(filename));
|
|
10833
11001
|
if (!expected || actual === expected) return {};
|
|
10834
11002
|
return {
|
|
10835
11003
|
Program(node) {
|
|
10836
11004
|
context.report({
|
|
10837
11005
|
node,
|
|
10838
|
-
message: `A utility file exporting ${functionName} must be named ${expected}.${
|
|
11006
|
+
message: `A utility file exporting ${functionName} must be named ${expected}.${path69.extname(filename).slice(1)}.`
|
|
10839
11007
|
});
|
|
10840
11008
|
}
|
|
10841
11009
|
};
|
|
@@ -10843,7 +11011,7 @@ var utilFileNameRule = {
|
|
|
10843
11011
|
};
|
|
10844
11012
|
|
|
10845
11013
|
// eslint/rules/value-extraction.ts
|
|
10846
|
-
import
|
|
11014
|
+
import path70 from "path";
|
|
10847
11015
|
var valueExtractionRule = {
|
|
10848
11016
|
meta: {
|
|
10849
11017
|
schema: [],
|
|
@@ -10854,7 +11022,7 @@ var valueExtractionRule = {
|
|
|
10854
11022
|
},
|
|
10855
11023
|
create(context) {
|
|
10856
11024
|
const sourceRoot = sourceRootOf(context);
|
|
10857
|
-
const file =
|
|
11025
|
+
const file = path70.resolve(context.filename);
|
|
10858
11026
|
const segments = segmentsOf(file, sourceRoot);
|
|
10859
11027
|
if (segments.length === 0 || segments[0] !== "app") return {};
|
|
10860
11028
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -10875,8 +11043,8 @@ var valueExtractionRule = {
|
|
|
10875
11043
|
};
|
|
10876
11044
|
|
|
10877
11045
|
// eslint/rules/vulyk/tracked-docs.ts
|
|
10878
|
-
import { existsSync as existsSync9, readFileSync as
|
|
10879
|
-
import
|
|
11046
|
+
import { existsSync as existsSync9, readFileSync as readFileSync16 } from "fs";
|
|
11047
|
+
import path71 from "path";
|
|
10880
11048
|
var PASIKA_REPO = "Bredansky/pasika";
|
|
10881
11049
|
var BASE_REQUIRED_TRACKED_DOCS = [
|
|
10882
11050
|
{ name: "documentation-guide", path: "docs/documentation-guide" },
|
|
@@ -10909,8 +11077,8 @@ var trackedDocsRule = {
|
|
|
10909
11077
|
if (!context.filename.endsWith("package.json")) return;
|
|
10910
11078
|
const root = node.body;
|
|
10911
11079
|
if (root.type !== "Object") return;
|
|
10912
|
-
const projectRoot =
|
|
10913
|
-
const configPath =
|
|
11080
|
+
const projectRoot = path71.dirname(path71.resolve(context.filename));
|
|
11081
|
+
const configPath = path71.join(projectRoot, "vulyk.config.ts");
|
|
10914
11082
|
if (!existsSync9(configPath)) {
|
|
10915
11083
|
context.report({
|
|
10916
11084
|
node,
|
|
@@ -10918,7 +11086,7 @@ var trackedDocsRule = {
|
|
|
10918
11086
|
});
|
|
10919
11087
|
return;
|
|
10920
11088
|
}
|
|
10921
|
-
const config =
|
|
11089
|
+
const config = readFileSync16(configPath, "utf8");
|
|
10922
11090
|
if (!config.includes(PASIKA_REPO)) {
|
|
10923
11091
|
context.report({
|
|
10924
11092
|
node,
|
|
@@ -10935,7 +11103,7 @@ var trackedDocsRule = {
|
|
|
10935
11103
|
});
|
|
10936
11104
|
}
|
|
10937
11105
|
}
|
|
10938
|
-
const agentsPath =
|
|
11106
|
+
const agentsPath = path71.join(projectRoot, "AGENTS.md");
|
|
10939
11107
|
if (!existsSync9(agentsPath)) {
|
|
10940
11108
|
context.report({
|
|
10941
11109
|
node,
|
|
@@ -11035,7 +11203,7 @@ var withResponseHelperRule = {
|
|
|
11035
11203
|
|
|
11036
11204
|
// eslint/rules/zirka-baseline.ts
|
|
11037
11205
|
import fs7 from "fs";
|
|
11038
|
-
import
|
|
11206
|
+
import path72 from "path";
|
|
11039
11207
|
var ESLINT_CONFIG = /^eslint\.config\.(?:ts|mts|cts|js|mjs|cjs)$/;
|
|
11040
11208
|
var PRETTIER_CONFIGS = [
|
|
11041
11209
|
"prettier.config.mjs",
|
|
@@ -11054,10 +11222,10 @@ var zirkaBaselineRule = {
|
|
|
11054
11222
|
}
|
|
11055
11223
|
},
|
|
11056
11224
|
create(context) {
|
|
11057
|
-
const filename =
|
|
11058
|
-
const basename =
|
|
11225
|
+
const filename = path72.resolve(context.filename);
|
|
11226
|
+
const basename = path72.basename(filename);
|
|
11059
11227
|
if (!ESLINT_CONFIG.test(basename)) return {};
|
|
11060
|
-
const projectRoot =
|
|
11228
|
+
const projectRoot = path72.dirname(filename);
|
|
11061
11229
|
const report3 = (message) => {
|
|
11062
11230
|
context.report({
|
|
11063
11231
|
node: context.sourceCode.ast,
|
|
@@ -11072,7 +11240,7 @@ var zirkaBaselineRule = {
|
|
|
11072
11240
|
'ESLint config must take its configuration from zirka (import { styleguide } from "zirka") instead of restating rules locally.'
|
|
11073
11241
|
);
|
|
11074
11242
|
}
|
|
11075
|
-
const tsconfigPath =
|
|
11243
|
+
const tsconfigPath = path72.join(projectRoot, "tsconfig.json");
|
|
11076
11244
|
if (!fs7.existsSync(tsconfigPath)) {
|
|
11077
11245
|
report3('No tsconfig.json found. Create one extending the zirka TypeScript base config ("zirka/typescript").');
|
|
11078
11246
|
} else {
|
|
@@ -11090,13 +11258,13 @@ var zirkaBaselineRule = {
|
|
|
11090
11258
|
report3('tsconfig.json must extend the zirka TypeScript base config ("zirka/typescript").');
|
|
11091
11259
|
}
|
|
11092
11260
|
}
|
|
11093
|
-
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(
|
|
11261
|
+
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(path72.join(projectRoot, name)));
|
|
11094
11262
|
if (!prettierConfigFile) {
|
|
11095
11263
|
report3(
|
|
11096
11264
|
"No prettier config found. Create one that takes its configuration from zirka (styleguide({ prettier: true }).prettierConfig)."
|
|
11097
11265
|
);
|
|
11098
11266
|
} else {
|
|
11099
|
-
const content = fs7.readFileSync(
|
|
11267
|
+
const content = fs7.readFileSync(path72.join(projectRoot, prettierConfigFile), "utf8");
|
|
11100
11268
|
if (!content.includes("zirka")) {
|
|
11101
11269
|
report3(
|
|
11102
11270
|
"The prettier config must take its configuration from zirka (styleguide({ prettier: true }).prettierConfig) instead of restating it locally."
|
|
@@ -11242,14 +11410,14 @@ var zodSchemaValidationRule = {
|
|
|
11242
11410
|
};
|
|
11243
11411
|
|
|
11244
11412
|
// eslint/ts-alignment.ts
|
|
11245
|
-
import { readFileSync as
|
|
11413
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
11246
11414
|
import { createRequire as createRequire2 } from "module";
|
|
11247
11415
|
import { join } from "path";
|
|
11248
11416
|
var ownRequire = createRequire2(import.meta.url);
|
|
11249
11417
|
var majorOf = (version) => Number(version.split(".")[0]);
|
|
11250
11418
|
function versionOf(packagePath) {
|
|
11251
11419
|
try {
|
|
11252
|
-
const parsed = JSON.parse(
|
|
11420
|
+
const parsed = JSON.parse(readFileSync17(packagePath, "utf8"));
|
|
11253
11421
|
if (typeof parsed !== "object" || parsed === null || !("version" in parsed)) return null;
|
|
11254
11422
|
return typeof parsed.version === "string" ? parsed.version : null;
|
|
11255
11423
|
} catch {
|
|
@@ -11327,6 +11495,7 @@ var pasikaNextjsAppRules = {
|
|
|
11327
11495
|
"interactive-component": interactiveComponentRule,
|
|
11328
11496
|
"ui-state": uiStateRule,
|
|
11329
11497
|
"no-mixed-concerns": noMixedConcernsRule,
|
|
11498
|
+
"no-duplicate-jsx-classes": noDuplicateJsxClassesRule,
|
|
11330
11499
|
"no-arbitrary-tailwind": noArbitraryTailwindRule,
|
|
11331
11500
|
"no-literal-inline-style": noLiteralInlineStyleRule,
|
|
11332
11501
|
"unknown-utility": unknownUtilityRule,
|