pasika 0.10.88 → 0.10.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eslint/pasika/index.js +179 -134
- package/package.json +1 -1
|
@@ -5120,20 +5120,21 @@ var noLiteralInlineStyleRule = {
|
|
|
5120
5120
|
};
|
|
5121
5121
|
|
|
5122
5122
|
// eslint/rules/no-mixed-concerns.ts
|
|
5123
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
5124
|
+
import path39 from "path";
|
|
5123
5125
|
var noMixedConcernsRule = {
|
|
5124
5126
|
meta: {
|
|
5125
5127
|
schema: [],
|
|
5126
5128
|
type: "problem",
|
|
5127
5129
|
docs: {
|
|
5128
|
-
description: "Enforce one React component
|
|
5130
|
+
description: "Enforce one React component per .tsx file and colocated exports consumed alongside it."
|
|
5129
5131
|
}
|
|
5130
5132
|
},
|
|
5131
5133
|
create(context) {
|
|
5132
5134
|
if (!context.filename.endsWith(".tsx")) return {};
|
|
5133
|
-
const sourceCode = context.sourceCode.text;
|
|
5134
5135
|
return {
|
|
5135
5136
|
"Program:exit"() {
|
|
5136
|
-
const components = parseComponentInfo(sourceCode, context.filename, { includeNonExported: true });
|
|
5137
|
+
const components = parseComponentInfo(context.sourceCode.text, context.filename, { includeNonExported: true });
|
|
5137
5138
|
if (components.length === 0) return;
|
|
5138
5139
|
for (const extra of components.slice(1)) {
|
|
5139
5140
|
context.report({
|
|
@@ -5144,33 +5145,77 @@ var noMixedConcernsRule = {
|
|
|
5144
5145
|
if (components.length > 1) return;
|
|
5145
5146
|
const componentName = components[0]?.name;
|
|
5146
5147
|
if (!componentName) return;
|
|
5148
|
+
const file = path39.resolve(context.filename);
|
|
5149
|
+
const sourceRoot = sourceRootOf(context);
|
|
5150
|
+
const index = getProjectIndex(sourceRoot);
|
|
5151
|
+
const componentConsumers = index?.symbolConsumers.get(symbolKey(file, componentName)) ?? /* @__PURE__ */ new Set();
|
|
5152
|
+
const isNextPageOrLayout = /(?:^|[/\\])src[/\\]app[/\\](?:[^/\\]+[/\\])*(?:page|layout)\.tsx$/.test(
|
|
5153
|
+
context.filename
|
|
5154
|
+
);
|
|
5155
|
+
const checkSupportingExport = (name, loc) => {
|
|
5156
|
+
if (name === componentName) return;
|
|
5157
|
+
if (isNextPageOrLayout) {
|
|
5158
|
+
if (["metadata", "viewport", "generateMetadata", "generateViewport"].includes(name)) return;
|
|
5159
|
+
context.report({
|
|
5160
|
+
loc,
|
|
5161
|
+
message: `Next.js page/layout files cannot export "${name}". Use a separate module for supporting values.`
|
|
5162
|
+
});
|
|
5163
|
+
return;
|
|
5164
|
+
}
|
|
5165
|
+
const consumers = index?.symbolConsumers.get(symbolKey(file, name));
|
|
5166
|
+
if (!consumers) return;
|
|
5167
|
+
const independent = [...consumers].filter((consumer) => !componentConsumers.has(consumer));
|
|
5168
|
+
if (independent.length > 0) {
|
|
5169
|
+
context.report({
|
|
5170
|
+
loc,
|
|
5171
|
+
message: `Supporting export "${name}" is imported without its component "${componentName}". Import them together or extract the supporting value to its appropriate module. See docs/next-codebase-guide/rules/no-mixed-concerns-rule.md`
|
|
5172
|
+
});
|
|
5173
|
+
}
|
|
5174
|
+
};
|
|
5147
5175
|
for (const statement of context.sourceCode.ast.body) {
|
|
5148
5176
|
if (statement.type === "ExportNamedDeclaration") {
|
|
5149
5177
|
if (/^export\s+(?:type|interface)\b/.test(context.sourceCode.getText(statement))) continue;
|
|
5150
5178
|
const declaration = statement.declaration;
|
|
5151
|
-
if (declaration?.type === "FunctionDeclaration"
|
|
5152
|
-
|
|
5179
|
+
if (declaration?.type === "FunctionDeclaration" || declaration?.type === "ClassDeclaration") {
|
|
5180
|
+
checkSupportingExport(declaration.id.name, statement.loc?.start ?? { line: 1, column: 0 });
|
|
5153
5181
|
continue;
|
|
5154
5182
|
}
|
|
5155
|
-
if (
|
|
5156
|
-
|
|
5157
|
-
|
|
5183
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
5184
|
+
for (const variable of declaration.declarations) {
|
|
5185
|
+
if (variable.id.type === "Identifier") {
|
|
5186
|
+
checkSupportingExport(variable.id.name, statement.loc?.start ?? { line: 1, column: 0 });
|
|
5187
|
+
}
|
|
5188
|
+
}
|
|
5158
5189
|
continue;
|
|
5159
5190
|
}
|
|
5191
|
+
const target = typeof statement.source?.value === "string" ? resolveSpecifier(file, statement.source.value, sourceRoot) : void 0;
|
|
5192
|
+
const forwardedComponents = target?.endsWith(".tsx") ? parseComponentInfo(readFileSync8(target, "utf8"), target).map((component) => component.name) : [];
|
|
5193
|
+
for (const specifier of statement.specifiers) {
|
|
5194
|
+
if (/^type\b/.test(context.sourceCode.getText(specifier))) continue;
|
|
5195
|
+
if (specifier.local.type !== "Identifier") continue;
|
|
5196
|
+
if (target && forwardedComponents.includes(specifier.local.name)) {
|
|
5197
|
+
context.report({
|
|
5198
|
+
node: statement,
|
|
5199
|
+
message: `Component file "${componentName}" must not re-export another component "${specifier.local.name}". Import that component directly.`
|
|
5200
|
+
});
|
|
5201
|
+
} else if (!statement.source) {
|
|
5202
|
+
checkSupportingExport(specifier.local.name, statement.loc?.start ?? { line: 1, column: 0 });
|
|
5203
|
+
} else if (specifier.exported.type === "Identifier") {
|
|
5204
|
+
checkSupportingExport(specifier.exported.name, statement.loc?.start ?? { line: 1, column: 0 });
|
|
5205
|
+
}
|
|
5206
|
+
}
|
|
5160
5207
|
} else if (statement.type === "ExportAllDeclaration") {
|
|
5161
5208
|
if (/^export\s+type\b/.test(context.sourceCode.getText(statement))) continue;
|
|
5209
|
+
context.report({
|
|
5210
|
+
node: statement,
|
|
5211
|
+
message: `Component file "${componentName}" must not use a wildcard runtime re-export. Export named supporting values only.`
|
|
5212
|
+
});
|
|
5162
5213
|
} else if (statement.type === "ExportDefaultDeclaration") {
|
|
5163
|
-
|
|
5164
|
-
if (
|
|
5165
|
-
|
|
5166
|
-
}
|
|
5167
|
-
} else {
|
|
5168
|
-
continue;
|
|
5214
|
+
const declaration = statement.declaration;
|
|
5215
|
+
if (declaration.type === "Identifier" && declaration.name === componentName) continue;
|
|
5216
|
+
if (declaration.type === "FunctionDeclaration" && declaration.id?.name === componentName) continue;
|
|
5217
|
+
checkSupportingExport("default", statement.loc?.start ?? { line: 1, column: 0 });
|
|
5169
5218
|
}
|
|
5170
|
-
context.report({
|
|
5171
|
-
node: statement,
|
|
5172
|
-
message: `Component files must export only their own component "${componentName}". Import other values directly from their files.`
|
|
5173
|
-
});
|
|
5174
5219
|
}
|
|
5175
5220
|
}
|
|
5176
5221
|
};
|
|
@@ -5178,10 +5223,10 @@ var noMixedConcernsRule = {
|
|
|
5178
5223
|
};
|
|
5179
5224
|
|
|
5180
5225
|
// eslint/rules/no-redundant-alias.ts
|
|
5181
|
-
import
|
|
5226
|
+
import path41 from "path";
|
|
5182
5227
|
|
|
5183
5228
|
// eslint/rules/contract-ownership.ts
|
|
5184
|
-
import
|
|
5229
|
+
import path40 from "path";
|
|
5185
5230
|
import ts7 from "typescript";
|
|
5186
5231
|
function isTsProgram(value) {
|
|
5187
5232
|
return typeof value === "object" && value !== null && "getTypeChecker" in value && typeof value.getTypeChecker === "function" && "getSourceFiles" in value && typeof value.getSourceFiles === "function";
|
|
@@ -5200,8 +5245,8 @@ function normalizePath(value) {
|
|
|
5200
5245
|
return value.replaceAll("\\", "/").toLowerCase();
|
|
5201
5246
|
}
|
|
5202
5247
|
function isWithin2(root, file) {
|
|
5203
|
-
const relative =
|
|
5204
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
5248
|
+
const relative = path40.relative(root, file);
|
|
5249
|
+
return relative === "" || !relative.startsWith("..") && !path40.isAbsolute(relative);
|
|
5205
5250
|
}
|
|
5206
5251
|
function mergeOwnership(values) {
|
|
5207
5252
|
if (values.length === 0 || values.includes("unknown")) return "unknown";
|
|
@@ -5341,7 +5386,7 @@ var ContractOwnershipIndex = class {
|
|
|
5341
5386
|
const normalized = normalizePath(fileName);
|
|
5342
5387
|
if (/\/typescript\/lib\/lib\.[^/]+\.d\.ts$/u.test(normalized)) return "platform";
|
|
5343
5388
|
if (normalized.includes("/node_modules/")) return "third-party";
|
|
5344
|
-
if (isWithin2(this.cwd,
|
|
5389
|
+
if (isWithin2(this.cwd, path40.resolve(fileName))) return "first-party";
|
|
5345
5390
|
return "unknown";
|
|
5346
5391
|
}
|
|
5347
5392
|
schemaOwnership(declaration) {
|
|
@@ -5355,7 +5400,7 @@ var ContractOwnershipIndex = class {
|
|
|
5355
5400
|
}
|
|
5356
5401
|
indexApiContracts() {
|
|
5357
5402
|
for (const sourceFile of this.program.getSourceFiles()) {
|
|
5358
|
-
if (sourceFile.isDeclarationFile || !isWithin2(this.cwd,
|
|
5403
|
+
if (sourceFile.isDeclarationFile || !isWithin2(this.cwd, path40.resolve(sourceFile.fileName))) continue;
|
|
5359
5404
|
const visit = (node) => {
|
|
5360
5405
|
if (ts7.isCallExpression(node) && this.isDefineApiContractCall(node)) this.indexApiContractCall(node);
|
|
5361
5406
|
ts7.forEachChild(node, visit);
|
|
@@ -5626,7 +5671,7 @@ var noRedundantAliasRule = {
|
|
|
5626
5671
|
if (declaration.type !== "VariableDeclaration" || declaration.kind !== "const") return;
|
|
5627
5672
|
if (node.init.type === "Identifier") {
|
|
5628
5673
|
const exported = declaration.parent.type === "ExportNamedDeclaration";
|
|
5629
|
-
const frameworkRouteAlias =
|
|
5674
|
+
const frameworkRouteAlias = path41.basename(context.filename) === "route.ts" && exported && HTTP_METHODS.has(node.id.name);
|
|
5630
5675
|
if (frameworkRouteAlias || VALUE_SENTINELS.has(node.init.name)) return;
|
|
5631
5676
|
context.report({
|
|
5632
5677
|
node,
|
|
@@ -5744,7 +5789,7 @@ var noRedundantAliasRule = {
|
|
|
5744
5789
|
const source = specifier.local.name;
|
|
5745
5790
|
const alias = specifier.exported.name;
|
|
5746
5791
|
if (source === alias) continue;
|
|
5747
|
-
const frameworkRouteAlias =
|
|
5792
|
+
const frameworkRouteAlias = path41.basename(context.filename) === "route.ts" && HTTP_METHODS.has(alias);
|
|
5748
5793
|
if (frameworkRouteAlias) continue;
|
|
5749
5794
|
context.report({
|
|
5750
5795
|
node: specifier,
|
|
@@ -5769,7 +5814,7 @@ var noRedundantAliasRule = {
|
|
|
5769
5814
|
};
|
|
5770
5815
|
|
|
5771
5816
|
// eslint/rules/no-util-barrel.ts
|
|
5772
|
-
import
|
|
5817
|
+
import path42 from "path";
|
|
5773
5818
|
var noUtilBarrelRule = {
|
|
5774
5819
|
meta: {
|
|
5775
5820
|
schema: [],
|
|
@@ -5779,7 +5824,7 @@ var noUtilBarrelRule = {
|
|
|
5779
5824
|
}
|
|
5780
5825
|
},
|
|
5781
5826
|
create(context) {
|
|
5782
|
-
const filename =
|
|
5827
|
+
const filename = path42.resolve(context.filename);
|
|
5783
5828
|
const sourceRoot = sourceRootOf3(context, filename);
|
|
5784
5829
|
return {
|
|
5785
5830
|
Program(node) {
|
|
@@ -5788,7 +5833,7 @@ var noUtilBarrelRule = {
|
|
|
5788
5833
|
if (!target) continue;
|
|
5789
5834
|
const segments = target.replace(/\\/g, "/").split("/");
|
|
5790
5835
|
const utilsIndex = segments.lastIndexOf("utils");
|
|
5791
|
-
if (utilsIndex < 0 || !
|
|
5836
|
+
if (utilsIndex < 0 || !path42.basename(target).startsWith("index.")) continue;
|
|
5792
5837
|
context.report({
|
|
5793
5838
|
node,
|
|
5794
5839
|
message: `Import utilities directly instead of through "${specifier}". See docs/next-codebase-guide/rules/utilities-rule.md`
|
|
@@ -5808,10 +5853,10 @@ function importSpecifiers2(source) {
|
|
|
5808
5853
|
return specifiers;
|
|
5809
5854
|
}
|
|
5810
5855
|
function sourceRootOf3(context, filename) {
|
|
5811
|
-
const marker = `${
|
|
5856
|
+
const marker = `${path42.sep}src${path42.sep}`;
|
|
5812
5857
|
const srcIndex = filename.lastIndexOf(marker);
|
|
5813
5858
|
if (srcIndex >= 0) return filename.slice(0, srcIndex + marker.length - 1);
|
|
5814
|
-
return
|
|
5859
|
+
return path42.resolve(context.cwd ?? process.cwd(), "src");
|
|
5815
5860
|
}
|
|
5816
5861
|
|
|
5817
5862
|
// eslint/rules/package-json/exact-version.ts
|
|
@@ -6029,8 +6074,8 @@ var nextjsStackRule = {
|
|
|
6029
6074
|
};
|
|
6030
6075
|
|
|
6031
6076
|
// eslint/rules/package-json/vitest-coverage.ts
|
|
6032
|
-
import { existsSync as existsSync5, readFileSync as
|
|
6033
|
-
import
|
|
6077
|
+
import { existsSync as existsSync5, readFileSync as readFileSync9 } from "fs";
|
|
6078
|
+
import path43 from "path";
|
|
6034
6079
|
function memberName5(member) {
|
|
6035
6080
|
return member.name.type === "String" ? member.name.value : member.name.name;
|
|
6036
6081
|
}
|
|
@@ -6100,7 +6145,7 @@ var vitestCoverageRule = {
|
|
|
6100
6145
|
message: 'package.json must declare a "test:unit:coverage" script that runs Vitest with coverage.'
|
|
6101
6146
|
});
|
|
6102
6147
|
}
|
|
6103
|
-
const configName = VITEST_CONFIG_NAMES.find((name) => existsSync5(
|
|
6148
|
+
const configName = VITEST_CONFIG_NAMES.find((name) => existsSync5(path43.join(context.cwd, name)));
|
|
6104
6149
|
if (!configName) {
|
|
6105
6150
|
context.report({
|
|
6106
6151
|
node,
|
|
@@ -6108,7 +6153,7 @@ var vitestCoverageRule = {
|
|
|
6108
6153
|
});
|
|
6109
6154
|
return;
|
|
6110
6155
|
}
|
|
6111
|
-
const content =
|
|
6156
|
+
const content = readFileSync9(path43.join(context.cwd, configName), "utf8");
|
|
6112
6157
|
for (const metric of THRESHOLD_METRICS) {
|
|
6113
6158
|
if (!new RegExp(`\\b${metric}\\s*:\\s*[1-9]\\d*`).test(content)) {
|
|
6114
6159
|
context.report({ node, message: `${configName} must set a coverage threshold above zero for ${metric}.` });
|
|
@@ -6154,7 +6199,7 @@ var nextjsPackageJsonRules = {
|
|
|
6154
6199
|
};
|
|
6155
6200
|
|
|
6156
6201
|
// eslint/rules/prefer-enum.ts
|
|
6157
|
-
import
|
|
6202
|
+
import path44 from "path";
|
|
6158
6203
|
function isConstAssertion(node) {
|
|
6159
6204
|
const typeAnnotation = node.typeAnnotation;
|
|
6160
6205
|
return typeAnnotation?.type === "TSTypeReference" && typeAnnotation.typeName?.type === "Identifier" && typeAnnotation.typeName.name === "const";
|
|
@@ -6206,9 +6251,9 @@ var preferEnumRule = {
|
|
|
6206
6251
|
}
|
|
6207
6252
|
},
|
|
6208
6253
|
create(context) {
|
|
6209
|
-
const filename =
|
|
6254
|
+
const filename = path44.resolve(context.filename);
|
|
6210
6255
|
const sourceRoot = sourceRootOf(context);
|
|
6211
|
-
if (!filename.startsWith(sourceRoot +
|
|
6256
|
+
if (!filename.startsWith(sourceRoot + path44.sep)) return {};
|
|
6212
6257
|
const objectSchemas = /* @__PURE__ */ new Map();
|
|
6213
6258
|
const discriminatedUnions = [];
|
|
6214
6259
|
const reportedDiscriminants = /* @__PURE__ */ new Set();
|
|
@@ -6751,7 +6796,7 @@ ${indentation}`;
|
|
|
6751
6796
|
};
|
|
6752
6797
|
|
|
6753
6798
|
// eslint/rules/pure-function-extract.ts
|
|
6754
|
-
import
|
|
6799
|
+
import path45 from "path";
|
|
6755
6800
|
var ROUTE_HANDLER_EXPORT_NAMES = /* @__PURE__ */ new Set([
|
|
6756
6801
|
"GET",
|
|
6757
6802
|
"POST",
|
|
@@ -6816,12 +6861,12 @@ var pureFunctionExtractRule = {
|
|
|
6816
6861
|
},
|
|
6817
6862
|
create(context) {
|
|
6818
6863
|
const filename = context.filename;
|
|
6819
|
-
const isRouteFile =
|
|
6864
|
+
const isRouteFile = path45.basename(filename) === "route.ts";
|
|
6820
6865
|
const isComponentFile = filename.endsWith(".tsx") || filename.endsWith(".jsx");
|
|
6821
6866
|
const sourceRoot = sourceRootOf(context);
|
|
6822
|
-
const relative =
|
|
6867
|
+
const relative = path45.relative(sourceRoot, filename);
|
|
6823
6868
|
if (relative.startsWith("..")) return {};
|
|
6824
|
-
const segments = relative.split(
|
|
6869
|
+
const segments = relative.split(path45.sep);
|
|
6825
6870
|
const folders = segments.slice(0, -1);
|
|
6826
6871
|
const isHookSupportFile = folders.includes("hooks") && /\.(?:[cm]?[jt]s)$/.test(filename);
|
|
6827
6872
|
if (!isComponentFile && !isRouteFile && !isHookSupportFile) return {};
|
|
@@ -6881,16 +6926,16 @@ var pureFunctionExtractRule = {
|
|
|
6881
6926
|
};
|
|
6882
6927
|
|
|
6883
6928
|
// eslint/rules/repeated-numeric-value.ts
|
|
6884
|
-
import
|
|
6929
|
+
import path46 from "path";
|
|
6885
6930
|
var ignoredValues = /* @__PURE__ */ new Set([-1, 0, 1]);
|
|
6886
6931
|
function isNonProductionFile(file, sourceRoot) {
|
|
6887
|
-
const relative =
|
|
6888
|
-
const segments = relative.split(
|
|
6889
|
-
const basename =
|
|
6932
|
+
const relative = path46.relative(sourceRoot, file);
|
|
6933
|
+
const segments = relative.split(path46.sep);
|
|
6934
|
+
const basename = path46.basename(file);
|
|
6890
6935
|
return /\.(?:test|spec|mock)\.[^.]+$/.test(basename) || segments.some((segment) => segment === "__tests__" || segment === "__mocks__" || segment === "mocks");
|
|
6891
6936
|
}
|
|
6892
6937
|
function isCanonicalConstantFile(file, sourceRoot) {
|
|
6893
|
-
const segments =
|
|
6938
|
+
const segments = path46.relative(sourceRoot, file).split(path46.sep);
|
|
6894
6939
|
return segments.includes("constants") || segments[0] === "config";
|
|
6895
6940
|
}
|
|
6896
6941
|
function groupKey(literal) {
|
|
@@ -6906,7 +6951,7 @@ var repeatedNumericValueRule = {
|
|
|
6906
6951
|
},
|
|
6907
6952
|
create(context) {
|
|
6908
6953
|
const sourceRoot = sourceRootOf(context);
|
|
6909
|
-
const file =
|
|
6954
|
+
const file = path46.resolve(context.filename);
|
|
6910
6955
|
if (isNonProductionFile(file, sourceRoot) || isCanonicalConstantFile(file, sourceRoot)) return {};
|
|
6911
6956
|
const index = getProjectIndex(sourceRoot);
|
|
6912
6957
|
if (!index) return {};
|
|
@@ -7126,7 +7171,7 @@ var repeatedStructureRule = {
|
|
|
7126
7171
|
|
|
7127
7172
|
// eslint/rules/require-barrel-star-exports.ts
|
|
7128
7173
|
import fs5 from "fs";
|
|
7129
|
-
import
|
|
7174
|
+
import path47 from "path";
|
|
7130
7175
|
var SUPPORT_FOLDERS3 = /* @__PURE__ */ new Set(["constants", "types", "schemas"]);
|
|
7131
7176
|
var INDEX_NAMES = /* @__PURE__ */ new Set(["index.ts", "index.tsx", "index.mts", "index.cts"]);
|
|
7132
7177
|
var MODULE_EXTENSIONS3 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
@@ -7134,9 +7179,9 @@ function resolveSiblingModule(indexFile, specifier) {
|
|
|
7134
7179
|
if (!specifier.startsWith("./")) return void 0;
|
|
7135
7180
|
const relative = specifier.slice(2);
|
|
7136
7181
|
if (!relative || relative.includes("/")) return void 0;
|
|
7137
|
-
const directory =
|
|
7138
|
-
const direct =
|
|
7139
|
-
const candidates =
|
|
7182
|
+
const directory = path47.dirname(indexFile);
|
|
7183
|
+
const direct = path47.resolve(directory, relative);
|
|
7184
|
+
const candidates = path47.extname(direct) ? [direct] : MODULE_EXTENSIONS3.map((extension) => `${direct}${extension}`);
|
|
7140
7185
|
return candidates.find((candidate) => fs5.existsSync(candidate) && fs5.statSync(candidate).isFile());
|
|
7141
7186
|
}
|
|
7142
7187
|
var requireBarrelStarExportsRule = {
|
|
@@ -7149,9 +7194,9 @@ var requireBarrelStarExportsRule = {
|
|
|
7149
7194
|
fixable: "code"
|
|
7150
7195
|
},
|
|
7151
7196
|
create(context) {
|
|
7152
|
-
const filename =
|
|
7153
|
-
if (!INDEX_NAMES.has(
|
|
7154
|
-
if (!SUPPORT_FOLDERS3.has(
|
|
7197
|
+
const filename = path47.resolve(context.filename);
|
|
7198
|
+
if (!INDEX_NAMES.has(path47.basename(filename))) return {};
|
|
7199
|
+
if (!SUPPORT_FOLDERS3.has(path47.basename(path47.dirname(filename)))) return {};
|
|
7155
7200
|
return {
|
|
7156
7201
|
ExportNamedDeclaration(node) {
|
|
7157
7202
|
const sourceNode = node.source;
|
|
@@ -7204,7 +7249,7 @@ var requireBarrelStarExportsRule = {
|
|
|
7204
7249
|
};
|
|
7205
7250
|
|
|
7206
7251
|
// eslint/rules/root-support-placement.ts
|
|
7207
|
-
import
|
|
7252
|
+
import path48 from "path";
|
|
7208
7253
|
function isSupportFolder(value) {
|
|
7209
7254
|
return value === "utils" || value === "types" || value === "schemas" || value === "constants";
|
|
7210
7255
|
}
|
|
@@ -7237,7 +7282,7 @@ var rootSupportPlacementRule = {
|
|
|
7237
7282
|
},
|
|
7238
7283
|
create(context) {
|
|
7239
7284
|
const sourceRoot = sourceRootOf(context);
|
|
7240
|
-
const file =
|
|
7285
|
+
const file = path48.resolve(context.filename);
|
|
7241
7286
|
const segments = segmentsOf(file, sourceRoot);
|
|
7242
7287
|
const folderSegments = folderSegmentsOf(file, sourceRoot);
|
|
7243
7288
|
const supportFolder = folderSegments[folderSegments.length - 1];
|
|
@@ -7283,7 +7328,7 @@ var rootSupportPlacementRule = {
|
|
|
7283
7328
|
};
|
|
7284
7329
|
|
|
7285
7330
|
// eslint/rules/route-handler-shape.ts
|
|
7286
|
-
import
|
|
7331
|
+
import path49 from "path";
|
|
7287
7332
|
import ts9 from "typescript";
|
|
7288
7333
|
var HTTP_METHODS2 = /* @__PURE__ */ new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]);
|
|
7289
7334
|
var REQUIRED_BOUNDARY = "withResponse";
|
|
@@ -7368,7 +7413,7 @@ var routeHandlerShapeRule = {
|
|
|
7368
7413
|
}
|
|
7369
7414
|
},
|
|
7370
7415
|
create(context) {
|
|
7371
|
-
if (
|
|
7416
|
+
if (path49.basename(context.filename) !== "route.ts") return {};
|
|
7372
7417
|
const sourceText = context.sourceCode.text;
|
|
7373
7418
|
function reportUnwrapped(node, name) {
|
|
7374
7419
|
context.report({
|
|
@@ -7427,7 +7472,7 @@ var routeHandlerShapeRule = {
|
|
|
7427
7472
|
};
|
|
7428
7473
|
|
|
7429
7474
|
// eslint/rules/schema-casing.ts
|
|
7430
|
-
import
|
|
7475
|
+
import path50 from "path";
|
|
7431
7476
|
function isCamelCase(name) {
|
|
7432
7477
|
return /^[a-z][a-zA-Z0-9]*$/.test(name);
|
|
7433
7478
|
}
|
|
@@ -7455,9 +7500,9 @@ var schemaCasingRule = {
|
|
|
7455
7500
|
}
|
|
7456
7501
|
},
|
|
7457
7502
|
create(context) {
|
|
7458
|
-
const filename =
|
|
7503
|
+
const filename = path50.resolve(context.filename);
|
|
7459
7504
|
const sourceRoot = sourceRootOf(context);
|
|
7460
|
-
if (!filename.startsWith(sourceRoot +
|
|
7505
|
+
if (!filename.startsWith(sourceRoot + path50.sep)) return {};
|
|
7461
7506
|
let zodLocalName;
|
|
7462
7507
|
return {
|
|
7463
7508
|
ImportDeclaration(node) {
|
|
@@ -7489,7 +7534,7 @@ var schemaCasingRule = {
|
|
|
7489
7534
|
};
|
|
7490
7535
|
|
|
7491
7536
|
// eslint/rules/sole-state-owner.ts
|
|
7492
|
-
import
|
|
7537
|
+
import path51 from "path";
|
|
7493
7538
|
import ts10 from "typescript";
|
|
7494
7539
|
function findStateHooks(node) {
|
|
7495
7540
|
const hooks = [];
|
|
@@ -7569,7 +7614,7 @@ var soleStateOwnerRule = {
|
|
|
7569
7614
|
}
|
|
7570
7615
|
},
|
|
7571
7616
|
create(context) {
|
|
7572
|
-
const filename =
|
|
7617
|
+
const filename = path51.resolve(context.filename);
|
|
7573
7618
|
if (!filename.endsWith(".tsx") && !filename.endsWith(".jsx")) return {};
|
|
7574
7619
|
const text = context.sourceCode.text;
|
|
7575
7620
|
const components = parseComponentInfo(text, filename);
|
|
@@ -7648,7 +7693,7 @@ function usesOutsideJsx(declaration, hook, children) {
|
|
|
7648
7693
|
}
|
|
7649
7694
|
|
|
7650
7695
|
// eslint/rules/source-under-src.ts
|
|
7651
|
-
import
|
|
7696
|
+
import path52 from "path";
|
|
7652
7697
|
var NON_SOURCE_ROOT_DIRS = /* @__PURE__ */ new Set([
|
|
7653
7698
|
".agents",
|
|
7654
7699
|
".cache",
|
|
@@ -7689,14 +7734,14 @@ var sourceUnderSrcRule = {
|
|
|
7689
7734
|
}
|
|
7690
7735
|
},
|
|
7691
7736
|
create(context) {
|
|
7692
|
-
const filename =
|
|
7737
|
+
const filename = path52.resolve(context.filename);
|
|
7693
7738
|
if (!MODULE_EXTENSION.test(filename)) return {};
|
|
7694
|
-
const relative =
|
|
7739
|
+
const relative = path52.relative(context.cwd, filename).replace(/\\/g, "/");
|
|
7695
7740
|
if (relative === "src" || relative.startsWith("src/")) return {};
|
|
7696
7741
|
const topLevel = relative.split("/")[0] ?? "";
|
|
7697
7742
|
if (NON_SOURCE_ROOT_DIRS.has(topLevel)) return {};
|
|
7698
7743
|
if (!relative.includes("/")) {
|
|
7699
|
-
const basename =
|
|
7744
|
+
const basename = path52.basename(filename);
|
|
7700
7745
|
if (CONFIG_FILE.test(basename) || DECLARATION_FILE.test(basename) || basename.startsWith(".")) return {};
|
|
7701
7746
|
}
|
|
7702
7747
|
return {
|
|
@@ -7712,7 +7757,7 @@ var sourceUnderSrcRule = {
|
|
|
7712
7757
|
};
|
|
7713
7758
|
|
|
7714
7759
|
// eslint/rules/stay-flat.ts
|
|
7715
|
-
import
|
|
7760
|
+
import path53 from "path";
|
|
7716
7761
|
var stayFlatRule = {
|
|
7717
7762
|
meta: {
|
|
7718
7763
|
schema: [],
|
|
@@ -7723,7 +7768,7 @@ var stayFlatRule = {
|
|
|
7723
7768
|
},
|
|
7724
7769
|
create(context) {
|
|
7725
7770
|
const sourceRoot = sourceRootOf(context);
|
|
7726
|
-
const file =
|
|
7771
|
+
const file = path53.resolve(context.filename);
|
|
7727
7772
|
const segments = segmentsOf(file, sourceRoot);
|
|
7728
7773
|
if (segments.length !== 3 || segments[0] !== "features") return {};
|
|
7729
7774
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -7763,7 +7808,7 @@ var stayFlatRule = {
|
|
|
7763
7808
|
};
|
|
7764
7809
|
|
|
7765
7810
|
// eslint/rules/support-file-placement.ts
|
|
7766
|
-
import
|
|
7811
|
+
import path54 from "path";
|
|
7767
7812
|
var CONFIG_OWNED_FOLDERS = /* @__PURE__ */ new Set(["types", "constants"]);
|
|
7768
7813
|
var EXPORT_KIND_BY_SUPPORT_FOLDER = /* @__PURE__ */ new Map([
|
|
7769
7814
|
["constants", "constant"],
|
|
@@ -7788,7 +7833,7 @@ var supportFilePlacementRule = {
|
|
|
7788
7833
|
},
|
|
7789
7834
|
create(context) {
|
|
7790
7835
|
const sourceRoot = sourceRootOf(context);
|
|
7791
|
-
const supportFile =
|
|
7836
|
+
const supportFile = path54.resolve(context.filename);
|
|
7792
7837
|
const currentFolder = folderSegmentsOf(supportFile, sourceRoot);
|
|
7793
7838
|
const supportFolder = currentFolder[currentFolder.length - 1];
|
|
7794
7839
|
if (supportFolder === void 0 || !SUPPORT_FOLDERS.has(supportFolder)) return {};
|
|
@@ -7842,7 +7887,7 @@ var supportFilePlacementRule = {
|
|
|
7842
7887
|
|
|
7843
7888
|
// eslint/rules/support-folder-shape.ts
|
|
7844
7889
|
import fs6 from "fs";
|
|
7845
|
-
import
|
|
7890
|
+
import path55 from "path";
|
|
7846
7891
|
var SUPPORT_FOLDERS4 = /* @__PURE__ */ new Set(["constants", "types", "schemas"]);
|
|
7847
7892
|
var INDEX_NAMES2 = /* @__PURE__ */ new Set(["index.ts", "index.tsx", "index.mts", "index.cts"]);
|
|
7848
7893
|
var supportFolderShapeRule = {
|
|
@@ -7854,12 +7899,12 @@ var supportFolderShapeRule = {
|
|
|
7854
7899
|
}
|
|
7855
7900
|
},
|
|
7856
7901
|
create(context) {
|
|
7857
|
-
const filename =
|
|
7858
|
-
const baseName =
|
|
7902
|
+
const filename = path55.resolve(context.filename);
|
|
7903
|
+
const baseName = path55.basename(filename);
|
|
7859
7904
|
if (!INDEX_NAMES2.has(baseName)) return {};
|
|
7860
|
-
const folder =
|
|
7905
|
+
const folder = path55.basename(path55.dirname(filename));
|
|
7861
7906
|
if (!SUPPORT_FOLDERS4.has(folder)) return {};
|
|
7862
|
-
const directory =
|
|
7907
|
+
const directory = path55.dirname(filename);
|
|
7863
7908
|
let entries;
|
|
7864
7909
|
try {
|
|
7865
7910
|
entries = fs6.readdirSync(directory);
|
|
@@ -7877,7 +7922,7 @@ var supportFolderShapeRule = {
|
|
|
7877
7922
|
for (const match of source.matchAll(exportPattern)) {
|
|
7878
7923
|
hasAnyReExport = true;
|
|
7879
7924
|
const specifier = match.groups?.specifier;
|
|
7880
|
-
if (specifier?.startsWith(".")) exportedFiles.add(
|
|
7925
|
+
if (specifier?.startsWith(".")) exportedFiles.add(path55.basename(specifier));
|
|
7881
7926
|
}
|
|
7882
7927
|
const guide = `docs/next-codebase-guide/rules/${folder === "constants" ? "constants" : "types-and-schemas"}-rule.md`;
|
|
7883
7928
|
if (siblingModules.length === 0) {
|
|
@@ -8056,11 +8101,11 @@ var baseLayerPairRule = {
|
|
|
8056
8101
|
|
|
8057
8102
|
// eslint/rules/tailwind/css-entry-point.ts
|
|
8058
8103
|
import { statSync as statSync4 } from "fs";
|
|
8059
|
-
import
|
|
8104
|
+
import path58 from "path";
|
|
8060
8105
|
|
|
8061
8106
|
// eslint/rules/tailwind/source-files.ts
|
|
8062
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
8063
|
-
import
|
|
8107
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync10, statSync as statSync3 } from "fs";
|
|
8108
|
+
import path56 from "path";
|
|
8064
8109
|
var CSS_EXTENSIONS = [".css"];
|
|
8065
8110
|
var MODULE_EXTENSIONS4 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
8066
8111
|
var SOURCE_EXTENSIONS = [...MODULE_EXTENSIONS4, ...CSS_EXTENSIONS];
|
|
@@ -8073,7 +8118,7 @@ function findFiles(dir, extensions) {
|
|
|
8073
8118
|
}
|
|
8074
8119
|
return entries.flatMap((entry) => {
|
|
8075
8120
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
8076
|
-
const entryPath =
|
|
8121
|
+
const entryPath = path56.join(dir, entry);
|
|
8077
8122
|
let stats;
|
|
8078
8123
|
try {
|
|
8079
8124
|
stats = statSync3(entryPath);
|
|
@@ -8081,7 +8126,7 @@ function findFiles(dir, extensions) {
|
|
|
8081
8126
|
return [];
|
|
8082
8127
|
}
|
|
8083
8128
|
if (stats.isDirectory()) return findFiles(entryPath, extensions);
|
|
8084
|
-
return extensions.includes(
|
|
8129
|
+
return extensions.includes(path56.extname(entry)) ? [entryPath] : [];
|
|
8085
8130
|
});
|
|
8086
8131
|
}
|
|
8087
8132
|
function cachedTextReader() {
|
|
@@ -8090,7 +8135,7 @@ function cachedTextReader() {
|
|
|
8090
8135
|
let text = texts.get(file);
|
|
8091
8136
|
if (text === void 0) {
|
|
8092
8137
|
try {
|
|
8093
|
-
text =
|
|
8138
|
+
text = readFileSync10(file, "utf8");
|
|
8094
8139
|
} catch {
|
|
8095
8140
|
text = "";
|
|
8096
8141
|
}
|
|
@@ -8104,7 +8149,7 @@ function escapeRegExp(text) {
|
|
|
8104
8149
|
}
|
|
8105
8150
|
|
|
8106
8151
|
// eslint/rules/tailwind/stylesheet-graph.ts
|
|
8107
|
-
import
|
|
8152
|
+
import path57 from "path";
|
|
8108
8153
|
function registersTailwind(text) {
|
|
8109
8154
|
return /@import\s+(?:url\(\s*)?["']tailwindcss["']\s*\)?/i.test(text);
|
|
8110
8155
|
}
|
|
@@ -8118,25 +8163,25 @@ function moduleImports(text, fileName) {
|
|
|
8118
8163
|
return new RegExp(`(?:import|require)\\s*\\(?\\s*["'][^"']*${escaped}["']`, "i").test(text);
|
|
8119
8164
|
}
|
|
8120
8165
|
function resolveSpecifier2(fromFile, spec, sourceRoot) {
|
|
8121
|
-
if (spec.startsWith("/")) return
|
|
8122
|
-
if (spec.startsWith("./") || spec.startsWith("../")) return
|
|
8123
|
-
if (spec.startsWith("@/")) return
|
|
8166
|
+
if (spec.startsWith("/")) return path57.resolve(spec);
|
|
8167
|
+
if (spec.startsWith("./") || spec.startsWith("../")) return path57.resolve(path57.dirname(fromFile), spec);
|
|
8168
|
+
if (spec.startsWith("@/")) return path57.resolve(sourceRoot, spec.slice(2));
|
|
8124
8169
|
return void 0;
|
|
8125
8170
|
}
|
|
8126
8171
|
function buildStylesheetGraph(options) {
|
|
8127
8172
|
const { cssFiles, sourceRoot, textOf } = options;
|
|
8128
|
-
const cssSet = new Set(cssFiles.map((file) =>
|
|
8173
|
+
const cssSet = new Set(cssFiles.map((file) => path57.normalize(file)));
|
|
8129
8174
|
const globals = cssFiles.filter((file) => registersTailwind(textOf(file)));
|
|
8130
8175
|
const reachable = /* @__PURE__ */ new Set();
|
|
8131
8176
|
const queue = [...globals];
|
|
8132
|
-
for (const global of globals) reachable.add(
|
|
8177
|
+
for (const global of globals) reachable.add(path57.normalize(global));
|
|
8133
8178
|
while (queue.length > 0) {
|
|
8134
8179
|
const from = queue.shift();
|
|
8135
8180
|
if (!from) continue;
|
|
8136
8181
|
for (const spec of importedSpecifiers(textOf(from))) {
|
|
8137
8182
|
const target = resolveSpecifier2(from, spec, sourceRoot);
|
|
8138
8183
|
if (!target) continue;
|
|
8139
|
-
const normalized =
|
|
8184
|
+
const normalized = path57.normalize(target);
|
|
8140
8185
|
if (cssSet.has(normalized) && !reachable.has(normalized)) {
|
|
8141
8186
|
reachable.add(normalized);
|
|
8142
8187
|
queue.push(normalized);
|
|
@@ -8148,7 +8193,7 @@ function buildStylesheetGraph(options) {
|
|
|
8148
8193
|
for (const spec of importedSpecifiers(textOf(global))) {
|
|
8149
8194
|
const target = resolveSpecifier2(global, spec, sourceRoot);
|
|
8150
8195
|
if (!target) continue;
|
|
8151
|
-
const normalized =
|
|
8196
|
+
const normalized = path57.normalize(target);
|
|
8152
8197
|
if (cssSet.has(normalized)) directChildren.add(normalized);
|
|
8153
8198
|
}
|
|
8154
8199
|
}
|
|
@@ -8156,8 +8201,8 @@ function buildStylesheetGraph(options) {
|
|
|
8156
8201
|
}
|
|
8157
8202
|
|
|
8158
8203
|
// eslint/rules/tailwind/css-entry-point.ts
|
|
8159
|
-
var APP_STYLES_DIR =
|
|
8160
|
-
var GLOBAL_STYLESHEET_PATH =
|
|
8204
|
+
var APP_STYLES_DIR = path58.join("app", "styles");
|
|
8205
|
+
var GLOBAL_STYLESHEET_PATH = path58.join(APP_STYLES_DIR, "globals.css");
|
|
8161
8206
|
var cssEntryPointRule = {
|
|
8162
8207
|
meta: {
|
|
8163
8208
|
schema: [],
|
|
@@ -8183,8 +8228,8 @@ var cssEntryPointRule = {
|
|
|
8183
8228
|
return {
|
|
8184
8229
|
"StyleSheet:exit"(node) {
|
|
8185
8230
|
if (globals.length === 0) return;
|
|
8186
|
-
const current =
|
|
8187
|
-
const relative =
|
|
8231
|
+
const current = path58.normalize(path58.resolve(context.filename));
|
|
8232
|
+
const relative = path58.relative(sourceRoot, current);
|
|
8188
8233
|
if (globals.includes(current)) {
|
|
8189
8234
|
if (globals.length > 1) {
|
|
8190
8235
|
context.report({
|
|
@@ -8200,7 +8245,7 @@ var cssEntryPointRule = {
|
|
|
8200
8245
|
});
|
|
8201
8246
|
return;
|
|
8202
8247
|
}
|
|
8203
|
-
const basename =
|
|
8248
|
+
const basename = path58.basename(current);
|
|
8204
8249
|
const importCount = moduleFiles.filter((modulePath) => moduleImports(textOf(modulePath), basename)).length;
|
|
8205
8250
|
if (importCount !== 1) {
|
|
8206
8251
|
context.report({
|
|
@@ -8210,7 +8255,7 @@ var cssEntryPointRule = {
|
|
|
8210
8255
|
}
|
|
8211
8256
|
return;
|
|
8212
8257
|
}
|
|
8213
|
-
const isInAppStyles = relative === APP_STYLES_DIR || relative.startsWith(`${APP_STYLES_DIR}${
|
|
8258
|
+
const isInAppStyles = relative === APP_STYLES_DIR || relative.startsWith(`${APP_STYLES_DIR}${path58.sep}`);
|
|
8214
8259
|
if (!isInAppStyles) {
|
|
8215
8260
|
context.report({
|
|
8216
8261
|
node,
|
|
@@ -8699,7 +8744,7 @@ var tailwindRules = {
|
|
|
8699
8744
|
};
|
|
8700
8745
|
|
|
8701
8746
|
// eslint/rules/type-extraction.ts
|
|
8702
|
-
import
|
|
8747
|
+
import path59 from "path";
|
|
8703
8748
|
var typeExtractionRule = {
|
|
8704
8749
|
meta: {
|
|
8705
8750
|
schema: [],
|
|
@@ -8710,7 +8755,7 @@ var typeExtractionRule = {
|
|
|
8710
8755
|
},
|
|
8711
8756
|
create(context) {
|
|
8712
8757
|
const sourceRoot = sourceRootOf(context);
|
|
8713
|
-
const file =
|
|
8758
|
+
const file = path59.resolve(context.filename);
|
|
8714
8759
|
const segments = segmentsOf(file, sourceRoot);
|
|
8715
8760
|
if (segments.length === 0) return {};
|
|
8716
8761
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -8849,9 +8894,9 @@ var uiStateRule = {
|
|
|
8849
8894
|
};
|
|
8850
8895
|
|
|
8851
8896
|
// eslint/rules/unknown-utility.ts
|
|
8852
|
-
import { existsSync as existsSync6, readdirSync as readdirSync4, readFileSync as
|
|
8897
|
+
import { existsSync as existsSync6, readdirSync as readdirSync4, readFileSync as readFileSync11, statSync as statSync6 } from "fs";
|
|
8853
8898
|
import { createRequire } from "module";
|
|
8854
|
-
import
|
|
8899
|
+
import path60 from "path";
|
|
8855
8900
|
var PREFIX_NAMESPACES = {
|
|
8856
8901
|
bg: ["color"],
|
|
8857
8902
|
text: ["color", "text"],
|
|
@@ -9091,7 +9136,7 @@ function stylesheetFiles(dir) {
|
|
|
9091
9136
|
}
|
|
9092
9137
|
return entries.flatMap((entry) => {
|
|
9093
9138
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
9094
|
-
const entryPath =
|
|
9139
|
+
const entryPath = path60.join(dir, entry);
|
|
9095
9140
|
let stats;
|
|
9096
9141
|
try {
|
|
9097
9142
|
stats = statSync6(entryPath);
|
|
@@ -9099,7 +9144,7 @@ function stylesheetFiles(dir) {
|
|
|
9099
9144
|
return [];
|
|
9100
9145
|
}
|
|
9101
9146
|
if (stats.isDirectory()) return stylesheetFiles(entryPath);
|
|
9102
|
-
return
|
|
9147
|
+
return path60.extname(entry) === ".css" ? [entryPath] : [];
|
|
9103
9148
|
});
|
|
9104
9149
|
}
|
|
9105
9150
|
function packageNameOf(specifier) {
|
|
@@ -9110,24 +9155,24 @@ function packageNameOf(specifier) {
|
|
|
9110
9155
|
function resolvePackageStylesheet(fromFile, specifier) {
|
|
9111
9156
|
const packageName = packageNameOf(specifier);
|
|
9112
9157
|
if (!packageName || packageName === "tailwindcss") return void 0;
|
|
9113
|
-
let directory =
|
|
9114
|
-
while (directory !==
|
|
9115
|
-
const packageRoot =
|
|
9116
|
-
const manifestPath =
|
|
9158
|
+
let directory = path60.dirname(fromFile);
|
|
9159
|
+
while (directory !== path60.dirname(directory)) {
|
|
9160
|
+
const packageRoot = path60.join(directory, "node_modules", packageName);
|
|
9161
|
+
const manifestPath = path60.join(packageRoot, "package.json");
|
|
9117
9162
|
if (existsSync6(manifestPath)) {
|
|
9118
9163
|
try {
|
|
9119
|
-
const manifest =
|
|
9164
|
+
const manifest = readFileSync11(manifestPath, "utf8");
|
|
9120
9165
|
const stylesheet = /"style"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
9121
9166
|
const main = /"main"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
9122
9167
|
const target = stylesheet ?? main;
|
|
9123
9168
|
if (!target) return void 0;
|
|
9124
|
-
const resolved =
|
|
9169
|
+
const resolved = path60.resolve(packageRoot, target);
|
|
9125
9170
|
return existsSync6(resolved) ? resolved : void 0;
|
|
9126
9171
|
} catch {
|
|
9127
9172
|
return void 0;
|
|
9128
9173
|
}
|
|
9129
9174
|
}
|
|
9130
|
-
directory =
|
|
9175
|
+
directory = path60.dirname(directory);
|
|
9131
9176
|
}
|
|
9132
9177
|
return void 0;
|
|
9133
9178
|
}
|
|
@@ -9136,7 +9181,7 @@ function inventoryStylesheetFiles(projectFiles) {
|
|
|
9136
9181
|
for (const file of projectFiles) {
|
|
9137
9182
|
let css2;
|
|
9138
9183
|
try {
|
|
9139
|
-
css2 =
|
|
9184
|
+
css2 = readFileSync11(file, "utf8");
|
|
9140
9185
|
} catch {
|
|
9141
9186
|
continue;
|
|
9142
9187
|
}
|
|
@@ -9202,7 +9247,7 @@ function readInventory(files) {
|
|
|
9202
9247
|
for (const file of files) {
|
|
9203
9248
|
let css2;
|
|
9204
9249
|
try {
|
|
9205
|
-
css2 =
|
|
9250
|
+
css2 = readFileSync11(file, "utf8");
|
|
9206
9251
|
} catch {
|
|
9207
9252
|
continue;
|
|
9208
9253
|
}
|
|
@@ -9378,7 +9423,7 @@ var unknownUtilityRule = {
|
|
|
9378
9423
|
};
|
|
9379
9424
|
|
|
9380
9425
|
// eslint/rules/util-file-name.ts
|
|
9381
|
-
import
|
|
9426
|
+
import path61 from "path";
|
|
9382
9427
|
function toKebabCase2(value) {
|
|
9383
9428
|
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();
|
|
9384
9429
|
}
|
|
@@ -9391,7 +9436,7 @@ var utilFileNameRule = {
|
|
|
9391
9436
|
}
|
|
9392
9437
|
},
|
|
9393
9438
|
create(context) {
|
|
9394
|
-
const filename =
|
|
9439
|
+
const filename = path61.resolve(context.filename);
|
|
9395
9440
|
const segments = filename.replace(/\\/g, "/").split("/");
|
|
9396
9441
|
if (!segments.includes("utils")) return {};
|
|
9397
9442
|
let module;
|
|
@@ -9405,13 +9450,13 @@ var utilFileNameRule = {
|
|
|
9405
9450
|
const functionName = functions[0]?.name;
|
|
9406
9451
|
if (!functionName) return {};
|
|
9407
9452
|
const expected = toKebabCase2(functionName);
|
|
9408
|
-
const actual =
|
|
9453
|
+
const actual = path61.basename(filename, path61.extname(filename));
|
|
9409
9454
|
if (!expected || actual === expected) return {};
|
|
9410
9455
|
return {
|
|
9411
9456
|
Program(node) {
|
|
9412
9457
|
context.report({
|
|
9413
9458
|
node,
|
|
9414
|
-
message: `A utility file exporting ${functionName} must be named ${expected}.${
|
|
9459
|
+
message: `A utility file exporting ${functionName} must be named ${expected}.${path61.extname(filename).slice(1)}.`
|
|
9415
9460
|
});
|
|
9416
9461
|
}
|
|
9417
9462
|
};
|
|
@@ -9419,7 +9464,7 @@ var utilFileNameRule = {
|
|
|
9419
9464
|
};
|
|
9420
9465
|
|
|
9421
9466
|
// eslint/rules/value-extraction.ts
|
|
9422
|
-
import
|
|
9467
|
+
import path62 from "path";
|
|
9423
9468
|
var valueExtractionRule = {
|
|
9424
9469
|
meta: {
|
|
9425
9470
|
schema: [],
|
|
@@ -9430,7 +9475,7 @@ var valueExtractionRule = {
|
|
|
9430
9475
|
},
|
|
9431
9476
|
create(context) {
|
|
9432
9477
|
const sourceRoot = sourceRootOf(context);
|
|
9433
|
-
const file =
|
|
9478
|
+
const file = path62.resolve(context.filename);
|
|
9434
9479
|
const segments = segmentsOf(file, sourceRoot);
|
|
9435
9480
|
if (segments.length === 0 || segments[0] !== "app") return {};
|
|
9436
9481
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -9451,8 +9496,8 @@ var valueExtractionRule = {
|
|
|
9451
9496
|
};
|
|
9452
9497
|
|
|
9453
9498
|
// eslint/rules/vulyk/tracked-docs.ts
|
|
9454
|
-
import { existsSync as existsSync7, readFileSync as
|
|
9455
|
-
import
|
|
9499
|
+
import { existsSync as existsSync7, readFileSync as readFileSync12 } from "fs";
|
|
9500
|
+
import path63 from "path";
|
|
9456
9501
|
var PASIKA_REPO = "Bredansky/pasika";
|
|
9457
9502
|
var BASE_REQUIRED_TRACKED_DOCS = [
|
|
9458
9503
|
{ name: "documentation-guide", path: "docs/documentation-guide" },
|
|
@@ -9485,8 +9530,8 @@ var trackedDocsRule = {
|
|
|
9485
9530
|
if (!context.filename.endsWith("package.json")) return;
|
|
9486
9531
|
const root = node.body;
|
|
9487
9532
|
if (root.type !== "Object") return;
|
|
9488
|
-
const projectRoot =
|
|
9489
|
-
const configPath =
|
|
9533
|
+
const projectRoot = path63.dirname(path63.resolve(context.filename));
|
|
9534
|
+
const configPath = path63.join(projectRoot, "vulyk.config.ts");
|
|
9490
9535
|
if (!existsSync7(configPath)) {
|
|
9491
9536
|
context.report({
|
|
9492
9537
|
node,
|
|
@@ -9494,7 +9539,7 @@ var trackedDocsRule = {
|
|
|
9494
9539
|
});
|
|
9495
9540
|
return;
|
|
9496
9541
|
}
|
|
9497
|
-
const config =
|
|
9542
|
+
const config = readFileSync12(configPath, "utf8");
|
|
9498
9543
|
if (!config.includes(PASIKA_REPO)) {
|
|
9499
9544
|
context.report({
|
|
9500
9545
|
node,
|
|
@@ -9511,7 +9556,7 @@ var trackedDocsRule = {
|
|
|
9511
9556
|
});
|
|
9512
9557
|
}
|
|
9513
9558
|
}
|
|
9514
|
-
const agentsPath =
|
|
9559
|
+
const agentsPath = path63.join(projectRoot, "AGENTS.md");
|
|
9515
9560
|
if (!existsSync7(agentsPath)) {
|
|
9516
9561
|
context.report({
|
|
9517
9562
|
node,
|
|
@@ -9611,7 +9656,7 @@ var withResponseHelperRule = {
|
|
|
9611
9656
|
|
|
9612
9657
|
// eslint/rules/zirka-baseline.ts
|
|
9613
9658
|
import fs7 from "fs";
|
|
9614
|
-
import
|
|
9659
|
+
import path64 from "path";
|
|
9615
9660
|
var ESLINT_CONFIG = /^eslint\.config\.(?:ts|mts|cts|js|mjs|cjs)$/;
|
|
9616
9661
|
var PRETTIER_CONFIGS = [
|
|
9617
9662
|
"prettier.config.mjs",
|
|
@@ -9630,10 +9675,10 @@ var zirkaBaselineRule = {
|
|
|
9630
9675
|
}
|
|
9631
9676
|
},
|
|
9632
9677
|
create(context) {
|
|
9633
|
-
const filename =
|
|
9634
|
-
const basename =
|
|
9678
|
+
const filename = path64.resolve(context.filename);
|
|
9679
|
+
const basename = path64.basename(filename);
|
|
9635
9680
|
if (!ESLINT_CONFIG.test(basename)) return {};
|
|
9636
|
-
const projectRoot =
|
|
9681
|
+
const projectRoot = path64.dirname(filename);
|
|
9637
9682
|
const report3 = (message) => {
|
|
9638
9683
|
context.report({
|
|
9639
9684
|
node: context.sourceCode.ast,
|
|
@@ -9648,7 +9693,7 @@ var zirkaBaselineRule = {
|
|
|
9648
9693
|
'ESLint config must take its configuration from zirka (import { styleguide } from "zirka") instead of restating rules locally.'
|
|
9649
9694
|
);
|
|
9650
9695
|
}
|
|
9651
|
-
const tsconfigPath =
|
|
9696
|
+
const tsconfigPath = path64.join(projectRoot, "tsconfig.json");
|
|
9652
9697
|
if (!fs7.existsSync(tsconfigPath)) {
|
|
9653
9698
|
report3('No tsconfig.json found. Create one extending the zirka TypeScript base config ("zirka/typescript").');
|
|
9654
9699
|
} else {
|
|
@@ -9666,13 +9711,13 @@ var zirkaBaselineRule = {
|
|
|
9666
9711
|
report3('tsconfig.json must extend the zirka TypeScript base config ("zirka/typescript").');
|
|
9667
9712
|
}
|
|
9668
9713
|
}
|
|
9669
|
-
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(
|
|
9714
|
+
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(path64.join(projectRoot, name)));
|
|
9670
9715
|
if (!prettierConfigFile) {
|
|
9671
9716
|
report3(
|
|
9672
9717
|
"No prettier config found. Create one that takes its configuration from zirka (styleguide({ prettier: true }).prettierConfig)."
|
|
9673
9718
|
);
|
|
9674
9719
|
} else {
|
|
9675
|
-
const content = fs7.readFileSync(
|
|
9720
|
+
const content = fs7.readFileSync(path64.join(projectRoot, prettierConfigFile), "utf8");
|
|
9676
9721
|
if (!content.includes("zirka")) {
|
|
9677
9722
|
report3(
|
|
9678
9723
|
"The prettier config must take its configuration from zirka (styleguide({ prettier: true }).prettierConfig) instead of restating it locally."
|
|
@@ -9818,14 +9863,14 @@ var zodSchemaValidationRule = {
|
|
|
9818
9863
|
};
|
|
9819
9864
|
|
|
9820
9865
|
// eslint/ts-alignment.ts
|
|
9821
|
-
import { readFileSync as
|
|
9866
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
9822
9867
|
import { createRequire as createRequire2 } from "module";
|
|
9823
9868
|
import { join } from "path";
|
|
9824
9869
|
var ownRequire = createRequire2(import.meta.url);
|
|
9825
9870
|
var majorOf = (version) => Number(version.split(".")[0]);
|
|
9826
9871
|
function versionOf(packagePath) {
|
|
9827
9872
|
try {
|
|
9828
|
-
const parsed = JSON.parse(
|
|
9873
|
+
const parsed = JSON.parse(readFileSync13(packagePath, "utf8"));
|
|
9829
9874
|
if (typeof parsed !== "object" || parsed === null || !("version" in parsed)) return null;
|
|
9830
9875
|
return typeof parsed.version === "string" ? parsed.version : null;
|
|
9831
9876
|
} catch {
|