pasika 0.10.89 → 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 +175 -141
- 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,44 +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();
|
|
5147
5152
|
const isNextPageOrLayout = /(?:^|[/\\])src[/\\]app[/\\](?:[^/\\]+[/\\])*(?:page|layout)\.tsx$/.test(
|
|
5148
5153
|
context.filename
|
|
5149
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
|
+
};
|
|
5150
5175
|
for (const statement of context.sourceCode.ast.body) {
|
|
5151
5176
|
if (statement.type === "ExportNamedDeclaration") {
|
|
5152
5177
|
if (/^export\s+(?:type|interface)\b/.test(context.sourceCode.getText(statement))) continue;
|
|
5153
5178
|
const declaration = statement.declaration;
|
|
5154
|
-
if (
|
|
5155
|
-
(
|
|
5156
|
-
)) {
|
|
5179
|
+
if (declaration?.type === "FunctionDeclaration" || declaration?.type === "ClassDeclaration") {
|
|
5180
|
+
checkSupportingExport(declaration.id.name, statement.loc?.start ?? { line: 1, column: 0 });
|
|
5157
5181
|
continue;
|
|
5158
5182
|
}
|
|
5159
|
-
if (
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
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
|
+
}
|
|
5164
5189
|
continue;
|
|
5165
5190
|
}
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
)
|
|
5169
|
-
continue;
|
|
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
|
+
}
|
|
5170
5206
|
}
|
|
5171
5207
|
} else if (statement.type === "ExportAllDeclaration") {
|
|
5172
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
|
+
});
|
|
5173
5213
|
} else if (statement.type === "ExportDefaultDeclaration") {
|
|
5174
|
-
|
|
5175
|
-
if (
|
|
5176
|
-
|
|
5177
|
-
}
|
|
5178
|
-
} else {
|
|
5179
|
-
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 });
|
|
5180
5218
|
}
|
|
5181
|
-
context.report({
|
|
5182
|
-
node: statement,
|
|
5183
|
-
message: `Component files must export only their own component "${componentName}". Import other values directly from their files.`
|
|
5184
|
-
});
|
|
5185
5219
|
}
|
|
5186
5220
|
}
|
|
5187
5221
|
};
|
|
@@ -5189,10 +5223,10 @@ var noMixedConcernsRule = {
|
|
|
5189
5223
|
};
|
|
5190
5224
|
|
|
5191
5225
|
// eslint/rules/no-redundant-alias.ts
|
|
5192
|
-
import
|
|
5226
|
+
import path41 from "path";
|
|
5193
5227
|
|
|
5194
5228
|
// eslint/rules/contract-ownership.ts
|
|
5195
|
-
import
|
|
5229
|
+
import path40 from "path";
|
|
5196
5230
|
import ts7 from "typescript";
|
|
5197
5231
|
function isTsProgram(value) {
|
|
5198
5232
|
return typeof value === "object" && value !== null && "getTypeChecker" in value && typeof value.getTypeChecker === "function" && "getSourceFiles" in value && typeof value.getSourceFiles === "function";
|
|
@@ -5211,8 +5245,8 @@ function normalizePath(value) {
|
|
|
5211
5245
|
return value.replaceAll("\\", "/").toLowerCase();
|
|
5212
5246
|
}
|
|
5213
5247
|
function isWithin2(root, file) {
|
|
5214
|
-
const relative =
|
|
5215
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
5248
|
+
const relative = path40.relative(root, file);
|
|
5249
|
+
return relative === "" || !relative.startsWith("..") && !path40.isAbsolute(relative);
|
|
5216
5250
|
}
|
|
5217
5251
|
function mergeOwnership(values) {
|
|
5218
5252
|
if (values.length === 0 || values.includes("unknown")) return "unknown";
|
|
@@ -5352,7 +5386,7 @@ var ContractOwnershipIndex = class {
|
|
|
5352
5386
|
const normalized = normalizePath(fileName);
|
|
5353
5387
|
if (/\/typescript\/lib\/lib\.[^/]+\.d\.ts$/u.test(normalized)) return "platform";
|
|
5354
5388
|
if (normalized.includes("/node_modules/")) return "third-party";
|
|
5355
|
-
if (isWithin2(this.cwd,
|
|
5389
|
+
if (isWithin2(this.cwd, path40.resolve(fileName))) return "first-party";
|
|
5356
5390
|
return "unknown";
|
|
5357
5391
|
}
|
|
5358
5392
|
schemaOwnership(declaration) {
|
|
@@ -5366,7 +5400,7 @@ var ContractOwnershipIndex = class {
|
|
|
5366
5400
|
}
|
|
5367
5401
|
indexApiContracts() {
|
|
5368
5402
|
for (const sourceFile of this.program.getSourceFiles()) {
|
|
5369
|
-
if (sourceFile.isDeclarationFile || !isWithin2(this.cwd,
|
|
5403
|
+
if (sourceFile.isDeclarationFile || !isWithin2(this.cwd, path40.resolve(sourceFile.fileName))) continue;
|
|
5370
5404
|
const visit = (node) => {
|
|
5371
5405
|
if (ts7.isCallExpression(node) && this.isDefineApiContractCall(node)) this.indexApiContractCall(node);
|
|
5372
5406
|
ts7.forEachChild(node, visit);
|
|
@@ -5637,7 +5671,7 @@ var noRedundantAliasRule = {
|
|
|
5637
5671
|
if (declaration.type !== "VariableDeclaration" || declaration.kind !== "const") return;
|
|
5638
5672
|
if (node.init.type === "Identifier") {
|
|
5639
5673
|
const exported = declaration.parent.type === "ExportNamedDeclaration";
|
|
5640
|
-
const frameworkRouteAlias =
|
|
5674
|
+
const frameworkRouteAlias = path41.basename(context.filename) === "route.ts" && exported && HTTP_METHODS.has(node.id.name);
|
|
5641
5675
|
if (frameworkRouteAlias || VALUE_SENTINELS.has(node.init.name)) return;
|
|
5642
5676
|
context.report({
|
|
5643
5677
|
node,
|
|
@@ -5755,7 +5789,7 @@ var noRedundantAliasRule = {
|
|
|
5755
5789
|
const source = specifier.local.name;
|
|
5756
5790
|
const alias = specifier.exported.name;
|
|
5757
5791
|
if (source === alias) continue;
|
|
5758
|
-
const frameworkRouteAlias =
|
|
5792
|
+
const frameworkRouteAlias = path41.basename(context.filename) === "route.ts" && HTTP_METHODS.has(alias);
|
|
5759
5793
|
if (frameworkRouteAlias) continue;
|
|
5760
5794
|
context.report({
|
|
5761
5795
|
node: specifier,
|
|
@@ -5780,7 +5814,7 @@ var noRedundantAliasRule = {
|
|
|
5780
5814
|
};
|
|
5781
5815
|
|
|
5782
5816
|
// eslint/rules/no-util-barrel.ts
|
|
5783
|
-
import
|
|
5817
|
+
import path42 from "path";
|
|
5784
5818
|
var noUtilBarrelRule = {
|
|
5785
5819
|
meta: {
|
|
5786
5820
|
schema: [],
|
|
@@ -5790,7 +5824,7 @@ var noUtilBarrelRule = {
|
|
|
5790
5824
|
}
|
|
5791
5825
|
},
|
|
5792
5826
|
create(context) {
|
|
5793
|
-
const filename =
|
|
5827
|
+
const filename = path42.resolve(context.filename);
|
|
5794
5828
|
const sourceRoot = sourceRootOf3(context, filename);
|
|
5795
5829
|
return {
|
|
5796
5830
|
Program(node) {
|
|
@@ -5799,7 +5833,7 @@ var noUtilBarrelRule = {
|
|
|
5799
5833
|
if (!target) continue;
|
|
5800
5834
|
const segments = target.replace(/\\/g, "/").split("/");
|
|
5801
5835
|
const utilsIndex = segments.lastIndexOf("utils");
|
|
5802
|
-
if (utilsIndex < 0 || !
|
|
5836
|
+
if (utilsIndex < 0 || !path42.basename(target).startsWith("index.")) continue;
|
|
5803
5837
|
context.report({
|
|
5804
5838
|
node,
|
|
5805
5839
|
message: `Import utilities directly instead of through "${specifier}". See docs/next-codebase-guide/rules/utilities-rule.md`
|
|
@@ -5819,10 +5853,10 @@ function importSpecifiers2(source) {
|
|
|
5819
5853
|
return specifiers;
|
|
5820
5854
|
}
|
|
5821
5855
|
function sourceRootOf3(context, filename) {
|
|
5822
|
-
const marker = `${
|
|
5856
|
+
const marker = `${path42.sep}src${path42.sep}`;
|
|
5823
5857
|
const srcIndex = filename.lastIndexOf(marker);
|
|
5824
5858
|
if (srcIndex >= 0) return filename.slice(0, srcIndex + marker.length - 1);
|
|
5825
|
-
return
|
|
5859
|
+
return path42.resolve(context.cwd ?? process.cwd(), "src");
|
|
5826
5860
|
}
|
|
5827
5861
|
|
|
5828
5862
|
// eslint/rules/package-json/exact-version.ts
|
|
@@ -6040,8 +6074,8 @@ var nextjsStackRule = {
|
|
|
6040
6074
|
};
|
|
6041
6075
|
|
|
6042
6076
|
// eslint/rules/package-json/vitest-coverage.ts
|
|
6043
|
-
import { existsSync as existsSync5, readFileSync as
|
|
6044
|
-
import
|
|
6077
|
+
import { existsSync as existsSync5, readFileSync as readFileSync9 } from "fs";
|
|
6078
|
+
import path43 from "path";
|
|
6045
6079
|
function memberName5(member) {
|
|
6046
6080
|
return member.name.type === "String" ? member.name.value : member.name.name;
|
|
6047
6081
|
}
|
|
@@ -6111,7 +6145,7 @@ var vitestCoverageRule = {
|
|
|
6111
6145
|
message: 'package.json must declare a "test:unit:coverage" script that runs Vitest with coverage.'
|
|
6112
6146
|
});
|
|
6113
6147
|
}
|
|
6114
|
-
const configName = VITEST_CONFIG_NAMES.find((name) => existsSync5(
|
|
6148
|
+
const configName = VITEST_CONFIG_NAMES.find((name) => existsSync5(path43.join(context.cwd, name)));
|
|
6115
6149
|
if (!configName) {
|
|
6116
6150
|
context.report({
|
|
6117
6151
|
node,
|
|
@@ -6119,7 +6153,7 @@ var vitestCoverageRule = {
|
|
|
6119
6153
|
});
|
|
6120
6154
|
return;
|
|
6121
6155
|
}
|
|
6122
|
-
const content =
|
|
6156
|
+
const content = readFileSync9(path43.join(context.cwd, configName), "utf8");
|
|
6123
6157
|
for (const metric of THRESHOLD_METRICS) {
|
|
6124
6158
|
if (!new RegExp(`\\b${metric}\\s*:\\s*[1-9]\\d*`).test(content)) {
|
|
6125
6159
|
context.report({ node, message: `${configName} must set a coverage threshold above zero for ${metric}.` });
|
|
@@ -6165,7 +6199,7 @@ var nextjsPackageJsonRules = {
|
|
|
6165
6199
|
};
|
|
6166
6200
|
|
|
6167
6201
|
// eslint/rules/prefer-enum.ts
|
|
6168
|
-
import
|
|
6202
|
+
import path44 from "path";
|
|
6169
6203
|
function isConstAssertion(node) {
|
|
6170
6204
|
const typeAnnotation = node.typeAnnotation;
|
|
6171
6205
|
return typeAnnotation?.type === "TSTypeReference" && typeAnnotation.typeName?.type === "Identifier" && typeAnnotation.typeName.name === "const";
|
|
@@ -6217,9 +6251,9 @@ var preferEnumRule = {
|
|
|
6217
6251
|
}
|
|
6218
6252
|
},
|
|
6219
6253
|
create(context) {
|
|
6220
|
-
const filename =
|
|
6254
|
+
const filename = path44.resolve(context.filename);
|
|
6221
6255
|
const sourceRoot = sourceRootOf(context);
|
|
6222
|
-
if (!filename.startsWith(sourceRoot +
|
|
6256
|
+
if (!filename.startsWith(sourceRoot + path44.sep)) return {};
|
|
6223
6257
|
const objectSchemas = /* @__PURE__ */ new Map();
|
|
6224
6258
|
const discriminatedUnions = [];
|
|
6225
6259
|
const reportedDiscriminants = /* @__PURE__ */ new Set();
|
|
@@ -6762,7 +6796,7 @@ ${indentation}`;
|
|
|
6762
6796
|
};
|
|
6763
6797
|
|
|
6764
6798
|
// eslint/rules/pure-function-extract.ts
|
|
6765
|
-
import
|
|
6799
|
+
import path45 from "path";
|
|
6766
6800
|
var ROUTE_HANDLER_EXPORT_NAMES = /* @__PURE__ */ new Set([
|
|
6767
6801
|
"GET",
|
|
6768
6802
|
"POST",
|
|
@@ -6827,12 +6861,12 @@ var pureFunctionExtractRule = {
|
|
|
6827
6861
|
},
|
|
6828
6862
|
create(context) {
|
|
6829
6863
|
const filename = context.filename;
|
|
6830
|
-
const isRouteFile =
|
|
6864
|
+
const isRouteFile = path45.basename(filename) === "route.ts";
|
|
6831
6865
|
const isComponentFile = filename.endsWith(".tsx") || filename.endsWith(".jsx");
|
|
6832
6866
|
const sourceRoot = sourceRootOf(context);
|
|
6833
|
-
const relative =
|
|
6867
|
+
const relative = path45.relative(sourceRoot, filename);
|
|
6834
6868
|
if (relative.startsWith("..")) return {};
|
|
6835
|
-
const segments = relative.split(
|
|
6869
|
+
const segments = relative.split(path45.sep);
|
|
6836
6870
|
const folders = segments.slice(0, -1);
|
|
6837
6871
|
const isHookSupportFile = folders.includes("hooks") && /\.(?:[cm]?[jt]s)$/.test(filename);
|
|
6838
6872
|
if (!isComponentFile && !isRouteFile && !isHookSupportFile) return {};
|
|
@@ -6892,16 +6926,16 @@ var pureFunctionExtractRule = {
|
|
|
6892
6926
|
};
|
|
6893
6927
|
|
|
6894
6928
|
// eslint/rules/repeated-numeric-value.ts
|
|
6895
|
-
import
|
|
6929
|
+
import path46 from "path";
|
|
6896
6930
|
var ignoredValues = /* @__PURE__ */ new Set([-1, 0, 1]);
|
|
6897
6931
|
function isNonProductionFile(file, sourceRoot) {
|
|
6898
|
-
const relative =
|
|
6899
|
-
const segments = relative.split(
|
|
6900
|
-
const basename =
|
|
6932
|
+
const relative = path46.relative(sourceRoot, file);
|
|
6933
|
+
const segments = relative.split(path46.sep);
|
|
6934
|
+
const basename = path46.basename(file);
|
|
6901
6935
|
return /\.(?:test|spec|mock)\.[^.]+$/.test(basename) || segments.some((segment) => segment === "__tests__" || segment === "__mocks__" || segment === "mocks");
|
|
6902
6936
|
}
|
|
6903
6937
|
function isCanonicalConstantFile(file, sourceRoot) {
|
|
6904
|
-
const segments =
|
|
6938
|
+
const segments = path46.relative(sourceRoot, file).split(path46.sep);
|
|
6905
6939
|
return segments.includes("constants") || segments[0] === "config";
|
|
6906
6940
|
}
|
|
6907
6941
|
function groupKey(literal) {
|
|
@@ -6917,7 +6951,7 @@ var repeatedNumericValueRule = {
|
|
|
6917
6951
|
},
|
|
6918
6952
|
create(context) {
|
|
6919
6953
|
const sourceRoot = sourceRootOf(context);
|
|
6920
|
-
const file =
|
|
6954
|
+
const file = path46.resolve(context.filename);
|
|
6921
6955
|
if (isNonProductionFile(file, sourceRoot) || isCanonicalConstantFile(file, sourceRoot)) return {};
|
|
6922
6956
|
const index = getProjectIndex(sourceRoot);
|
|
6923
6957
|
if (!index) return {};
|
|
@@ -7137,7 +7171,7 @@ var repeatedStructureRule = {
|
|
|
7137
7171
|
|
|
7138
7172
|
// eslint/rules/require-barrel-star-exports.ts
|
|
7139
7173
|
import fs5 from "fs";
|
|
7140
|
-
import
|
|
7174
|
+
import path47 from "path";
|
|
7141
7175
|
var SUPPORT_FOLDERS3 = /* @__PURE__ */ new Set(["constants", "types", "schemas"]);
|
|
7142
7176
|
var INDEX_NAMES = /* @__PURE__ */ new Set(["index.ts", "index.tsx", "index.mts", "index.cts"]);
|
|
7143
7177
|
var MODULE_EXTENSIONS3 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
@@ -7145,9 +7179,9 @@ function resolveSiblingModule(indexFile, specifier) {
|
|
|
7145
7179
|
if (!specifier.startsWith("./")) return void 0;
|
|
7146
7180
|
const relative = specifier.slice(2);
|
|
7147
7181
|
if (!relative || relative.includes("/")) return void 0;
|
|
7148
|
-
const directory =
|
|
7149
|
-
const direct =
|
|
7150
|
-
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}`);
|
|
7151
7185
|
return candidates.find((candidate) => fs5.existsSync(candidate) && fs5.statSync(candidate).isFile());
|
|
7152
7186
|
}
|
|
7153
7187
|
var requireBarrelStarExportsRule = {
|
|
@@ -7160,9 +7194,9 @@ var requireBarrelStarExportsRule = {
|
|
|
7160
7194
|
fixable: "code"
|
|
7161
7195
|
},
|
|
7162
7196
|
create(context) {
|
|
7163
|
-
const filename =
|
|
7164
|
-
if (!INDEX_NAMES.has(
|
|
7165
|
-
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 {};
|
|
7166
7200
|
return {
|
|
7167
7201
|
ExportNamedDeclaration(node) {
|
|
7168
7202
|
const sourceNode = node.source;
|
|
@@ -7215,7 +7249,7 @@ var requireBarrelStarExportsRule = {
|
|
|
7215
7249
|
};
|
|
7216
7250
|
|
|
7217
7251
|
// eslint/rules/root-support-placement.ts
|
|
7218
|
-
import
|
|
7252
|
+
import path48 from "path";
|
|
7219
7253
|
function isSupportFolder(value) {
|
|
7220
7254
|
return value === "utils" || value === "types" || value === "schemas" || value === "constants";
|
|
7221
7255
|
}
|
|
@@ -7248,7 +7282,7 @@ var rootSupportPlacementRule = {
|
|
|
7248
7282
|
},
|
|
7249
7283
|
create(context) {
|
|
7250
7284
|
const sourceRoot = sourceRootOf(context);
|
|
7251
|
-
const file =
|
|
7285
|
+
const file = path48.resolve(context.filename);
|
|
7252
7286
|
const segments = segmentsOf(file, sourceRoot);
|
|
7253
7287
|
const folderSegments = folderSegmentsOf(file, sourceRoot);
|
|
7254
7288
|
const supportFolder = folderSegments[folderSegments.length - 1];
|
|
@@ -7294,7 +7328,7 @@ var rootSupportPlacementRule = {
|
|
|
7294
7328
|
};
|
|
7295
7329
|
|
|
7296
7330
|
// eslint/rules/route-handler-shape.ts
|
|
7297
|
-
import
|
|
7331
|
+
import path49 from "path";
|
|
7298
7332
|
import ts9 from "typescript";
|
|
7299
7333
|
var HTTP_METHODS2 = /* @__PURE__ */ new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]);
|
|
7300
7334
|
var REQUIRED_BOUNDARY = "withResponse";
|
|
@@ -7379,7 +7413,7 @@ var routeHandlerShapeRule = {
|
|
|
7379
7413
|
}
|
|
7380
7414
|
},
|
|
7381
7415
|
create(context) {
|
|
7382
|
-
if (
|
|
7416
|
+
if (path49.basename(context.filename) !== "route.ts") return {};
|
|
7383
7417
|
const sourceText = context.sourceCode.text;
|
|
7384
7418
|
function reportUnwrapped(node, name) {
|
|
7385
7419
|
context.report({
|
|
@@ -7438,7 +7472,7 @@ var routeHandlerShapeRule = {
|
|
|
7438
7472
|
};
|
|
7439
7473
|
|
|
7440
7474
|
// eslint/rules/schema-casing.ts
|
|
7441
|
-
import
|
|
7475
|
+
import path50 from "path";
|
|
7442
7476
|
function isCamelCase(name) {
|
|
7443
7477
|
return /^[a-z][a-zA-Z0-9]*$/.test(name);
|
|
7444
7478
|
}
|
|
@@ -7466,9 +7500,9 @@ var schemaCasingRule = {
|
|
|
7466
7500
|
}
|
|
7467
7501
|
},
|
|
7468
7502
|
create(context) {
|
|
7469
|
-
const filename =
|
|
7503
|
+
const filename = path50.resolve(context.filename);
|
|
7470
7504
|
const sourceRoot = sourceRootOf(context);
|
|
7471
|
-
if (!filename.startsWith(sourceRoot +
|
|
7505
|
+
if (!filename.startsWith(sourceRoot + path50.sep)) return {};
|
|
7472
7506
|
let zodLocalName;
|
|
7473
7507
|
return {
|
|
7474
7508
|
ImportDeclaration(node) {
|
|
@@ -7500,7 +7534,7 @@ var schemaCasingRule = {
|
|
|
7500
7534
|
};
|
|
7501
7535
|
|
|
7502
7536
|
// eslint/rules/sole-state-owner.ts
|
|
7503
|
-
import
|
|
7537
|
+
import path51 from "path";
|
|
7504
7538
|
import ts10 from "typescript";
|
|
7505
7539
|
function findStateHooks(node) {
|
|
7506
7540
|
const hooks = [];
|
|
@@ -7580,7 +7614,7 @@ var soleStateOwnerRule = {
|
|
|
7580
7614
|
}
|
|
7581
7615
|
},
|
|
7582
7616
|
create(context) {
|
|
7583
|
-
const filename =
|
|
7617
|
+
const filename = path51.resolve(context.filename);
|
|
7584
7618
|
if (!filename.endsWith(".tsx") && !filename.endsWith(".jsx")) return {};
|
|
7585
7619
|
const text = context.sourceCode.text;
|
|
7586
7620
|
const components = parseComponentInfo(text, filename);
|
|
@@ -7659,7 +7693,7 @@ function usesOutsideJsx(declaration, hook, children) {
|
|
|
7659
7693
|
}
|
|
7660
7694
|
|
|
7661
7695
|
// eslint/rules/source-under-src.ts
|
|
7662
|
-
import
|
|
7696
|
+
import path52 from "path";
|
|
7663
7697
|
var NON_SOURCE_ROOT_DIRS = /* @__PURE__ */ new Set([
|
|
7664
7698
|
".agents",
|
|
7665
7699
|
".cache",
|
|
@@ -7700,14 +7734,14 @@ var sourceUnderSrcRule = {
|
|
|
7700
7734
|
}
|
|
7701
7735
|
},
|
|
7702
7736
|
create(context) {
|
|
7703
|
-
const filename =
|
|
7737
|
+
const filename = path52.resolve(context.filename);
|
|
7704
7738
|
if (!MODULE_EXTENSION.test(filename)) return {};
|
|
7705
|
-
const relative =
|
|
7739
|
+
const relative = path52.relative(context.cwd, filename).replace(/\\/g, "/");
|
|
7706
7740
|
if (relative === "src" || relative.startsWith("src/")) return {};
|
|
7707
7741
|
const topLevel = relative.split("/")[0] ?? "";
|
|
7708
7742
|
if (NON_SOURCE_ROOT_DIRS.has(topLevel)) return {};
|
|
7709
7743
|
if (!relative.includes("/")) {
|
|
7710
|
-
const basename =
|
|
7744
|
+
const basename = path52.basename(filename);
|
|
7711
7745
|
if (CONFIG_FILE.test(basename) || DECLARATION_FILE.test(basename) || basename.startsWith(".")) return {};
|
|
7712
7746
|
}
|
|
7713
7747
|
return {
|
|
@@ -7723,7 +7757,7 @@ var sourceUnderSrcRule = {
|
|
|
7723
7757
|
};
|
|
7724
7758
|
|
|
7725
7759
|
// eslint/rules/stay-flat.ts
|
|
7726
|
-
import
|
|
7760
|
+
import path53 from "path";
|
|
7727
7761
|
var stayFlatRule = {
|
|
7728
7762
|
meta: {
|
|
7729
7763
|
schema: [],
|
|
@@ -7734,7 +7768,7 @@ var stayFlatRule = {
|
|
|
7734
7768
|
},
|
|
7735
7769
|
create(context) {
|
|
7736
7770
|
const sourceRoot = sourceRootOf(context);
|
|
7737
|
-
const file =
|
|
7771
|
+
const file = path53.resolve(context.filename);
|
|
7738
7772
|
const segments = segmentsOf(file, sourceRoot);
|
|
7739
7773
|
if (segments.length !== 3 || segments[0] !== "features") return {};
|
|
7740
7774
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -7774,7 +7808,7 @@ var stayFlatRule = {
|
|
|
7774
7808
|
};
|
|
7775
7809
|
|
|
7776
7810
|
// eslint/rules/support-file-placement.ts
|
|
7777
|
-
import
|
|
7811
|
+
import path54 from "path";
|
|
7778
7812
|
var CONFIG_OWNED_FOLDERS = /* @__PURE__ */ new Set(["types", "constants"]);
|
|
7779
7813
|
var EXPORT_KIND_BY_SUPPORT_FOLDER = /* @__PURE__ */ new Map([
|
|
7780
7814
|
["constants", "constant"],
|
|
@@ -7799,7 +7833,7 @@ var supportFilePlacementRule = {
|
|
|
7799
7833
|
},
|
|
7800
7834
|
create(context) {
|
|
7801
7835
|
const sourceRoot = sourceRootOf(context);
|
|
7802
|
-
const supportFile =
|
|
7836
|
+
const supportFile = path54.resolve(context.filename);
|
|
7803
7837
|
const currentFolder = folderSegmentsOf(supportFile, sourceRoot);
|
|
7804
7838
|
const supportFolder = currentFolder[currentFolder.length - 1];
|
|
7805
7839
|
if (supportFolder === void 0 || !SUPPORT_FOLDERS.has(supportFolder)) return {};
|
|
@@ -7853,7 +7887,7 @@ var supportFilePlacementRule = {
|
|
|
7853
7887
|
|
|
7854
7888
|
// eslint/rules/support-folder-shape.ts
|
|
7855
7889
|
import fs6 from "fs";
|
|
7856
|
-
import
|
|
7890
|
+
import path55 from "path";
|
|
7857
7891
|
var SUPPORT_FOLDERS4 = /* @__PURE__ */ new Set(["constants", "types", "schemas"]);
|
|
7858
7892
|
var INDEX_NAMES2 = /* @__PURE__ */ new Set(["index.ts", "index.tsx", "index.mts", "index.cts"]);
|
|
7859
7893
|
var supportFolderShapeRule = {
|
|
@@ -7865,12 +7899,12 @@ var supportFolderShapeRule = {
|
|
|
7865
7899
|
}
|
|
7866
7900
|
},
|
|
7867
7901
|
create(context) {
|
|
7868
|
-
const filename =
|
|
7869
|
-
const baseName =
|
|
7902
|
+
const filename = path55.resolve(context.filename);
|
|
7903
|
+
const baseName = path55.basename(filename);
|
|
7870
7904
|
if (!INDEX_NAMES2.has(baseName)) return {};
|
|
7871
|
-
const folder =
|
|
7905
|
+
const folder = path55.basename(path55.dirname(filename));
|
|
7872
7906
|
if (!SUPPORT_FOLDERS4.has(folder)) return {};
|
|
7873
|
-
const directory =
|
|
7907
|
+
const directory = path55.dirname(filename);
|
|
7874
7908
|
let entries;
|
|
7875
7909
|
try {
|
|
7876
7910
|
entries = fs6.readdirSync(directory);
|
|
@@ -7888,7 +7922,7 @@ var supportFolderShapeRule = {
|
|
|
7888
7922
|
for (const match of source.matchAll(exportPattern)) {
|
|
7889
7923
|
hasAnyReExport = true;
|
|
7890
7924
|
const specifier = match.groups?.specifier;
|
|
7891
|
-
if (specifier?.startsWith(".")) exportedFiles.add(
|
|
7925
|
+
if (specifier?.startsWith(".")) exportedFiles.add(path55.basename(specifier));
|
|
7892
7926
|
}
|
|
7893
7927
|
const guide = `docs/next-codebase-guide/rules/${folder === "constants" ? "constants" : "types-and-schemas"}-rule.md`;
|
|
7894
7928
|
if (siblingModules.length === 0) {
|
|
@@ -8067,11 +8101,11 @@ var baseLayerPairRule = {
|
|
|
8067
8101
|
|
|
8068
8102
|
// eslint/rules/tailwind/css-entry-point.ts
|
|
8069
8103
|
import { statSync as statSync4 } from "fs";
|
|
8070
|
-
import
|
|
8104
|
+
import path58 from "path";
|
|
8071
8105
|
|
|
8072
8106
|
// eslint/rules/tailwind/source-files.ts
|
|
8073
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
8074
|
-
import
|
|
8107
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync10, statSync as statSync3 } from "fs";
|
|
8108
|
+
import path56 from "path";
|
|
8075
8109
|
var CSS_EXTENSIONS = [".css"];
|
|
8076
8110
|
var MODULE_EXTENSIONS4 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
8077
8111
|
var SOURCE_EXTENSIONS = [...MODULE_EXTENSIONS4, ...CSS_EXTENSIONS];
|
|
@@ -8084,7 +8118,7 @@ function findFiles(dir, extensions) {
|
|
|
8084
8118
|
}
|
|
8085
8119
|
return entries.flatMap((entry) => {
|
|
8086
8120
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
8087
|
-
const entryPath =
|
|
8121
|
+
const entryPath = path56.join(dir, entry);
|
|
8088
8122
|
let stats;
|
|
8089
8123
|
try {
|
|
8090
8124
|
stats = statSync3(entryPath);
|
|
@@ -8092,7 +8126,7 @@ function findFiles(dir, extensions) {
|
|
|
8092
8126
|
return [];
|
|
8093
8127
|
}
|
|
8094
8128
|
if (stats.isDirectory()) return findFiles(entryPath, extensions);
|
|
8095
|
-
return extensions.includes(
|
|
8129
|
+
return extensions.includes(path56.extname(entry)) ? [entryPath] : [];
|
|
8096
8130
|
});
|
|
8097
8131
|
}
|
|
8098
8132
|
function cachedTextReader() {
|
|
@@ -8101,7 +8135,7 @@ function cachedTextReader() {
|
|
|
8101
8135
|
let text = texts.get(file);
|
|
8102
8136
|
if (text === void 0) {
|
|
8103
8137
|
try {
|
|
8104
|
-
text =
|
|
8138
|
+
text = readFileSync10(file, "utf8");
|
|
8105
8139
|
} catch {
|
|
8106
8140
|
text = "";
|
|
8107
8141
|
}
|
|
@@ -8115,7 +8149,7 @@ function escapeRegExp(text) {
|
|
|
8115
8149
|
}
|
|
8116
8150
|
|
|
8117
8151
|
// eslint/rules/tailwind/stylesheet-graph.ts
|
|
8118
|
-
import
|
|
8152
|
+
import path57 from "path";
|
|
8119
8153
|
function registersTailwind(text) {
|
|
8120
8154
|
return /@import\s+(?:url\(\s*)?["']tailwindcss["']\s*\)?/i.test(text);
|
|
8121
8155
|
}
|
|
@@ -8129,25 +8163,25 @@ function moduleImports(text, fileName) {
|
|
|
8129
8163
|
return new RegExp(`(?:import|require)\\s*\\(?\\s*["'][^"']*${escaped}["']`, "i").test(text);
|
|
8130
8164
|
}
|
|
8131
8165
|
function resolveSpecifier2(fromFile, spec, sourceRoot) {
|
|
8132
|
-
if (spec.startsWith("/")) return
|
|
8133
|
-
if (spec.startsWith("./") || spec.startsWith("../")) return
|
|
8134
|
-
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));
|
|
8135
8169
|
return void 0;
|
|
8136
8170
|
}
|
|
8137
8171
|
function buildStylesheetGraph(options) {
|
|
8138
8172
|
const { cssFiles, sourceRoot, textOf } = options;
|
|
8139
|
-
const cssSet = new Set(cssFiles.map((file) =>
|
|
8173
|
+
const cssSet = new Set(cssFiles.map((file) => path57.normalize(file)));
|
|
8140
8174
|
const globals = cssFiles.filter((file) => registersTailwind(textOf(file)));
|
|
8141
8175
|
const reachable = /* @__PURE__ */ new Set();
|
|
8142
8176
|
const queue = [...globals];
|
|
8143
|
-
for (const global of globals) reachable.add(
|
|
8177
|
+
for (const global of globals) reachable.add(path57.normalize(global));
|
|
8144
8178
|
while (queue.length > 0) {
|
|
8145
8179
|
const from = queue.shift();
|
|
8146
8180
|
if (!from) continue;
|
|
8147
8181
|
for (const spec of importedSpecifiers(textOf(from))) {
|
|
8148
8182
|
const target = resolveSpecifier2(from, spec, sourceRoot);
|
|
8149
8183
|
if (!target) continue;
|
|
8150
|
-
const normalized =
|
|
8184
|
+
const normalized = path57.normalize(target);
|
|
8151
8185
|
if (cssSet.has(normalized) && !reachable.has(normalized)) {
|
|
8152
8186
|
reachable.add(normalized);
|
|
8153
8187
|
queue.push(normalized);
|
|
@@ -8159,7 +8193,7 @@ function buildStylesheetGraph(options) {
|
|
|
8159
8193
|
for (const spec of importedSpecifiers(textOf(global))) {
|
|
8160
8194
|
const target = resolveSpecifier2(global, spec, sourceRoot);
|
|
8161
8195
|
if (!target) continue;
|
|
8162
|
-
const normalized =
|
|
8196
|
+
const normalized = path57.normalize(target);
|
|
8163
8197
|
if (cssSet.has(normalized)) directChildren.add(normalized);
|
|
8164
8198
|
}
|
|
8165
8199
|
}
|
|
@@ -8167,8 +8201,8 @@ function buildStylesheetGraph(options) {
|
|
|
8167
8201
|
}
|
|
8168
8202
|
|
|
8169
8203
|
// eslint/rules/tailwind/css-entry-point.ts
|
|
8170
|
-
var APP_STYLES_DIR =
|
|
8171
|
-
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");
|
|
8172
8206
|
var cssEntryPointRule = {
|
|
8173
8207
|
meta: {
|
|
8174
8208
|
schema: [],
|
|
@@ -8194,8 +8228,8 @@ var cssEntryPointRule = {
|
|
|
8194
8228
|
return {
|
|
8195
8229
|
"StyleSheet:exit"(node) {
|
|
8196
8230
|
if (globals.length === 0) return;
|
|
8197
|
-
const current =
|
|
8198
|
-
const relative =
|
|
8231
|
+
const current = path58.normalize(path58.resolve(context.filename));
|
|
8232
|
+
const relative = path58.relative(sourceRoot, current);
|
|
8199
8233
|
if (globals.includes(current)) {
|
|
8200
8234
|
if (globals.length > 1) {
|
|
8201
8235
|
context.report({
|
|
@@ -8211,7 +8245,7 @@ var cssEntryPointRule = {
|
|
|
8211
8245
|
});
|
|
8212
8246
|
return;
|
|
8213
8247
|
}
|
|
8214
|
-
const basename =
|
|
8248
|
+
const basename = path58.basename(current);
|
|
8215
8249
|
const importCount = moduleFiles.filter((modulePath) => moduleImports(textOf(modulePath), basename)).length;
|
|
8216
8250
|
if (importCount !== 1) {
|
|
8217
8251
|
context.report({
|
|
@@ -8221,7 +8255,7 @@ var cssEntryPointRule = {
|
|
|
8221
8255
|
}
|
|
8222
8256
|
return;
|
|
8223
8257
|
}
|
|
8224
|
-
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}`);
|
|
8225
8259
|
if (!isInAppStyles) {
|
|
8226
8260
|
context.report({
|
|
8227
8261
|
node,
|
|
@@ -8710,7 +8744,7 @@ var tailwindRules = {
|
|
|
8710
8744
|
};
|
|
8711
8745
|
|
|
8712
8746
|
// eslint/rules/type-extraction.ts
|
|
8713
|
-
import
|
|
8747
|
+
import path59 from "path";
|
|
8714
8748
|
var typeExtractionRule = {
|
|
8715
8749
|
meta: {
|
|
8716
8750
|
schema: [],
|
|
@@ -8721,7 +8755,7 @@ var typeExtractionRule = {
|
|
|
8721
8755
|
},
|
|
8722
8756
|
create(context) {
|
|
8723
8757
|
const sourceRoot = sourceRootOf(context);
|
|
8724
|
-
const file =
|
|
8758
|
+
const file = path59.resolve(context.filename);
|
|
8725
8759
|
const segments = segmentsOf(file, sourceRoot);
|
|
8726
8760
|
if (segments.length === 0) return {};
|
|
8727
8761
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -8860,9 +8894,9 @@ var uiStateRule = {
|
|
|
8860
8894
|
};
|
|
8861
8895
|
|
|
8862
8896
|
// eslint/rules/unknown-utility.ts
|
|
8863
|
-
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";
|
|
8864
8898
|
import { createRequire } from "module";
|
|
8865
|
-
import
|
|
8899
|
+
import path60 from "path";
|
|
8866
8900
|
var PREFIX_NAMESPACES = {
|
|
8867
8901
|
bg: ["color"],
|
|
8868
8902
|
text: ["color", "text"],
|
|
@@ -9102,7 +9136,7 @@ function stylesheetFiles(dir) {
|
|
|
9102
9136
|
}
|
|
9103
9137
|
return entries.flatMap((entry) => {
|
|
9104
9138
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
9105
|
-
const entryPath =
|
|
9139
|
+
const entryPath = path60.join(dir, entry);
|
|
9106
9140
|
let stats;
|
|
9107
9141
|
try {
|
|
9108
9142
|
stats = statSync6(entryPath);
|
|
@@ -9110,7 +9144,7 @@ function stylesheetFiles(dir) {
|
|
|
9110
9144
|
return [];
|
|
9111
9145
|
}
|
|
9112
9146
|
if (stats.isDirectory()) return stylesheetFiles(entryPath);
|
|
9113
|
-
return
|
|
9147
|
+
return path60.extname(entry) === ".css" ? [entryPath] : [];
|
|
9114
9148
|
});
|
|
9115
9149
|
}
|
|
9116
9150
|
function packageNameOf(specifier) {
|
|
@@ -9121,24 +9155,24 @@ function packageNameOf(specifier) {
|
|
|
9121
9155
|
function resolvePackageStylesheet(fromFile, specifier) {
|
|
9122
9156
|
const packageName = packageNameOf(specifier);
|
|
9123
9157
|
if (!packageName || packageName === "tailwindcss") return void 0;
|
|
9124
|
-
let directory =
|
|
9125
|
-
while (directory !==
|
|
9126
|
-
const packageRoot =
|
|
9127
|
-
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");
|
|
9128
9162
|
if (existsSync6(manifestPath)) {
|
|
9129
9163
|
try {
|
|
9130
|
-
const manifest =
|
|
9164
|
+
const manifest = readFileSync11(manifestPath, "utf8");
|
|
9131
9165
|
const stylesheet = /"style"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
9132
9166
|
const main = /"main"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
9133
9167
|
const target = stylesheet ?? main;
|
|
9134
9168
|
if (!target) return void 0;
|
|
9135
|
-
const resolved =
|
|
9169
|
+
const resolved = path60.resolve(packageRoot, target);
|
|
9136
9170
|
return existsSync6(resolved) ? resolved : void 0;
|
|
9137
9171
|
} catch {
|
|
9138
9172
|
return void 0;
|
|
9139
9173
|
}
|
|
9140
9174
|
}
|
|
9141
|
-
directory =
|
|
9175
|
+
directory = path60.dirname(directory);
|
|
9142
9176
|
}
|
|
9143
9177
|
return void 0;
|
|
9144
9178
|
}
|
|
@@ -9147,7 +9181,7 @@ function inventoryStylesheetFiles(projectFiles) {
|
|
|
9147
9181
|
for (const file of projectFiles) {
|
|
9148
9182
|
let css2;
|
|
9149
9183
|
try {
|
|
9150
|
-
css2 =
|
|
9184
|
+
css2 = readFileSync11(file, "utf8");
|
|
9151
9185
|
} catch {
|
|
9152
9186
|
continue;
|
|
9153
9187
|
}
|
|
@@ -9213,7 +9247,7 @@ function readInventory(files) {
|
|
|
9213
9247
|
for (const file of files) {
|
|
9214
9248
|
let css2;
|
|
9215
9249
|
try {
|
|
9216
|
-
css2 =
|
|
9250
|
+
css2 = readFileSync11(file, "utf8");
|
|
9217
9251
|
} catch {
|
|
9218
9252
|
continue;
|
|
9219
9253
|
}
|
|
@@ -9389,7 +9423,7 @@ var unknownUtilityRule = {
|
|
|
9389
9423
|
};
|
|
9390
9424
|
|
|
9391
9425
|
// eslint/rules/util-file-name.ts
|
|
9392
|
-
import
|
|
9426
|
+
import path61 from "path";
|
|
9393
9427
|
function toKebabCase2(value) {
|
|
9394
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();
|
|
9395
9429
|
}
|
|
@@ -9402,7 +9436,7 @@ var utilFileNameRule = {
|
|
|
9402
9436
|
}
|
|
9403
9437
|
},
|
|
9404
9438
|
create(context) {
|
|
9405
|
-
const filename =
|
|
9439
|
+
const filename = path61.resolve(context.filename);
|
|
9406
9440
|
const segments = filename.replace(/\\/g, "/").split("/");
|
|
9407
9441
|
if (!segments.includes("utils")) return {};
|
|
9408
9442
|
let module;
|
|
@@ -9416,13 +9450,13 @@ var utilFileNameRule = {
|
|
|
9416
9450
|
const functionName = functions[0]?.name;
|
|
9417
9451
|
if (!functionName) return {};
|
|
9418
9452
|
const expected = toKebabCase2(functionName);
|
|
9419
|
-
const actual =
|
|
9453
|
+
const actual = path61.basename(filename, path61.extname(filename));
|
|
9420
9454
|
if (!expected || actual === expected) return {};
|
|
9421
9455
|
return {
|
|
9422
9456
|
Program(node) {
|
|
9423
9457
|
context.report({
|
|
9424
9458
|
node,
|
|
9425
|
-
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)}.`
|
|
9426
9460
|
});
|
|
9427
9461
|
}
|
|
9428
9462
|
};
|
|
@@ -9430,7 +9464,7 @@ var utilFileNameRule = {
|
|
|
9430
9464
|
};
|
|
9431
9465
|
|
|
9432
9466
|
// eslint/rules/value-extraction.ts
|
|
9433
|
-
import
|
|
9467
|
+
import path62 from "path";
|
|
9434
9468
|
var valueExtractionRule = {
|
|
9435
9469
|
meta: {
|
|
9436
9470
|
schema: [],
|
|
@@ -9441,7 +9475,7 @@ var valueExtractionRule = {
|
|
|
9441
9475
|
},
|
|
9442
9476
|
create(context) {
|
|
9443
9477
|
const sourceRoot = sourceRootOf(context);
|
|
9444
|
-
const file =
|
|
9478
|
+
const file = path62.resolve(context.filename);
|
|
9445
9479
|
const segments = segmentsOf(file, sourceRoot);
|
|
9446
9480
|
if (segments.length === 0 || segments[0] !== "app") return {};
|
|
9447
9481
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -9462,8 +9496,8 @@ var valueExtractionRule = {
|
|
|
9462
9496
|
};
|
|
9463
9497
|
|
|
9464
9498
|
// eslint/rules/vulyk/tracked-docs.ts
|
|
9465
|
-
import { existsSync as existsSync7, readFileSync as
|
|
9466
|
-
import
|
|
9499
|
+
import { existsSync as existsSync7, readFileSync as readFileSync12 } from "fs";
|
|
9500
|
+
import path63 from "path";
|
|
9467
9501
|
var PASIKA_REPO = "Bredansky/pasika";
|
|
9468
9502
|
var BASE_REQUIRED_TRACKED_DOCS = [
|
|
9469
9503
|
{ name: "documentation-guide", path: "docs/documentation-guide" },
|
|
@@ -9496,8 +9530,8 @@ var trackedDocsRule = {
|
|
|
9496
9530
|
if (!context.filename.endsWith("package.json")) return;
|
|
9497
9531
|
const root = node.body;
|
|
9498
9532
|
if (root.type !== "Object") return;
|
|
9499
|
-
const projectRoot =
|
|
9500
|
-
const configPath =
|
|
9533
|
+
const projectRoot = path63.dirname(path63.resolve(context.filename));
|
|
9534
|
+
const configPath = path63.join(projectRoot, "vulyk.config.ts");
|
|
9501
9535
|
if (!existsSync7(configPath)) {
|
|
9502
9536
|
context.report({
|
|
9503
9537
|
node,
|
|
@@ -9505,7 +9539,7 @@ var trackedDocsRule = {
|
|
|
9505
9539
|
});
|
|
9506
9540
|
return;
|
|
9507
9541
|
}
|
|
9508
|
-
const config =
|
|
9542
|
+
const config = readFileSync12(configPath, "utf8");
|
|
9509
9543
|
if (!config.includes(PASIKA_REPO)) {
|
|
9510
9544
|
context.report({
|
|
9511
9545
|
node,
|
|
@@ -9522,7 +9556,7 @@ var trackedDocsRule = {
|
|
|
9522
9556
|
});
|
|
9523
9557
|
}
|
|
9524
9558
|
}
|
|
9525
|
-
const agentsPath =
|
|
9559
|
+
const agentsPath = path63.join(projectRoot, "AGENTS.md");
|
|
9526
9560
|
if (!existsSync7(agentsPath)) {
|
|
9527
9561
|
context.report({
|
|
9528
9562
|
node,
|
|
@@ -9622,7 +9656,7 @@ var withResponseHelperRule = {
|
|
|
9622
9656
|
|
|
9623
9657
|
// eslint/rules/zirka-baseline.ts
|
|
9624
9658
|
import fs7 from "fs";
|
|
9625
|
-
import
|
|
9659
|
+
import path64 from "path";
|
|
9626
9660
|
var ESLINT_CONFIG = /^eslint\.config\.(?:ts|mts|cts|js|mjs|cjs)$/;
|
|
9627
9661
|
var PRETTIER_CONFIGS = [
|
|
9628
9662
|
"prettier.config.mjs",
|
|
@@ -9641,10 +9675,10 @@ var zirkaBaselineRule = {
|
|
|
9641
9675
|
}
|
|
9642
9676
|
},
|
|
9643
9677
|
create(context) {
|
|
9644
|
-
const filename =
|
|
9645
|
-
const basename =
|
|
9678
|
+
const filename = path64.resolve(context.filename);
|
|
9679
|
+
const basename = path64.basename(filename);
|
|
9646
9680
|
if (!ESLINT_CONFIG.test(basename)) return {};
|
|
9647
|
-
const projectRoot =
|
|
9681
|
+
const projectRoot = path64.dirname(filename);
|
|
9648
9682
|
const report3 = (message) => {
|
|
9649
9683
|
context.report({
|
|
9650
9684
|
node: context.sourceCode.ast,
|
|
@@ -9659,7 +9693,7 @@ var zirkaBaselineRule = {
|
|
|
9659
9693
|
'ESLint config must take its configuration from zirka (import { styleguide } from "zirka") instead of restating rules locally.'
|
|
9660
9694
|
);
|
|
9661
9695
|
}
|
|
9662
|
-
const tsconfigPath =
|
|
9696
|
+
const tsconfigPath = path64.join(projectRoot, "tsconfig.json");
|
|
9663
9697
|
if (!fs7.existsSync(tsconfigPath)) {
|
|
9664
9698
|
report3('No tsconfig.json found. Create one extending the zirka TypeScript base config ("zirka/typescript").');
|
|
9665
9699
|
} else {
|
|
@@ -9677,13 +9711,13 @@ var zirkaBaselineRule = {
|
|
|
9677
9711
|
report3('tsconfig.json must extend the zirka TypeScript base config ("zirka/typescript").');
|
|
9678
9712
|
}
|
|
9679
9713
|
}
|
|
9680
|
-
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(
|
|
9714
|
+
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(path64.join(projectRoot, name)));
|
|
9681
9715
|
if (!prettierConfigFile) {
|
|
9682
9716
|
report3(
|
|
9683
9717
|
"No prettier config found. Create one that takes its configuration from zirka (styleguide({ prettier: true }).prettierConfig)."
|
|
9684
9718
|
);
|
|
9685
9719
|
} else {
|
|
9686
|
-
const content = fs7.readFileSync(
|
|
9720
|
+
const content = fs7.readFileSync(path64.join(projectRoot, prettierConfigFile), "utf8");
|
|
9687
9721
|
if (!content.includes("zirka")) {
|
|
9688
9722
|
report3(
|
|
9689
9723
|
"The prettier config must take its configuration from zirka (styleguide({ prettier: true }).prettierConfig) instead of restating it locally."
|
|
@@ -9829,14 +9863,14 @@ var zodSchemaValidationRule = {
|
|
|
9829
9863
|
};
|
|
9830
9864
|
|
|
9831
9865
|
// eslint/ts-alignment.ts
|
|
9832
|
-
import { readFileSync as
|
|
9866
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
9833
9867
|
import { createRequire as createRequire2 } from "module";
|
|
9834
9868
|
import { join } from "path";
|
|
9835
9869
|
var ownRequire = createRequire2(import.meta.url);
|
|
9836
9870
|
var majorOf = (version) => Number(version.split(".")[0]);
|
|
9837
9871
|
function versionOf(packagePath) {
|
|
9838
9872
|
try {
|
|
9839
|
-
const parsed = JSON.parse(
|
|
9873
|
+
const parsed = JSON.parse(readFileSync13(packagePath, "utf8"));
|
|
9840
9874
|
if (typeof parsed !== "object" || parsed === null || !("version" in parsed)) return null;
|
|
9841
9875
|
return typeof parsed.version === "string" ? parsed.version : null;
|
|
9842
9876
|
} catch {
|