@sarj/eslint-plugin 16.14.2 → 16.14.4
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/index.cjs +45 -54
- package/dist/index.js +146 -155
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@sarj/eslint-plugin",
|
|
4
|
-
version: "16.14.
|
|
4
|
+
version: "16.14.4",
|
|
5
5
|
packageManager: "npm@12.2.0",
|
|
6
6
|
description: "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
|
|
7
7
|
type: "module",
|
|
@@ -331,6 +331,7 @@ function deepFreeze(value) {
|
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
// src/rules/_paths.ts
|
|
334
|
+
import { posix } from "path";
|
|
334
335
|
var LINE_TERMINATOR_RE = /[\n\r\u2028\u2029]/u;
|
|
335
336
|
var SCRIPT_FILE_RE = /(?:^|[\\/])scripts[\\/]|\.mjs$/;
|
|
336
337
|
var STORY_FILE_RE = /\.stories\.[cm]?[jt]sx?$/i;
|
|
@@ -414,6 +415,10 @@ function leadingCommentBodies(sourceText) {
|
|
|
414
415
|
function isScriptFile(filename) {
|
|
415
416
|
return SCRIPT_FILE_RE.test(filename);
|
|
416
417
|
}
|
|
418
|
+
function matchesAnyPattern(filename, patterns) {
|
|
419
|
+
const normalized = filename.replaceAll("\\", "/");
|
|
420
|
+
return patterns.some((pattern) => posix.matchesGlob(normalized, pattern.replaceAll("\\", "/")));
|
|
421
|
+
}
|
|
417
422
|
function commentLineEnd(sourceText, start) {
|
|
418
423
|
const end = sourceText.slice(start).search(LINE_TERMINATOR_RE);
|
|
419
424
|
return end === -1 ? sourceText.length : start + end;
|
|
@@ -5803,15 +5808,6 @@ var NO_ENUM_DOCUMENTATION = {
|
|
|
5803
5808
|
{ id: "generated-header", scenarioId: "native-header-boundary", title: "Respect a native generated banner", outcome: "no-match", files: [{ path: "src/status.ts", source: '// auto-generated file\u2028const marker="auto-generated file"; enum Mode {Start} console.log(Mode.Start, marker);' }], focusPath: "src/status.ts", expectedCount: 0, public: true }
|
|
5804
5809
|
]
|
|
5805
5810
|
};
|
|
5806
|
-
function matchesAnyPattern(filename, patterns) {
|
|
5807
|
-
for (const pattern of patterns) {
|
|
5808
|
-
const regexSource = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "::DOUBLESTAR::").replace(/\*/g, "[^/\\\\]*").replace(/::DOUBLESTAR::/g, ".*");
|
|
5809
|
-
if (new RegExp(`^${regexSource}$`).test(filename)) {
|
|
5810
|
-
return true;
|
|
5811
|
-
}
|
|
5812
|
-
}
|
|
5813
|
-
return false;
|
|
5814
|
-
}
|
|
5815
5811
|
var no_enum_default = createRule({
|
|
5816
5812
|
name: "no-enum",
|
|
5817
5813
|
documentation: NO_ENUM_DOCUMENTATION,
|
|
@@ -6476,15 +6472,6 @@ var GLOBAL_OBJECTS = /* @__PURE__ */ new Set([
|
|
|
6476
6472
|
]);
|
|
6477
6473
|
var CLIENT_ONLY_MODULES = /^(react|react-dom|react-native|svelte|vue|preact|solid-js)(\/|$)|^next\/(navigation|router|link|image)$/;
|
|
6478
6474
|
var RACE_METHODS = /* @__PURE__ */ new Set(["race", "any"]);
|
|
6479
|
-
function matchesAnyPattern2(filename, patterns) {
|
|
6480
|
-
for (const pattern of patterns) {
|
|
6481
|
-
const regexSource = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "::DOUBLESTAR::").replace(/\*/g, "[^/\\\\]*").replace(/::DOUBLESTAR::/g, ".*");
|
|
6482
|
-
if (new RegExp(`^${regexSource}$`).test(filename)) {
|
|
6483
|
-
return true;
|
|
6484
|
-
}
|
|
6485
|
-
}
|
|
6486
|
-
return false;
|
|
6487
|
-
}
|
|
6488
6475
|
function isSetTimeoutCallee(callee) {
|
|
6489
6476
|
callee = unwrapExpression(callee);
|
|
6490
6477
|
if (callee.type === AST_NODE_TYPES32.Identifier) {
|
|
@@ -6590,7 +6577,7 @@ var no_hand_rolled_sleep_default = createRule({
|
|
|
6590
6577
|
return {};
|
|
6591
6578
|
}
|
|
6592
6579
|
const allowIn = optionsArg?.allowIn ?? [];
|
|
6593
|
-
if (allowIn.length > 0 &&
|
|
6580
|
+
if (allowIn.length > 0 && matchesAnyPattern(filename, allowIn)) {
|
|
6594
6581
|
return {};
|
|
6595
6582
|
}
|
|
6596
6583
|
const checkClientModules = optionsArg?.checkClientModules ?? false;
|
|
@@ -18081,7 +18068,7 @@ var prefer_multi_value_zod_literal_default = createRule({
|
|
|
18081
18068
|
});
|
|
18082
18069
|
|
|
18083
18070
|
// src/rules/prefer-nominal-id-types.ts
|
|
18084
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES84
|
|
18071
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES84 } from "@typescript-eslint/utils";
|
|
18085
18072
|
var OPERATIONAL_ROLES = /* @__PURE__ */ new Set([
|
|
18086
18073
|
"request",
|
|
18087
18074
|
"trace",
|
|
@@ -18119,8 +18106,7 @@ function isNullish(node) {
|
|
|
18119
18106
|
}
|
|
18120
18107
|
function referenceCarrier(node, context, depth) {
|
|
18121
18108
|
if (node.typeName.type !== AST_NODE_TYPES84.Identifier) return void 0;
|
|
18122
|
-
const
|
|
18123
|
-
const definitions = variable?.defs ?? [];
|
|
18109
|
+
const definitions = typeDefinitions(node, context);
|
|
18124
18110
|
const args = node.typeArguments?.params;
|
|
18125
18111
|
if (definitions.length === 0 && ["Array", "ReadonlyArray"].includes(node.typeName.name) && args?.length === 1) {
|
|
18126
18112
|
return arrayCarrier(rawCarrier(args[0], context, depth + 1));
|
|
@@ -18130,6 +18116,17 @@ function referenceCarrier(node, context, depth) {
|
|
|
18130
18116
|
if (declaration?.type !== AST_NODE_TYPES84.TSTypeAliasDeclaration || declaration.typeParameters !== void 0) return void 0;
|
|
18131
18117
|
return rawCarrier(declaration.typeAnnotation, context, depth + 1);
|
|
18132
18118
|
}
|
|
18119
|
+
function typeDefinitions(node, context) {
|
|
18120
|
+
if (node.typeName.type !== AST_NODE_TYPES84.Identifier) return [];
|
|
18121
|
+
let scope = context.sourceCode.getScope(node);
|
|
18122
|
+
while (scope !== null) {
|
|
18123
|
+
const variable = scope.set.get(node.typeName.name);
|
|
18124
|
+
const definitions = variable?.defs.filter((definition) => definition.isTypeDefinition) ?? [];
|
|
18125
|
+
if (definitions.length > 0 || variable?.isTypeVariable === true) return definitions;
|
|
18126
|
+
scope = scope.upper;
|
|
18127
|
+
}
|
|
18128
|
+
return [];
|
|
18129
|
+
}
|
|
18133
18130
|
function rawCarrier(node, context, depth = 0) {
|
|
18134
18131
|
if (node === void 0 || depth >= MAX_ALIAS_DEPTH) return void 0;
|
|
18135
18132
|
switch (node.type) {
|
|
@@ -18200,6 +18197,9 @@ var prefer_nominal_id_types_default = createRule({
|
|
|
18200
18197
|
FunctionExpression: (node) => checkBoundary(node, context),
|
|
18201
18198
|
TSDeclareFunction: (node) => checkBoundary(node, context),
|
|
18202
18199
|
TSEmptyBodyFunctionExpression: (node) => checkBoundary(node, context),
|
|
18200
|
+
TSCallSignatureDeclaration: (node) => checkBoundary(node, context),
|
|
18201
|
+
TSConstructSignatureDeclaration: (node) => checkBoundary(node, context),
|
|
18202
|
+
TSConstructorType: (node) => checkBoundary(node, context),
|
|
18203
18203
|
TSFunctionType: (node) => checkBoundary(node, context),
|
|
18204
18204
|
TSMethodSignature: (node) => checkBoundary(node, context)
|
|
18205
18205
|
};
|
|
@@ -18320,7 +18320,7 @@ var prefer_named_complex_return_type_default = createRule({
|
|
|
18320
18320
|
});
|
|
18321
18321
|
|
|
18322
18322
|
// src/rules/prefer-native-random-uuid.ts
|
|
18323
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES87, ASTUtils as
|
|
18323
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES87, ASTUtils as ASTUtils50 } from "@typescript-eslint/utils";
|
|
18324
18324
|
var PREFER_NATIVE_RANDOM_UUID_DOCUMENTATION = {
|
|
18325
18325
|
summary: "Prefer `globalThis.crypto.randomUUID()` over resolved zero-argument UUID v4 bindings from the `uuid` package.",
|
|
18326
18326
|
rationale: "The platform implementation avoids an unnecessary dependency for standard random UUID generation.",
|
|
@@ -18356,14 +18356,14 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
18356
18356
|
const directBindings = /* @__PURE__ */ new Set();
|
|
18357
18357
|
const namespaceBindings = /* @__PURE__ */ new Set();
|
|
18358
18358
|
function resolve2(identifier) {
|
|
18359
|
-
return
|
|
18359
|
+
return ASTUtils50.findVariable(context.sourceCode.getScope(identifier), identifier.name);
|
|
18360
18360
|
}
|
|
18361
18361
|
function record(identifier, destination) {
|
|
18362
18362
|
const variable = resolve2(identifier);
|
|
18363
18363
|
if (variable !== null) destination.add(variable);
|
|
18364
18364
|
}
|
|
18365
18365
|
function report2(node) {
|
|
18366
|
-
const globalBinding =
|
|
18366
|
+
const globalBinding = ASTUtils50.findVariable(context.sourceCode.getScope(node), "globalThis");
|
|
18367
18367
|
const canSuggest = (globalBinding?.defs.length ?? 0) === 0 && context.sourceCode.getCommentsInside(node).length === 0;
|
|
18368
18368
|
context.report({
|
|
18369
18369
|
node,
|
|
@@ -18422,7 +18422,7 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
18422
18422
|
});
|
|
18423
18423
|
|
|
18424
18424
|
// src/rules/prefer-node-crypto-hash.ts
|
|
18425
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES88, ASTUtils as
|
|
18425
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES88, ASTUtils as ASTUtils51 } from "@typescript-eslint/utils";
|
|
18426
18426
|
var PREFER_NODE_CRYPTO_HASH_DOCUMENTATION = {
|
|
18427
18427
|
defaultLevel: "warning",
|
|
18428
18428
|
summary: "Prefer the modern one-shot node:crypto hash API when streaming state is unnecessary.",
|
|
@@ -18450,7 +18450,7 @@ function isCryptoLoader(node, resolve2) {
|
|
|
18450
18450
|
if (unwrappedNodeCallee?.type === AST_NODE_TYPES88.Identifier) {
|
|
18451
18451
|
return unwrappedNodeCallee.name === "require" && isUnshadowedBuiltinIdentifier(unwrappedNodeCallee, resolve2);
|
|
18452
18452
|
}
|
|
18453
|
-
return unwrappedNodeCallee?.type === AST_NODE_TYPES88.MemberExpression && unwrappedNodeCallee.object.type === AST_NODE_TYPES88.Identifier && unwrappedNodeCallee.object.name === "process" && isUnshadowedBuiltinIdentifier(unwrappedNodeCallee.object, resolve2) &&
|
|
18453
|
+
return unwrappedNodeCallee?.type === AST_NODE_TYPES88.MemberExpression && unwrappedNodeCallee.object.type === AST_NODE_TYPES88.Identifier && unwrappedNodeCallee.object.name === "process" && isUnshadowedBuiltinIdentifier(unwrappedNodeCallee.object, resolve2) && ASTUtils51.getPropertyName(unwrappedNodeCallee) === "getBuiltinModule";
|
|
18454
18454
|
}
|
|
18455
18455
|
function isCryptoSpecifier(node) {
|
|
18456
18456
|
return node.type === AST_NODE_TYPES88.Literal && (node.value === "crypto" || node.value === "node:crypto");
|
|
@@ -18475,7 +18475,7 @@ var prefer_node_crypto_hash_default = createRule({
|
|
|
18475
18475
|
const directBindings = /* @__PURE__ */ new Set();
|
|
18476
18476
|
const namespaceBindings = /* @__PURE__ */ new Set();
|
|
18477
18477
|
function resolve2(identifier) {
|
|
18478
|
-
return
|
|
18478
|
+
return ASTUtils51.findVariable(
|
|
18479
18479
|
context.sourceCode.getScope(identifier),
|
|
18480
18480
|
identifier.name
|
|
18481
18481
|
);
|
|
@@ -18537,7 +18537,7 @@ function importedName5(node) {
|
|
|
18537
18537
|
}
|
|
18538
18538
|
function isMemberCall(node, name) {
|
|
18539
18539
|
const unwrappedNodeCallee = unwrapExpression(node.callee);
|
|
18540
|
-
return unwrappedNodeCallee.type === AST_NODE_TYPES88.MemberExpression &&
|
|
18540
|
+
return unwrappedNodeCallee.type === AST_NODE_TYPES88.MemberExpression && ASTUtils51.getPropertyName(unwrappedNodeCallee) === name;
|
|
18541
18541
|
}
|
|
18542
18542
|
function isCreateHashCall(node, directBindings, namespaceBindings, resolve2) {
|
|
18543
18543
|
const unwrappedNodeCallee = unwrapExpression(node.callee);
|
|
@@ -18545,7 +18545,7 @@ function isCreateHashCall(node, directBindings, namespaceBindings, resolve2) {
|
|
|
18545
18545
|
const variable2 = resolve2(unwrappedNodeCallee);
|
|
18546
18546
|
return variable2 !== null && directBindings.has(variable2);
|
|
18547
18547
|
}
|
|
18548
|
-
if (unwrappedNodeCallee.type !== AST_NODE_TYPES88.MemberExpression ||
|
|
18548
|
+
if (unwrappedNodeCallee.type !== AST_NODE_TYPES88.MemberExpression || ASTUtils51.getPropertyName(unwrappedNodeCallee) !== "createHash") {
|
|
18549
18549
|
return false;
|
|
18550
18550
|
}
|
|
18551
18551
|
if (isCryptoLoader(unwrappedNodeCallee.object, resolve2)) return true;
|
|
@@ -18555,7 +18555,7 @@ function isCreateHashCall(node, directBindings, namespaceBindings, resolve2) {
|
|
|
18555
18555
|
}
|
|
18556
18556
|
|
|
18557
18557
|
// src/rules/prefer-node-fs-promises.ts
|
|
18558
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES89, ASTUtils as
|
|
18558
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES89, ASTUtils as ASTUtils52 } from "@typescript-eslint/utils";
|
|
18559
18559
|
var PREFER_NODE_FS_PROMISES_DOCUMENTATION = {
|
|
18560
18560
|
defaultLevel: "warning",
|
|
18561
18561
|
summary: "Prefer promise-based Node.js filesystem APIs over synchronous calls in production modules.",
|
|
@@ -18617,7 +18617,7 @@ var prefer_node_fs_promises_default = createRule({
|
|
|
18617
18617
|
if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text) || normalizedFilename.includes("src/rules/"))
|
|
18618
18618
|
return {};
|
|
18619
18619
|
const namespaces = /* @__PURE__ */ new Set();
|
|
18620
|
-
const bindingOf = (node) =>
|
|
18620
|
+
const bindingOf = (node) => ASTUtils52.findVariable(context.sourceCode.getScope(node), node.name);
|
|
18621
18621
|
const isGlobal = (node) => {
|
|
18622
18622
|
const binding = bindingOf(node);
|
|
18623
18623
|
return binding === null || binding.defs.length === 0;
|
|
@@ -18683,7 +18683,7 @@ var prefer_node_fs_promises_default = createRule({
|
|
|
18683
18683
|
});
|
|
18684
18684
|
|
|
18685
18685
|
// src/rules/prefer-non-nullable-collection.ts
|
|
18686
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES90, ASTUtils as
|
|
18686
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES90, ASTUtils as ASTUtils53 } from "@typescript-eslint/utils";
|
|
18687
18687
|
var PREFER_NON_NULLABLE_COLLECTION_DOCUMENTATION = {
|
|
18688
18688
|
summary: "Suggest reviewing nullish arrays that use local empty-array defaults or a shared null-or-empty guard.",
|
|
18689
18689
|
rationale: "A redundant nullish collection state spreads defaults and guards through consumers without carrying information.",
|
|
@@ -18808,14 +18808,14 @@ function directlyCoalesced(node) {
|
|
|
18808
18808
|
return parent?.type === AST_NODE_TYPES90.LogicalExpression && parent.left === node && (parent.operator === "??" || parent.operator === "||") && emptyArray(parent.right);
|
|
18809
18809
|
}
|
|
18810
18810
|
function identifierIsOnlyCoalesced(context, binding, fn) {
|
|
18811
|
-
const variable =
|
|
18811
|
+
const variable = ASTUtils53.findVariable(context.sourceCode.getScope(binding), binding.name);
|
|
18812
18812
|
if (variable === null || variable.references.length === 0) return false;
|
|
18813
18813
|
return variable.references.every(
|
|
18814
18814
|
(reference) => belongsToFunction(reference.identifier, fn) && directlyCoalesced(reference.identifier)
|
|
18815
18815
|
);
|
|
18816
18816
|
}
|
|
18817
18817
|
function memberIsOnlyCoalesced(context, object, property, fn) {
|
|
18818
|
-
const variable =
|
|
18818
|
+
const variable = ASTUtils53.findVariable(context.sourceCode.getScope(object), object.name);
|
|
18819
18819
|
if (variable === null) return false;
|
|
18820
18820
|
const accesses = variable.references.flatMap((reference) => {
|
|
18821
18821
|
if (!belongsToFunction(reference.identifier, fn)) return [null];
|
|
@@ -18883,7 +18883,7 @@ var prefer_non_nullable_collection_default = createRule({
|
|
|
18883
18883
|
function checkDestructuredProperties(parameter, properties) {
|
|
18884
18884
|
for (const property of properties) {
|
|
18885
18885
|
const bindingProperty = parameter.properties.find(
|
|
18886
|
-
(entry) => entry.type === AST_NODE_TYPES90.Property && !entry.computed &&
|
|
18886
|
+
(entry) => entry.type === AST_NODE_TYPES90.Property && !entry.computed && ASTUtils53.getPropertyName(entry) === property.name
|
|
18887
18887
|
);
|
|
18888
18888
|
if (bindingProperty === void 0) continue;
|
|
18889
18889
|
const value = bindingProperty.value;
|
|
@@ -18931,7 +18931,7 @@ var prefer_non_nullable_collection_default = createRule({
|
|
|
18931
18931
|
// src/rules/prefer-nullish-filter-predicate.ts
|
|
18932
18932
|
import {
|
|
18933
18933
|
AST_NODE_TYPES as AST_NODE_TYPES91,
|
|
18934
|
-
ASTUtils as
|
|
18934
|
+
ASTUtils as ASTUtils54,
|
|
18935
18935
|
ESLintUtils as ESLintUtils12
|
|
18936
18936
|
} from "@typescript-eslint/utils";
|
|
18937
18937
|
import ts10 from "typescript";
|
|
@@ -18977,7 +18977,7 @@ var PREFER_NULLISH_FILTER_PREDICATE_DOCUMENTATION = {
|
|
|
18977
18977
|
]
|
|
18978
18978
|
};
|
|
18979
18979
|
function isUnshadowedBoolean(node, context) {
|
|
18980
|
-
const variable =
|
|
18980
|
+
const variable = ASTUtils54.findVariable(context.sourceCode.getScope(node), node.name);
|
|
18981
18981
|
return variable === null || variable.defs.length === 0;
|
|
18982
18982
|
}
|
|
18983
18983
|
function isBuiltinArrayFilter(node, services) {
|
|
@@ -19036,7 +19036,7 @@ function isProvablyTruthy(type, checker) {
|
|
|
19036
19036
|
}
|
|
19037
19037
|
function availableParameterName(node, context) {
|
|
19038
19038
|
for (const name of ["value", "item", "element", "candidate"]) {
|
|
19039
|
-
if (
|
|
19039
|
+
if (ASTUtils54.findVariable(context.sourceCode.getScope(node), name) === null) return name;
|
|
19040
19040
|
}
|
|
19041
19041
|
return null;
|
|
19042
19042
|
}
|
|
@@ -19067,7 +19067,7 @@ var prefer_nullish_filter_predicate_default = createRule({
|
|
|
19067
19067
|
CallExpression(node) {
|
|
19068
19068
|
const callee = unwrapExpression(node.callee);
|
|
19069
19069
|
const callback = node.arguments[0] === void 0 ? void 0 : unwrapExpression(node.arguments[0]);
|
|
19070
|
-
if (node.arguments.length !== 1 || callback?.type !== AST_NODE_TYPES91.Identifier || callback.name !== "Boolean" || callee.type !== AST_NODE_TYPES91.MemberExpression ||
|
|
19070
|
+
if (node.arguments.length !== 1 || callback?.type !== AST_NODE_TYPES91.Identifier || callback.name !== "Boolean" || callee.type !== AST_NODE_TYPES91.MemberExpression || ASTUtils54.getPropertyName(callee) === null || (ASTUtils54.getPropertyName(callee) ?? "") !== "filter" || !isUnshadowedBoolean(callback, context) || !isBuiltinArrayFilter(callee, services)) return;
|
|
19071
19071
|
const elementType = arrayElementType(callee.object, services);
|
|
19072
19072
|
const checker = services.program.getTypeChecker();
|
|
19073
19073
|
if (elementType === null || !isNullishPlusTruthy(elementType, checker)) return;
|
|
@@ -19090,7 +19090,7 @@ var prefer_nullish_filter_predicate_default = createRule({
|
|
|
19090
19090
|
|
|
19091
19091
|
// src/rules/prefer-await-in-async-return.ts
|
|
19092
19092
|
import {
|
|
19093
|
-
ASTUtils as
|
|
19093
|
+
ASTUtils as ASTUtils55,
|
|
19094
19094
|
ESLintUtils as ESLintUtils13,
|
|
19095
19095
|
AST_NODE_TYPES as AST_NODE_TYPES92
|
|
19096
19096
|
} from "@typescript-eslint/utils";
|
|
@@ -19153,7 +19153,7 @@ function isRuntimeFunction(node) {
|
|
|
19153
19153
|
}
|
|
19154
19154
|
function promiseThenReceiver(node) {
|
|
19155
19155
|
const callee = unwrapExpression(node.callee);
|
|
19156
|
-
if (callee.type !== AST_NODE_TYPES92.MemberExpression || callee.optional ||
|
|
19156
|
+
if (callee.type !== AST_NODE_TYPES92.MemberExpression || callee.optional || ASTUtils55.getPropertyName(callee) === null || (ASTUtils55.getPropertyName(callee) ?? "") !== "then" || node.optional || node.arguments.length !== 1) {
|
|
19157
19157
|
return null;
|
|
19158
19158
|
}
|
|
19159
19159
|
const argument = node.arguments[0];
|
|
@@ -19223,7 +19223,7 @@ var prefer_await_in_async_return_default = createRule({
|
|
|
19223
19223
|
if (services === null) return {};
|
|
19224
19224
|
const frameworkLoaders = /* @__PURE__ */ new Set();
|
|
19225
19225
|
const rememberFrameworkLoader = (identifier) => {
|
|
19226
|
-
const variable =
|
|
19226
|
+
const variable = ASTUtils55.findVariable(context.sourceCode.getScope(identifier), identifier.name);
|
|
19227
19227
|
if (variable !== null) frameworkLoaders.add(variable);
|
|
19228
19228
|
};
|
|
19229
19229
|
const isFrameworkLoaderCallback = (owner) => {
|
|
@@ -19231,7 +19231,7 @@ var prefer_await_in_async_return_default = createRule({
|
|
|
19231
19231
|
if (parent === null || parent.arguments[0] !== outerExpression(owner)) return false;
|
|
19232
19232
|
const callee = unwrapExpression(parent.callee);
|
|
19233
19233
|
if (callee.type !== AST_NODE_TYPES92.Identifier) return false;
|
|
19234
|
-
const variable =
|
|
19234
|
+
const variable = ASTUtils55.findVariable(context.sourceCode.getScope(callee), callee.name);
|
|
19235
19235
|
return variable !== null && frameworkLoaders.has(variable);
|
|
19236
19236
|
};
|
|
19237
19237
|
return {
|
|
@@ -19268,18 +19268,18 @@ var prefer_await_in_async_return_default = createRule({
|
|
|
19268
19268
|
});
|
|
19269
19269
|
|
|
19270
19270
|
// src/rules/prefer-schema-for-api-payload.ts
|
|
19271
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES94, ASTUtils as
|
|
19271
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES94, ASTUtils as ASTUtils57 } from "@typescript-eslint/utils";
|
|
19272
19272
|
|
|
19273
19273
|
// src/rules/_native-fetch-reference.ts
|
|
19274
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES93, ASTUtils as
|
|
19274
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES93, ASTUtils as ASTUtils56 } from "@typescript-eslint/utils";
|
|
19275
19275
|
var GLOBAL_RECEIVERS3 = /* @__PURE__ */ new Set(["globalThis", "self", "window"]);
|
|
19276
19276
|
function nativeFetchReference(node, sourceCode, seen = /* @__PURE__ */ new Set()) {
|
|
19277
19277
|
const expression = unwrapExpression(node);
|
|
19278
19278
|
if (expression.type === AST_NODE_TYPES93.MemberExpression) {
|
|
19279
|
-
return
|
|
19279
|
+
return ASTUtils56.getPropertyName(expression) === "fetch" && globalReceiver(expression.object, sourceCode);
|
|
19280
19280
|
}
|
|
19281
19281
|
if (expression.type !== AST_NODE_TYPES93.Identifier) return false;
|
|
19282
|
-
const binding =
|
|
19282
|
+
const binding = ASTUtils56.findVariable(sourceCode.getScope(expression), expression.name);
|
|
19283
19283
|
if (binding === null || binding.defs.length === 0) return expression.name === "fetch";
|
|
19284
19284
|
if (seen.has(binding) || seen.size >= 8 || binding.defs.length !== 1 || binding.references.some((reference) => reference.isWrite() && reference.init !== true)) return false;
|
|
19285
19285
|
seen.add(binding);
|
|
@@ -19288,11 +19288,11 @@ function nativeFetchReference(node, sourceCode, seen = /* @__PURE__ */ new Set()
|
|
|
19288
19288
|
if (definition.node.id.type === AST_NODE_TYPES93.Identifier) {
|
|
19289
19289
|
return nativeFetchReference(definition.node.init, sourceCode, seen);
|
|
19290
19290
|
}
|
|
19291
|
-
return definition.node.id.type === AST_NODE_TYPES93.ObjectPattern && globalReceiver(definition.node.init, sourceCode) && definition.node.id.properties.some((property) => property.type === AST_NODE_TYPES93.Property &&
|
|
19291
|
+
return definition.node.id.type === AST_NODE_TYPES93.ObjectPattern && globalReceiver(definition.node.init, sourceCode) && definition.node.id.properties.some((property) => property.type === AST_NODE_TYPES93.Property && ASTUtils56.getPropertyName(property) === "fetch" && property.value.type === AST_NODE_TYPES93.Identifier && ASTUtils56.findVariable(sourceCode.getScope(property.value), property.value.name) === binding);
|
|
19292
19292
|
}
|
|
19293
19293
|
function globalReceiver(node, sourceCode) {
|
|
19294
19294
|
const receiver = unwrapExpression(node);
|
|
19295
|
-
return receiver.type === AST_NODE_TYPES93.Identifier && GLOBAL_RECEIVERS3.has(receiver.name) && !
|
|
19295
|
+
return receiver.type === AST_NODE_TYPES93.Identifier && GLOBAL_RECEIVERS3.has(receiver.name) && !ASTUtils56.findVariable(sourceCode.getScope(receiver), receiver.name)?.defs.length;
|
|
19296
19296
|
}
|
|
19297
19297
|
|
|
19298
19298
|
// src/rules/prefer-schema-for-api-payload.ts
|
|
@@ -19332,7 +19332,7 @@ var PROMISE_CHAIN_METHODS = /* @__PURE__ */ new Set([
|
|
|
19332
19332
|
]);
|
|
19333
19333
|
var isSchemaParseReference = (node) => {
|
|
19334
19334
|
const inner = unwrap5(node);
|
|
19335
|
-
return inner !== null && inner.type === AST_NODE_TYPES94.MemberExpression &&
|
|
19335
|
+
return inner !== null && inner.type === AST_NODE_TYPES94.MemberExpression && ASTUtils57.getPropertyName(inner) !== null && ((ASTUtils57.getPropertyName(inner) ?? "") === "parse" || (ASTUtils57.getPropertyName(inner) ?? "") === "safeParse");
|
|
19336
19336
|
};
|
|
19337
19337
|
var isRawPayloadSource = (node, context, isKnownLocalText) => {
|
|
19338
19338
|
let current = unwrap5(node);
|
|
@@ -19347,7 +19347,7 @@ var isRawPayloadSource = (node, context, isKnownLocalText) => {
|
|
|
19347
19347
|
if (callee === null || callee.type !== AST_NODE_TYPES94.MemberExpression) {
|
|
19348
19348
|
return false;
|
|
19349
19349
|
}
|
|
19350
|
-
const property =
|
|
19350
|
+
const property = ASTUtils57.getPropertyName(callee);
|
|
19351
19351
|
if (property === null) {
|
|
19352
19352
|
return false;
|
|
19353
19353
|
}
|
|
@@ -19359,19 +19359,19 @@ var isRawPayloadSource = (node, context, isKnownLocalText) => {
|
|
|
19359
19359
|
}
|
|
19360
19360
|
const object = unwrap5(callee.object);
|
|
19361
19361
|
const input = unwrap5(current.arguments[0]);
|
|
19362
|
-
if (input?.type === AST_NODE_TYPES94.CallExpression && input.arguments.length === 1 && input.callee.type === AST_NODE_TYPES94.MemberExpression && input.callee.object.type === AST_NODE_TYPES94.Identifier && input.callee.object.name === "JSON" &&
|
|
19363
|
-
return property === "parse" && object !== null && object.type === AST_NODE_TYPES94.Identifier && object.name === "JSON" && (
|
|
19362
|
+
if (input?.type === AST_NODE_TYPES94.CallExpression && input.arguments.length === 1 && input.callee.type === AST_NODE_TYPES94.MemberExpression && input.callee.object.type === AST_NODE_TYPES94.Identifier && input.callee.object.name === "JSON" && ASTUtils57.getPropertyName(input.callee) === "stringify" && (ASTUtils57.findVariable(context.sourceCode.getScope(input.callee.object), "JSON")?.defs.length ?? 0) === 0) return false;
|
|
19363
|
+
return property === "parse" && object !== null && object.type === AST_NODE_TYPES94.Identifier && object.name === "JSON" && (ASTUtils57.findVariable(context.sourceCode.getScope(object), "JSON")?.defs.length ?? 0) === 0 && !isLocalFileRead(current.arguments[0]) && isKnownLocalText?.(current.arguments[0]) !== true;
|
|
19364
19364
|
};
|
|
19365
19365
|
var isResponseSource = (node, context, seen = /* @__PURE__ */ new Set()) => {
|
|
19366
19366
|
let current = unwrap5(node);
|
|
19367
19367
|
if (current?.type === AST_NODE_TYPES94.AwaitExpression) current = unwrap5(current.argument);
|
|
19368
19368
|
if (current === null || seen.has(current)) return false;
|
|
19369
19369
|
seen.add(current);
|
|
19370
|
-
const isGlobal = (identifier) => (
|
|
19370
|
+
const isGlobal = (identifier) => (ASTUtils57.findVariable(context.sourceCode.getScope(identifier), identifier.name)?.defs.length ?? 0) === 0;
|
|
19371
19371
|
if (current.type === AST_NODE_TYPES94.CallExpression) return nativeFetchReference(current.callee, context.sourceCode);
|
|
19372
19372
|
if (current.type === AST_NODE_TYPES94.NewExpression) return current.callee.type === AST_NODE_TYPES94.Identifier && ["Request", "Response"].includes(current.callee.name) && isGlobal(current.callee);
|
|
19373
19373
|
if (current.type !== AST_NODE_TYPES94.Identifier) return false;
|
|
19374
|
-
const binding =
|
|
19374
|
+
const binding = ASTUtils57.findVariable(context.sourceCode.getScope(current), current.name);
|
|
19375
19375
|
if (binding?.defs.length !== 1 || binding.references.some((reference) => reference.isWrite() && reference.init !== true)) return false;
|
|
19376
19376
|
const definition = binding.defs[0];
|
|
19377
19377
|
const annotation = definition?.name.type === AST_NODE_TYPES94.Identifier ? definition.name.typeAnnotation?.typeAnnotation : void 0;
|
|
@@ -19386,7 +19386,7 @@ var isDirectLocalFileRead = (node) => {
|
|
|
19386
19386
|
}
|
|
19387
19387
|
if (current?.type !== AST_NODE_TYPES94.CallExpression) return false;
|
|
19388
19388
|
const callee = unwrap5(current.callee);
|
|
19389
|
-
const name = callee?.type === AST_NODE_TYPES94.Identifier ? callee.name : callee?.type === AST_NODE_TYPES94.MemberExpression &&
|
|
19389
|
+
const name = callee?.type === AST_NODE_TYPES94.Identifier ? callee.name : callee?.type === AST_NODE_TYPES94.MemberExpression && ASTUtils57.getPropertyName(callee) !== null ? ASTUtils57.getPropertyName(callee) ?? "" : null;
|
|
19390
19390
|
return name !== null && FILE_READ_RE.test(name);
|
|
19391
19391
|
};
|
|
19392
19392
|
var isLocalFileRead = (node) => {
|
|
@@ -19447,7 +19447,7 @@ var isValidationRead = (node) => {
|
|
|
19447
19447
|
return false;
|
|
19448
19448
|
}
|
|
19449
19449
|
const callee = parent.callee;
|
|
19450
|
-
if (callee.type === AST_NODE_TYPES94.MemberExpression && callee.object.type === AST_NODE_TYPES94.Identifier && callee.object.name === "Array" &&
|
|
19450
|
+
if (callee.type === AST_NODE_TYPES94.MemberExpression && callee.object.type === AST_NODE_TYPES94.Identifier && callee.object.name === "Array" && ASTUtils57.getPropertyName(callee) === "isArray") {
|
|
19451
19451
|
return parent.arguments.length === 1;
|
|
19452
19452
|
}
|
|
19453
19453
|
return callee.type === AST_NODE_TYPES94.Identifier && GUARD_NAME_RE.test(callee.name);
|
|
@@ -19475,11 +19475,11 @@ var bindingValidationPolarity = (test, bindingName) => {
|
|
|
19475
19475
|
}
|
|
19476
19476
|
return test.operator === "!==" || test.operator === "!=" ? "valid-when-false" : null;
|
|
19477
19477
|
}
|
|
19478
|
-
return test.type === AST_NODE_TYPES94.CallExpression && test.arguments.length === 1 && test.arguments[0]?.type === AST_NODE_TYPES94.Identifier && test.arguments[0].name === bindingName && test.callee.type === AST_NODE_TYPES94.MemberExpression && test.callee.object.type === AST_NODE_TYPES94.Identifier && test.callee.object.name === "Array" &&
|
|
19478
|
+
return test.type === AST_NODE_TYPES94.CallExpression && test.arguments.length === 1 && test.arguments[0]?.type === AST_NODE_TYPES94.Identifier && test.arguments[0].name === bindingName && test.callee.type === AST_NODE_TYPES94.MemberExpression && test.callee.object.type === AST_NODE_TYPES94.Identifier && test.callee.object.name === "Array" && ASTUtils57.getPropertyName(test.callee) === "isArray" ? "valid-when-true" : null;
|
|
19479
19479
|
};
|
|
19480
19480
|
var plainMemberAccess = (node) => {
|
|
19481
19481
|
if (node.type !== AST_NODE_TYPES94.MemberExpression || node.object.type !== AST_NODE_TYPES94.Identifier) return null;
|
|
19482
|
-
const property =
|
|
19482
|
+
const property = ASTUtils57.getPropertyName(node);
|
|
19483
19483
|
return property === null ? null : { object: node.object.name, property };
|
|
19484
19484
|
};
|
|
19485
19485
|
var isSamePlainMember = (node, access) => {
|
|
@@ -19543,7 +19543,7 @@ var memberValidationPolarity = (test, access) => {
|
|
|
19543
19543
|
}
|
|
19544
19544
|
return test.operator === "!==" || test.operator === "!=" ? "valid-when-false" : null;
|
|
19545
19545
|
}
|
|
19546
|
-
return test.type === AST_NODE_TYPES94.CallExpression && test.arguments.length === 1 && test.arguments[0] !== void 0 && test.arguments[0].type !== AST_NODE_TYPES94.SpreadElement && isSamePlainMember(test.arguments[0], access) && test.callee.type === AST_NODE_TYPES94.MemberExpression && test.callee.object.type === AST_NODE_TYPES94.Identifier && test.callee.object.name === "Array" &&
|
|
19546
|
+
return test.type === AST_NODE_TYPES94.CallExpression && test.arguments.length === 1 && test.arguments[0] !== void 0 && test.arguments[0].type !== AST_NODE_TYPES94.SpreadElement && isSamePlainMember(test.arguments[0], access) && test.callee.type === AST_NODE_TYPES94.MemberExpression && test.callee.object.type === AST_NODE_TYPES94.Identifier && test.callee.object.name === "Array" && ASTUtils57.getPropertyName(test.callee) === "isArray" ? "valid-when-true" : null;
|
|
19547
19547
|
};
|
|
19548
19548
|
var isFullyValidatedExtractedBinding = (member, source, context) => {
|
|
19549
19549
|
const isValidationReference = (identifier) => {
|
|
@@ -19826,7 +19826,7 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
19826
19826
|
(candidate2) => localFileTextRef(candidate2, scope) !== null
|
|
19827
19827
|
)) {
|
|
19828
19828
|
const parent = node.parent;
|
|
19829
|
-
const method =
|
|
19829
|
+
const method = ASTUtils57.getPropertyName(node);
|
|
19830
19830
|
if (parent.type === AST_NODE_TYPES94.CallExpression && parent.callee === node && method !== null && (method === "parse" || method === "safeParse" || PROMISE_CHAIN_METHODS.has(method))) {
|
|
19831
19831
|
return;
|
|
19832
19832
|
}
|
|
@@ -19879,7 +19879,7 @@ function ifGuardDominates(use, branch, positive) {
|
|
|
19879
19879
|
}
|
|
19880
19880
|
|
|
19881
19881
|
// src/rules/prefer-shared-zod-enum.ts
|
|
19882
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES95, ASTUtils as
|
|
19882
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES95, ASTUtils as ASTUtils58 } from "@typescript-eslint/utils";
|
|
19883
19883
|
var PREFER_SHARED_ZOD_ENUM_DOCUMENTATION = {
|
|
19884
19884
|
defaultLevel: "warning",
|
|
19885
19885
|
summary: "Give repeated literal Zod enum domains one reusable module-level schema.",
|
|
@@ -19930,7 +19930,7 @@ var prefer_shared_zod_enum_default = createRule({
|
|
|
19930
19930
|
create(context) {
|
|
19931
19931
|
if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text)) return {};
|
|
19932
19932
|
const zodBindings = /* @__PURE__ */ new Set();
|
|
19933
|
-
const bindingOf = (node) =>
|
|
19933
|
+
const bindingOf = (node) => ASTUtils58.findVariable(context.sourceCode.getScope(node), node.name);
|
|
19934
19934
|
const candidates = /* @__PURE__ */ new Map();
|
|
19935
19935
|
return {
|
|
19936
19936
|
ImportDeclaration(node) {
|
|
@@ -19945,7 +19945,7 @@ var prefer_shared_zod_enum_default = createRule({
|
|
|
19945
19945
|
CallExpression(node) {
|
|
19946
19946
|
const unwrappedNodeCallee = unwrapExpression(node.callee);
|
|
19947
19947
|
const receiver = unwrappedNodeCallee.type === AST_NODE_TYPES95.MemberExpression ? unwrapExpression(unwrappedNodeCallee.object) : unwrappedNodeCallee;
|
|
19948
|
-
if (unwrappedNodeCallee.type !== AST_NODE_TYPES95.MemberExpression || receiver.type !== AST_NODE_TYPES95.Identifier ||
|
|
19948
|
+
if (unwrappedNodeCallee.type !== AST_NODE_TYPES95.MemberExpression || receiver.type !== AST_NODE_TYPES95.Identifier || ASTUtils58.getPropertyName(unwrappedNodeCallee) === null || (ASTUtils58.getPropertyName(unwrappedNodeCallee) ?? "") !== "enum") return;
|
|
19949
19949
|
const binding = bindingOf(receiver);
|
|
19950
19950
|
if (binding === null || !zodBindings.has(binding)) return;
|
|
19951
19951
|
const domain = literalDomain(node);
|
|
@@ -19970,7 +19970,7 @@ var prefer_shared_zod_enum_default = createRule({
|
|
|
19970
19970
|
});
|
|
19971
19971
|
|
|
19972
19972
|
// src/rules/prefer-switch-for-repeated-equality.ts
|
|
19973
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES96, ASTUtils as
|
|
19973
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES96, ASTUtils as ASTUtils59 } from "@typescript-eslint/utils";
|
|
19974
19974
|
var PREFER_SWITCH_FOR_REPEATED_EQUALITY_DOCUMENTATION = {
|
|
19975
19975
|
defaultLevel: "error",
|
|
19976
19976
|
summary: "Prefer switch over long if/else-if chains that compare one value for strict equality.",
|
|
@@ -20022,7 +20022,7 @@ var prefer_switch_for_repeated_equality_default = createRule({
|
|
|
20022
20022
|
if (node.parent.type === AST_NODE_TYPES96.IfStatement && node.parent.alternate === node) return;
|
|
20023
20023
|
const first = discriminantName(node.test);
|
|
20024
20024
|
if (first === null) return;
|
|
20025
|
-
const binding =
|
|
20025
|
+
const binding = ASTUtils59.findVariable(context.sourceCode.getScope(node), first);
|
|
20026
20026
|
if (binding === null || binding.defs.length !== 1 || binding.scope.type === "global") return;
|
|
20027
20027
|
const [definition] = binding.defs;
|
|
20028
20028
|
if (definition?.type !== "Parameter" && definition?.type !== "Variable") return;
|
|
@@ -20569,7 +20569,7 @@ function packageWorkspaceGlobs(parsed) {
|
|
|
20569
20569
|
}
|
|
20570
20570
|
|
|
20571
20571
|
// src/rules/prefer-server-actions.ts
|
|
20572
|
-
import { ASTUtils as
|
|
20572
|
+
import { ASTUtils as ASTUtils60 } from "@typescript-eslint/utils";
|
|
20573
20573
|
var PREFER_SERVER_ACTIONS_DOCUMENTATION = {
|
|
20574
20574
|
summary: "Prefer Next.js Server Actions over same-origin API mutations.",
|
|
20575
20575
|
rationale: "Server Actions can remove a hand-written internal API wrapper while retaining typed application calls. Client invocations still cross a network and serialization boundary.",
|
|
@@ -20602,7 +20602,7 @@ function resolveNode(node, context) {
|
|
|
20602
20602
|
node = node == null ? node : unwrapExpression(node);
|
|
20603
20603
|
if (!node) return null;
|
|
20604
20604
|
if (node.type !== "Identifier") return node;
|
|
20605
|
-
const variable =
|
|
20605
|
+
const variable = ASTUtils60.findVariable(getScope(context, node), node.name);
|
|
20606
20606
|
const definition = variable?.defs.length === 1 ? variable.defs[0] : void 0;
|
|
20607
20607
|
if (definition?.type !== "Variable" || definition.parent.kind !== "const" || definition.node.init === null || variable?.references.some((reference) => reference.isWrite() && reference.init !== true)) return node;
|
|
20608
20608
|
if (definition.node.init.type === "ObjectExpression" && variable?.references.some((reference) => reference.identifier !== node && reference.init !== true)) return node;
|
|
@@ -20611,7 +20611,7 @@ function resolveNode(node, context) {
|
|
|
20611
20611
|
function isAxiosClient(node, context, seen = /* @__PURE__ */ new Set()) {
|
|
20612
20612
|
if (node.type !== "Identifier" || seen.has(node)) return false;
|
|
20613
20613
|
seen.add(node);
|
|
20614
|
-
const variable =
|
|
20614
|
+
const variable = ASTUtils60.findVariable(getScope(context, node), node.name);
|
|
20615
20615
|
const definition = variable?.defs.length === 1 ? variable.defs[0] : void 0;
|
|
20616
20616
|
if (definition === void 0 || variable?.references.some((reference) => reference.isWrite() && reference.init !== true)) return false;
|
|
20617
20617
|
if (variable?.references.some((reference) => {
|
|
@@ -20695,10 +20695,10 @@ function isFunctionArgument(node, context) {
|
|
|
20695
20695
|
}
|
|
20696
20696
|
function getPropertyNode(objNode, propName2) {
|
|
20697
20697
|
if (!objNode || objNode.type !== "ObjectExpression") return null;
|
|
20698
|
-
if (objNode.properties.some((property) => property.type === "SpreadElement" ||
|
|
20698
|
+
if (objNode.properties.some((property) => property.type === "SpreadElement" || ASTUtils60.getPropertyName(property) === null)) return null;
|
|
20699
20699
|
for (const prop of [...objNode.properties].reverse()) {
|
|
20700
20700
|
if (prop.type !== "Property") continue;
|
|
20701
|
-
const keyName =
|
|
20701
|
+
const keyName = ASTUtils60.getPropertyName(prop);
|
|
20702
20702
|
if (keyName === propName2) {
|
|
20703
20703
|
if (prop.value.type === "AssignmentPattern" || prop.value.type === "ArrayPattern" || prop.value.type === "ObjectPattern") {
|
|
20704
20704
|
return null;
|
|
@@ -20822,7 +20822,7 @@ var prefer_server_actions_default = createRule({
|
|
|
20822
20822
|
});
|
|
20823
20823
|
|
|
20824
20824
|
// src/rules/prefer-whole-object-assertion.ts
|
|
20825
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES98, ASTUtils as
|
|
20825
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES98, ASTUtils as ASTUtils61 } from "@typescript-eslint/utils";
|
|
20826
20826
|
var MERGEABLE_MATCHERS = /* @__PURE__ */ new Set(["toBe", "toEqual", "toStrictEqual"]);
|
|
20827
20827
|
var SYNTHETIC_LITERAL_MATCHERS = /* @__PURE__ */ new Map([
|
|
20828
20828
|
["toBeNull", "null"]
|
|
@@ -20887,7 +20887,7 @@ function propertyAccess(node) {
|
|
|
20887
20887
|
const path = [];
|
|
20888
20888
|
let current = node;
|
|
20889
20889
|
while (current.type === AST_NODE_TYPES98.MemberExpression && !current.optional) {
|
|
20890
|
-
const name =
|
|
20890
|
+
const name = ASTUtils61.getPropertyName(current);
|
|
20891
20891
|
if (name === null || COLLECTION_PROPERTIES.has(name) || LITERAL_KEY_HAZARDS.has(name)) return null;
|
|
20892
20892
|
path.unshift(name);
|
|
20893
20893
|
current = unwrapExpression(current.object);
|
|
@@ -21034,7 +21034,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
21034
21034
|
const callee = unwrapExpression(call.callee);
|
|
21035
21035
|
const calleeReceiver = callee.type === AST_NODE_TYPES98.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
21036
21036
|
if (callee.type !== AST_NODE_TYPES98.MemberExpression) return null;
|
|
21037
|
-
const matcher =
|
|
21037
|
+
const matcher = ASTUtils61.getPropertyName(callee);
|
|
21038
21038
|
if (matcher === null) return null;
|
|
21039
21039
|
const expectCall = calleeReceiver;
|
|
21040
21040
|
const expectCallee = expectCall.type === AST_NODE_TYPES98.CallExpression ? unwrapExpression(expectCall.callee) : null;
|
|
@@ -21064,7 +21064,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
21064
21064
|
return assertionExpectation(statement, call, receiver, key, matcher);
|
|
21065
21065
|
}
|
|
21066
21066
|
function isTestExpect(callee) {
|
|
21067
|
-
const variable =
|
|
21067
|
+
const variable = ASTUtils61.findVariable(sourceCode.getScope(callee), callee.name);
|
|
21068
21068
|
if (variable !== null && variable.defs.some((definition) => {
|
|
21069
21069
|
if (definition.node.type !== AST_NODE_TYPES98.ImportSpecifier) return true;
|
|
21070
21070
|
const declaration = definition.node.parent;
|
|
@@ -21107,7 +21107,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
21107
21107
|
});
|
|
21108
21108
|
|
|
21109
21109
|
// src/rules/repeated-static-call-cases.ts
|
|
21110
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES99, ASTUtils as
|
|
21110
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES99, ASTUtils as ASTUtils62 } from "@typescript-eslint/utils";
|
|
21111
21111
|
var REPEATED_STATIC_CALL_CASES_DOCUMENTATION = {
|
|
21112
21112
|
summary: "Review three or more consecutive static-input call assertions as potential named cases.",
|
|
21113
21113
|
rationale: "Copy-pasted cases obscure the input table, and a thrown assertion can stop later cases from being reported.",
|
|
@@ -21128,7 +21128,7 @@ var EXPECT_MODIFIERS = /* @__PURE__ */ new Set(["not", "rejects", "resolves"]);
|
|
|
21128
21128
|
var SNAPSHOT_MATCHERS = /snapshot/iu;
|
|
21129
21129
|
var MIN_CASES2 = 3;
|
|
21130
21130
|
function importedName6(identifier, context, modules) {
|
|
21131
|
-
const variable =
|
|
21131
|
+
const variable = ASTUtils62.findVariable(context.sourceCode.getScope(identifier), identifier.name);
|
|
21132
21132
|
if (variable === null || variable.defs.length === 0) return identifier.name;
|
|
21133
21133
|
for (const definition of variable.defs) {
|
|
21134
21134
|
if (definition.node.type !== AST_NODE_TYPES99.ImportSpecifier) continue;
|
|
@@ -21150,7 +21150,7 @@ function testRoot2(callee) {
|
|
|
21150
21150
|
callee = unwrapExpression(callee);
|
|
21151
21151
|
if (callee.type === AST_NODE_TYPES99.Identifier) return callee;
|
|
21152
21152
|
if (callee.type !== AST_NODE_TYPES99.MemberExpression) return null;
|
|
21153
|
-
const modifier =
|
|
21153
|
+
const modifier = ASTUtils62.getPropertyName(callee);
|
|
21154
21154
|
return modifier !== null && TEST_MODIFIERS5.has(modifier) ? testRoot2(callee.object) : null;
|
|
21155
21155
|
}
|
|
21156
21156
|
function isStatic(input) {
|
|
@@ -21196,8 +21196,8 @@ function assertionShape(statement, context, callback) {
|
|
|
21196
21196
|
const matcherCall = unwrapExpression(statement.expression);
|
|
21197
21197
|
if (matcherCall.type !== AST_NODE_TYPES99.CallExpression) return null;
|
|
21198
21198
|
const matcherCallee = unwrapExpression(matcherCall.callee);
|
|
21199
|
-
if (matcherCallee.type !== AST_NODE_TYPES99.MemberExpression ||
|
|
21200
|
-
const matcher =
|
|
21199
|
+
if (matcherCallee.type !== AST_NODE_TYPES99.MemberExpression || ASTUtils62.getPropertyName(matcherCallee) === null || matcherCall.arguments.length !== 1) return null;
|
|
21200
|
+
const matcher = ASTUtils62.getPropertyName(matcherCallee) ?? "";
|
|
21201
21201
|
if (SNAPSHOT_MATCHERS.test(matcher)) return null;
|
|
21202
21202
|
const chain = expectCallFromMatcher(matcherCallee);
|
|
21203
21203
|
const expectCallee = chain === null ? null : unwrapExpression(chain.call.callee);
|
|
@@ -21207,7 +21207,7 @@ function assertionShape(statement, context, callback) {
|
|
|
21207
21207
|
const observedCallee = observed?.type === AST_NODE_TYPES99.CallExpression ? unwrapExpression(observed.callee) : null;
|
|
21208
21208
|
if (observed?.type !== AST_NODE_TYPES99.CallExpression || observedCallee?.type !== AST_NODE_TYPES99.Identifier || observed.arguments.length === 0 || observed.arguments.some((arg) => arg.type === AST_NODE_TYPES99.SpreadElement || !isStatic(arg)) || expected?.type === AST_NODE_TYPES99.SpreadElement || expected === void 0 || !isStatic(expected)) return null;
|
|
21209
21209
|
const skeleton = `${observedCallee.name}/${observed.arguments.map((item) => staticShape(item)).join(",")}/${chain.modifiers.join(".")}/${matcher}/${staticShape(expected)}`;
|
|
21210
|
-
const binding =
|
|
21210
|
+
const binding = ASTUtils62.findVariable(context.sourceCode.getScope(observedCallee), observedCallee.name);
|
|
21211
21211
|
if (binding?.defs.some(
|
|
21212
21212
|
(definition) => definition.node.range[0] >= callback.range[0] && definition.node.range[1] <= callback.range[1]
|
|
21213
21213
|
)) return null;
|
|
@@ -21218,7 +21218,7 @@ function expectCallFromMatcher(node) {
|
|
|
21218
21218
|
const modifiers = [];
|
|
21219
21219
|
let receiver = node.object;
|
|
21220
21220
|
while (receiver.type === AST_NODE_TYPES99.MemberExpression) {
|
|
21221
|
-
const modifier =
|
|
21221
|
+
const modifier = ASTUtils62.getPropertyName(receiver);
|
|
21222
21222
|
if (modifier === null || !EXPECT_MODIFIERS.has(modifier)) return null;
|
|
21223
21223
|
modifiers.unshift(modifier);
|
|
21224
21224
|
receiver = receiver.object;
|
|
@@ -21294,7 +21294,7 @@ var repeated_static_call_cases_default = createRule({
|
|
|
21294
21294
|
});
|
|
21295
21295
|
|
|
21296
21296
|
// src/rules/prefer-zod-infer.ts
|
|
21297
|
-
import { ASTUtils as
|
|
21297
|
+
import { ASTUtils as ASTUtils63, AST_NODE_TYPES as AST_NODE_TYPES100 } from "@typescript-eslint/utils";
|
|
21298
21298
|
var PREFER_ZOD_INFER_DOCUMENTATION = {
|
|
21299
21299
|
summary: "Derive a type from its Zod schema with `z.infer` instead of hand-writing a twin declaration beside it.",
|
|
21300
21300
|
rationale: "A derived type stays synchronized when the runtime schema changes.",
|
|
@@ -21612,7 +21612,7 @@ function twinCallChain(node, zodNamespaces) {
|
|
|
21612
21612
|
while (current.type === AST_NODE_TYPES100.CallExpression) {
|
|
21613
21613
|
const callee = unwrapExpression(current.callee);
|
|
21614
21614
|
const calleeReceiver = callee.type === AST_NODE_TYPES100.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
21615
|
-
if (callee.type !== AST_NODE_TYPES100.MemberExpression ||
|
|
21615
|
+
if (callee.type !== AST_NODE_TYPES100.MemberExpression || ASTUtils63.getPropertyName(callee) === null) {
|
|
21616
21616
|
return null;
|
|
21617
21617
|
}
|
|
21618
21618
|
chain.push(current);
|
|
@@ -21625,7 +21625,7 @@ function twinCallChain(node, zodNamespaces) {
|
|
|
21625
21625
|
}
|
|
21626
21626
|
function twinMethodName(call) {
|
|
21627
21627
|
const callee = unwrapExpression(call.callee);
|
|
21628
|
-
return callee.type === AST_NODE_TYPES100.MemberExpression &&
|
|
21628
|
+
return callee.type === AST_NODE_TYPES100.MemberExpression && ASTUtils63.getPropertyName(callee) !== null ? ASTUtils63.getPropertyName(callee) ?? "" : "";
|
|
21629
21629
|
}
|
|
21630
21630
|
function twinSchemaFields(initializer, zodNamespaces) {
|
|
21631
21631
|
const chain = twinCallChain(initializer, zodNamespaces);
|
|
@@ -21640,7 +21640,7 @@ function twinSchemaFields(initializer, zodNamespaces) {
|
|
|
21640
21640
|
const fields = /* @__PURE__ */ new Map();
|
|
21641
21641
|
for (const property of shape.properties) {
|
|
21642
21642
|
if (property.type !== AST_NODE_TYPES100.Property) return null;
|
|
21643
|
-
const name =
|
|
21643
|
+
const name = ASTUtils63.getPropertyName(property);
|
|
21644
21644
|
if (name === null) return null;
|
|
21645
21645
|
fields.set(name, twinSchemaField(property.value, zodNamespaces));
|
|
21646
21646
|
}
|
|
@@ -21654,16 +21654,16 @@ function twinSchemaField(node, zodNamespaces) {
|
|
|
21654
21654
|
while (current.type === AST_NODE_TYPES100.CallExpression) {
|
|
21655
21655
|
const callee = unwrapExpression(current.callee);
|
|
21656
21656
|
const calleeReceiver = callee.type === AST_NODE_TYPES100.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
21657
|
-
if (callee.type !== AST_NODE_TYPES100.MemberExpression ||
|
|
21657
|
+
if (callee.type !== AST_NODE_TYPES100.MemberExpression || ASTUtils63.getPropertyName(callee) === null) {
|
|
21658
21658
|
break;
|
|
21659
21659
|
}
|
|
21660
21660
|
const receiver = calleeReceiver;
|
|
21661
21661
|
if (receiver.type === AST_NODE_TYPES100.Identifier && zodNamespaces.has(receiver.name)) {
|
|
21662
|
-
leaf =
|
|
21662
|
+
leaf = ASTUtils63.getPropertyName(callee) ?? "";
|
|
21663
21663
|
leafCall = current;
|
|
21664
21664
|
break;
|
|
21665
21665
|
}
|
|
21666
|
-
modifiers.push(
|
|
21666
|
+
modifiers.push(ASTUtils63.getPropertyName(callee) ?? "");
|
|
21667
21667
|
current = receiver;
|
|
21668
21668
|
}
|
|
21669
21669
|
return {
|
|
@@ -21866,7 +21866,7 @@ var prefer_zod_infer_default = createRule({
|
|
|
21866
21866
|
},
|
|
21867
21867
|
/** Records `XSchema.transform(...)` and equivalent module-level reshaping. */
|
|
21868
21868
|
"MemberExpression"(node) {
|
|
21869
|
-
if (node.object.type === AST_NODE_TYPES100.Identifier &&
|
|
21869
|
+
if (node.object.type === AST_NODE_TYPES100.Identifier && ASTUtils63.getPropertyName(node) !== null && isPreferZodInferModuleReshaper(ASTUtils63.getPropertyName(node) ?? "")) {
|
|
21870
21870
|
reshapedSchemaNames.add(node.object.name);
|
|
21871
21871
|
}
|
|
21872
21872
|
},
|
|
@@ -22023,7 +22023,7 @@ function staticFieldName(key) {
|
|
|
22023
22023
|
}
|
|
22024
22024
|
|
|
22025
22025
|
// src/rules/named-child-schema-type.ts
|
|
22026
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES101, ASTUtils as
|
|
22026
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES101, ASTUtils as ASTUtils64 } from "@typescript-eslint/utils";
|
|
22027
22027
|
var UNRESOLVED_TYPE_NODES = /* @__PURE__ */ new Set([
|
|
22028
22028
|
AST_NODE_TYPES101.TSTypeQuery,
|
|
22029
22029
|
AST_NODE_TYPES101.TSImportType,
|
|
@@ -22068,7 +22068,7 @@ var named_child_schema_type_default = createRule({
|
|
|
22068
22068
|
const source = context.sourceCode;
|
|
22069
22069
|
if (isGeneratedFile(context.filename, source.text)) return {};
|
|
22070
22070
|
const namespaces = /* @__PURE__ */ new Set();
|
|
22071
|
-
const bindingOf = (node) =>
|
|
22071
|
+
const bindingOf = (node) => ASTUtils64.findVariable(source.getScope(node), node.name);
|
|
22072
22072
|
function namespaceOf(type) {
|
|
22073
22073
|
if (type.typeName.type !== AST_NODE_TYPES101.TSQualifiedName || type.typeName.left.type !== AST_NODE_TYPES101.Identifier) return null;
|
|
22074
22074
|
const binding = bindingOf(type.typeName.left);
|
|
@@ -22112,7 +22112,7 @@ var named_child_schema_type_default = createRule({
|
|
|
22112
22112
|
VariableDeclarator(node) {
|
|
22113
22113
|
if (!isModuleConst(node) || node.id.type !== AST_NODE_TYPES101.Identifier || node.init?.type !== AST_NODE_TYPES101.CallExpression) return;
|
|
22114
22114
|
const call = node.init;
|
|
22115
|
-
if (call.arguments.length !== 2 || call.callee.type !== AST_NODE_TYPES101.MemberExpression || call.callee.object.type !== AST_NODE_TYPES101.Identifier ||
|
|
22115
|
+
if (call.arguments.length !== 2 || call.callee.type !== AST_NODE_TYPES101.MemberExpression || call.callee.object.type !== AST_NODE_TYPES101.Identifier || ASTUtils64.getPropertyName(call.callee) !== "record") return;
|
|
22116
22116
|
const annotation = node.id.typeAnnotation?.typeAnnotation;
|
|
22117
22117
|
if (annotation?.type !== AST_NODE_TYPES101.TSTypeReference || annotation.typeName.type !== AST_NODE_TYPES101.TSQualifiedName || annotation.typeName.right.name !== "ZodRecord") return;
|
|
22118
22118
|
const namespace = namespaceOf(annotation);
|
|
@@ -22128,7 +22128,7 @@ var named_child_schema_type_default = createRule({
|
|
|
22128
22128
|
|
|
22129
22129
|
// src/rules/prefer-zod-parse-output-type.ts
|
|
22130
22130
|
import {
|
|
22131
|
-
ASTUtils as
|
|
22131
|
+
ASTUtils as ASTUtils65,
|
|
22132
22132
|
AST_NODE_TYPES as AST_NODE_TYPES102,
|
|
22133
22133
|
ESLintUtils as ESLintUtils14
|
|
22134
22134
|
} from "@typescript-eslint/utils";
|
|
@@ -22198,11 +22198,11 @@ function isLocalZodObjectSchema(node, namespaces) {
|
|
|
22198
22198
|
while (current.type === AST_NODE_TYPES102.CallExpression) {
|
|
22199
22199
|
const callee = unwrapExpression(current.callee);
|
|
22200
22200
|
const calleeReceiver = callee.type === AST_NODE_TYPES102.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
22201
|
-
if (callee.type !== AST_NODE_TYPES102.MemberExpression ||
|
|
22201
|
+
if (callee.type !== AST_NODE_TYPES102.MemberExpression || ASTUtils65.getPropertyName(callee) === null) {
|
|
22202
22202
|
return false;
|
|
22203
22203
|
}
|
|
22204
22204
|
if (calleeReceiver.type === AST_NODE_TYPES102.Identifier) {
|
|
22205
|
-
return namespaces.has(calleeReceiver.name) && ((
|
|
22205
|
+
return namespaces.has(calleeReceiver.name) && ((ASTUtils65.getPropertyName(callee) ?? "") === "object" || (ASTUtils65.getPropertyName(callee) ?? "") === "strictObject");
|
|
22206
22206
|
}
|
|
22207
22207
|
current = calleeReceiver;
|
|
22208
22208
|
}
|
|
@@ -22211,10 +22211,10 @@ function isLocalZodObjectSchema(node, namespaces) {
|
|
|
22211
22211
|
function zodParseCall(node) {
|
|
22212
22212
|
const callee = unwrapExpression(node.callee);
|
|
22213
22213
|
const calleeReceiver = callee.type === AST_NODE_TYPES102.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
22214
|
-
if (callee.type !== AST_NODE_TYPES102.MemberExpression || calleeReceiver.type !== AST_NODE_TYPES102.Identifier ||
|
|
22214
|
+
if (callee.type !== AST_NODE_TYPES102.MemberExpression || calleeReceiver.type !== AST_NODE_TYPES102.Identifier || ASTUtils65.getPropertyName(callee) === null) {
|
|
22215
22215
|
return null;
|
|
22216
22216
|
}
|
|
22217
|
-
const method =
|
|
22217
|
+
const method = ASTUtils65.getPropertyName(callee);
|
|
22218
22218
|
if (method !== "parse" && method !== "safeParse") return null;
|
|
22219
22219
|
return {
|
|
22220
22220
|
call: node,
|
|
@@ -22256,7 +22256,7 @@ function localParseReturnCandidates(node, sourceCode) {
|
|
|
22256
22256
|
for (const reference of variable.references) {
|
|
22257
22257
|
const identifier = reference.identifier;
|
|
22258
22258
|
const parent = identifier.parent;
|
|
22259
|
-
const output = parsed.method === "parse" ? identifier : parent.type === AST_NODE_TYPES102.MemberExpression && parent.object === identifier &&
|
|
22259
|
+
const output = parsed.method === "parse" ? identifier : parent.type === AST_NODE_TYPES102.MemberExpression && parent.object === identifier && ASTUtils65.getPropertyName(parent) !== null && (ASTUtils65.getPropertyName(parent) ?? "") === "data" ? parent : null;
|
|
22260
22260
|
if (output === null) continue;
|
|
22261
22261
|
const candidate2 = returnedOutputCandidate(parsed, output);
|
|
22262
22262
|
if (candidate2 !== null) candidates.push(candidate2);
|
|
@@ -22641,7 +22641,7 @@ var require_assert_never_default = createRule({
|
|
|
22641
22641
|
// src/rules/require-fetch-timeout.ts
|
|
22642
22642
|
import {
|
|
22643
22643
|
AST_NODE_TYPES as AST_NODE_TYPES104,
|
|
22644
|
-
ASTUtils as
|
|
22644
|
+
ASTUtils as ASTUtils66
|
|
22645
22645
|
} from "@typescript-eslint/utils";
|
|
22646
22646
|
var REQUIRE_FETCH_TIMEOUT_DOCUMENTATION = {
|
|
22647
22647
|
summary: "Require an explicit abort signal on locally analyzable global fetch calls.",
|
|
@@ -22684,15 +22684,6 @@ var REQUIRE_FETCH_TIMEOUT_DOCUMENTATION = {
|
|
|
22684
22684
|
}
|
|
22685
22685
|
]
|
|
22686
22686
|
};
|
|
22687
|
-
function matchesAnyPattern3(filename, patterns) {
|
|
22688
|
-
for (const pattern of patterns) {
|
|
22689
|
-
const regexSource = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "::DOUBLESTAR::").replace(/\*/g, "[^/\\\\]*").replace(/::DOUBLESTAR::/g, ".*");
|
|
22690
|
-
if (new RegExp(`^${regexSource}$`).test(filename)) {
|
|
22691
|
-
return true;
|
|
22692
|
-
}
|
|
22693
|
-
}
|
|
22694
|
-
return false;
|
|
22695
|
-
}
|
|
22696
22687
|
function emptySignal(expression, resolvesToGlobal) {
|
|
22697
22688
|
const value = unwrapExpression(expression);
|
|
22698
22689
|
if (value.type === AST_NODE_TYPES104.Literal && value.value === null)
|
|
@@ -22719,7 +22710,7 @@ function initSignalState(init, resolvesToGlobal) {
|
|
|
22719
22710
|
const isSignal = !prop.computed && prop.key.type === AST_NODE_TYPES104.Identifier && prop.key.name === "signal" || prop.key.type === AST_NODE_TYPES104.Literal && prop.key.value === "signal";
|
|
22720
22711
|
if (isSignal) {
|
|
22721
22712
|
state = !prop.method ? emptySignal(prop.value, resolvesToGlobal) ?? "unknown" : "unknown";
|
|
22722
|
-
} else if (!prop.computed &&
|
|
22713
|
+
} else if (!prop.computed && ASTUtils66.getPropertyName(prop) === "__proto__" && state === "absent") {
|
|
22723
22714
|
state = "unknown";
|
|
22724
22715
|
} else if (prop.computed && prop.key.type !== AST_NODE_TYPES104.Literal) {
|
|
22725
22716
|
state = "unknown";
|
|
@@ -22728,14 +22719,14 @@ function initSignalState(init, resolvesToGlobal) {
|
|
|
22728
22719
|
return state;
|
|
22729
22720
|
}
|
|
22730
22721
|
function hasUnprovedPrototype(property) {
|
|
22731
|
-
if (property.computed || property.method || property.shorthand ||
|
|
22722
|
+
if (property.computed || property.method || property.shorthand || ASTUtils66.getPropertyName(property) !== "__proto__")
|
|
22732
22723
|
return false;
|
|
22733
22724
|
const prototype = unwrapExpression(property.value);
|
|
22734
22725
|
if (prototype.type === AST_NODE_TYPES104.Literal && prototype.value === null)
|
|
22735
22726
|
return false;
|
|
22736
22727
|
if (prototype.type !== AST_NODE_TYPES104.ObjectExpression) return true;
|
|
22737
22728
|
return prototype.properties.some(
|
|
22738
|
-
(member) => member.type === AST_NODE_TYPES104.SpreadElement || member.kind !== "init" || !member.computed &&
|
|
22729
|
+
(member) => member.type === AST_NODE_TYPES104.SpreadElement || member.kind !== "init" || !member.computed && ASTUtils66.getPropertyName(member) === "__proto__" || member.computed && member.key.type !== AST_NODE_TYPES104.Literal
|
|
22739
22730
|
);
|
|
22740
22731
|
}
|
|
22741
22732
|
function isInlineUrl(node, resolvesToGlobal) {
|
|
@@ -22773,16 +22764,16 @@ var require_fetch_timeout_default = createRule({
|
|
|
22773
22764
|
return {};
|
|
22774
22765
|
}
|
|
22775
22766
|
const allowIn = optionsArg?.allowIn ?? [];
|
|
22776
|
-
if (allowIn.length > 0 &&
|
|
22767
|
+
if (allowIn.length > 0 && matchesAnyPattern(context.filename, allowIn)) {
|
|
22777
22768
|
return {};
|
|
22778
22769
|
}
|
|
22779
22770
|
function resolvesToGlobal(identifier) {
|
|
22780
22771
|
const scope = context.sourceCode.getScope(identifier);
|
|
22781
|
-
const variable =
|
|
22772
|
+
const variable = ASTUtils66.findVariable(scope, identifier.name);
|
|
22782
22773
|
return variable === null || variable.defs.length === 0;
|
|
22783
22774
|
}
|
|
22784
22775
|
function localConstInitSignalState(identifier) {
|
|
22785
|
-
const variable =
|
|
22776
|
+
const variable = ASTUtils66.findVariable(
|
|
22786
22777
|
context.sourceCode.getScope(identifier),
|
|
22787
22778
|
identifier.name
|
|
22788
22779
|
);
|
|
@@ -22804,7 +22795,7 @@ var require_fetch_timeout_default = createRule({
|
|
|
22804
22795
|
function isForwardedRequest(argument) {
|
|
22805
22796
|
let value = unwrapExpression(argument);
|
|
22806
22797
|
if (value.type === AST_NODE_TYPES104.Identifier) {
|
|
22807
|
-
const binding =
|
|
22798
|
+
const binding = ASTUtils66.findVariable(
|
|
22808
22799
|
context.sourceCode.getScope(value),
|
|
22809
22800
|
value.name
|
|
22810
22801
|
);
|
|
@@ -22989,7 +22980,7 @@ function exportedClasses(program, classes) {
|
|
|
22989
22980
|
}
|
|
22990
22981
|
|
|
22991
22982
|
// src/rules/require-sql-access-class.ts
|
|
22992
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES106, ASTUtils as
|
|
22983
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES106, ASTUtils as ASTUtils67 } from "@typescript-eslint/utils";
|
|
22993
22984
|
var DIRECT_EXECUTION_METHODS = /* @__PURE__ */ new Set([
|
|
22994
22985
|
"all",
|
|
22995
22986
|
"batch",
|
|
@@ -23096,7 +23087,7 @@ function databaseReceiver(node) {
|
|
|
23096
23087
|
if (node.type === AST_NODE_TYPES106.Identifier)
|
|
23097
23088
|
return DATABASE_NAMES.test(node.name);
|
|
23098
23089
|
if (node.type !== AST_NODE_TYPES106.MemberExpression) return false;
|
|
23099
|
-
const name =
|
|
23090
|
+
const name = ASTUtils67.getPropertyName(node);
|
|
23100
23091
|
return name === "DB" || name !== null && DATABASE_NAMES.test(name);
|
|
23101
23092
|
}
|
|
23102
23093
|
function databaseRootMember(node) {
|
|
@@ -23114,7 +23105,7 @@ function databaseRootMember(node) {
|
|
|
23114
23105
|
}
|
|
23115
23106
|
if (current.type === AST_NODE_TYPES106.MemberExpression) {
|
|
23116
23107
|
if (current.object.type === AST_NODE_TYPES106.ThisExpression)
|
|
23117
|
-
return
|
|
23108
|
+
return ASTUtils67.getPropertyName(current);
|
|
23118
23109
|
current = current.object;
|
|
23119
23110
|
continue;
|
|
23120
23111
|
}
|
|
@@ -23135,7 +23126,7 @@ function expressionHasDatabaseMarker(node) {
|
|
|
23135
23126
|
continue;
|
|
23136
23127
|
}
|
|
23137
23128
|
if (current.type === AST_NODE_TYPES106.MemberExpression) {
|
|
23138
|
-
const name =
|
|
23129
|
+
const name = ASTUtils67.getPropertyName(current);
|
|
23139
23130
|
if (name === "DB" || name !== null && DATABASE_NAMES.test(name))
|
|
23140
23131
|
return true;
|
|
23141
23132
|
current = current.object;
|
|
@@ -23154,7 +23145,7 @@ function expressionCallsBuilder(node) {
|
|
|
23154
23145
|
}
|
|
23155
23146
|
if (current.type === AST_NODE_TYPES106.CallExpression) {
|
|
23156
23147
|
if (current.callee.type !== AST_NODE_TYPES106.MemberExpression) return false;
|
|
23157
|
-
const name =
|
|
23148
|
+
const name = ASTUtils67.getPropertyName(current.callee);
|
|
23158
23149
|
if (name !== null && BUILDER_METHODS.has(name)) return true;
|
|
23159
23150
|
current = current.callee.object;
|
|
23160
23151
|
continue;
|
|
@@ -23205,7 +23196,7 @@ function thisRootMember(node) {
|
|
|
23205
23196
|
let current = node;
|
|
23206
23197
|
let root = null;
|
|
23207
23198
|
while (current.type === AST_NODE_TYPES106.MemberExpression) {
|
|
23208
|
-
const name =
|
|
23199
|
+
const name = ASTUtils67.getPropertyName(current);
|
|
23209
23200
|
if (name === null) return null;
|
|
23210
23201
|
root = name;
|
|
23211
23202
|
current = current.object;
|
|
@@ -23249,19 +23240,19 @@ var require_sql_access_class_default = createRule({
|
|
|
23249
23240
|
if (seen.has(node)) return false;
|
|
23250
23241
|
seen.add(node);
|
|
23251
23242
|
if (node.type === AST_NODE_TYPES106.Identifier) {
|
|
23252
|
-
const binding =
|
|
23243
|
+
const binding = ASTUtils67.findVariable(context.sourceCode.getScope(node), node.name);
|
|
23253
23244
|
if (binding?.defs.length !== 1 || binding.references.some((reference) => reference.isWrite() && reference.init !== true)) return false;
|
|
23254
23245
|
const definition = binding.defs[0];
|
|
23255
23246
|
return definition?.type === "Variable" && definition.node.init !== null && knownNonDatabase(definition.node.init, seen);
|
|
23256
23247
|
}
|
|
23257
|
-
return node.type === AST_NODE_TYPES106.NewExpression && unwrappedNodeCallee?.type === AST_NODE_TYPES106.Identifier && ["Map", "WeakMap", "URLSearchParams"].includes(unwrappedNodeCallee.name) && (
|
|
23248
|
+
return node.type === AST_NODE_TYPES106.NewExpression && unwrappedNodeCallee?.type === AST_NODE_TYPES106.Identifier && ["Map", "WeakMap", "URLSearchParams"].includes(unwrappedNodeCallee.name) && (ASTUtils67.findVariable(context.sourceCode.getScope(unwrappedNodeCallee), unwrappedNodeCallee.name)?.defs.length ?? 0) === 0;
|
|
23258
23249
|
}
|
|
23259
23250
|
return {
|
|
23260
23251
|
CallExpression(node) {
|
|
23261
23252
|
const unwrappedNodeCallee = unwrapExpression(node.callee);
|
|
23262
23253
|
if (unwrappedNodeCallee.type !== AST_NODE_TYPES106.MemberExpression)
|
|
23263
23254
|
return;
|
|
23264
|
-
const method =
|
|
23255
|
+
const method = ASTUtils67.getPropertyName(unwrappedNodeCallee);
|
|
23265
23256
|
if (knownNonDatabase(unwrappedNodeCallee.object)) return;
|
|
23266
23257
|
if (method === null || !isDatabaseOperation(method, unwrappedNodeCallee.object))
|
|
23267
23258
|
return;
|
|
@@ -23361,7 +23352,7 @@ var require_static_next_matcher_default = createRule({
|
|
|
23361
23352
|
});
|
|
23362
23353
|
|
|
23363
23354
|
// src/rules/require-use-form-default-values.ts
|
|
23364
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES108, ASTUtils as
|
|
23355
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES108, ASTUtils as ASTUtils68 } from "@typescript-eslint/utils";
|
|
23365
23356
|
var REQUIRE_USE_FORM_DEFAULT_VALUES_DOCUMENTATION = {
|
|
23366
23357
|
summary: "Require explicit form-level initialization or a field default for directly bound Controller fields.",
|
|
23367
23358
|
rationale: "React Hook Form exposes form-level defaultValues/values and field-level defaultValue as its explicit initialization mechanisms. A directly bound controlled field should not omit both mechanisms.",
|
|
@@ -23412,7 +23403,7 @@ var require_use_form_default_values_default = createRule({
|
|
|
23412
23403
|
const imported = /* @__PURE__ */ new Map();
|
|
23413
23404
|
const uninitializedForms = /* @__PURE__ */ new Set();
|
|
23414
23405
|
const uninitializedControls = /* @__PURE__ */ new Set();
|
|
23415
|
-
const bindingNamed = (node, name) =>
|
|
23406
|
+
const bindingNamed = (node, name) => ASTUtils68.findVariable(context.sourceCode.getScope(node), name);
|
|
23416
23407
|
const bindingOf = (node) => bindingNamed(node, node.name);
|
|
23417
23408
|
const stable = (variable) => !variable.references.some((reference) => reference.isWrite() && reference.init !== true);
|
|
23418
23409
|
const importedKind = (node) => {
|
|
@@ -23458,7 +23449,7 @@ var require_use_form_default_values_default = createRule({
|
|
|
23458
23449
|
const variable = bindingOf(node);
|
|
23459
23450
|
return variable !== null && stable(variable) && uninitializedControls.has(variable);
|
|
23460
23451
|
}
|
|
23461
|
-
return node.type === AST_NODE_TYPES108.MemberExpression &&
|
|
23452
|
+
return node.type === AST_NODE_TYPES108.MemberExpression && ASTUtils68.getPropertyName(node) !== null && (ASTUtils68.getPropertyName(node) ?? "") === "control" && isUninitializedForm(node.object);
|
|
23462
23453
|
};
|
|
23463
23454
|
const fieldOptionsNeedDefault = (node) => {
|
|
23464
23455
|
if (node?.type !== AST_NODE_TYPES108.ObjectExpression) return false;
|
|
@@ -23514,7 +23505,7 @@ var require_use_form_default_values_default = createRule({
|
|
|
23514
23505
|
trackDestructuredControl(node.id);
|
|
23515
23506
|
return;
|
|
23516
23507
|
}
|
|
23517
|
-
if (node.id.type === AST_NODE_TYPES108.Identifier && node.init.type === AST_NODE_TYPES108.MemberExpression &&
|
|
23508
|
+
if (node.id.type === AST_NODE_TYPES108.Identifier && node.init.type === AST_NODE_TYPES108.MemberExpression && ASTUtils68.getPropertyName(node.init) !== null && (ASTUtils68.getPropertyName(node.init) ?? "") === "control" && isUninitializedForm(node.init.object)) {
|
|
23518
23509
|
const variable = bindingOf(node.id);
|
|
23519
23510
|
if (variable !== null) uninitializedControls.add(variable);
|
|
23520
23511
|
}
|
|
@@ -23607,7 +23598,7 @@ var require_use_server_in_actions_file_default = createRule({
|
|
|
23607
23598
|
// src/rules/require-zod-form-validation.ts
|
|
23608
23599
|
import {
|
|
23609
23600
|
AST_NODE_TYPES as AST_NODE_TYPES109,
|
|
23610
|
-
ASTUtils as
|
|
23601
|
+
ASTUtils as ASTUtils69
|
|
23611
23602
|
} from "@typescript-eslint/utils";
|
|
23612
23603
|
var REQUIRE_ZOD_FORM_VALIDATION_DOCUMENTATION = {
|
|
23613
23604
|
summary: "Require Zod validation (`Schema.parse(...)` / `Schema.safeParse(...)`) when reading values out of a `FormData` object.",
|
|
@@ -23655,7 +23646,7 @@ var isFormDataMethodCall = (node) => {
|
|
|
23655
23646
|
}
|
|
23656
23647
|
if (current.type !== AST_NODE_TYPES109.CallExpression) return false;
|
|
23657
23648
|
const callee = unwrapExpression(current.callee);
|
|
23658
|
-
return callee.type === AST_NODE_TYPES109.MemberExpression &&
|
|
23649
|
+
return callee.type === AST_NODE_TYPES109.MemberExpression && ASTUtils69.getPropertyName(callee) === "formData";
|
|
23659
23650
|
};
|
|
23660
23651
|
var require_zod_form_validation_default = createRule({
|
|
23661
23652
|
name: "require-zod-form-validation",
|
|
@@ -23676,7 +23667,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
23676
23667
|
return {};
|
|
23677
23668
|
}
|
|
23678
23669
|
const zodBindings = /* @__PURE__ */ new Set();
|
|
23679
|
-
const resolvedBinding = (identifier) =>
|
|
23670
|
+
const resolvedBinding = (identifier) => ASTUtils69.findVariable(
|
|
23680
23671
|
context.sourceCode.getScope(identifier),
|
|
23681
23672
|
identifier.name
|
|
23682
23673
|
);
|
|
@@ -23684,7 +23675,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
23684
23675
|
const callee = unwrapExpression(node.callee);
|
|
23685
23676
|
const calleeReceiver = callee.type === AST_NODE_TYPES109.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
23686
23677
|
if (callee.type !== AST_NODE_TYPES109.MemberExpression) return false;
|
|
23687
|
-
if (
|
|
23678
|
+
if (ASTUtils69.getPropertyName(callee) === null || !FORM_VALUE_METHODS.has(ASTUtils69.getPropertyName(callee) ?? "")) {
|
|
23688
23679
|
return false;
|
|
23689
23680
|
}
|
|
23690
23681
|
return isFormSourceIdentifier(calleeReceiver);
|
|
@@ -23715,7 +23706,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
23715
23706
|
parent = parent.parent;
|
|
23716
23707
|
continue;
|
|
23717
23708
|
}
|
|
23718
|
-
if (parent.type === AST_NODE_TYPES109.CallExpression && parent.callee.type === AST_NODE_TYPES109.MemberExpression && parent.callee.object.type === AST_NODE_TYPES109.Identifier && parent.callee.object.name === "Object" &&
|
|
23709
|
+
if (parent.type === AST_NODE_TYPES109.CallExpression && parent.callee.type === AST_NODE_TYPES109.MemberExpression && parent.callee.object.type === AST_NODE_TYPES109.Identifier && parent.callee.object.name === "Object" && ASTUtils69.getPropertyName(parent.callee) === "fromEntries" && (resolvedBinding(parent.callee.object)?.defs.length ?? 0) === 0) {
|
|
23719
23710
|
parent = parent.parent;
|
|
23720
23711
|
continue;
|
|
23721
23712
|
}
|
|
@@ -23728,7 +23719,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
23728
23719
|
if (node.type !== AST_NODE_TYPES109.CallExpression) return false;
|
|
23729
23720
|
const callee = unwrapExpression(node.callee);
|
|
23730
23721
|
const calleeReceiver = callee.type === AST_NODE_TYPES109.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
23731
|
-
if (callee.type !== AST_NODE_TYPES109.MemberExpression ||
|
|
23722
|
+
if (callee.type !== AST_NODE_TYPES109.MemberExpression || ASTUtils69.getPropertyName(callee) === null || !ZOD_PARSE_METHODS.has(ASTUtils69.getPropertyName(callee) ?? "")) {
|
|
23732
23723
|
return false;
|
|
23733
23724
|
}
|
|
23734
23725
|
const root = zodReceiverRoot(calleeReceiver);
|
|
@@ -23814,7 +23805,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
23814
23805
|
};
|
|
23815
23806
|
const zodParseMethod = (call) => {
|
|
23816
23807
|
const callee = unwrapExpression(call.callee);
|
|
23817
|
-
return callee.type === AST_NODE_TYPES109.MemberExpression &&
|
|
23808
|
+
return callee.type === AST_NODE_TYPES109.MemberExpression && ASTUtils69.getPropertyName(callee) !== null ? ASTUtils69.getPropertyName(callee) ?? "" : null;
|
|
23818
23809
|
};
|
|
23819
23810
|
const isSafePrevalidationInspection = (identifier) => {
|
|
23820
23811
|
const parent = identifier.parent;
|
|
@@ -23990,7 +23981,7 @@ function expressionCallableName(current) {
|
|
|
23990
23981
|
}
|
|
23991
23982
|
|
|
23992
23983
|
// src/rules/stepdown.ts
|
|
23993
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES110, ASTUtils as
|
|
23984
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES110, ASTUtils as ASTUtils70 } from "@typescript-eslint/utils";
|
|
23994
23985
|
var STEPDOWN_DOCUMENTATION = {
|
|
23995
23986
|
summary: "Place a private helper below its sole direct same-scope caller.",
|
|
23996
23987
|
rationale: "Caller-first ordering lets a reader follow the main flow before descending into implementation details.",
|
|
@@ -24290,7 +24281,7 @@ function receiverOrigin(context, object, receivers) {
|
|
|
24290
24281
|
while (true) {
|
|
24291
24282
|
const unwrapped = unwrapExpression4(current);
|
|
24292
24283
|
if (unwrapped.type !== AST_NODE_TYPES110.Identifier) return unwrapped;
|
|
24293
|
-
const variable =
|
|
24284
|
+
const variable = ASTUtils70.findVariable(context.sourceCode.getScope(unwrapped), unwrapped.name);
|
|
24294
24285
|
if (variable === null) return null;
|
|
24295
24286
|
const known = receivers.get(variable);
|
|
24296
24287
|
if (known !== void 0) return known;
|
|
@@ -24471,11 +24462,11 @@ function classScope(context, node, computedReferences) {
|
|
|
24471
24462
|
function classReceiverBindings(context, node) {
|
|
24472
24463
|
const classReceivers = /* @__PURE__ */ new Map();
|
|
24473
24464
|
if (node.id !== null) {
|
|
24474
|
-
const internal =
|
|
24465
|
+
const internal = ASTUtils70.findVariable(context.sourceCode.getScope(node), node.id.name);
|
|
24475
24466
|
if (internal !== null && stableVariable(internal)) classReceivers.set(internal, true);
|
|
24476
24467
|
}
|
|
24477
24468
|
if (node.type === AST_NODE_TYPES110.ClassExpression && node.parent.type === AST_NODE_TYPES110.VariableDeclarator && node.parent.id.type === AST_NODE_TYPES110.Identifier && node.parent.parent.type === AST_NODE_TYPES110.VariableDeclaration && node.parent.parent.kind === "const") {
|
|
24478
|
-
const outer =
|
|
24469
|
+
const outer = ASTUtils70.findVariable(context.sourceCode.getScope(node.parent), node.parent.id.name);
|
|
24479
24470
|
if (outer !== null && stableVariable(outer)) classReceivers.set(outer, true);
|
|
24480
24471
|
}
|
|
24481
24472
|
return classReceivers;
|
|
@@ -24561,7 +24552,7 @@ function classMethodCounts(body2, methods) {
|
|
|
24561
24552
|
}
|
|
24562
24553
|
|
|
24563
24554
|
// src/rules/source-coupled-test.ts
|
|
24564
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES111, ASTUtils as
|
|
24555
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES111, ASTUtils as ASTUtils71 } from "@typescript-eslint/utils";
|
|
24565
24556
|
var GENERAL_SOURCE_SUFFIX_RE = /\.(?:bash|sh|ya?ml|jsonc?|toml|py|[cm]?[jt]s)$/iu;
|
|
24566
24557
|
var FS_MODULES = /* @__PURE__ */ new Set(["fs", "node:fs", "fs/promises", "node:fs/promises"]);
|
|
24567
24558
|
var FS_READERS = /* @__PURE__ */ new Set(["readFile", "readFileSync"]);
|
|
@@ -24678,7 +24669,7 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
24678
24669
|
const scopes = [newScope()];
|
|
24679
24670
|
const reportedOrigins = /* @__PURE__ */ new Set();
|
|
24680
24671
|
const currentScope = () => scopes.at(-1) ?? scopes[0];
|
|
24681
|
-
const bindingOf = (node) =>
|
|
24672
|
+
const bindingOf = (node) => ASTUtils71.findVariable(context.sourceCode.getScope(node), node.name);
|
|
24682
24673
|
const assertionKind = (node) => {
|
|
24683
24674
|
const binding = bindingOf(node);
|
|
24684
24675
|
if (binding === null || binding.defs.length === 0) {
|
|
@@ -24731,7 +24722,7 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
24731
24722
|
return visible("fsReaders", callee) && sourcePath(current.arguments[0]);
|
|
24732
24723
|
}
|
|
24733
24724
|
if (callee.type !== AST_NODE_TYPES111.MemberExpression) return false;
|
|
24734
|
-
const name2 =
|
|
24725
|
+
const name2 = ASTUtils71.getPropertyName(callee);
|
|
24735
24726
|
const object = unwrap6(calleeReceiver);
|
|
24736
24727
|
return name2 !== null && FS_READERS.has(name2) && object.type === AST_NODE_TYPES111.Identifier && visible("fsObjects", object) && sourcePath(current.arguments[0]);
|
|
24737
24728
|
};
|
|
@@ -24740,12 +24731,12 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
24740
24731
|
if (current.type === AST_NODE_TYPES111.Identifier) return visibleRawOrigins(current);
|
|
24741
24732
|
if (rawRead(current)) return /* @__PURE__ */ new Set([`${current.range[0]}:${current.range[1]}`]);
|
|
24742
24733
|
if (current.type === AST_NODE_TYPES111.BinaryExpression && current.operator === "+") return /* @__PURE__ */ new Set([...rawOrigins(current.left), ...rawOrigins(current.right)]);
|
|
24743
|
-
if (current.type === AST_NODE_TYPES111.MemberExpression &&
|
|
24734
|
+
if (current.type === AST_NODE_TYPES111.MemberExpression && ASTUtils71.getPropertyName(current) === "length") return rawOrigins(current.object);
|
|
24744
24735
|
if (current.type !== AST_NODE_TYPES111.CallExpression) return /* @__PURE__ */ new Set();
|
|
24745
24736
|
const callee = unwrap6(current.callee);
|
|
24746
24737
|
const calleeReceiver = callee.type === AST_NODE_TYPES111.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
24747
24738
|
if (callee.type !== AST_NODE_TYPES111.MemberExpression) return /* @__PURE__ */ new Set();
|
|
24748
|
-
const name2 =
|
|
24739
|
+
const name2 = ASTUtils71.getPropertyName(callee);
|
|
24749
24740
|
return name2 !== null && TEXT_TRANSFORMS.has(name2) ? rawOrigins(calleeReceiver) : /* @__PURE__ */ new Set();
|
|
24750
24741
|
};
|
|
24751
24742
|
const evidenceOrigins = (node) => {
|
|
@@ -24758,7 +24749,7 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
24758
24749
|
const callee = unwrap6(current.callee);
|
|
24759
24750
|
const calleeReceiver = callee.type === AST_NODE_TYPES111.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
24760
24751
|
if (callee.type !== AST_NODE_TYPES111.MemberExpression) return /* @__PURE__ */ new Set();
|
|
24761
|
-
const name2 =
|
|
24752
|
+
const name2 = ASTUtils71.getPropertyName(callee);
|
|
24762
24753
|
if (name2 !== null && TEXT_PREDICATES.has(name2)) return rawOrigins(calleeReceiver);
|
|
24763
24754
|
if (name2 !== null && REGEXP_PREDICATES.has(name2)) return new Set(current.arguments.flatMap((argument) => argument.type === AST_NODE_TYPES111.SpreadElement ? [] : [...rawOrigins(argument)]));
|
|
24764
24755
|
return /* @__PURE__ */ new Set();
|
|
@@ -24770,10 +24761,10 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
24770
24761
|
return new Set(node.arguments.flatMap((argument) => argument.type === AST_NODE_TYPES111.SpreadElement ? [] : [...evidenceOrigins(argument)]));
|
|
24771
24762
|
}
|
|
24772
24763
|
if (callee.type !== AST_NODE_TYPES111.MemberExpression) return /* @__PURE__ */ new Set();
|
|
24773
|
-
const matcher =
|
|
24764
|
+
const matcher = ASTUtils71.getPropertyName(callee);
|
|
24774
24765
|
if (matcher === null) return /* @__PURE__ */ new Set();
|
|
24775
24766
|
let receiver = unwrap6(calleeReceiver);
|
|
24776
|
-
while (receiver.type === AST_NODE_TYPES111.MemberExpression && EXPECT_MODIFIERS2.has(
|
|
24767
|
+
while (receiver.type === AST_NODE_TYPES111.MemberExpression && EXPECT_MODIFIERS2.has(ASTUtils71.getPropertyName(receiver) ?? "")) receiver = unwrap6(receiver.object);
|
|
24777
24768
|
const expectCallee = receiver.type === AST_NODE_TYPES111.CallExpression ? unwrapExpression(receiver.callee) : null;
|
|
24778
24769
|
if (receiver.type === AST_NODE_TYPES111.CallExpression && expectCallee?.type === AST_NODE_TYPES111.Identifier && assertionKind(expectCallee) === "expect") {
|
|
24779
24770
|
if (!EXPECT_MATCHERS.has(matcher)) return /* @__PURE__ */ new Set();
|
|
@@ -25056,7 +25047,7 @@ var iac_source_coupled_test_default = createSourceCoupledRule(
|
|
|
25056
25047
|
// src/rules/require-pascal-case-zod-schema-name.ts
|
|
25057
25048
|
import {
|
|
25058
25049
|
AST_NODE_TYPES as AST_NODE_TYPES113,
|
|
25059
|
-
ASTUtils as
|
|
25050
|
+
ASTUtils as ASTUtils72
|
|
25060
25051
|
} from "@typescript-eslint/utils";
|
|
25061
25052
|
var REQUIRE_PASCAL_CASE_ZOD_SCHEMA_NAME_DOCUMENTATION = {
|
|
25062
25053
|
summary: "Require confirmed module-level Zod schema contracts to use PascalCase with a `Schema` suffix.",
|
|
@@ -25189,7 +25180,7 @@ var SCHEMA_RETURNING_METHODS = /* @__PURE__ */ new Set([
|
|
|
25189
25180
|
"superRefine",
|
|
25190
25181
|
"transform"
|
|
25191
25182
|
]);
|
|
25192
|
-
var terminalMethodName = (callee) =>
|
|
25183
|
+
var terminalMethodName = (callee) => ASTUtils72.getPropertyName(callee) !== null ? ASTUtils72.getPropertyName(callee) ?? "" : null;
|
|
25193
25184
|
var calleeChainRoot2 = (node) => {
|
|
25194
25185
|
let current = node;
|
|
25195
25186
|
for (; ; ) {
|
|
@@ -25214,8 +25205,8 @@ var chainMemberNames2 = (node) => {
|
|
|
25214
25205
|
for (; ; ) {
|
|
25215
25206
|
current = unwrapExpression(current);
|
|
25216
25207
|
if (current.type === AST_NODE_TYPES113.MemberExpression) {
|
|
25217
|
-
if (
|
|
25218
|
-
names.push(
|
|
25208
|
+
if (ASTUtils72.getPropertyName(current) === null) return [];
|
|
25209
|
+
names.push(ASTUtils72.getPropertyName(current) ?? "");
|
|
25219
25210
|
current = current.object;
|
|
25220
25211
|
continue;
|
|
25221
25212
|
}
|
|
@@ -25252,7 +25243,7 @@ var require_pascal_case_zod_schema_name_default = createRule({
|
|
|
25252
25243
|
const zodBindings = /* @__PURE__ */ new Set();
|
|
25253
25244
|
const schemaBindings = /* @__PURE__ */ new Set();
|
|
25254
25245
|
function resolvedBinding(identifier) {
|
|
25255
|
-
return
|
|
25246
|
+
return ASTUtils72.findVariable(
|
|
25256
25247
|
context.sourceCode.getScope(identifier),
|
|
25257
25248
|
identifier.name
|
|
25258
25249
|
);
|