@sarj/eslint-plugin 16.14.3 → 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 +16 -3
- package/dist/index.js +139 -126
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -52,7 +52,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
52
52
|
// package.json
|
|
53
53
|
var package_default = {
|
|
54
54
|
name: "@sarj/eslint-plugin",
|
|
55
|
-
version: "16.14.
|
|
55
|
+
version: "16.14.4",
|
|
56
56
|
packageManager: "npm@12.2.0",
|
|
57
57
|
description: "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
|
|
58
58
|
type: "module",
|
|
@@ -18106,8 +18106,7 @@ function isNullish(node) {
|
|
|
18106
18106
|
}
|
|
18107
18107
|
function referenceCarrier(node, context, depth) {
|
|
18108
18108
|
if (node.typeName.type !== import_utils100.AST_NODE_TYPES.Identifier) return void 0;
|
|
18109
|
-
const
|
|
18110
|
-
const definitions = variable?.defs ?? [];
|
|
18109
|
+
const definitions = typeDefinitions(node, context);
|
|
18111
18110
|
const args = node.typeArguments?.params;
|
|
18112
18111
|
if (definitions.length === 0 && ["Array", "ReadonlyArray"].includes(node.typeName.name) && args?.length === 1) {
|
|
18113
18112
|
return arrayCarrier(rawCarrier(args[0], context, depth + 1));
|
|
@@ -18117,6 +18116,17 @@ function referenceCarrier(node, context, depth) {
|
|
|
18117
18116
|
if (declaration?.type !== import_utils100.AST_NODE_TYPES.TSTypeAliasDeclaration || declaration.typeParameters !== void 0) return void 0;
|
|
18118
18117
|
return rawCarrier(declaration.typeAnnotation, context, depth + 1);
|
|
18119
18118
|
}
|
|
18119
|
+
function typeDefinitions(node, context) {
|
|
18120
|
+
if (node.typeName.type !== import_utils100.AST_NODE_TYPES.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
|
+
}
|
|
18120
18130
|
function rawCarrier(node, context, depth = 0) {
|
|
18121
18131
|
if (node === void 0 || depth >= MAX_ALIAS_DEPTH) return void 0;
|
|
18122
18132
|
switch (node.type) {
|
|
@@ -18187,6 +18197,9 @@ var prefer_nominal_id_types_default = createRule({
|
|
|
18187
18197
|
FunctionExpression: (node) => checkBoundary(node, context),
|
|
18188
18198
|
TSDeclareFunction: (node) => checkBoundary(node, context),
|
|
18189
18199
|
TSEmptyBodyFunctionExpression: (node) => checkBoundary(node, context),
|
|
18200
|
+
TSCallSignatureDeclaration: (node) => checkBoundary(node, context),
|
|
18201
|
+
TSConstructSignatureDeclaration: (node) => checkBoundary(node, context),
|
|
18202
|
+
TSConstructorType: (node) => checkBoundary(node, context),
|
|
18190
18203
|
TSFunctionType: (node) => checkBoundary(node, context),
|
|
18191
18204
|
TSMethodSignature: (node) => checkBoundary(node, context)
|
|
18192
18205
|
};
|
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",
|
|
@@ -18068,7 +18068,7 @@ var prefer_multi_value_zod_literal_default = createRule({
|
|
|
18068
18068
|
});
|
|
18069
18069
|
|
|
18070
18070
|
// src/rules/prefer-nominal-id-types.ts
|
|
18071
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES84
|
|
18071
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES84 } from "@typescript-eslint/utils";
|
|
18072
18072
|
var OPERATIONAL_ROLES = /* @__PURE__ */ new Set([
|
|
18073
18073
|
"request",
|
|
18074
18074
|
"trace",
|
|
@@ -18106,8 +18106,7 @@ function isNullish(node) {
|
|
|
18106
18106
|
}
|
|
18107
18107
|
function referenceCarrier(node, context, depth) {
|
|
18108
18108
|
if (node.typeName.type !== AST_NODE_TYPES84.Identifier) return void 0;
|
|
18109
|
-
const
|
|
18110
|
-
const definitions = variable?.defs ?? [];
|
|
18109
|
+
const definitions = typeDefinitions(node, context);
|
|
18111
18110
|
const args = node.typeArguments?.params;
|
|
18112
18111
|
if (definitions.length === 0 && ["Array", "ReadonlyArray"].includes(node.typeName.name) && args?.length === 1) {
|
|
18113
18112
|
return arrayCarrier(rawCarrier(args[0], context, depth + 1));
|
|
@@ -18117,6 +18116,17 @@ function referenceCarrier(node, context, depth) {
|
|
|
18117
18116
|
if (declaration?.type !== AST_NODE_TYPES84.TSTypeAliasDeclaration || declaration.typeParameters !== void 0) return void 0;
|
|
18118
18117
|
return rawCarrier(declaration.typeAnnotation, context, depth + 1);
|
|
18119
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
|
+
}
|
|
18120
18130
|
function rawCarrier(node, context, depth = 0) {
|
|
18121
18131
|
if (node === void 0 || depth >= MAX_ALIAS_DEPTH) return void 0;
|
|
18122
18132
|
switch (node.type) {
|
|
@@ -18187,6 +18197,9 @@ var prefer_nominal_id_types_default = createRule({
|
|
|
18187
18197
|
FunctionExpression: (node) => checkBoundary(node, context),
|
|
18188
18198
|
TSDeclareFunction: (node) => checkBoundary(node, context),
|
|
18189
18199
|
TSEmptyBodyFunctionExpression: (node) => checkBoundary(node, context),
|
|
18200
|
+
TSCallSignatureDeclaration: (node) => checkBoundary(node, context),
|
|
18201
|
+
TSConstructSignatureDeclaration: (node) => checkBoundary(node, context),
|
|
18202
|
+
TSConstructorType: (node) => checkBoundary(node, context),
|
|
18190
18203
|
TSFunctionType: (node) => checkBoundary(node, context),
|
|
18191
18204
|
TSMethodSignature: (node) => checkBoundary(node, context)
|
|
18192
18205
|
};
|
|
@@ -18307,7 +18320,7 @@ var prefer_named_complex_return_type_default = createRule({
|
|
|
18307
18320
|
});
|
|
18308
18321
|
|
|
18309
18322
|
// src/rules/prefer-native-random-uuid.ts
|
|
18310
|
-
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";
|
|
18311
18324
|
var PREFER_NATIVE_RANDOM_UUID_DOCUMENTATION = {
|
|
18312
18325
|
summary: "Prefer `globalThis.crypto.randomUUID()` over resolved zero-argument UUID v4 bindings from the `uuid` package.",
|
|
18313
18326
|
rationale: "The platform implementation avoids an unnecessary dependency for standard random UUID generation.",
|
|
@@ -18343,14 +18356,14 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
18343
18356
|
const directBindings = /* @__PURE__ */ new Set();
|
|
18344
18357
|
const namespaceBindings = /* @__PURE__ */ new Set();
|
|
18345
18358
|
function resolve2(identifier) {
|
|
18346
|
-
return
|
|
18359
|
+
return ASTUtils50.findVariable(context.sourceCode.getScope(identifier), identifier.name);
|
|
18347
18360
|
}
|
|
18348
18361
|
function record(identifier, destination) {
|
|
18349
18362
|
const variable = resolve2(identifier);
|
|
18350
18363
|
if (variable !== null) destination.add(variable);
|
|
18351
18364
|
}
|
|
18352
18365
|
function report2(node) {
|
|
18353
|
-
const globalBinding =
|
|
18366
|
+
const globalBinding = ASTUtils50.findVariable(context.sourceCode.getScope(node), "globalThis");
|
|
18354
18367
|
const canSuggest = (globalBinding?.defs.length ?? 0) === 0 && context.sourceCode.getCommentsInside(node).length === 0;
|
|
18355
18368
|
context.report({
|
|
18356
18369
|
node,
|
|
@@ -18409,7 +18422,7 @@ var prefer_native_random_uuid_default = createRule({
|
|
|
18409
18422
|
});
|
|
18410
18423
|
|
|
18411
18424
|
// src/rules/prefer-node-crypto-hash.ts
|
|
18412
|
-
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";
|
|
18413
18426
|
var PREFER_NODE_CRYPTO_HASH_DOCUMENTATION = {
|
|
18414
18427
|
defaultLevel: "warning",
|
|
18415
18428
|
summary: "Prefer the modern one-shot node:crypto hash API when streaming state is unnecessary.",
|
|
@@ -18437,7 +18450,7 @@ function isCryptoLoader(node, resolve2) {
|
|
|
18437
18450
|
if (unwrappedNodeCallee?.type === AST_NODE_TYPES88.Identifier) {
|
|
18438
18451
|
return unwrappedNodeCallee.name === "require" && isUnshadowedBuiltinIdentifier(unwrappedNodeCallee, resolve2);
|
|
18439
18452
|
}
|
|
18440
|
-
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";
|
|
18441
18454
|
}
|
|
18442
18455
|
function isCryptoSpecifier(node) {
|
|
18443
18456
|
return node.type === AST_NODE_TYPES88.Literal && (node.value === "crypto" || node.value === "node:crypto");
|
|
@@ -18462,7 +18475,7 @@ var prefer_node_crypto_hash_default = createRule({
|
|
|
18462
18475
|
const directBindings = /* @__PURE__ */ new Set();
|
|
18463
18476
|
const namespaceBindings = /* @__PURE__ */ new Set();
|
|
18464
18477
|
function resolve2(identifier) {
|
|
18465
|
-
return
|
|
18478
|
+
return ASTUtils51.findVariable(
|
|
18466
18479
|
context.sourceCode.getScope(identifier),
|
|
18467
18480
|
identifier.name
|
|
18468
18481
|
);
|
|
@@ -18524,7 +18537,7 @@ function importedName5(node) {
|
|
|
18524
18537
|
}
|
|
18525
18538
|
function isMemberCall(node, name) {
|
|
18526
18539
|
const unwrappedNodeCallee = unwrapExpression(node.callee);
|
|
18527
|
-
return unwrappedNodeCallee.type === AST_NODE_TYPES88.MemberExpression &&
|
|
18540
|
+
return unwrappedNodeCallee.type === AST_NODE_TYPES88.MemberExpression && ASTUtils51.getPropertyName(unwrappedNodeCallee) === name;
|
|
18528
18541
|
}
|
|
18529
18542
|
function isCreateHashCall(node, directBindings, namespaceBindings, resolve2) {
|
|
18530
18543
|
const unwrappedNodeCallee = unwrapExpression(node.callee);
|
|
@@ -18532,7 +18545,7 @@ function isCreateHashCall(node, directBindings, namespaceBindings, resolve2) {
|
|
|
18532
18545
|
const variable2 = resolve2(unwrappedNodeCallee);
|
|
18533
18546
|
return variable2 !== null && directBindings.has(variable2);
|
|
18534
18547
|
}
|
|
18535
|
-
if (unwrappedNodeCallee.type !== AST_NODE_TYPES88.MemberExpression ||
|
|
18548
|
+
if (unwrappedNodeCallee.type !== AST_NODE_TYPES88.MemberExpression || ASTUtils51.getPropertyName(unwrappedNodeCallee) !== "createHash") {
|
|
18536
18549
|
return false;
|
|
18537
18550
|
}
|
|
18538
18551
|
if (isCryptoLoader(unwrappedNodeCallee.object, resolve2)) return true;
|
|
@@ -18542,7 +18555,7 @@ function isCreateHashCall(node, directBindings, namespaceBindings, resolve2) {
|
|
|
18542
18555
|
}
|
|
18543
18556
|
|
|
18544
18557
|
// src/rules/prefer-node-fs-promises.ts
|
|
18545
|
-
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";
|
|
18546
18559
|
var PREFER_NODE_FS_PROMISES_DOCUMENTATION = {
|
|
18547
18560
|
defaultLevel: "warning",
|
|
18548
18561
|
summary: "Prefer promise-based Node.js filesystem APIs over synchronous calls in production modules.",
|
|
@@ -18604,7 +18617,7 @@ var prefer_node_fs_promises_default = createRule({
|
|
|
18604
18617
|
if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text) || normalizedFilename.includes("src/rules/"))
|
|
18605
18618
|
return {};
|
|
18606
18619
|
const namespaces = /* @__PURE__ */ new Set();
|
|
18607
|
-
const bindingOf = (node) =>
|
|
18620
|
+
const bindingOf = (node) => ASTUtils52.findVariable(context.sourceCode.getScope(node), node.name);
|
|
18608
18621
|
const isGlobal = (node) => {
|
|
18609
18622
|
const binding = bindingOf(node);
|
|
18610
18623
|
return binding === null || binding.defs.length === 0;
|
|
@@ -18670,7 +18683,7 @@ var prefer_node_fs_promises_default = createRule({
|
|
|
18670
18683
|
});
|
|
18671
18684
|
|
|
18672
18685
|
// src/rules/prefer-non-nullable-collection.ts
|
|
18673
|
-
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";
|
|
18674
18687
|
var PREFER_NON_NULLABLE_COLLECTION_DOCUMENTATION = {
|
|
18675
18688
|
summary: "Suggest reviewing nullish arrays that use local empty-array defaults or a shared null-or-empty guard.",
|
|
18676
18689
|
rationale: "A redundant nullish collection state spreads defaults and guards through consumers without carrying information.",
|
|
@@ -18795,14 +18808,14 @@ function directlyCoalesced(node) {
|
|
|
18795
18808
|
return parent?.type === AST_NODE_TYPES90.LogicalExpression && parent.left === node && (parent.operator === "??" || parent.operator === "||") && emptyArray(parent.right);
|
|
18796
18809
|
}
|
|
18797
18810
|
function identifierIsOnlyCoalesced(context, binding, fn) {
|
|
18798
|
-
const variable =
|
|
18811
|
+
const variable = ASTUtils53.findVariable(context.sourceCode.getScope(binding), binding.name);
|
|
18799
18812
|
if (variable === null || variable.references.length === 0) return false;
|
|
18800
18813
|
return variable.references.every(
|
|
18801
18814
|
(reference) => belongsToFunction(reference.identifier, fn) && directlyCoalesced(reference.identifier)
|
|
18802
18815
|
);
|
|
18803
18816
|
}
|
|
18804
18817
|
function memberIsOnlyCoalesced(context, object, property, fn) {
|
|
18805
|
-
const variable =
|
|
18818
|
+
const variable = ASTUtils53.findVariable(context.sourceCode.getScope(object), object.name);
|
|
18806
18819
|
if (variable === null) return false;
|
|
18807
18820
|
const accesses = variable.references.flatMap((reference) => {
|
|
18808
18821
|
if (!belongsToFunction(reference.identifier, fn)) return [null];
|
|
@@ -18870,7 +18883,7 @@ var prefer_non_nullable_collection_default = createRule({
|
|
|
18870
18883
|
function checkDestructuredProperties(parameter, properties) {
|
|
18871
18884
|
for (const property of properties) {
|
|
18872
18885
|
const bindingProperty = parameter.properties.find(
|
|
18873
|
-
(entry) => entry.type === AST_NODE_TYPES90.Property && !entry.computed &&
|
|
18886
|
+
(entry) => entry.type === AST_NODE_TYPES90.Property && !entry.computed && ASTUtils53.getPropertyName(entry) === property.name
|
|
18874
18887
|
);
|
|
18875
18888
|
if (bindingProperty === void 0) continue;
|
|
18876
18889
|
const value = bindingProperty.value;
|
|
@@ -18918,7 +18931,7 @@ var prefer_non_nullable_collection_default = createRule({
|
|
|
18918
18931
|
// src/rules/prefer-nullish-filter-predicate.ts
|
|
18919
18932
|
import {
|
|
18920
18933
|
AST_NODE_TYPES as AST_NODE_TYPES91,
|
|
18921
|
-
ASTUtils as
|
|
18934
|
+
ASTUtils as ASTUtils54,
|
|
18922
18935
|
ESLintUtils as ESLintUtils12
|
|
18923
18936
|
} from "@typescript-eslint/utils";
|
|
18924
18937
|
import ts10 from "typescript";
|
|
@@ -18964,7 +18977,7 @@ var PREFER_NULLISH_FILTER_PREDICATE_DOCUMENTATION = {
|
|
|
18964
18977
|
]
|
|
18965
18978
|
};
|
|
18966
18979
|
function isUnshadowedBoolean(node, context) {
|
|
18967
|
-
const variable =
|
|
18980
|
+
const variable = ASTUtils54.findVariable(context.sourceCode.getScope(node), node.name);
|
|
18968
18981
|
return variable === null || variable.defs.length === 0;
|
|
18969
18982
|
}
|
|
18970
18983
|
function isBuiltinArrayFilter(node, services) {
|
|
@@ -19023,7 +19036,7 @@ function isProvablyTruthy(type, checker) {
|
|
|
19023
19036
|
}
|
|
19024
19037
|
function availableParameterName(node, context) {
|
|
19025
19038
|
for (const name of ["value", "item", "element", "candidate"]) {
|
|
19026
|
-
if (
|
|
19039
|
+
if (ASTUtils54.findVariable(context.sourceCode.getScope(node), name) === null) return name;
|
|
19027
19040
|
}
|
|
19028
19041
|
return null;
|
|
19029
19042
|
}
|
|
@@ -19054,7 +19067,7 @@ var prefer_nullish_filter_predicate_default = createRule({
|
|
|
19054
19067
|
CallExpression(node) {
|
|
19055
19068
|
const callee = unwrapExpression(node.callee);
|
|
19056
19069
|
const callback = node.arguments[0] === void 0 ? void 0 : unwrapExpression(node.arguments[0]);
|
|
19057
|
-
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;
|
|
19058
19071
|
const elementType = arrayElementType(callee.object, services);
|
|
19059
19072
|
const checker = services.program.getTypeChecker();
|
|
19060
19073
|
if (elementType === null || !isNullishPlusTruthy(elementType, checker)) return;
|
|
@@ -19077,7 +19090,7 @@ var prefer_nullish_filter_predicate_default = createRule({
|
|
|
19077
19090
|
|
|
19078
19091
|
// src/rules/prefer-await-in-async-return.ts
|
|
19079
19092
|
import {
|
|
19080
|
-
ASTUtils as
|
|
19093
|
+
ASTUtils as ASTUtils55,
|
|
19081
19094
|
ESLintUtils as ESLintUtils13,
|
|
19082
19095
|
AST_NODE_TYPES as AST_NODE_TYPES92
|
|
19083
19096
|
} from "@typescript-eslint/utils";
|
|
@@ -19140,7 +19153,7 @@ function isRuntimeFunction(node) {
|
|
|
19140
19153
|
}
|
|
19141
19154
|
function promiseThenReceiver(node) {
|
|
19142
19155
|
const callee = unwrapExpression(node.callee);
|
|
19143
|
-
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) {
|
|
19144
19157
|
return null;
|
|
19145
19158
|
}
|
|
19146
19159
|
const argument = node.arguments[0];
|
|
@@ -19210,7 +19223,7 @@ var prefer_await_in_async_return_default = createRule({
|
|
|
19210
19223
|
if (services === null) return {};
|
|
19211
19224
|
const frameworkLoaders = /* @__PURE__ */ new Set();
|
|
19212
19225
|
const rememberFrameworkLoader = (identifier) => {
|
|
19213
|
-
const variable =
|
|
19226
|
+
const variable = ASTUtils55.findVariable(context.sourceCode.getScope(identifier), identifier.name);
|
|
19214
19227
|
if (variable !== null) frameworkLoaders.add(variable);
|
|
19215
19228
|
};
|
|
19216
19229
|
const isFrameworkLoaderCallback = (owner) => {
|
|
@@ -19218,7 +19231,7 @@ var prefer_await_in_async_return_default = createRule({
|
|
|
19218
19231
|
if (parent === null || parent.arguments[0] !== outerExpression(owner)) return false;
|
|
19219
19232
|
const callee = unwrapExpression(parent.callee);
|
|
19220
19233
|
if (callee.type !== AST_NODE_TYPES92.Identifier) return false;
|
|
19221
|
-
const variable =
|
|
19234
|
+
const variable = ASTUtils55.findVariable(context.sourceCode.getScope(callee), callee.name);
|
|
19222
19235
|
return variable !== null && frameworkLoaders.has(variable);
|
|
19223
19236
|
};
|
|
19224
19237
|
return {
|
|
@@ -19255,18 +19268,18 @@ var prefer_await_in_async_return_default = createRule({
|
|
|
19255
19268
|
});
|
|
19256
19269
|
|
|
19257
19270
|
// src/rules/prefer-schema-for-api-payload.ts
|
|
19258
|
-
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";
|
|
19259
19272
|
|
|
19260
19273
|
// src/rules/_native-fetch-reference.ts
|
|
19261
|
-
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";
|
|
19262
19275
|
var GLOBAL_RECEIVERS3 = /* @__PURE__ */ new Set(["globalThis", "self", "window"]);
|
|
19263
19276
|
function nativeFetchReference(node, sourceCode, seen = /* @__PURE__ */ new Set()) {
|
|
19264
19277
|
const expression = unwrapExpression(node);
|
|
19265
19278
|
if (expression.type === AST_NODE_TYPES93.MemberExpression) {
|
|
19266
|
-
return
|
|
19279
|
+
return ASTUtils56.getPropertyName(expression) === "fetch" && globalReceiver(expression.object, sourceCode);
|
|
19267
19280
|
}
|
|
19268
19281
|
if (expression.type !== AST_NODE_TYPES93.Identifier) return false;
|
|
19269
|
-
const binding =
|
|
19282
|
+
const binding = ASTUtils56.findVariable(sourceCode.getScope(expression), expression.name);
|
|
19270
19283
|
if (binding === null || binding.defs.length === 0) return expression.name === "fetch";
|
|
19271
19284
|
if (seen.has(binding) || seen.size >= 8 || binding.defs.length !== 1 || binding.references.some((reference) => reference.isWrite() && reference.init !== true)) return false;
|
|
19272
19285
|
seen.add(binding);
|
|
@@ -19275,11 +19288,11 @@ function nativeFetchReference(node, sourceCode, seen = /* @__PURE__ */ new Set()
|
|
|
19275
19288
|
if (definition.node.id.type === AST_NODE_TYPES93.Identifier) {
|
|
19276
19289
|
return nativeFetchReference(definition.node.init, sourceCode, seen);
|
|
19277
19290
|
}
|
|
19278
|
-
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);
|
|
19279
19292
|
}
|
|
19280
19293
|
function globalReceiver(node, sourceCode) {
|
|
19281
19294
|
const receiver = unwrapExpression(node);
|
|
19282
|
-
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;
|
|
19283
19296
|
}
|
|
19284
19297
|
|
|
19285
19298
|
// src/rules/prefer-schema-for-api-payload.ts
|
|
@@ -19319,7 +19332,7 @@ var PROMISE_CHAIN_METHODS = /* @__PURE__ */ new Set([
|
|
|
19319
19332
|
]);
|
|
19320
19333
|
var isSchemaParseReference = (node) => {
|
|
19321
19334
|
const inner = unwrap5(node);
|
|
19322
|
-
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");
|
|
19323
19336
|
};
|
|
19324
19337
|
var isRawPayloadSource = (node, context, isKnownLocalText) => {
|
|
19325
19338
|
let current = unwrap5(node);
|
|
@@ -19334,7 +19347,7 @@ var isRawPayloadSource = (node, context, isKnownLocalText) => {
|
|
|
19334
19347
|
if (callee === null || callee.type !== AST_NODE_TYPES94.MemberExpression) {
|
|
19335
19348
|
return false;
|
|
19336
19349
|
}
|
|
19337
|
-
const property =
|
|
19350
|
+
const property = ASTUtils57.getPropertyName(callee);
|
|
19338
19351
|
if (property === null) {
|
|
19339
19352
|
return false;
|
|
19340
19353
|
}
|
|
@@ -19346,19 +19359,19 @@ var isRawPayloadSource = (node, context, isKnownLocalText) => {
|
|
|
19346
19359
|
}
|
|
19347
19360
|
const object = unwrap5(callee.object);
|
|
19348
19361
|
const input = unwrap5(current.arguments[0]);
|
|
19349
|
-
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" &&
|
|
19350
|
-
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;
|
|
19351
19364
|
};
|
|
19352
19365
|
var isResponseSource = (node, context, seen = /* @__PURE__ */ new Set()) => {
|
|
19353
19366
|
let current = unwrap5(node);
|
|
19354
19367
|
if (current?.type === AST_NODE_TYPES94.AwaitExpression) current = unwrap5(current.argument);
|
|
19355
19368
|
if (current === null || seen.has(current)) return false;
|
|
19356
19369
|
seen.add(current);
|
|
19357
|
-
const isGlobal = (identifier) => (
|
|
19370
|
+
const isGlobal = (identifier) => (ASTUtils57.findVariable(context.sourceCode.getScope(identifier), identifier.name)?.defs.length ?? 0) === 0;
|
|
19358
19371
|
if (current.type === AST_NODE_TYPES94.CallExpression) return nativeFetchReference(current.callee, context.sourceCode);
|
|
19359
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);
|
|
19360
19373
|
if (current.type !== AST_NODE_TYPES94.Identifier) return false;
|
|
19361
|
-
const binding =
|
|
19374
|
+
const binding = ASTUtils57.findVariable(context.sourceCode.getScope(current), current.name);
|
|
19362
19375
|
if (binding?.defs.length !== 1 || binding.references.some((reference) => reference.isWrite() && reference.init !== true)) return false;
|
|
19363
19376
|
const definition = binding.defs[0];
|
|
19364
19377
|
const annotation = definition?.name.type === AST_NODE_TYPES94.Identifier ? definition.name.typeAnnotation?.typeAnnotation : void 0;
|
|
@@ -19373,7 +19386,7 @@ var isDirectLocalFileRead = (node) => {
|
|
|
19373
19386
|
}
|
|
19374
19387
|
if (current?.type !== AST_NODE_TYPES94.CallExpression) return false;
|
|
19375
19388
|
const callee = unwrap5(current.callee);
|
|
19376
|
-
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;
|
|
19377
19390
|
return name !== null && FILE_READ_RE.test(name);
|
|
19378
19391
|
};
|
|
19379
19392
|
var isLocalFileRead = (node) => {
|
|
@@ -19434,7 +19447,7 @@ var isValidationRead = (node) => {
|
|
|
19434
19447
|
return false;
|
|
19435
19448
|
}
|
|
19436
19449
|
const callee = parent.callee;
|
|
19437
|
-
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") {
|
|
19438
19451
|
return parent.arguments.length === 1;
|
|
19439
19452
|
}
|
|
19440
19453
|
return callee.type === AST_NODE_TYPES94.Identifier && GUARD_NAME_RE.test(callee.name);
|
|
@@ -19462,11 +19475,11 @@ var bindingValidationPolarity = (test, bindingName) => {
|
|
|
19462
19475
|
}
|
|
19463
19476
|
return test.operator === "!==" || test.operator === "!=" ? "valid-when-false" : null;
|
|
19464
19477
|
}
|
|
19465
|
-
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;
|
|
19466
19479
|
};
|
|
19467
19480
|
var plainMemberAccess = (node) => {
|
|
19468
19481
|
if (node.type !== AST_NODE_TYPES94.MemberExpression || node.object.type !== AST_NODE_TYPES94.Identifier) return null;
|
|
19469
|
-
const property =
|
|
19482
|
+
const property = ASTUtils57.getPropertyName(node);
|
|
19470
19483
|
return property === null ? null : { object: node.object.name, property };
|
|
19471
19484
|
};
|
|
19472
19485
|
var isSamePlainMember = (node, access) => {
|
|
@@ -19530,7 +19543,7 @@ var memberValidationPolarity = (test, access) => {
|
|
|
19530
19543
|
}
|
|
19531
19544
|
return test.operator === "!==" || test.operator === "!=" ? "valid-when-false" : null;
|
|
19532
19545
|
}
|
|
19533
|
-
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;
|
|
19534
19547
|
};
|
|
19535
19548
|
var isFullyValidatedExtractedBinding = (member, source, context) => {
|
|
19536
19549
|
const isValidationReference = (identifier) => {
|
|
@@ -19813,7 +19826,7 @@ var prefer_schema_for_api_payload_default = createRule({
|
|
|
19813
19826
|
(candidate2) => localFileTextRef(candidate2, scope) !== null
|
|
19814
19827
|
)) {
|
|
19815
19828
|
const parent = node.parent;
|
|
19816
|
-
const method =
|
|
19829
|
+
const method = ASTUtils57.getPropertyName(node);
|
|
19817
19830
|
if (parent.type === AST_NODE_TYPES94.CallExpression && parent.callee === node && method !== null && (method === "parse" || method === "safeParse" || PROMISE_CHAIN_METHODS.has(method))) {
|
|
19818
19831
|
return;
|
|
19819
19832
|
}
|
|
@@ -19866,7 +19879,7 @@ function ifGuardDominates(use, branch, positive) {
|
|
|
19866
19879
|
}
|
|
19867
19880
|
|
|
19868
19881
|
// src/rules/prefer-shared-zod-enum.ts
|
|
19869
|
-
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";
|
|
19870
19883
|
var PREFER_SHARED_ZOD_ENUM_DOCUMENTATION = {
|
|
19871
19884
|
defaultLevel: "warning",
|
|
19872
19885
|
summary: "Give repeated literal Zod enum domains one reusable module-level schema.",
|
|
@@ -19917,7 +19930,7 @@ var prefer_shared_zod_enum_default = createRule({
|
|
|
19917
19930
|
create(context) {
|
|
19918
19931
|
if (isTestFile(context.filename) || isGeneratedFile(context.filename, context.sourceCode.text)) return {};
|
|
19919
19932
|
const zodBindings = /* @__PURE__ */ new Set();
|
|
19920
|
-
const bindingOf = (node) =>
|
|
19933
|
+
const bindingOf = (node) => ASTUtils58.findVariable(context.sourceCode.getScope(node), node.name);
|
|
19921
19934
|
const candidates = /* @__PURE__ */ new Map();
|
|
19922
19935
|
return {
|
|
19923
19936
|
ImportDeclaration(node) {
|
|
@@ -19932,7 +19945,7 @@ var prefer_shared_zod_enum_default = createRule({
|
|
|
19932
19945
|
CallExpression(node) {
|
|
19933
19946
|
const unwrappedNodeCallee = unwrapExpression(node.callee);
|
|
19934
19947
|
const receiver = unwrappedNodeCallee.type === AST_NODE_TYPES95.MemberExpression ? unwrapExpression(unwrappedNodeCallee.object) : unwrappedNodeCallee;
|
|
19935
|
-
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;
|
|
19936
19949
|
const binding = bindingOf(receiver);
|
|
19937
19950
|
if (binding === null || !zodBindings.has(binding)) return;
|
|
19938
19951
|
const domain = literalDomain(node);
|
|
@@ -19957,7 +19970,7 @@ var prefer_shared_zod_enum_default = createRule({
|
|
|
19957
19970
|
});
|
|
19958
19971
|
|
|
19959
19972
|
// src/rules/prefer-switch-for-repeated-equality.ts
|
|
19960
|
-
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";
|
|
19961
19974
|
var PREFER_SWITCH_FOR_REPEATED_EQUALITY_DOCUMENTATION = {
|
|
19962
19975
|
defaultLevel: "error",
|
|
19963
19976
|
summary: "Prefer switch over long if/else-if chains that compare one value for strict equality.",
|
|
@@ -20009,7 +20022,7 @@ var prefer_switch_for_repeated_equality_default = createRule({
|
|
|
20009
20022
|
if (node.parent.type === AST_NODE_TYPES96.IfStatement && node.parent.alternate === node) return;
|
|
20010
20023
|
const first = discriminantName(node.test);
|
|
20011
20024
|
if (first === null) return;
|
|
20012
|
-
const binding =
|
|
20025
|
+
const binding = ASTUtils59.findVariable(context.sourceCode.getScope(node), first);
|
|
20013
20026
|
if (binding === null || binding.defs.length !== 1 || binding.scope.type === "global") return;
|
|
20014
20027
|
const [definition] = binding.defs;
|
|
20015
20028
|
if (definition?.type !== "Parameter" && definition?.type !== "Variable") return;
|
|
@@ -20556,7 +20569,7 @@ function packageWorkspaceGlobs(parsed) {
|
|
|
20556
20569
|
}
|
|
20557
20570
|
|
|
20558
20571
|
// src/rules/prefer-server-actions.ts
|
|
20559
|
-
import { ASTUtils as
|
|
20572
|
+
import { ASTUtils as ASTUtils60 } from "@typescript-eslint/utils";
|
|
20560
20573
|
var PREFER_SERVER_ACTIONS_DOCUMENTATION = {
|
|
20561
20574
|
summary: "Prefer Next.js Server Actions over same-origin API mutations.",
|
|
20562
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.",
|
|
@@ -20589,7 +20602,7 @@ function resolveNode(node, context) {
|
|
|
20589
20602
|
node = node == null ? node : unwrapExpression(node);
|
|
20590
20603
|
if (!node) return null;
|
|
20591
20604
|
if (node.type !== "Identifier") return node;
|
|
20592
|
-
const variable =
|
|
20605
|
+
const variable = ASTUtils60.findVariable(getScope(context, node), node.name);
|
|
20593
20606
|
const definition = variable?.defs.length === 1 ? variable.defs[0] : void 0;
|
|
20594
20607
|
if (definition?.type !== "Variable" || definition.parent.kind !== "const" || definition.node.init === null || variable?.references.some((reference) => reference.isWrite() && reference.init !== true)) return node;
|
|
20595
20608
|
if (definition.node.init.type === "ObjectExpression" && variable?.references.some((reference) => reference.identifier !== node && reference.init !== true)) return node;
|
|
@@ -20598,7 +20611,7 @@ function resolveNode(node, context) {
|
|
|
20598
20611
|
function isAxiosClient(node, context, seen = /* @__PURE__ */ new Set()) {
|
|
20599
20612
|
if (node.type !== "Identifier" || seen.has(node)) return false;
|
|
20600
20613
|
seen.add(node);
|
|
20601
|
-
const variable =
|
|
20614
|
+
const variable = ASTUtils60.findVariable(getScope(context, node), node.name);
|
|
20602
20615
|
const definition = variable?.defs.length === 1 ? variable.defs[0] : void 0;
|
|
20603
20616
|
if (definition === void 0 || variable?.references.some((reference) => reference.isWrite() && reference.init !== true)) return false;
|
|
20604
20617
|
if (variable?.references.some((reference) => {
|
|
@@ -20682,10 +20695,10 @@ function isFunctionArgument(node, context) {
|
|
|
20682
20695
|
}
|
|
20683
20696
|
function getPropertyNode(objNode, propName2) {
|
|
20684
20697
|
if (!objNode || objNode.type !== "ObjectExpression") return null;
|
|
20685
|
-
if (objNode.properties.some((property) => property.type === "SpreadElement" ||
|
|
20698
|
+
if (objNode.properties.some((property) => property.type === "SpreadElement" || ASTUtils60.getPropertyName(property) === null)) return null;
|
|
20686
20699
|
for (const prop of [...objNode.properties].reverse()) {
|
|
20687
20700
|
if (prop.type !== "Property") continue;
|
|
20688
|
-
const keyName =
|
|
20701
|
+
const keyName = ASTUtils60.getPropertyName(prop);
|
|
20689
20702
|
if (keyName === propName2) {
|
|
20690
20703
|
if (prop.value.type === "AssignmentPattern" || prop.value.type === "ArrayPattern" || prop.value.type === "ObjectPattern") {
|
|
20691
20704
|
return null;
|
|
@@ -20809,7 +20822,7 @@ var prefer_server_actions_default = createRule({
|
|
|
20809
20822
|
});
|
|
20810
20823
|
|
|
20811
20824
|
// src/rules/prefer-whole-object-assertion.ts
|
|
20812
|
-
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";
|
|
20813
20826
|
var MERGEABLE_MATCHERS = /* @__PURE__ */ new Set(["toBe", "toEqual", "toStrictEqual"]);
|
|
20814
20827
|
var SYNTHETIC_LITERAL_MATCHERS = /* @__PURE__ */ new Map([
|
|
20815
20828
|
["toBeNull", "null"]
|
|
@@ -20874,7 +20887,7 @@ function propertyAccess(node) {
|
|
|
20874
20887
|
const path = [];
|
|
20875
20888
|
let current = node;
|
|
20876
20889
|
while (current.type === AST_NODE_TYPES98.MemberExpression && !current.optional) {
|
|
20877
|
-
const name =
|
|
20890
|
+
const name = ASTUtils61.getPropertyName(current);
|
|
20878
20891
|
if (name === null || COLLECTION_PROPERTIES.has(name) || LITERAL_KEY_HAZARDS.has(name)) return null;
|
|
20879
20892
|
path.unshift(name);
|
|
20880
20893
|
current = unwrapExpression(current.object);
|
|
@@ -21021,7 +21034,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
21021
21034
|
const callee = unwrapExpression(call.callee);
|
|
21022
21035
|
const calleeReceiver = callee.type === AST_NODE_TYPES98.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
21023
21036
|
if (callee.type !== AST_NODE_TYPES98.MemberExpression) return null;
|
|
21024
|
-
const matcher =
|
|
21037
|
+
const matcher = ASTUtils61.getPropertyName(callee);
|
|
21025
21038
|
if (matcher === null) return null;
|
|
21026
21039
|
const expectCall = calleeReceiver;
|
|
21027
21040
|
const expectCallee = expectCall.type === AST_NODE_TYPES98.CallExpression ? unwrapExpression(expectCall.callee) : null;
|
|
@@ -21051,7 +21064,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
21051
21064
|
return assertionExpectation(statement, call, receiver, key, matcher);
|
|
21052
21065
|
}
|
|
21053
21066
|
function isTestExpect(callee) {
|
|
21054
|
-
const variable =
|
|
21067
|
+
const variable = ASTUtils61.findVariable(sourceCode.getScope(callee), callee.name);
|
|
21055
21068
|
if (variable !== null && variable.defs.some((definition) => {
|
|
21056
21069
|
if (definition.node.type !== AST_NODE_TYPES98.ImportSpecifier) return true;
|
|
21057
21070
|
const declaration = definition.node.parent;
|
|
@@ -21094,7 +21107,7 @@ var prefer_whole_object_assertion_default = createRule({
|
|
|
21094
21107
|
});
|
|
21095
21108
|
|
|
21096
21109
|
// src/rules/repeated-static-call-cases.ts
|
|
21097
|
-
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";
|
|
21098
21111
|
var REPEATED_STATIC_CALL_CASES_DOCUMENTATION = {
|
|
21099
21112
|
summary: "Review three or more consecutive static-input call assertions as potential named cases.",
|
|
21100
21113
|
rationale: "Copy-pasted cases obscure the input table, and a thrown assertion can stop later cases from being reported.",
|
|
@@ -21115,7 +21128,7 @@ var EXPECT_MODIFIERS = /* @__PURE__ */ new Set(["not", "rejects", "resolves"]);
|
|
|
21115
21128
|
var SNAPSHOT_MATCHERS = /snapshot/iu;
|
|
21116
21129
|
var MIN_CASES2 = 3;
|
|
21117
21130
|
function importedName6(identifier, context, modules) {
|
|
21118
|
-
const variable =
|
|
21131
|
+
const variable = ASTUtils62.findVariable(context.sourceCode.getScope(identifier), identifier.name);
|
|
21119
21132
|
if (variable === null || variable.defs.length === 0) return identifier.name;
|
|
21120
21133
|
for (const definition of variable.defs) {
|
|
21121
21134
|
if (definition.node.type !== AST_NODE_TYPES99.ImportSpecifier) continue;
|
|
@@ -21137,7 +21150,7 @@ function testRoot2(callee) {
|
|
|
21137
21150
|
callee = unwrapExpression(callee);
|
|
21138
21151
|
if (callee.type === AST_NODE_TYPES99.Identifier) return callee;
|
|
21139
21152
|
if (callee.type !== AST_NODE_TYPES99.MemberExpression) return null;
|
|
21140
|
-
const modifier =
|
|
21153
|
+
const modifier = ASTUtils62.getPropertyName(callee);
|
|
21141
21154
|
return modifier !== null && TEST_MODIFIERS5.has(modifier) ? testRoot2(callee.object) : null;
|
|
21142
21155
|
}
|
|
21143
21156
|
function isStatic(input) {
|
|
@@ -21183,8 +21196,8 @@ function assertionShape(statement, context, callback) {
|
|
|
21183
21196
|
const matcherCall = unwrapExpression(statement.expression);
|
|
21184
21197
|
if (matcherCall.type !== AST_NODE_TYPES99.CallExpression) return null;
|
|
21185
21198
|
const matcherCallee = unwrapExpression(matcherCall.callee);
|
|
21186
|
-
if (matcherCallee.type !== AST_NODE_TYPES99.MemberExpression ||
|
|
21187
|
-
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) ?? "";
|
|
21188
21201
|
if (SNAPSHOT_MATCHERS.test(matcher)) return null;
|
|
21189
21202
|
const chain = expectCallFromMatcher(matcherCallee);
|
|
21190
21203
|
const expectCallee = chain === null ? null : unwrapExpression(chain.call.callee);
|
|
@@ -21194,7 +21207,7 @@ function assertionShape(statement, context, callback) {
|
|
|
21194
21207
|
const observedCallee = observed?.type === AST_NODE_TYPES99.CallExpression ? unwrapExpression(observed.callee) : null;
|
|
21195
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;
|
|
21196
21209
|
const skeleton = `${observedCallee.name}/${observed.arguments.map((item) => staticShape(item)).join(",")}/${chain.modifiers.join(".")}/${matcher}/${staticShape(expected)}`;
|
|
21197
|
-
const binding =
|
|
21210
|
+
const binding = ASTUtils62.findVariable(context.sourceCode.getScope(observedCallee), observedCallee.name);
|
|
21198
21211
|
if (binding?.defs.some(
|
|
21199
21212
|
(definition) => definition.node.range[0] >= callback.range[0] && definition.node.range[1] <= callback.range[1]
|
|
21200
21213
|
)) return null;
|
|
@@ -21205,7 +21218,7 @@ function expectCallFromMatcher(node) {
|
|
|
21205
21218
|
const modifiers = [];
|
|
21206
21219
|
let receiver = node.object;
|
|
21207
21220
|
while (receiver.type === AST_NODE_TYPES99.MemberExpression) {
|
|
21208
|
-
const modifier =
|
|
21221
|
+
const modifier = ASTUtils62.getPropertyName(receiver);
|
|
21209
21222
|
if (modifier === null || !EXPECT_MODIFIERS.has(modifier)) return null;
|
|
21210
21223
|
modifiers.unshift(modifier);
|
|
21211
21224
|
receiver = receiver.object;
|
|
@@ -21281,7 +21294,7 @@ var repeated_static_call_cases_default = createRule({
|
|
|
21281
21294
|
});
|
|
21282
21295
|
|
|
21283
21296
|
// src/rules/prefer-zod-infer.ts
|
|
21284
|
-
import { ASTUtils as
|
|
21297
|
+
import { ASTUtils as ASTUtils63, AST_NODE_TYPES as AST_NODE_TYPES100 } from "@typescript-eslint/utils";
|
|
21285
21298
|
var PREFER_ZOD_INFER_DOCUMENTATION = {
|
|
21286
21299
|
summary: "Derive a type from its Zod schema with `z.infer` instead of hand-writing a twin declaration beside it.",
|
|
21287
21300
|
rationale: "A derived type stays synchronized when the runtime schema changes.",
|
|
@@ -21599,7 +21612,7 @@ function twinCallChain(node, zodNamespaces) {
|
|
|
21599
21612
|
while (current.type === AST_NODE_TYPES100.CallExpression) {
|
|
21600
21613
|
const callee = unwrapExpression(current.callee);
|
|
21601
21614
|
const calleeReceiver = callee.type === AST_NODE_TYPES100.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
21602
|
-
if (callee.type !== AST_NODE_TYPES100.MemberExpression ||
|
|
21615
|
+
if (callee.type !== AST_NODE_TYPES100.MemberExpression || ASTUtils63.getPropertyName(callee) === null) {
|
|
21603
21616
|
return null;
|
|
21604
21617
|
}
|
|
21605
21618
|
chain.push(current);
|
|
@@ -21612,7 +21625,7 @@ function twinCallChain(node, zodNamespaces) {
|
|
|
21612
21625
|
}
|
|
21613
21626
|
function twinMethodName(call) {
|
|
21614
21627
|
const callee = unwrapExpression(call.callee);
|
|
21615
|
-
return callee.type === AST_NODE_TYPES100.MemberExpression &&
|
|
21628
|
+
return callee.type === AST_NODE_TYPES100.MemberExpression && ASTUtils63.getPropertyName(callee) !== null ? ASTUtils63.getPropertyName(callee) ?? "" : "";
|
|
21616
21629
|
}
|
|
21617
21630
|
function twinSchemaFields(initializer, zodNamespaces) {
|
|
21618
21631
|
const chain = twinCallChain(initializer, zodNamespaces);
|
|
@@ -21627,7 +21640,7 @@ function twinSchemaFields(initializer, zodNamespaces) {
|
|
|
21627
21640
|
const fields = /* @__PURE__ */ new Map();
|
|
21628
21641
|
for (const property of shape.properties) {
|
|
21629
21642
|
if (property.type !== AST_NODE_TYPES100.Property) return null;
|
|
21630
|
-
const name =
|
|
21643
|
+
const name = ASTUtils63.getPropertyName(property);
|
|
21631
21644
|
if (name === null) return null;
|
|
21632
21645
|
fields.set(name, twinSchemaField(property.value, zodNamespaces));
|
|
21633
21646
|
}
|
|
@@ -21641,16 +21654,16 @@ function twinSchemaField(node, zodNamespaces) {
|
|
|
21641
21654
|
while (current.type === AST_NODE_TYPES100.CallExpression) {
|
|
21642
21655
|
const callee = unwrapExpression(current.callee);
|
|
21643
21656
|
const calleeReceiver = callee.type === AST_NODE_TYPES100.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
21644
|
-
if (callee.type !== AST_NODE_TYPES100.MemberExpression ||
|
|
21657
|
+
if (callee.type !== AST_NODE_TYPES100.MemberExpression || ASTUtils63.getPropertyName(callee) === null) {
|
|
21645
21658
|
break;
|
|
21646
21659
|
}
|
|
21647
21660
|
const receiver = calleeReceiver;
|
|
21648
21661
|
if (receiver.type === AST_NODE_TYPES100.Identifier && zodNamespaces.has(receiver.name)) {
|
|
21649
|
-
leaf =
|
|
21662
|
+
leaf = ASTUtils63.getPropertyName(callee) ?? "";
|
|
21650
21663
|
leafCall = current;
|
|
21651
21664
|
break;
|
|
21652
21665
|
}
|
|
21653
|
-
modifiers.push(
|
|
21666
|
+
modifiers.push(ASTUtils63.getPropertyName(callee) ?? "");
|
|
21654
21667
|
current = receiver;
|
|
21655
21668
|
}
|
|
21656
21669
|
return {
|
|
@@ -21853,7 +21866,7 @@ var prefer_zod_infer_default = createRule({
|
|
|
21853
21866
|
},
|
|
21854
21867
|
/** Records `XSchema.transform(...)` and equivalent module-level reshaping. */
|
|
21855
21868
|
"MemberExpression"(node) {
|
|
21856
|
-
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) ?? "")) {
|
|
21857
21870
|
reshapedSchemaNames.add(node.object.name);
|
|
21858
21871
|
}
|
|
21859
21872
|
},
|
|
@@ -22010,7 +22023,7 @@ function staticFieldName(key) {
|
|
|
22010
22023
|
}
|
|
22011
22024
|
|
|
22012
22025
|
// src/rules/named-child-schema-type.ts
|
|
22013
|
-
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";
|
|
22014
22027
|
var UNRESOLVED_TYPE_NODES = /* @__PURE__ */ new Set([
|
|
22015
22028
|
AST_NODE_TYPES101.TSTypeQuery,
|
|
22016
22029
|
AST_NODE_TYPES101.TSImportType,
|
|
@@ -22055,7 +22068,7 @@ var named_child_schema_type_default = createRule({
|
|
|
22055
22068
|
const source = context.sourceCode;
|
|
22056
22069
|
if (isGeneratedFile(context.filename, source.text)) return {};
|
|
22057
22070
|
const namespaces = /* @__PURE__ */ new Set();
|
|
22058
|
-
const bindingOf = (node) =>
|
|
22071
|
+
const bindingOf = (node) => ASTUtils64.findVariable(source.getScope(node), node.name);
|
|
22059
22072
|
function namespaceOf(type) {
|
|
22060
22073
|
if (type.typeName.type !== AST_NODE_TYPES101.TSQualifiedName || type.typeName.left.type !== AST_NODE_TYPES101.Identifier) return null;
|
|
22061
22074
|
const binding = bindingOf(type.typeName.left);
|
|
@@ -22099,7 +22112,7 @@ var named_child_schema_type_default = createRule({
|
|
|
22099
22112
|
VariableDeclarator(node) {
|
|
22100
22113
|
if (!isModuleConst(node) || node.id.type !== AST_NODE_TYPES101.Identifier || node.init?.type !== AST_NODE_TYPES101.CallExpression) return;
|
|
22101
22114
|
const call = node.init;
|
|
22102
|
-
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;
|
|
22103
22116
|
const annotation = node.id.typeAnnotation?.typeAnnotation;
|
|
22104
22117
|
if (annotation?.type !== AST_NODE_TYPES101.TSTypeReference || annotation.typeName.type !== AST_NODE_TYPES101.TSQualifiedName || annotation.typeName.right.name !== "ZodRecord") return;
|
|
22105
22118
|
const namespace = namespaceOf(annotation);
|
|
@@ -22115,7 +22128,7 @@ var named_child_schema_type_default = createRule({
|
|
|
22115
22128
|
|
|
22116
22129
|
// src/rules/prefer-zod-parse-output-type.ts
|
|
22117
22130
|
import {
|
|
22118
|
-
ASTUtils as
|
|
22131
|
+
ASTUtils as ASTUtils65,
|
|
22119
22132
|
AST_NODE_TYPES as AST_NODE_TYPES102,
|
|
22120
22133
|
ESLintUtils as ESLintUtils14
|
|
22121
22134
|
} from "@typescript-eslint/utils";
|
|
@@ -22185,11 +22198,11 @@ function isLocalZodObjectSchema(node, namespaces) {
|
|
|
22185
22198
|
while (current.type === AST_NODE_TYPES102.CallExpression) {
|
|
22186
22199
|
const callee = unwrapExpression(current.callee);
|
|
22187
22200
|
const calleeReceiver = callee.type === AST_NODE_TYPES102.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
22188
|
-
if (callee.type !== AST_NODE_TYPES102.MemberExpression ||
|
|
22201
|
+
if (callee.type !== AST_NODE_TYPES102.MemberExpression || ASTUtils65.getPropertyName(callee) === null) {
|
|
22189
22202
|
return false;
|
|
22190
22203
|
}
|
|
22191
22204
|
if (calleeReceiver.type === AST_NODE_TYPES102.Identifier) {
|
|
22192
|
-
return namespaces.has(calleeReceiver.name) && ((
|
|
22205
|
+
return namespaces.has(calleeReceiver.name) && ((ASTUtils65.getPropertyName(callee) ?? "") === "object" || (ASTUtils65.getPropertyName(callee) ?? "") === "strictObject");
|
|
22193
22206
|
}
|
|
22194
22207
|
current = calleeReceiver;
|
|
22195
22208
|
}
|
|
@@ -22198,10 +22211,10 @@ function isLocalZodObjectSchema(node, namespaces) {
|
|
|
22198
22211
|
function zodParseCall(node) {
|
|
22199
22212
|
const callee = unwrapExpression(node.callee);
|
|
22200
22213
|
const calleeReceiver = callee.type === AST_NODE_TYPES102.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
22201
|
-
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) {
|
|
22202
22215
|
return null;
|
|
22203
22216
|
}
|
|
22204
|
-
const method =
|
|
22217
|
+
const method = ASTUtils65.getPropertyName(callee);
|
|
22205
22218
|
if (method !== "parse" && method !== "safeParse") return null;
|
|
22206
22219
|
return {
|
|
22207
22220
|
call: node,
|
|
@@ -22243,7 +22256,7 @@ function localParseReturnCandidates(node, sourceCode) {
|
|
|
22243
22256
|
for (const reference of variable.references) {
|
|
22244
22257
|
const identifier = reference.identifier;
|
|
22245
22258
|
const parent = identifier.parent;
|
|
22246
|
-
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;
|
|
22247
22260
|
if (output === null) continue;
|
|
22248
22261
|
const candidate2 = returnedOutputCandidate(parsed, output);
|
|
22249
22262
|
if (candidate2 !== null) candidates.push(candidate2);
|
|
@@ -22628,7 +22641,7 @@ var require_assert_never_default = createRule({
|
|
|
22628
22641
|
// src/rules/require-fetch-timeout.ts
|
|
22629
22642
|
import {
|
|
22630
22643
|
AST_NODE_TYPES as AST_NODE_TYPES104,
|
|
22631
|
-
ASTUtils as
|
|
22644
|
+
ASTUtils as ASTUtils66
|
|
22632
22645
|
} from "@typescript-eslint/utils";
|
|
22633
22646
|
var REQUIRE_FETCH_TIMEOUT_DOCUMENTATION = {
|
|
22634
22647
|
summary: "Require an explicit abort signal on locally analyzable global fetch calls.",
|
|
@@ -22697,7 +22710,7 @@ function initSignalState(init, resolvesToGlobal) {
|
|
|
22697
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";
|
|
22698
22711
|
if (isSignal) {
|
|
22699
22712
|
state = !prop.method ? emptySignal(prop.value, resolvesToGlobal) ?? "unknown" : "unknown";
|
|
22700
|
-
} else if (!prop.computed &&
|
|
22713
|
+
} else if (!prop.computed && ASTUtils66.getPropertyName(prop) === "__proto__" && state === "absent") {
|
|
22701
22714
|
state = "unknown";
|
|
22702
22715
|
} else if (prop.computed && prop.key.type !== AST_NODE_TYPES104.Literal) {
|
|
22703
22716
|
state = "unknown";
|
|
@@ -22706,14 +22719,14 @@ function initSignalState(init, resolvesToGlobal) {
|
|
|
22706
22719
|
return state;
|
|
22707
22720
|
}
|
|
22708
22721
|
function hasUnprovedPrototype(property) {
|
|
22709
|
-
if (property.computed || property.method || property.shorthand ||
|
|
22722
|
+
if (property.computed || property.method || property.shorthand || ASTUtils66.getPropertyName(property) !== "__proto__")
|
|
22710
22723
|
return false;
|
|
22711
22724
|
const prototype = unwrapExpression(property.value);
|
|
22712
22725
|
if (prototype.type === AST_NODE_TYPES104.Literal && prototype.value === null)
|
|
22713
22726
|
return false;
|
|
22714
22727
|
if (prototype.type !== AST_NODE_TYPES104.ObjectExpression) return true;
|
|
22715
22728
|
return prototype.properties.some(
|
|
22716
|
-
(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
|
|
22717
22730
|
);
|
|
22718
22731
|
}
|
|
22719
22732
|
function isInlineUrl(node, resolvesToGlobal) {
|
|
@@ -22756,11 +22769,11 @@ var require_fetch_timeout_default = createRule({
|
|
|
22756
22769
|
}
|
|
22757
22770
|
function resolvesToGlobal(identifier) {
|
|
22758
22771
|
const scope = context.sourceCode.getScope(identifier);
|
|
22759
|
-
const variable =
|
|
22772
|
+
const variable = ASTUtils66.findVariable(scope, identifier.name);
|
|
22760
22773
|
return variable === null || variable.defs.length === 0;
|
|
22761
22774
|
}
|
|
22762
22775
|
function localConstInitSignalState(identifier) {
|
|
22763
|
-
const variable =
|
|
22776
|
+
const variable = ASTUtils66.findVariable(
|
|
22764
22777
|
context.sourceCode.getScope(identifier),
|
|
22765
22778
|
identifier.name
|
|
22766
22779
|
);
|
|
@@ -22782,7 +22795,7 @@ var require_fetch_timeout_default = createRule({
|
|
|
22782
22795
|
function isForwardedRequest(argument) {
|
|
22783
22796
|
let value = unwrapExpression(argument);
|
|
22784
22797
|
if (value.type === AST_NODE_TYPES104.Identifier) {
|
|
22785
|
-
const binding =
|
|
22798
|
+
const binding = ASTUtils66.findVariable(
|
|
22786
22799
|
context.sourceCode.getScope(value),
|
|
22787
22800
|
value.name
|
|
22788
22801
|
);
|
|
@@ -22967,7 +22980,7 @@ function exportedClasses(program, classes) {
|
|
|
22967
22980
|
}
|
|
22968
22981
|
|
|
22969
22982
|
// src/rules/require-sql-access-class.ts
|
|
22970
|
-
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";
|
|
22971
22984
|
var DIRECT_EXECUTION_METHODS = /* @__PURE__ */ new Set([
|
|
22972
22985
|
"all",
|
|
22973
22986
|
"batch",
|
|
@@ -23074,7 +23087,7 @@ function databaseReceiver(node) {
|
|
|
23074
23087
|
if (node.type === AST_NODE_TYPES106.Identifier)
|
|
23075
23088
|
return DATABASE_NAMES.test(node.name);
|
|
23076
23089
|
if (node.type !== AST_NODE_TYPES106.MemberExpression) return false;
|
|
23077
|
-
const name =
|
|
23090
|
+
const name = ASTUtils67.getPropertyName(node);
|
|
23078
23091
|
return name === "DB" || name !== null && DATABASE_NAMES.test(name);
|
|
23079
23092
|
}
|
|
23080
23093
|
function databaseRootMember(node) {
|
|
@@ -23092,7 +23105,7 @@ function databaseRootMember(node) {
|
|
|
23092
23105
|
}
|
|
23093
23106
|
if (current.type === AST_NODE_TYPES106.MemberExpression) {
|
|
23094
23107
|
if (current.object.type === AST_NODE_TYPES106.ThisExpression)
|
|
23095
|
-
return
|
|
23108
|
+
return ASTUtils67.getPropertyName(current);
|
|
23096
23109
|
current = current.object;
|
|
23097
23110
|
continue;
|
|
23098
23111
|
}
|
|
@@ -23113,7 +23126,7 @@ function expressionHasDatabaseMarker(node) {
|
|
|
23113
23126
|
continue;
|
|
23114
23127
|
}
|
|
23115
23128
|
if (current.type === AST_NODE_TYPES106.MemberExpression) {
|
|
23116
|
-
const name =
|
|
23129
|
+
const name = ASTUtils67.getPropertyName(current);
|
|
23117
23130
|
if (name === "DB" || name !== null && DATABASE_NAMES.test(name))
|
|
23118
23131
|
return true;
|
|
23119
23132
|
current = current.object;
|
|
@@ -23132,7 +23145,7 @@ function expressionCallsBuilder(node) {
|
|
|
23132
23145
|
}
|
|
23133
23146
|
if (current.type === AST_NODE_TYPES106.CallExpression) {
|
|
23134
23147
|
if (current.callee.type !== AST_NODE_TYPES106.MemberExpression) return false;
|
|
23135
|
-
const name =
|
|
23148
|
+
const name = ASTUtils67.getPropertyName(current.callee);
|
|
23136
23149
|
if (name !== null && BUILDER_METHODS.has(name)) return true;
|
|
23137
23150
|
current = current.callee.object;
|
|
23138
23151
|
continue;
|
|
@@ -23183,7 +23196,7 @@ function thisRootMember(node) {
|
|
|
23183
23196
|
let current = node;
|
|
23184
23197
|
let root = null;
|
|
23185
23198
|
while (current.type === AST_NODE_TYPES106.MemberExpression) {
|
|
23186
|
-
const name =
|
|
23199
|
+
const name = ASTUtils67.getPropertyName(current);
|
|
23187
23200
|
if (name === null) return null;
|
|
23188
23201
|
root = name;
|
|
23189
23202
|
current = current.object;
|
|
@@ -23227,19 +23240,19 @@ var require_sql_access_class_default = createRule({
|
|
|
23227
23240
|
if (seen.has(node)) return false;
|
|
23228
23241
|
seen.add(node);
|
|
23229
23242
|
if (node.type === AST_NODE_TYPES106.Identifier) {
|
|
23230
|
-
const binding =
|
|
23243
|
+
const binding = ASTUtils67.findVariable(context.sourceCode.getScope(node), node.name);
|
|
23231
23244
|
if (binding?.defs.length !== 1 || binding.references.some((reference) => reference.isWrite() && reference.init !== true)) return false;
|
|
23232
23245
|
const definition = binding.defs[0];
|
|
23233
23246
|
return definition?.type === "Variable" && definition.node.init !== null && knownNonDatabase(definition.node.init, seen);
|
|
23234
23247
|
}
|
|
23235
|
-
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;
|
|
23236
23249
|
}
|
|
23237
23250
|
return {
|
|
23238
23251
|
CallExpression(node) {
|
|
23239
23252
|
const unwrappedNodeCallee = unwrapExpression(node.callee);
|
|
23240
23253
|
if (unwrappedNodeCallee.type !== AST_NODE_TYPES106.MemberExpression)
|
|
23241
23254
|
return;
|
|
23242
|
-
const method =
|
|
23255
|
+
const method = ASTUtils67.getPropertyName(unwrappedNodeCallee);
|
|
23243
23256
|
if (knownNonDatabase(unwrappedNodeCallee.object)) return;
|
|
23244
23257
|
if (method === null || !isDatabaseOperation(method, unwrappedNodeCallee.object))
|
|
23245
23258
|
return;
|
|
@@ -23339,7 +23352,7 @@ var require_static_next_matcher_default = createRule({
|
|
|
23339
23352
|
});
|
|
23340
23353
|
|
|
23341
23354
|
// src/rules/require-use-form-default-values.ts
|
|
23342
|
-
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";
|
|
23343
23356
|
var REQUIRE_USE_FORM_DEFAULT_VALUES_DOCUMENTATION = {
|
|
23344
23357
|
summary: "Require explicit form-level initialization or a field default for directly bound Controller fields.",
|
|
23345
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.",
|
|
@@ -23390,7 +23403,7 @@ var require_use_form_default_values_default = createRule({
|
|
|
23390
23403
|
const imported = /* @__PURE__ */ new Map();
|
|
23391
23404
|
const uninitializedForms = /* @__PURE__ */ new Set();
|
|
23392
23405
|
const uninitializedControls = /* @__PURE__ */ new Set();
|
|
23393
|
-
const bindingNamed = (node, name) =>
|
|
23406
|
+
const bindingNamed = (node, name) => ASTUtils68.findVariable(context.sourceCode.getScope(node), name);
|
|
23394
23407
|
const bindingOf = (node) => bindingNamed(node, node.name);
|
|
23395
23408
|
const stable = (variable) => !variable.references.some((reference) => reference.isWrite() && reference.init !== true);
|
|
23396
23409
|
const importedKind = (node) => {
|
|
@@ -23436,7 +23449,7 @@ var require_use_form_default_values_default = createRule({
|
|
|
23436
23449
|
const variable = bindingOf(node);
|
|
23437
23450
|
return variable !== null && stable(variable) && uninitializedControls.has(variable);
|
|
23438
23451
|
}
|
|
23439
|
-
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);
|
|
23440
23453
|
};
|
|
23441
23454
|
const fieldOptionsNeedDefault = (node) => {
|
|
23442
23455
|
if (node?.type !== AST_NODE_TYPES108.ObjectExpression) return false;
|
|
@@ -23492,7 +23505,7 @@ var require_use_form_default_values_default = createRule({
|
|
|
23492
23505
|
trackDestructuredControl(node.id);
|
|
23493
23506
|
return;
|
|
23494
23507
|
}
|
|
23495
|
-
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)) {
|
|
23496
23509
|
const variable = bindingOf(node.id);
|
|
23497
23510
|
if (variable !== null) uninitializedControls.add(variable);
|
|
23498
23511
|
}
|
|
@@ -23585,7 +23598,7 @@ var require_use_server_in_actions_file_default = createRule({
|
|
|
23585
23598
|
// src/rules/require-zod-form-validation.ts
|
|
23586
23599
|
import {
|
|
23587
23600
|
AST_NODE_TYPES as AST_NODE_TYPES109,
|
|
23588
|
-
ASTUtils as
|
|
23601
|
+
ASTUtils as ASTUtils69
|
|
23589
23602
|
} from "@typescript-eslint/utils";
|
|
23590
23603
|
var REQUIRE_ZOD_FORM_VALIDATION_DOCUMENTATION = {
|
|
23591
23604
|
summary: "Require Zod validation (`Schema.parse(...)` / `Schema.safeParse(...)`) when reading values out of a `FormData` object.",
|
|
@@ -23633,7 +23646,7 @@ var isFormDataMethodCall = (node) => {
|
|
|
23633
23646
|
}
|
|
23634
23647
|
if (current.type !== AST_NODE_TYPES109.CallExpression) return false;
|
|
23635
23648
|
const callee = unwrapExpression(current.callee);
|
|
23636
|
-
return callee.type === AST_NODE_TYPES109.MemberExpression &&
|
|
23649
|
+
return callee.type === AST_NODE_TYPES109.MemberExpression && ASTUtils69.getPropertyName(callee) === "formData";
|
|
23637
23650
|
};
|
|
23638
23651
|
var require_zod_form_validation_default = createRule({
|
|
23639
23652
|
name: "require-zod-form-validation",
|
|
@@ -23654,7 +23667,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
23654
23667
|
return {};
|
|
23655
23668
|
}
|
|
23656
23669
|
const zodBindings = /* @__PURE__ */ new Set();
|
|
23657
|
-
const resolvedBinding = (identifier) =>
|
|
23670
|
+
const resolvedBinding = (identifier) => ASTUtils69.findVariable(
|
|
23658
23671
|
context.sourceCode.getScope(identifier),
|
|
23659
23672
|
identifier.name
|
|
23660
23673
|
);
|
|
@@ -23662,7 +23675,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
23662
23675
|
const callee = unwrapExpression(node.callee);
|
|
23663
23676
|
const calleeReceiver = callee.type === AST_NODE_TYPES109.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
23664
23677
|
if (callee.type !== AST_NODE_TYPES109.MemberExpression) return false;
|
|
23665
|
-
if (
|
|
23678
|
+
if (ASTUtils69.getPropertyName(callee) === null || !FORM_VALUE_METHODS.has(ASTUtils69.getPropertyName(callee) ?? "")) {
|
|
23666
23679
|
return false;
|
|
23667
23680
|
}
|
|
23668
23681
|
return isFormSourceIdentifier(calleeReceiver);
|
|
@@ -23693,7 +23706,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
23693
23706
|
parent = parent.parent;
|
|
23694
23707
|
continue;
|
|
23695
23708
|
}
|
|
23696
|
-
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) {
|
|
23697
23710
|
parent = parent.parent;
|
|
23698
23711
|
continue;
|
|
23699
23712
|
}
|
|
@@ -23706,7 +23719,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
23706
23719
|
if (node.type !== AST_NODE_TYPES109.CallExpression) return false;
|
|
23707
23720
|
const callee = unwrapExpression(node.callee);
|
|
23708
23721
|
const calleeReceiver = callee.type === AST_NODE_TYPES109.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
23709
|
-
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) ?? "")) {
|
|
23710
23723
|
return false;
|
|
23711
23724
|
}
|
|
23712
23725
|
const root = zodReceiverRoot(calleeReceiver);
|
|
@@ -23792,7 +23805,7 @@ var require_zod_form_validation_default = createRule({
|
|
|
23792
23805
|
};
|
|
23793
23806
|
const zodParseMethod = (call) => {
|
|
23794
23807
|
const callee = unwrapExpression(call.callee);
|
|
23795
|
-
return callee.type === AST_NODE_TYPES109.MemberExpression &&
|
|
23808
|
+
return callee.type === AST_NODE_TYPES109.MemberExpression && ASTUtils69.getPropertyName(callee) !== null ? ASTUtils69.getPropertyName(callee) ?? "" : null;
|
|
23796
23809
|
};
|
|
23797
23810
|
const isSafePrevalidationInspection = (identifier) => {
|
|
23798
23811
|
const parent = identifier.parent;
|
|
@@ -23968,7 +23981,7 @@ function expressionCallableName(current) {
|
|
|
23968
23981
|
}
|
|
23969
23982
|
|
|
23970
23983
|
// src/rules/stepdown.ts
|
|
23971
|
-
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";
|
|
23972
23985
|
var STEPDOWN_DOCUMENTATION = {
|
|
23973
23986
|
summary: "Place a private helper below its sole direct same-scope caller.",
|
|
23974
23987
|
rationale: "Caller-first ordering lets a reader follow the main flow before descending into implementation details.",
|
|
@@ -24268,7 +24281,7 @@ function receiverOrigin(context, object, receivers) {
|
|
|
24268
24281
|
while (true) {
|
|
24269
24282
|
const unwrapped = unwrapExpression4(current);
|
|
24270
24283
|
if (unwrapped.type !== AST_NODE_TYPES110.Identifier) return unwrapped;
|
|
24271
|
-
const variable =
|
|
24284
|
+
const variable = ASTUtils70.findVariable(context.sourceCode.getScope(unwrapped), unwrapped.name);
|
|
24272
24285
|
if (variable === null) return null;
|
|
24273
24286
|
const known = receivers.get(variable);
|
|
24274
24287
|
if (known !== void 0) return known;
|
|
@@ -24449,11 +24462,11 @@ function classScope(context, node, computedReferences) {
|
|
|
24449
24462
|
function classReceiverBindings(context, node) {
|
|
24450
24463
|
const classReceivers = /* @__PURE__ */ new Map();
|
|
24451
24464
|
if (node.id !== null) {
|
|
24452
|
-
const internal =
|
|
24465
|
+
const internal = ASTUtils70.findVariable(context.sourceCode.getScope(node), node.id.name);
|
|
24453
24466
|
if (internal !== null && stableVariable(internal)) classReceivers.set(internal, true);
|
|
24454
24467
|
}
|
|
24455
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") {
|
|
24456
|
-
const outer =
|
|
24469
|
+
const outer = ASTUtils70.findVariable(context.sourceCode.getScope(node.parent), node.parent.id.name);
|
|
24457
24470
|
if (outer !== null && stableVariable(outer)) classReceivers.set(outer, true);
|
|
24458
24471
|
}
|
|
24459
24472
|
return classReceivers;
|
|
@@ -24539,7 +24552,7 @@ function classMethodCounts(body2, methods) {
|
|
|
24539
24552
|
}
|
|
24540
24553
|
|
|
24541
24554
|
// src/rules/source-coupled-test.ts
|
|
24542
|
-
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";
|
|
24543
24556
|
var GENERAL_SOURCE_SUFFIX_RE = /\.(?:bash|sh|ya?ml|jsonc?|toml|py|[cm]?[jt]s)$/iu;
|
|
24544
24557
|
var FS_MODULES = /* @__PURE__ */ new Set(["fs", "node:fs", "fs/promises", "node:fs/promises"]);
|
|
24545
24558
|
var FS_READERS = /* @__PURE__ */ new Set(["readFile", "readFileSync"]);
|
|
@@ -24656,7 +24669,7 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
24656
24669
|
const scopes = [newScope()];
|
|
24657
24670
|
const reportedOrigins = /* @__PURE__ */ new Set();
|
|
24658
24671
|
const currentScope = () => scopes.at(-1) ?? scopes[0];
|
|
24659
|
-
const bindingOf = (node) =>
|
|
24672
|
+
const bindingOf = (node) => ASTUtils71.findVariable(context.sourceCode.getScope(node), node.name);
|
|
24660
24673
|
const assertionKind = (node) => {
|
|
24661
24674
|
const binding = bindingOf(node);
|
|
24662
24675
|
if (binding === null || binding.defs.length === 0) {
|
|
@@ -24709,7 +24722,7 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
24709
24722
|
return visible("fsReaders", callee) && sourcePath(current.arguments[0]);
|
|
24710
24723
|
}
|
|
24711
24724
|
if (callee.type !== AST_NODE_TYPES111.MemberExpression) return false;
|
|
24712
|
-
const name2 =
|
|
24725
|
+
const name2 = ASTUtils71.getPropertyName(callee);
|
|
24713
24726
|
const object = unwrap6(calleeReceiver);
|
|
24714
24727
|
return name2 !== null && FS_READERS.has(name2) && object.type === AST_NODE_TYPES111.Identifier && visible("fsObjects", object) && sourcePath(current.arguments[0]);
|
|
24715
24728
|
};
|
|
@@ -24718,12 +24731,12 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
24718
24731
|
if (current.type === AST_NODE_TYPES111.Identifier) return visibleRawOrigins(current);
|
|
24719
24732
|
if (rawRead(current)) return /* @__PURE__ */ new Set([`${current.range[0]}:${current.range[1]}`]);
|
|
24720
24733
|
if (current.type === AST_NODE_TYPES111.BinaryExpression && current.operator === "+") return /* @__PURE__ */ new Set([...rawOrigins(current.left), ...rawOrigins(current.right)]);
|
|
24721
|
-
if (current.type === AST_NODE_TYPES111.MemberExpression &&
|
|
24734
|
+
if (current.type === AST_NODE_TYPES111.MemberExpression && ASTUtils71.getPropertyName(current) === "length") return rawOrigins(current.object);
|
|
24722
24735
|
if (current.type !== AST_NODE_TYPES111.CallExpression) return /* @__PURE__ */ new Set();
|
|
24723
24736
|
const callee = unwrap6(current.callee);
|
|
24724
24737
|
const calleeReceiver = callee.type === AST_NODE_TYPES111.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
24725
24738
|
if (callee.type !== AST_NODE_TYPES111.MemberExpression) return /* @__PURE__ */ new Set();
|
|
24726
|
-
const name2 =
|
|
24739
|
+
const name2 = ASTUtils71.getPropertyName(callee);
|
|
24727
24740
|
return name2 !== null && TEXT_TRANSFORMS.has(name2) ? rawOrigins(calleeReceiver) : /* @__PURE__ */ new Set();
|
|
24728
24741
|
};
|
|
24729
24742
|
const evidenceOrigins = (node) => {
|
|
@@ -24736,7 +24749,7 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
24736
24749
|
const callee = unwrap6(current.callee);
|
|
24737
24750
|
const calleeReceiver = callee.type === AST_NODE_TYPES111.MemberExpression ? unwrapExpression(callee.object) : callee;
|
|
24738
24751
|
if (callee.type !== AST_NODE_TYPES111.MemberExpression) return /* @__PURE__ */ new Set();
|
|
24739
|
-
const name2 =
|
|
24752
|
+
const name2 = ASTUtils71.getPropertyName(callee);
|
|
24740
24753
|
if (name2 !== null && TEXT_PREDICATES.has(name2)) return rawOrigins(calleeReceiver);
|
|
24741
24754
|
if (name2 !== null && REGEXP_PREDICATES.has(name2)) return new Set(current.arguments.flatMap((argument) => argument.type === AST_NODE_TYPES111.SpreadElement ? [] : [...rawOrigins(argument)]));
|
|
24742
24755
|
return /* @__PURE__ */ new Set();
|
|
@@ -24748,10 +24761,10 @@ function createSourceCoupledRule(name, documentation, sourceSuffixRe) {
|
|
|
24748
24761
|
return new Set(node.arguments.flatMap((argument) => argument.type === AST_NODE_TYPES111.SpreadElement ? [] : [...evidenceOrigins(argument)]));
|
|
24749
24762
|
}
|
|
24750
24763
|
if (callee.type !== AST_NODE_TYPES111.MemberExpression) return /* @__PURE__ */ new Set();
|
|
24751
|
-
const matcher =
|
|
24764
|
+
const matcher = ASTUtils71.getPropertyName(callee);
|
|
24752
24765
|
if (matcher === null) return /* @__PURE__ */ new Set();
|
|
24753
24766
|
let receiver = unwrap6(calleeReceiver);
|
|
24754
|
-
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);
|
|
24755
24768
|
const expectCallee = receiver.type === AST_NODE_TYPES111.CallExpression ? unwrapExpression(receiver.callee) : null;
|
|
24756
24769
|
if (receiver.type === AST_NODE_TYPES111.CallExpression && expectCallee?.type === AST_NODE_TYPES111.Identifier && assertionKind(expectCallee) === "expect") {
|
|
24757
24770
|
if (!EXPECT_MATCHERS.has(matcher)) return /* @__PURE__ */ new Set();
|
|
@@ -25034,7 +25047,7 @@ var iac_source_coupled_test_default = createSourceCoupledRule(
|
|
|
25034
25047
|
// src/rules/require-pascal-case-zod-schema-name.ts
|
|
25035
25048
|
import {
|
|
25036
25049
|
AST_NODE_TYPES as AST_NODE_TYPES113,
|
|
25037
|
-
ASTUtils as
|
|
25050
|
+
ASTUtils as ASTUtils72
|
|
25038
25051
|
} from "@typescript-eslint/utils";
|
|
25039
25052
|
var REQUIRE_PASCAL_CASE_ZOD_SCHEMA_NAME_DOCUMENTATION = {
|
|
25040
25053
|
summary: "Require confirmed module-level Zod schema contracts to use PascalCase with a `Schema` suffix.",
|
|
@@ -25167,7 +25180,7 @@ var SCHEMA_RETURNING_METHODS = /* @__PURE__ */ new Set([
|
|
|
25167
25180
|
"superRefine",
|
|
25168
25181
|
"transform"
|
|
25169
25182
|
]);
|
|
25170
|
-
var terminalMethodName = (callee) =>
|
|
25183
|
+
var terminalMethodName = (callee) => ASTUtils72.getPropertyName(callee) !== null ? ASTUtils72.getPropertyName(callee) ?? "" : null;
|
|
25171
25184
|
var calleeChainRoot2 = (node) => {
|
|
25172
25185
|
let current = node;
|
|
25173
25186
|
for (; ; ) {
|
|
@@ -25192,8 +25205,8 @@ var chainMemberNames2 = (node) => {
|
|
|
25192
25205
|
for (; ; ) {
|
|
25193
25206
|
current = unwrapExpression(current);
|
|
25194
25207
|
if (current.type === AST_NODE_TYPES113.MemberExpression) {
|
|
25195
|
-
if (
|
|
25196
|
-
names.push(
|
|
25208
|
+
if (ASTUtils72.getPropertyName(current) === null) return [];
|
|
25209
|
+
names.push(ASTUtils72.getPropertyName(current) ?? "");
|
|
25197
25210
|
current = current.object;
|
|
25198
25211
|
continue;
|
|
25199
25212
|
}
|
|
@@ -25230,7 +25243,7 @@ var require_pascal_case_zod_schema_name_default = createRule({
|
|
|
25230
25243
|
const zodBindings = /* @__PURE__ */ new Set();
|
|
25231
25244
|
const schemaBindings = /* @__PURE__ */ new Set();
|
|
25232
25245
|
function resolvedBinding(identifier) {
|
|
25233
|
-
return
|
|
25246
|
+
return ASTUtils72.findVariable(
|
|
25234
25247
|
context.sourceCode.getScope(identifier),
|
|
25235
25248
|
identifier.name
|
|
25236
25249
|
);
|