@sarj/eslint-plugin 18.0.3 → 18.0.5

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.
Files changed (3) hide show
  1. package/dist/index.cjs +988 -913
  2. package/dist/index.js +978 -903
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -859,11 +859,11 @@ function sameShape(checker, input, output, location) {
859
859
  }
860
860
 
861
861
  // src/rules/prefer-server-data-preparation.ts
862
- var import_utils9 = require("@typescript-eslint/utils");
863
- var import_typescript3 = __toESM(require("typescript"), 1);
862
+ var import_utils10 = require("@typescript-eslint/utils");
863
+ var import_typescript7 = __toESM(require("typescript"), 1);
864
864
 
865
865
  // src/rules/_react-prop-bindings.ts
866
- var import_utils8 = require("@typescript-eslint/utils");
866
+ var import_utils9 = require("@typescript-eslint/utils");
867
867
 
868
868
  // src/rules/_import-specifier-name.ts
869
869
  var import_utils6 = require("@typescript-eslint/utils");
@@ -871,6 +871,206 @@ function importSpecifierName(node) {
871
871
  return node.imported.type === import_utils6.AST_NODE_TYPES.Identifier ? node.imported.name : node.imported.value;
872
872
  }
873
873
 
874
+ // src/rules/_private-scalar-consumer.ts
875
+ var import_utils8 = require("@typescript-eslint/utils");
876
+ var import_typescript6 = __toESM(require("typescript"), 1);
877
+
878
+ // src/rules/_scalar-parameter-view.ts
879
+ var import_typescript5 = __toESM(require("typescript"), 1);
880
+
881
+ // src/rules/_checked-native-source.ts
882
+ var import_typescript3 = __toESM(require("typescript"), 1);
883
+ var CHECKED = /* @__PURE__ */ new WeakMap();
884
+ var SINGLE_LINE_DIRECTIVE = /^\/\/\/?\s*@(?:ts-expect-error|ts-ignore)/u;
885
+ var MULTI_LINE_DIRECTIVE = /^[/*]*\s*@(?:ts-expect-error|ts-ignore)/u;
886
+ var SINGLE_LINE_PRAGMA = /^\/\/\/?\s*@([^\s:]+)(?:(?:[^\S\r\n]|:).*)?$/mu;
887
+ function currentNativeSource(sourceCode, services) {
888
+ const source = services.esTreeNodeToTSNodeMap.get(sourceCode.ast);
889
+ return import_typescript3.default.isSourceFile(source) && services.program.getSourceFile(source.fileName) === source && source.text === sourceCode.text ? source : null;
890
+ }
891
+ function checkedNativeSource(program, source) {
892
+ let files = CHECKED.get(program);
893
+ if (!files) {
894
+ files = /* @__PURE__ */ new WeakMap();
895
+ CHECKED.set(program, files);
896
+ }
897
+ const known2 = files.get(source);
898
+ if (known2 !== void 0) return known2;
899
+ const available = !program.getCompilerOptions().noCheck && !source.isDeclarationFile && (source.flags & (import_typescript3.default.NodeFlags.JavaScriptFile | import_typescript3.default.NodeFlags.JsonFile)) === 0 && !program.getProjectReferences()?.length && !program.getResolvedProjectReferences()?.length && program.getSourceFile(source.fileName) === source && !program.isSourceFileFromExternalLibrary(source) && !program.isSourceFileDefaultLibrary(source) && !program.getSyntacticDiagnostics(source).some((diagnostic) => diagnostic.category === import_typescript3.default.DiagnosticCategory.Error && diagnostic.file === source) && !checkingSuppressed(source) && !program.getSemanticDiagnostics(source).some((diagnostic) => diagnostic.category === import_typescript3.default.DiagnosticCategory.Error && diagnostic.file === source);
900
+ files.set(source, available);
901
+ return available;
902
+ }
903
+ function checkingSuppressed(source) {
904
+ if (!/@ts-/iu.test(source.text)) return false;
905
+ if (import_typescript3.default.getLeadingCommentRanges(source.text, 0)?.some((comment) => comment.kind === import_typescript3.default.SyntaxKind.SingleLineCommentTrivia && SINGLE_LINE_PRAGMA.exec(source.text.slice(comment.pos, comment.end))?.[1]?.toLowerCase() === "ts-nocheck")) return true;
906
+ const pending = [source];
907
+ while (pending.length) {
908
+ const node = pending.pop();
909
+ if (!node || import_typescript3.default.isJsxText(node) || import_typescript3.default.isJSDoc(node) || (node.flags & import_typescript3.default.NodeFlags.JSDoc) !== 0) continue;
910
+ if (!import_typescript3.default.isToken(node)) {
911
+ for (const child of node.getChildren(source)) pending.push(child);
912
+ continue;
913
+ }
914
+ if (tokenTriviaSuppressesChecking(node, source)) return true;
915
+ }
916
+ return false;
917
+ }
918
+ function tokenTriviaSuppressesChecking(node, source) {
919
+ const start = node.getStart(source);
920
+ for (const comment of [...import_typescript3.default.getLeadingCommentRanges(source.text, node.pos) ?? [], ...import_typescript3.default.getTrailingCommentRanges(source.text, node.pos) ?? []]) {
921
+ if (comment.pos < node.pos || comment.end > start) continue;
922
+ if (commentSuppressesChecking(source.text.slice(comment.pos, comment.end), comment.kind)) return true;
923
+ }
924
+ return false;
925
+ }
926
+ function commentSuppressesChecking(text, kind) {
927
+ if (kind === import_typescript3.default.SyntaxKind.SingleLineCommentTrivia) return SINGLE_LINE_DIRECTIVE.test(text);
928
+ let lastLine = text.length;
929
+ while (lastLine > 0 && !import_typescript3.default.isLineBreak(text.charCodeAt(lastLine - 1))) lastLine--;
930
+ return MULTI_LINE_DIRECTIVE.test(text.slice(lastLine).trimStart());
931
+ }
932
+
933
+ // src/rules/_native-const-value.ts
934
+ var import_typescript4 = __toESM(require("typescript"), 1);
935
+ function constInitializer(declaration) {
936
+ if (!declaration || !import_typescript4.default.isVariableDeclaration(declaration) || !import_typescript4.default.isVariableDeclarationList(declaration.parent) || (declaration.parent.flags & import_typescript4.default.NodeFlags.BlockScoped) !== import_typescript4.default.NodeFlags.Const) return void 0;
937
+ let initializer = declaration.initializer;
938
+ while (initializer && import_typescript4.default.isParenthesizedExpression(initializer)) initializer = initializer.expression;
939
+ return initializer;
940
+ }
941
+ function unassertedValue(node) {
942
+ let value = node;
943
+ while (import_typescript4.default.isParenthesizedExpression(value) || import_typescript4.default.isAsExpression(value) || import_typescript4.default.isTypeAssertionExpression(value) || import_typescript4.default.isNonNullExpression(value) || import_typescript4.default.isSatisfiesExpression(value)) value = value.expression;
944
+ return value;
945
+ }
946
+
947
+ // src/rules/_scalar-parameter-view.ts
948
+ var SCALAR_OPERATORS = /* @__PURE__ */ new Set([
949
+ import_typescript5.default.SyntaxKind.PlusToken,
950
+ import_typescript5.default.SyntaxKind.MinusToken,
951
+ import_typescript5.default.SyntaxKind.AsteriskToken,
952
+ import_typescript5.default.SyntaxKind.SlashToken,
953
+ import_typescript5.default.SyntaxKind.PercentToken,
954
+ import_typescript5.default.SyntaxKind.AsteriskAsteriskToken,
955
+ import_typescript5.default.SyntaxKind.LessThanToken,
956
+ import_typescript5.default.SyntaxKind.LessThanEqualsToken,
957
+ import_typescript5.default.SyntaxKind.GreaterThanToken,
958
+ import_typescript5.default.SyntaxKind.GreaterThanEqualsToken,
959
+ import_typescript5.default.SyntaxKind.EqualsEqualsEqualsToken,
960
+ import_typescript5.default.SyntaxKind.ExclamationEqualsEqualsToken,
961
+ import_typescript5.default.SyntaxKind.EqualsEqualsToken,
962
+ import_typescript5.default.SyntaxKind.ExclamationEqualsToken,
963
+ import_typescript5.default.SyntaxKind.AmpersandAmpersandToken,
964
+ import_typescript5.default.SyntaxKind.BarBarToken,
965
+ import_typescript5.default.SyntaxKind.QuestionQuestionToken
966
+ ]);
967
+ var SCALAR_PREFIXES = /* @__PURE__ */ new Set([import_typescript5.default.SyntaxKind.PlusToken, import_typescript5.default.SyntaxKind.MinusToken, import_typescript5.default.SyntaxKind.ExclamationToken, import_typescript5.default.SyntaxKind.TildeToken]);
968
+ var RETURNED_OPERANDS = /* @__PURE__ */ new Set([import_typescript5.default.SyntaxKind.AmpersandAmpersandToken, import_typescript5.default.SyntaxKind.BarBarToken, import_typescript5.default.SyntaxKind.QuestionQuestionToken]);
969
+ function scalarParameterView(parameter, body3, checker) {
970
+ return parameterReads(parameter, body3, checker, true);
971
+ }
972
+ function scalarParameterReads(parameter, body3, checker, callProgram, auxiliaries) {
973
+ return parameterReads(parameter, body3, checker, false, callProgram, auxiliaries);
974
+ }
975
+ function parameterReads(parameter, body3, checker, jsx, callProgram, auxiliaries) {
976
+ if (parameter.dotDotDotToken || parameter.initializer || import_typescript5.default.isArrayBindingPattern(parameter.name)) return null;
977
+ const root = import_typescript5.default.isIdentifier(parameter.name) ? checker.getSymbolAtLocation(parameter.name) : void 0;
978
+ if (import_typescript5.default.isIdentifier(parameter.name) && !root) return null;
979
+ const reads = /* @__PURE__ */ new Set();
980
+ const aliases = parameterAliases(parameter.name, checker, reads);
981
+ if (!aliases) return null;
982
+ const expression = returnedExpression(body3);
983
+ const view = { checker, props: checker.getTypeAtLocation(parameter), root, aliases, reads, callProgram, auxiliaries };
984
+ return expression && scalarView(expression, view, jsx) ? reads : null;
985
+ }
986
+ function scalarType(type, allowUndefined = true) {
987
+ if (type.isUnion()) return type.types.every((part) => scalarType(part, allowUndefined));
988
+ const flags = import_typescript5.default.TypeFlags.StringLike | import_typescript5.default.TypeFlags.NumberLike | import_typescript5.default.TypeFlags.BooleanLike | import_typescript5.default.TypeFlags.BigIntLike | import_typescript5.default.TypeFlags.Null;
989
+ return (type.flags & (allowUndefined ? flags | import_typescript5.default.TypeFlags.Undefined : flags)) !== 0;
990
+ }
991
+ function parameterAliases(name, checker, reads) {
992
+ const aliases = /* @__PURE__ */ new Map();
993
+ if (import_typescript5.default.isIdentifier(name)) return aliases;
994
+ for (const element of name.elements) {
995
+ const key = element.propertyName ?? element.name;
996
+ if (element.dotDotDotToken || element.initializer || !import_typescript5.default.isIdentifier(element.name) || !import_typescript5.default.isIdentifier(key) && !import_typescript5.default.isStringLiteralLike(key) && !import_typescript5.default.isNumericLiteral(key)) return null;
997
+ const binding3 = checker.getSymbolAtLocation(element.name);
998
+ if (!binding3) return null;
999
+ reads.add(key.text);
1000
+ aliases.set(binding3, key.text);
1001
+ }
1002
+ return aliases;
1003
+ }
1004
+ function returnedExpression(body3) {
1005
+ if (!import_typescript5.default.isBlock(body3)) return body3;
1006
+ const statement = body3.statements.length === 1 ? body3.statements[0] : void 0;
1007
+ return statement && import_typescript5.default.isReturnStatement(statement) ? statement.expression : void 0;
1008
+ }
1009
+ function scalarView(node, view, jsx = false) {
1010
+ if (scalarLiteral(node)) return true;
1011
+ if (import_typescript5.default.isCallExpression(node)) return !jsx && scalarCall(node, view);
1012
+ if (import_typescript5.default.isJsxExpression(node)) return !node.dotDotDotToken && (!node.expression || scalarView(node.expression, view, jsx));
1013
+ if (import_typescript5.default.isIdentifier(node)) {
1014
+ const binding3 = view.checker.getSymbolAtLocation(node);
1015
+ if (binding3 && view.auxiliaries?.has(binding3)) return scalarType(view.checker.getTypeAtLocation(node));
1016
+ const key = binding3 && view.aliases.get(binding3);
1017
+ return key !== void 0 && readField(node, key, view);
1018
+ }
1019
+ if (import_typescript5.default.isPropertyAccessExpression(node) || import_typescript5.default.isElementAccessExpression(node)) return memberRead(node, view);
1020
+ return scalarOperation(node, view, jsx);
1021
+ }
1022
+ function scalarOperation(node, view, jsx) {
1023
+ if (import_typescript5.default.isParenthesizedExpression(node) || import_typescript5.default.isNonNullExpression(node)) return scalarView(node.expression, view, jsx);
1024
+ if (import_typescript5.default.isTypeOfExpression(node)) return scalarView(node.expression, view);
1025
+ if (import_typescript5.default.isConditionalExpression(node)) return scalarView(node.condition, view) && scalarView(node.whenTrue, view, jsx) && scalarView(node.whenFalse, view, jsx);
1026
+ if (import_typescript5.default.isBinaryExpression(node)) return binaryView(node, view, jsx);
1027
+ if (import_typescript5.default.isPrefixUnaryExpression(node)) return SCALAR_PREFIXES.has(node.operator) && scalarView(node.operand, view);
1028
+ if (import_typescript5.default.isTemplateExpression(node)) return node.templateSpans.every((span) => scalarView(span.expression, view));
1029
+ return jsx && jsxView(node, view);
1030
+ }
1031
+ function scalarCall(node, view) {
1032
+ if (!view.callProgram || node.questionDotToken || node.typeArguments?.length || !import_typescript5.default.isIdentifier(node.expression) || !node.arguments.length || node.arguments.some(import_typescript5.default.isSpreadElement)) return false;
1033
+ const declarations = view.checker.getSymbolAtLocation(node.expression)?.declarations;
1034
+ const declaration = declarations?.length === 1 ? declarations[0] : void 0;
1035
+ const helper = declaration && localHelper(declaration);
1036
+ if (!helper || helper.getSourceFile() !== node.getSourceFile() || helper.typeParameters?.length || !helper.type || !node.arguments.every((argument) => scalarView(argument, view))) return false;
1037
+ if (!checkedNativeSource(view.callProgram, node.getSourceFile())) return false;
1038
+ const signature = view.checker.getResolvedSignature(node);
1039
+ return signature?.declaration === helper && !view.checker.getTypePredicateOfSignature(signature) && scalarType(view.checker.getTypeAtLocation(node));
1040
+ }
1041
+ function localHelper(node) {
1042
+ if (import_typescript5.default.isFunctionDeclaration(node)) return node.body && import_typescript5.default.isSourceFile(node.parent) ? node : void 0;
1043
+ if (!import_typescript5.default.isVariableDeclaration(node) || node.type || !node.initializer || constInitializer(node) !== node.initializer || !import_typescript5.default.isArrowFunction(node.initializer) || !import_typescript5.default.isVariableStatement(node.parent.parent) || !import_typescript5.default.isSourceFile(node.parent.parent.parent)) return void 0;
1044
+ return node.initializer;
1045
+ }
1046
+ function binaryView(node, view, jsx) {
1047
+ const returned2 = jsx && RETURNED_OPERANDS.has(node.operatorToken.kind);
1048
+ return SCALAR_OPERATORS.has(node.operatorToken.kind) && scalarView(node.left, view, returned2) && scalarView(node.right, view, returned2);
1049
+ }
1050
+ function scalarLiteral(node) {
1051
+ return import_typescript5.default.isStringLiteralLike(node) || import_typescript5.default.isNumericLiteral(node) || import_typescript5.default.isBigIntLiteral(node) || import_typescript5.default.isJsxText(node) || node.kind === import_typescript5.default.SyntaxKind.TrueKeyword || node.kind === import_typescript5.default.SyntaxKind.FalseKeyword || node.kind === import_typescript5.default.SyntaxKind.NullKeyword;
1052
+ }
1053
+ function memberRead(node, view) {
1054
+ if (!view.root || !import_typescript5.default.isIdentifier(node.expression) || view.checker.getSymbolAtLocation(node.expression) !== view.root) return false;
1055
+ const key = import_typescript5.default.isPropertyAccessExpression(node) ? node.name.text : node.argumentExpression && (import_typescript5.default.isStringLiteralLike(node.argumentExpression) || import_typescript5.default.isNumericLiteral(node.argumentExpression)) ? node.argumentExpression.text : void 0;
1056
+ return key !== void 0 && readField(node, key, view);
1057
+ }
1058
+ function readField(node, key, view) {
1059
+ if (!view.checker.getPropertyOfType(view.props, key) || !scalarType(view.checker.getTypeAtLocation(node))) return false;
1060
+ view.reads.add(key);
1061
+ return true;
1062
+ }
1063
+ function jsxView(node, view) {
1064
+ if (import_typescript5.default.isJsxFragment(node)) return node.children.every((child) => scalarView(child, view, true));
1065
+ if (import_typescript5.default.isJsxElement(node)) return jsxView(node.openingElement, view) && node.children.every((child) => scalarView(child, view, true));
1066
+ if (!import_typescript5.default.isJsxOpeningElement(node) && !import_typescript5.default.isJsxSelfClosingElement(node)) return false;
1067
+ if (!import_typescript5.default.isIdentifier(node.tagName) || !/^[a-z][A-Za-z0-9]*$/u.test(node.tagName.text)) return false;
1068
+ return node.attributes.properties.every((attribute) => intrinsicAttribute(attribute, view));
1069
+ }
1070
+ function intrinsicAttribute(attribute, view) {
1071
+ return import_typescript5.default.isJsxAttribute(attribute) && import_typescript5.default.isIdentifier(attribute.name) && attribute.name.text !== "is" && (!attribute.initializer || scalarView(attribute.initializer, view));
1072
+ }
1073
+
874
1074
  // src/rules/_stable-value-binding.ts
875
1075
  var import_utils7 = require("@typescript-eslint/utils");
876
1076
  function typeOnlyReference(reference) {
@@ -891,8 +1091,107 @@ function stableValueBinding(variable, acceptRead) {
891
1091
  });
892
1092
  }
893
1093
 
1094
+ // src/rules/_private-scalar-consumer.ts
1095
+ function directEval(node) {
1096
+ let callee = unwrapExpression(node.callee);
1097
+ while (callee.type === import_utils8.AST_NODE_TYPES.TSInstantiationExpression) callee = unwrapExpression(callee.expression);
1098
+ return callee.type === import_utils8.AST_NODE_TYPES.Identifier && callee.name === "eval";
1099
+ }
1100
+ function primitiveKeyword(node) {
1101
+ return node !== void 0 && (node.kind === import_typescript6.default.SyntaxKind.StringKeyword || node.kind === import_typescript6.default.SyntaxKind.NumberKeyword || node.kind === import_typescript6.default.SyntaxKind.BooleanKeyword || node.kind === import_typescript6.default.SyntaxKind.BigIntKeyword);
1102
+ }
1103
+ function nullishPrimitiveUnion(node) {
1104
+ return node !== void 0 && import_typescript6.default.isUnionTypeNode(node) && node.types.length === 2 && node.types.some(primitiveKeyword) && node.types.some((part) => part.kind === import_typescript6.default.SyntaxKind.UndefinedKeyword || import_typescript6.default.isLiteralTypeNode(part) && part.literal.kind === import_typescript6.default.SyntaxKind.NullKeyword);
1105
+ }
1106
+ function consumerAnnotation(node, auxiliaryScalars = false) {
1107
+ if (node.params.length !== 1) {
1108
+ if (!auxiliaryScalars) return void 0;
1109
+ let annotation;
1110
+ for (const parameter2 of node.params) {
1111
+ if (parameter2.type !== import_utils8.AST_NODE_TYPES.Identifier && parameter2.type !== import_utils8.AST_NODE_TYPES.ObjectPattern) continue;
1112
+ const current = parameter2.typeAnnotation?.typeAnnotation;
1113
+ if (current?.type !== import_utils8.AST_NODE_TYPES.TSTypeLiteral) continue;
1114
+ if (annotation) return void 0;
1115
+ annotation = current;
1116
+ }
1117
+ return annotation;
1118
+ }
1119
+ const parameter = node.params[0];
1120
+ return parameter?.type === import_utils8.AST_NODE_TYPES.Identifier || parameter?.type === import_utils8.AST_NODE_TYPES.ObjectPattern ? parameter.typeAnnotation?.typeAnnotation : void 0;
1121
+ }
1122
+ function exportedSymbols(source, checker) {
1123
+ const symbol = checker.getSymbolAtLocation(source);
1124
+ return new Set(symbol ? checker.getExportsOfModule(symbol).map((entry) => (entry.flags & import_typescript6.default.SymbolFlags.Alias) !== 0 ? checker.getAliasedSymbol(entry) : entry) : []);
1125
+ }
1126
+ function privateScalarConsumer(node, sourceCode, services, exports2, options = {}) {
1127
+ const native = services.esTreeNodeToTSNodeMap.get(node);
1128
+ if (!import_typescript6.default.isFunctionDeclaration(native) && !import_typescript6.default.isArrowFunction(native) || !native.body) return null;
1129
+ let parameter = native.parameters[0];
1130
+ if (native.parameters.length !== 1) {
1131
+ const annotation = consumerAnnotation(node, options.auxiliaryScalars);
1132
+ const selected = annotation && services.esTreeNodeToTSNodeMap.get(annotation);
1133
+ parameter = native.parameters.find((entry) => entry.type === selected);
1134
+ }
1135
+ if (!parameter || !independentSignature(native, parameter, options.auxiliaryScalars === true)) return null;
1136
+ const checker = services.program.getTypeChecker();
1137
+ if (!import_typescript6.default.isExternalModule(native.getSourceFile()) || !services.program.getCompilerOptions().strict) return null;
1138
+ if (!privateDirectCallable(node, native, sourceCode, checker, exports2)) return null;
1139
+ const signature = checker.getSignatureFromDeclaration(native);
1140
+ if (!signature || signature.typeParameters?.length || checker.getTypePredicateOfSignature(signature)) return null;
1141
+ const expression = returnedExpression(native.body);
1142
+ if (!expression || !checker.isTypeAssignableTo(checker.getTypeAtLocation(expression), checker.getReturnTypeOfSignature(signature))) return null;
1143
+ const auxiliaries = native.parameters.length > 1 ? auxiliaryBindings(native, parameter, checker) : void 0;
1144
+ if (auxiliaries === null) return null;
1145
+ const reads = scalarParameterReads(parameter, native.body, checker, options.scalarCalls ? services.program : void 0, auxiliaries);
1146
+ return reads?.size ? { parameter, reads } : null;
1147
+ }
1148
+ function privateDirectCallable(node, native, sourceCode, checker, exports2) {
1149
+ const binding3 = callableBinding(node, sourceCode);
1150
+ if (!binding3 || binding3.defs.length !== 1) return false;
1151
+ const name = import_typescript6.default.isFunctionDeclaration(native) ? native.name : import_typescript6.default.isVariableDeclaration(native.parent) ? native.parent.name : void 0;
1152
+ const symbol = name && checker.getSymbolAtLocation(name);
1153
+ return symbol !== void 0 && symbol.declarations?.length === 1 && !exports2.has(symbol) && directCalls(binding3, native.parameters.length);
1154
+ }
1155
+ function independentSignature(native, selected, auxiliaryScalars) {
1156
+ if (!auxiliaryScalars && native.parameters.length !== 1 || native.typeParameters?.length || native.asteriskToken || native.modifiers?.length || !primitiveKeyword(native.type)) return false;
1157
+ return native.parameters.every((parameter) => parameter.type !== void 0 && !parameter.modifiers?.length && !parameter.questionToken && !parameter.initializer && !parameter.dotDotDotToken && (!import_typescript6.default.isIdentifier(parameter.name) || parameter.name.text !== "this") && (parameter === selected || import_typescript6.default.isIdentifier(parameter.name) && primitiveKeyword(parameter.type)));
1158
+ }
1159
+ function auxiliaryBindings(native, selected, checker) {
1160
+ const bindings = /* @__PURE__ */ new Set();
1161
+ for (const parameter of native.parameters) {
1162
+ if (parameter === selected) continue;
1163
+ const symbol = import_typescript6.default.isIdentifier(parameter.name) ? checker.getSymbolAtLocation(parameter.name) : void 0;
1164
+ if (!symbol || symbol.declarations?.length !== 1 || symbol.declarations[0] !== parameter || bindings.has(symbol)) return null;
1165
+ bindings.add(symbol);
1166
+ }
1167
+ return bindings;
1168
+ }
1169
+ function callableBinding(node, sourceCode) {
1170
+ if (node.type === import_utils8.AST_NODE_TYPES.FunctionDeclaration) {
1171
+ if (node.parent.type !== import_utils8.AST_NODE_TYPES.Program) return void 0;
1172
+ return sourceCode.getDeclaredVariables(node).find((variable) => variable.defs.some((definition) => definition.type === "FunctionName" && definition.node === node));
1173
+ }
1174
+ const declaration = node.parent;
1175
+ if (declaration.type !== import_utils8.AST_NODE_TYPES.VariableDeclarator || declaration.init !== node || declaration.id.type !== import_utils8.AST_NODE_TYPES.Identifier || declaration.id.typeAnnotation || declaration.parent.kind !== "const" || declaration.parent.parent.type !== import_utils8.AST_NODE_TYPES.Program) return void 0;
1176
+ return sourceCode.getDeclaredVariables(declaration).find((variable) => variable.defs.some((definition) => definition.type === "Variable" && definition.node === declaration));
1177
+ }
1178
+ function directCalls(binding3, arity) {
1179
+ let calls = 0;
1180
+ const stable2 = stableValueBinding(binding3, (reference) => {
1181
+ const identifier = reference.identifier;
1182
+ const call = identifier.parent;
1183
+ if (reference.isTypeReference || !reference.isReadOnly() || call.type !== import_utils8.AST_NODE_TYPES.CallExpression || call.callee !== identifier || call.optional || call.typeArguments || call.arguments.length !== arity || !call.arguments.every((argument) => argument.type === import_utils8.AST_NODE_TYPES.Identifier)) return false;
1184
+ calls += 1;
1185
+ return true;
1186
+ });
1187
+ return stable2 && calls > 0;
1188
+ }
1189
+
894
1190
  // src/rules/_react-prop-bindings.ts
895
1191
  var VIEWS = /* @__PURE__ */ new WeakMap();
1192
+ var DIRECT_EVAL = /* @__PURE__ */ new WeakMap();
1193
+ var REACT_IMPORTS = /* @__PURE__ */ new WeakMap();
1194
+ var PARAMETER_BINDINGS = /* @__PURE__ */ new WeakMap();
896
1195
  function renderFunction(node) {
897
1196
  let parent = node.parent;
898
1197
  while (parent !== void 0 && parent !== null) {
@@ -909,13 +1208,27 @@ function renderFunction(node) {
909
1208
  return null;
910
1209
  }
911
1210
  function firstParameterBindings(source, node) {
1211
+ let functions = PARAMETER_BINDINGS.get(source);
1212
+ if (functions === void 0) {
1213
+ functions = /* @__PURE__ */ new WeakMap();
1214
+ PARAMETER_BINDINGS.set(source, functions);
1215
+ }
1216
+ let bindings = functions.get(node);
1217
+ if (bindings === void 0) {
1218
+ bindings = collectParameterBindings(source, node);
1219
+ functions.set(node, bindings);
1220
+ }
1221
+ return bindings;
1222
+ }
1223
+ function collectParameterBindings(source, node) {
1224
+ if (hasDirectEval(source)) return /* @__PURE__ */ new Set();
912
1225
  const parameter = node.params[0];
913
1226
  const identifiers = [];
914
- if (parameter?.type === import_utils8.AST_NODE_TYPES.Identifier)
1227
+ if (parameter?.type === import_utils9.AST_NODE_TYPES.Identifier)
915
1228
  identifiers.push(parameter);
916
- if (parameter?.type === import_utils8.AST_NODE_TYPES.ObjectPattern) {
1229
+ if (parameter?.type === import_utils9.AST_NODE_TYPES.ObjectPattern) {
917
1230
  for (const property of parameter.properties) {
918
- if (property.type === import_utils8.AST_NODE_TYPES.Property && !property.computed && property.value.type === import_utils8.AST_NODE_TYPES.Identifier)
1231
+ if (property.type === import_utils9.AST_NODE_TYPES.Property && !property.computed && property.value.type === import_utils9.AST_NODE_TYPES.Identifier)
919
1232
  identifiers.push(property.value);
920
1233
  }
921
1234
  }
@@ -927,17 +1240,34 @@ function firstParameterBindings(source, node) {
927
1240
  )
928
1241
  );
929
1242
  }
1243
+ function hasDirectEval(source) {
1244
+ let found = DIRECT_EVAL.get(source);
1245
+ if (found !== void 0) return found;
1246
+ found = source.scopeManager?.scopes.some(
1247
+ (scope) => scope.references.some(({ identifier }) => {
1248
+ if (identifier.type !== import_utils9.AST_NODE_TYPES.Identifier || identifier.name !== "eval")
1249
+ return false;
1250
+ let callee = outerExpression(identifier);
1251
+ while (callee.parent?.type === import_utils9.AST_NODE_TYPES.TSInstantiationExpression && callee.parent.expression === callee)
1252
+ callee = outerExpression(callee.parent);
1253
+ const call = callee.parent;
1254
+ return call?.type === import_utils9.AST_NODE_TYPES.CallExpression && call.callee === callee && !call.optional && directEval(call);
1255
+ })
1256
+ ) ?? true;
1257
+ DIRECT_EVAL.set(source, found);
1258
+ return found;
1259
+ }
930
1260
  function parameterPath(source, node, bindings) {
931
1261
  let current = unwrapExpression(node);
932
1262
  for (let depth = 0; depth < 64; depth += 1) {
933
- if (current.type === import_utils8.AST_NODE_TYPES.Identifier) {
934
- const variable = import_utils8.ASTUtils.findVariable(
1263
+ if (current.type === import_utils9.AST_NODE_TYPES.Identifier) {
1264
+ const variable = import_utils9.ASTUtils.findVariable(
935
1265
  source.getScope(current),
936
1266
  current.name
937
1267
  );
938
1268
  return variable !== null && bindings.has(variable);
939
1269
  }
940
- if (current.type !== import_utils8.AST_NODE_TYPES.MemberExpression || current.optional || current.computed && (current.property.type !== import_utils8.AST_NODE_TYPES.Literal || typeof current.property.value !== "string"))
1270
+ if (current.type !== import_utils9.AST_NODE_TYPES.MemberExpression || current.optional || current.computed && (current.property.type !== import_utils9.AST_NODE_TYPES.Literal || typeof current.property.value !== "string"))
941
1271
  return false;
942
1272
  current = unwrapExpression(current.object);
943
1273
  }
@@ -947,25 +1277,30 @@ function reactHook(source, callee, hook) {
947
1277
  callee = unwrapExpression(callee);
948
1278
  let identifier;
949
1279
  let namespace = false;
950
- if (callee.type === import_utils8.AST_NODE_TYPES.Identifier) identifier = callee;
951
- else if (callee.type === import_utils8.AST_NODE_TYPES.MemberExpression && !callee.optional && import_utils8.ASTUtils.getPropertyName(callee) === hook && callee.object.type === import_utils8.AST_NODE_TYPES.Identifier) {
1280
+ if (callee.type === import_utils9.AST_NODE_TYPES.Identifier) identifier = callee;
1281
+ else if (callee.type === import_utils9.AST_NODE_TYPES.MemberExpression && !callee.optional && import_utils9.ASTUtils.getPropertyName(callee) === hook && callee.object.type === import_utils9.AST_NODE_TYPES.Identifier) {
952
1282
  identifier = callee.object;
953
1283
  namespace = true;
954
1284
  } else return false;
955
- const variable = import_utils8.ASTUtils.findVariable(
1285
+ const variable = import_utils9.ASTUtils.findVariable(
956
1286
  source.getScope(identifier),
957
1287
  identifier.name
958
1288
  );
959
- if (variable === null || variable.defs.length !== 1 || !stableValueBinding(variable))
960
- return false;
1289
+ if (variable === null) return false;
1290
+ const specifier = reactImportSpecifier(variable);
1291
+ if (specifier === null) return false;
1292
+ return namespace ? specifier.type === import_utils9.AST_NODE_TYPES.ImportDefaultSpecifier || specifier.type === import_utils9.AST_NODE_TYPES.ImportNamespaceSpecifier : specifier.type === import_utils9.AST_NODE_TYPES.ImportSpecifier && specifier.importKind !== "type" && importSpecifierName(specifier) === hook;
1293
+ }
1294
+ function reactImportSpecifier(variable) {
1295
+ let specifier = REACT_IMPORTS.get(variable);
1296
+ if (specifier !== void 0) return specifier;
961
1297
  const definition = variable.defs[0];
962
- if (definition?.type !== "ImportBinding" || definition.parent.type !== import_utils8.AST_NODE_TYPES.ImportDeclaration || definition.parent.source.value !== "react" || definition.parent.importKind === "type")
963
- return false;
964
- const specifier = definition.node;
965
- return namespace ? specifier.type === import_utils8.AST_NODE_TYPES.ImportDefaultSpecifier || specifier.type === import_utils8.AST_NODE_TYPES.ImportNamespaceSpecifier : specifier.type === import_utils8.AST_NODE_TYPES.ImportSpecifier && specifier.importKind !== "type" && importSpecifierName(specifier) === hook;
1298
+ specifier = variable.defs.length === 1 && definition?.type === "ImportBinding" && definition.parent.type === import_utils9.AST_NODE_TYPES.ImportDeclaration && definition.parent.source.value === "react" && definition.parent.importKind !== "type" && stableValueBinding(variable) ? definition.node : null;
1299
+ REACT_IMPORTS.set(variable, specifier);
1300
+ return specifier;
966
1301
  }
967
1302
  function containsView(node) {
968
- if (node.type === import_utils8.AST_NODE_TYPES.JSXElement || node.type === import_utils8.AST_NODE_TYPES.JSXFragment)
1303
+ if (node.type === import_utils9.AST_NODE_TYPES.JSXElement || node.type === import_utils9.AST_NODE_TYPES.JSXFragment)
969
1304
  return true;
970
1305
  if (isFunction(node)) return false;
971
1306
  return forEachOwnAstChild(
@@ -975,7 +1310,7 @@ function containsView(node) {
975
1310
  );
976
1311
  }
977
1312
  function isFunction(node) {
978
- return node.type === import_utils8.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils8.AST_NODE_TYPES.FunctionDeclaration || node.type === import_utils8.AST_NODE_TYPES.FunctionExpression;
1313
+ return node.type === import_utils9.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils9.AST_NODE_TYPES.FunctionDeclaration || node.type === import_utils9.AST_NODE_TYPES.FunctionExpression;
979
1314
  }
980
1315
 
981
1316
  // src/rules/prefer-server-data-preparation.ts
@@ -1015,8 +1350,8 @@ var PREFER_SERVER_DATA_PREPARATION_DOCUMENTATION = {
1015
1350
  category: "architecture",
1016
1351
  limitations: [
1017
1352
  "Advisory only. Local syntax cannot establish whether a caller is a Server Component, whether props change interactively or whether server preparation reduces the total cost. This rule is a review lead, never proof that code can be moved to the server. No automatic fix is provided.",
1018
- "Requires an explicit use client directive and parser-owned TypeScript services resolving map/filter/flatMap to the standard Array or ReadonlyArray library signature. The containing view must have an independent React useState/useReducer call or an intrinsic DOM onClick/onChange/onInput/onSubmit handler. Noninteractive boundaries remain owned by no-unnecessary-use-client; custom hooks and other indirect client requirements are unsupported.",
1019
- "Every runtime reference to the source parameter binding must be a supported native data projection or a field-only JSX display loop. Inputs also needed for editing, whole-record forwarding, lookup, mutation, other fields or opaque helpers are excluded. Only direct first-parameter paths and synchronous single-expression callbacks are supported. Whole-row identity maps and constant maps are excluded; supported projections must read a fixed input field.",
1353
+ "Requires an explicit use client directive and parser-owned TypeScript services resolving map/filter/flatMap to the standard Array or ReadonlyArray library signature. The receiver beneath erased wrappers must itself have an Array, ReadonlyArray or tuple type after nullish narrowing; casts from opaque or custom collections do not establish this. Subclass and structural collection types outside those native array types are excluded. The containing view must have an independent React useState/useReducer call or a native callable type on an intrinsic DOM onClick/onChange/onInput/onSubmit handler. Nullish, noncallable and opaque handler types do not establish interaction. Noninteractive boundaries remain owned by no-unnecessary-use-client; custom hooks and indirect client requirements are unsupported.",
1354
+ "Every runtime reference to the source parameter binding must be a supported native data projection or a field-only JSX display loop. Inputs also needed for editing, whole-record forwarding, lookup, mutation, other fields or opaque helpers are excluded. Files containing direct eval are excluded because it can observe or change lexical bindings; indirect eval and properties named eval do not establish lexical access. Only direct first-parameter paths and synchronous single-expression callbacks are supported. Whole-row identity maps and constant maps are excluded; supported projections must read a fixed input field.",
1020
1355
  "JSX-rendering callbacks are never reported as preparation findings. Callback calls, captured values, destructuring defaults/rest/nesting, async callbacks, event handlers, effects, memo callbacks, opaque helpers, dynamic/optional paths, custom collection signatures, missing type services, generated source and tests are excluded. First-parameter provenance is syntactic; annotations cannot prove absence of runtime getters or patched array methods. Analysis does not claim callback purity or preserve semantics of a hypothetical move.",
1021
1356
  "Reports the direct source projection once; chained operations with a call receiver are not independently reported. A static subprojection may still be prepared by its producer while a union with pending local edits remains in the client."
1022
1357
  ],
@@ -1063,35 +1398,65 @@ var prefer_server_data_preparation_default = createRule({
1063
1398
  const services = getTypeServices(context);
1064
1399
  const checker = services.program.getTypeChecker();
1065
1400
  const interactions = /* @__PURE__ */ new WeakMap();
1401
+ const projectedInputs = /* @__PURE__ */ new WeakMap();
1402
+ const callable = (node) => {
1403
+ const type = checker.getTypeAtLocation(
1404
+ services.esTreeNodeToTSNodeMap.get(unwrapExpression(node))
1405
+ );
1406
+ const members = type.isUnion() ? type.types : [type];
1407
+ return members.some((member3) => member3.getCallSignatures().length > 0);
1408
+ };
1066
1409
  const nativeArray = (node) => {
1410
+ const callee = unwrapExpression(node.callee);
1411
+ if (callee.type !== import_utils10.AST_NODE_TYPES.MemberExpression) return false;
1412
+ const receiver = checker.getNonNullableType(
1413
+ checker.getTypeAtLocation(
1414
+ services.esTreeNodeToTSNodeMap.get(unwrapExpression(callee.object))
1415
+ )
1416
+ );
1417
+ const members = receiver.isUnion() ? receiver.types : [receiver];
1418
+ if (!members.every(
1419
+ (type) => checker.isArrayType(type) || checker.isTupleType(type)
1420
+ ))
1421
+ return false;
1067
1422
  const declaration = checker.getResolvedSignature(
1068
1423
  services.esTreeNodeToTSNodeMap.get(node)
1069
1424
  )?.declaration;
1070
1425
  return declaration !== void 0 && services.program.isSourceFileDefaultLibrary(
1071
1426
  declaration.getSourceFile()
1072
- ) && import_typescript3.default.isInterfaceDeclaration(declaration.parent) && ["Array", "ReadonlyArray"].includes(declaration.parent.name.text);
1427
+ ) && import_typescript7.default.isInterfaceDeclaration(declaration.parent) && ["Array", "ReadonlyArray"].includes(declaration.parent.name.text);
1073
1428
  };
1074
1429
  return {
1075
1430
  CallExpression(node) {
1076
1431
  const callee = unwrapExpression(node.callee);
1077
- if (node.optional || callee.type !== import_utils9.AST_NODE_TYPES.MemberExpression || callee.optional || node.arguments.length !== 1 || !METHODS.has(import_utils9.ASTUtils.getPropertyName(callee) ?? ""))
1432
+ if (node.optional || callee.type !== import_utils10.AST_NODE_TYPES.MemberExpression || callee.optional || node.arguments.length !== 1 || !METHODS.has(import_utils10.ASTUtils.getPropertyName(callee) ?? ""))
1078
1433
  return;
1079
1434
  const callback = node.arguments[0];
1080
- if (callback?.type !== import_utils9.AST_NODE_TYPES.ArrowFunctionExpression && callback?.type !== import_utils9.AST_NODE_TYPES.FunctionExpression)
1435
+ if (callback?.type !== import_utils10.AST_NODE_TYPES.ArrowFunctionExpression && callback?.type !== import_utils10.AST_NODE_TYPES.FunctionExpression)
1081
1436
  return;
1082
1437
  const component = renderFunction(node);
1083
1438
  if (component === null || !parameterPath(
1084
1439
  context.sourceCode,
1085
1440
  callee.object,
1086
1441
  firstParameterBindings(context.sourceCode, component)
1087
- ) || !projection(context.sourceCode, callback) || !nativeArray(node) || !onlyProjectedInput(context.sourceCode, callee.object, nativeArray))
1442
+ ) || !projection(context.sourceCode, callback))
1088
1443
  return;
1089
1444
  let interactive = interactions.get(component);
1090
1445
  if (interactive === void 0) {
1091
- interactive = clientInteraction(context.sourceCode, component.body);
1446
+ interactive = clientInteraction(
1447
+ context.sourceCode,
1448
+ component.body,
1449
+ callable
1450
+ );
1092
1451
  interactions.set(component, interactive);
1093
1452
  }
1094
- if (!interactive) return;
1453
+ if (!interactive || !onlyProjectedInput(
1454
+ context.sourceCode,
1455
+ callee.object,
1456
+ nativeArray,
1457
+ projectedInputs
1458
+ ))
1459
+ return;
1095
1460
  context.report({ node, messageId: "prepareData" });
1096
1461
  }
1097
1462
  };
@@ -1099,7 +1464,7 @@ var prefer_server_data_preparation_default = createRule({
1099
1464
  });
1100
1465
  function clientDirective(program) {
1101
1466
  for (const statement of program.body) {
1102
- if (statement.type !== import_utils9.AST_NODE_TYPES.ExpressionStatement || statement.directive === void 0)
1467
+ if (statement.type !== import_utils10.AST_NODE_TYPES.ExpressionStatement || statement.directive === void 0)
1103
1468
  return false;
1104
1469
  if (statement.directive === "use client") return true;
1105
1470
  }
@@ -1109,16 +1474,16 @@ function projection(source, callback, mode = "data") {
1109
1474
  if (callback.async || callback.generator || callback.params.length !== 1)
1110
1475
  return false;
1111
1476
  const parameter = callback.params[0];
1112
- if (parameter?.type === import_utils9.AST_NODE_TYPES.ObjectPattern && parameter.properties.some(
1113
- (property) => property.type !== import_utils9.AST_NODE_TYPES.Property || property.computed || property.value.type !== import_utils9.AST_NODE_TYPES.Identifier
1477
+ if (parameter?.type === import_utils10.AST_NODE_TYPES.ObjectPattern && parameter.properties.some(
1478
+ (property) => property.type !== import_utils10.AST_NODE_TYPES.Property || property.computed || property.value.type !== import_utils10.AST_NODE_TYPES.Identifier
1114
1479
  ))
1115
1480
  return false;
1116
1481
  const parameters = firstParameterBindings(source, callback);
1117
1482
  if (parameters.size === 0) return false;
1118
1483
  let body3 = callback.body;
1119
- if (body3.type === import_utils9.AST_NODE_TYPES.BlockStatement) {
1484
+ if (body3.type === import_utils10.AST_NODE_TYPES.BlockStatement) {
1120
1485
  const [statement] = body3.body;
1121
- if (body3.body.length !== 1 || statement?.type !== import_utils9.AST_NODE_TYPES.ReturnStatement || statement.argument === null)
1486
+ if (body3.body.length !== 1 || statement?.type !== import_utils10.AST_NODE_TYPES.ReturnStatement || statement.argument === null)
1122
1487
  return false;
1123
1488
  body3 = statement.argument;
1124
1489
  }
@@ -1127,242 +1492,96 @@ function projection(source, callback, mode = "data") {
1127
1492
  if (depth > 64) return false;
1128
1493
  node = unwrapExpression(node);
1129
1494
  if (parameterPath(source, node, parameters)) {
1130
- if (node.type !== import_utils9.AST_NODE_TYPES.MemberExpression && callback.params[0]?.type !== import_utils9.AST_NODE_TYPES.ObjectPattern)
1495
+ if (node.type !== import_utils10.AST_NODE_TYPES.MemberExpression && callback.params[0]?.type !== import_utils10.AST_NODE_TYPES.ObjectPattern)
1131
1496
  return false;
1132
1497
  fieldRead = true;
1133
- return true;
1134
- }
1135
- if (node.type === import_utils9.AST_NODE_TYPES.Literal) return !("regex" in node);
1136
- if (node.type === import_utils9.AST_NODE_TYPES.UnaryExpression)
1137
- return ["!", "+", "-", "~", "typeof"].includes(node.operator) && inspect(node.argument, depth + 1);
1138
- if (node.type === import_utils9.AST_NODE_TYPES.BinaryExpression)
1139
- return BINARY.has(node.operator) && inspect(node.left, depth + 1) && inspect(node.right, depth + 1);
1140
- if (node.type === import_utils9.AST_NODE_TYPES.LogicalExpression)
1141
- return inspect(node.left, depth + 1) && inspect(node.right, depth + 1);
1142
- if (node.type === import_utils9.AST_NODE_TYPES.ConditionalExpression)
1143
- return inspect(node.test, depth + 1) && inspect(node.consequent, depth + 1) && inspect(node.alternate, depth + 1);
1144
- if (node.type === import_utils9.AST_NODE_TYPES.ObjectExpression)
1145
- return node.properties.every(
1146
- (property) => property.type === import_utils9.AST_NODE_TYPES.Property && property.kind === "init" && !property.method && !property.computed && inspect(property.value, depth + 1)
1147
- );
1148
- return mode === "view" && displayProjection(node, (child) => inspect(child, depth + 1));
1149
- };
1150
- return inspect(body3, 0) && fieldRead;
1151
- }
1152
- function displayProjection(node, inspectChild) {
1153
- if (node.type === import_utils9.AST_NODE_TYPES.JSXElement)
1154
- return node.openingElement.attributes.every(
1155
- (attribute) => attribute.type === import_utils9.AST_NODE_TYPES.JSXAttribute && (attribute.value === null || inspectChild(attribute.value))
1156
- ) && node.children.every(inspectChild);
1157
- if (node.type === import_utils9.AST_NODE_TYPES.JSXFragment)
1158
- return node.children.every(inspectChild);
1159
- if (node.type === import_utils9.AST_NODE_TYPES.JSXText) return true;
1160
- if (node.type === import_utils9.AST_NODE_TYPES.JSXExpressionContainer)
1161
- return node.expression.type === import_utils9.AST_NODE_TYPES.JSXEmptyExpression || inspectChild(node.expression);
1162
- return false;
1163
- }
1164
- function onlyProjectedInput(source, receiver, nativeArray) {
1165
- let root = unwrapExpression(receiver);
1166
- while (root.type === import_utils9.AST_NODE_TYPES.MemberExpression)
1167
- root = unwrapExpression(root.object);
1168
- if (root.type !== import_utils9.AST_NODE_TYPES.Identifier) return false;
1169
- const variable = import_utils9.ASTUtils.findVariable(source.getScope(root), root.name);
1170
- return variable !== null && variable.references.every((reference) => {
1171
- if (typeOnlyReference(reference)) return true;
1172
- if (!reference.isRead()) return false;
1173
- let access = outerExpression(reference.identifier);
1174
- let parent = access.parent;
1175
- while (parent?.type === import_utils9.AST_NODE_TYPES.MemberExpression && parent.object === access) {
1176
- access = outerExpression(parent);
1177
- parent = access.parent;
1178
- }
1179
- const member3 = unwrapExpression(access);
1180
- const call = parent;
1181
- if (call?.type !== import_utils9.AST_NODE_TYPES.CallExpression) return false;
1182
- if (member3.type !== import_utils9.AST_NODE_TYPES.MemberExpression || member3.optional || !METHODS.has(import_utils9.ASTUtils.getPropertyName(member3) ?? "") || call.optional || call.arguments.length !== 1 || !nativeArray(call))
1183
- return false;
1184
- const callback = call.arguments[0];
1185
- return (callback?.type === import_utils9.AST_NODE_TYPES.ArrowFunctionExpression || callback?.type === import_utils9.AST_NODE_TYPES.FunctionExpression) && (projection(source, callback) || projection(source, callback, "view")) && call.callee === access;
1186
- });
1187
- }
1188
- function clientInteraction(source, node) {
1189
- if (node.type === import_utils9.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils9.AST_NODE_TYPES.FunctionExpression || node.type === import_utils9.AST_NODE_TYPES.FunctionDeclaration)
1190
- return false;
1191
- if (node.type === import_utils9.AST_NODE_TYPES.CallExpression && (reactHook(source, node.callee, "useState") || reactHook(source, node.callee, "useReducer")))
1192
- return true;
1193
- if (node.type === import_utils9.AST_NODE_TYPES.JSXOpeningElement && node.name.type === import_utils9.AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.name.name) && node.attributes.some(
1194
- (attribute) => attribute.type === import_utils9.AST_NODE_TYPES.JSXAttribute && attribute.name.type === import_utils9.AST_NODE_TYPES.JSXIdentifier && DOM_EVENTS.has(attribute.name.name) && attribute.value !== null
1195
- ))
1196
- return true;
1197
- return forEachOwnAstChild(
1198
- node,
1199
- (child) => clientInteraction(source, child),
1200
- (key) => key !== "tokens" && key !== "comments"
1201
- );
1202
- }
1203
-
1204
- // src/rules/no-readonly-prop-state.ts
1205
- var import_utils12 = require("@typescript-eslint/utils");
1206
- var import_typescript4 = __toESM(require("typescript"), 1);
1207
-
1208
- // src/rules/_unused-private-binding.ts
1209
- var import_utils11 = require("@typescript-eslint/utils");
1210
-
1211
- // src/rules/_type-binding.ts
1212
- var import_utils10 = require("@typescript-eslint/utils");
1213
- function typeBinding(source, identifier) {
1214
- let scope = source.getScope(identifier);
1215
- while (scope !== null) {
1216
- const variable = scope.set.get(identifier.name);
1217
- if (variable !== void 0 && (variable.isTypeVariable || variable.defs.some((definition) => definition.isTypeDefinition))) {
1218
- return variable;
1219
- }
1220
- scope = scope.upper;
1221
- }
1222
- return null;
1223
- }
1224
- var REFERENCE_INDEXES = /* @__PURE__ */ new WeakMap();
1225
- function retainsNamedTypeUses(source, removed) {
1226
- const manager = source.scopeManager;
1227
- if (manager === null) return false;
1228
- const index = referenceIndex(source, manager);
1229
- for (const reference of referencesWithin(index.references, removed)) {
1230
- if (!reference.isRead()) continue;
1231
- const binding3 = reference.resolved;
1232
- if (!binding3 || !reference.isTypeReference && !reference.isValueReference) return false;
1233
- if (binding3.defs.length === 0) continue;
1234
- const reads = publicReadExtents(index, binding3);
1235
- const extent = reference.isTypeReference ? reference.isValueReference ? reads.both : reads.type : reads.value;
1236
- if (extent === null || extent.minStart >= removed.range[0] && extent.maxEnd <= removed.range[1]) return false;
1237
- }
1238
- return true;
1239
- }
1240
- function referenceIndex(source, manager) {
1241
- const cached = REFERENCE_INDEXES.get(source);
1242
- if (cached?.manager === manager) return cached;
1243
- const references = manager.scopes.flatMap((scope) => scope.references);
1244
- references.sort((left, right) => left.identifier.range[0] - right.identifier.range[0]);
1245
- const index = { manager, references, publicReads: /* @__PURE__ */ new Map() };
1246
- REFERENCE_INDEXES.set(source, index);
1247
- return index;
1248
- }
1249
- function* referencesWithin(references, removed) {
1250
- let low = 0;
1251
- let high = references.length;
1252
- while (low < high) {
1253
- const middle = low + Math.floor((high - low) / 2);
1254
- const reference = references[middle];
1255
- if (reference === void 0 || reference.identifier.range[0] >= removed.range[0]) high = middle;
1256
- else low = middle + 1;
1257
- }
1258
- for (let index = low; index < references.length; index++) {
1259
- const reference = references[index];
1260
- if (reference === void 0) continue;
1261
- if (reference.identifier.range[0] > removed.range[1]) break;
1262
- if (insideTypeRange(reference.identifier, removed)) yield reference;
1263
- }
1264
- }
1265
- function publicReadExtents(index, binding3) {
1266
- const cached = index.publicReads.get(binding3);
1267
- if (cached !== void 0) return cached;
1268
- let type = null;
1269
- let value = null;
1270
- let both = null;
1271
- for (const retained of binding3.references) {
1272
- if (!retained.isRead() || !retained.isTypeReference && !retained.isValueReference || binding3.defs.some((definition) => insideTypeRange(retained.identifier, definition.node)) || !publicTypeUse(retained.identifier)) continue;
1273
- if (retained.isTypeReference) type = extendExtent(type, retained.identifier);
1274
- if (retained.isValueReference) value = extendExtent(value, retained.identifier);
1275
- if (retained.isTypeReference && retained.isValueReference) both = extendExtent(both, retained.identifier);
1276
- }
1277
- const result = { type, value, both };
1278
- index.publicReads.set(binding3, result);
1279
- return result;
1280
- }
1281
- function extendExtent(extent, identifier) {
1282
- return {
1283
- minStart: Math.min(extent?.minStart ?? identifier.range[0], identifier.range[0]),
1284
- maxEnd: Math.max(extent?.maxEnd ?? identifier.range[1], identifier.range[1])
1285
- };
1286
- }
1287
- function publicTypeUse(identifier) {
1288
- let node = identifier;
1289
- while (node.parent) {
1290
- if (node.type === import_utils10.AST_NODE_TYPES.TSTypeAnnotation || node.type === import_utils10.AST_NODE_TYPES.TSTypePredicate || node.type === import_utils10.AST_NODE_TYPES.TSAsExpression || node.type === import_utils10.AST_NODE_TYPES.TSTypeAssertion) return false;
1291
- if (node.type === import_utils10.AST_NODE_TYPES.TSTypeAliasDeclaration) {
1292
- return node.parent.type === import_utils10.AST_NODE_TYPES.ExportNamedDeclaration && node.parent.declaration === node && node.parent.parent.type === import_utils10.AST_NODE_TYPES.Program;
1293
- }
1294
- if (node.type === import_utils10.AST_NODE_TYPES.ExportSpecifier) {
1295
- return node.parent.type === import_utils10.AST_NODE_TYPES.ExportNamedDeclaration && node.parent.source === null && node.parent.parent.type === import_utils10.AST_NODE_TYPES.Program;
1296
- }
1297
- node = node.parent;
1298
- }
1299
- return false;
1300
- }
1301
- function insideTypeRange(node, range) {
1302
- return node.range[0] >= range.range[0] && node.range[1] <= range.range[1];
1303
- }
1304
-
1305
- // src/rules/_unused-private-binding.ts
1306
- function isUnusedPrivateBinding(sourceCode, declaration, identifier, filename, allowedDeclarations = [declaration]) {
1307
- if (/\.d\.[cm]?ts$/u.test(filename)) return false;
1308
- const bindings = sourceCode.getDeclaredVariables(declaration).filter((binding3) => binding3.name === identifier.name);
1309
- if (bindings.length === 0 || bindings.some((binding3) => binding3.defs.length !== allowedDeclarations.length || binding3.defs.some((definition) => !allowedDeclarations.includes(definition.node)) || binding3.eslintUsed || binding3.references.some((reference) => reference.isRead() || reference.init !== true))) return false;
1310
- if (hasIdentifierNamed(sourceCode.ast, "eval")) return false;
1311
- const statement = declaration.type === import_utils11.AST_NODE_TYPES.VariableDeclarator ? declaration.parent : declaration;
1312
- if (statement.parent.type === import_utils11.AST_NODE_TYPES.ExportNamedDeclaration || statement.parent.type === import_utils11.AST_NODE_TYPES.ExportDefaultDeclaration) return false;
1313
- if (statement.parent.type !== import_utils11.AST_NODE_TYPES.Program) return statement.parent.type === import_utils11.AST_NODE_TYPES.BlockStatement;
1314
- return sourceCode.ast.body.some((node) => node.type === import_utils11.AST_NODE_TYPES.ImportDeclaration || node.type === import_utils11.AST_NODE_TYPES.ExportNamedDeclaration || node.type === import_utils11.AST_NODE_TYPES.ExportDefaultDeclaration || node.type === import_utils11.AST_NODE_TYPES.ExportAllDeclaration);
1498
+ return true;
1499
+ }
1500
+ if (node.type === import_utils10.AST_NODE_TYPES.Literal) return !("regex" in node);
1501
+ if (node.type === import_utils10.AST_NODE_TYPES.UnaryExpression)
1502
+ return ["!", "+", "-", "~", "typeof"].includes(node.operator) && inspect(node.argument, depth + 1);
1503
+ if (node.type === import_utils10.AST_NODE_TYPES.BinaryExpression)
1504
+ return BINARY.has(node.operator) && inspect(node.left, depth + 1) && inspect(node.right, depth + 1);
1505
+ if (node.type === import_utils10.AST_NODE_TYPES.LogicalExpression)
1506
+ return inspect(node.left, depth + 1) && inspect(node.right, depth + 1);
1507
+ if (node.type === import_utils10.AST_NODE_TYPES.ConditionalExpression)
1508
+ return inspect(node.test, depth + 1) && inspect(node.consequent, depth + 1) && inspect(node.alternate, depth + 1);
1509
+ if (node.type === import_utils10.AST_NODE_TYPES.ObjectExpression)
1510
+ return node.properties.every(
1511
+ (property) => property.type === import_utils10.AST_NODE_TYPES.Property && property.kind === "init" && !property.method && !property.computed && inspect(property.value, depth + 1)
1512
+ );
1513
+ return mode === "view" && displayProjection(node, (child) => inspect(child, depth + 1));
1514
+ };
1515
+ return inspect(body3, 0) && fieldRead;
1315
1516
  }
1316
- function hasOnlyDirectFactoryUses(variable) {
1317
- return variable.references.every((reference) => {
1318
- if (reference.isTypeReference && !reference.isValueReference) return true;
1319
- const identifier = reference.identifier;
1320
- const parent = identifier.parent;
1321
- if (parent.type === import_utils11.AST_NODE_TYPES.CallExpression && parent.callee === identifier) return true;
1322
- return parent.type === import_utils11.AST_NODE_TYPES.MemberExpression && parent.object === identifier && !parent.computed && parent.parent.type === import_utils11.AST_NODE_TYPES.CallExpression && parent.parent.callee === parent;
1323
- });
1517
+ function displayProjection(node, inspectChild) {
1518
+ if (node.type === import_utils10.AST_NODE_TYPES.JSXElement)
1519
+ return node.openingElement.attributes.every(
1520
+ (attribute) => attribute.type === import_utils10.AST_NODE_TYPES.JSXAttribute && (attribute.value === null || inspectChild(attribute.value))
1521
+ ) && node.children.every(inspectChild);
1522
+ if (node.type === import_utils10.AST_NODE_TYPES.JSXFragment)
1523
+ return node.children.every(inspectChild);
1524
+ if (node.type === import_utils10.AST_NODE_TYPES.JSXText) return true;
1525
+ if (node.type === import_utils10.AST_NODE_TYPES.JSXExpressionContainer)
1526
+ return node.expression.type === import_utils10.AST_NODE_TYPES.JSXEmptyExpression || inspectChild(node.expression);
1527
+ return false;
1324
1528
  }
1325
- var IDENTIFIER_NAMES = /* @__PURE__ */ new WeakMap();
1326
- function hasIdentifierNamed(node, name) {
1327
- let names = IDENTIFIER_NAMES.get(node);
1328
- if (names === void 0) {
1329
- const collected = /* @__PURE__ */ new Set();
1330
- const pending = [node];
1331
- const seen = /* @__PURE__ */ new WeakSet();
1332
- while (pending.length > 0) {
1333
- const current = pending.pop();
1334
- if (current === void 0 || seen.has(current)) continue;
1335
- seen.add(current);
1336
- if (current.type === import_utils11.AST_NODE_TYPES.Identifier || current.type === import_utils11.AST_NODE_TYPES.JSXIdentifier) collected.add(current.name);
1337
- forEachOwnAstChild(current, (child) => {
1338
- pending.push(child);
1339
- }, (key) => key !== "tokens" && key !== "comments");
1529
+ function onlyProjectedInput(source, receiver, nativeArray, cache) {
1530
+ let root = unwrapExpression(receiver);
1531
+ while (root.type === import_utils10.AST_NODE_TYPES.MemberExpression)
1532
+ root = unwrapExpression(root.object);
1533
+ if (root.type !== import_utils10.AST_NODE_TYPES.Identifier) return false;
1534
+ const variable = import_utils10.ASTUtils.findVariable(source.getScope(root), root.name);
1535
+ if (variable === null) return false;
1536
+ const cached = cache.get(variable);
1537
+ if (cached !== void 0) return cached;
1538
+ const projected = variable.references.every((reference) => {
1539
+ if (typeOnlyReference(reference)) return true;
1540
+ if (!reference.isRead()) return false;
1541
+ let access = outerExpression(reference.identifier);
1542
+ let parent = access.parent;
1543
+ while (parent?.type === import_utils10.AST_NODE_TYPES.MemberExpression && parent.object === access) {
1544
+ access = outerExpression(parent);
1545
+ parent = access.parent;
1340
1546
  }
1341
- names = collected;
1342
- IDENTIFIER_NAMES.set(node, names);
1343
- }
1344
- return names.has(name);
1547
+ const member3 = unwrapExpression(access);
1548
+ const call = parent;
1549
+ if (call?.type !== import_utils10.AST_NODE_TYPES.CallExpression) return false;
1550
+ if (member3.type !== import_utils10.AST_NODE_TYPES.MemberExpression || member3.optional || !METHODS.has(import_utils10.ASTUtils.getPropertyName(member3) ?? "") || call.optional || call.arguments.length !== 1 || !nativeArray(call))
1551
+ return false;
1552
+ const callback = call.arguments[0];
1553
+ return (callback?.type === import_utils10.AST_NODE_TYPES.ArrowFunctionExpression || callback?.type === import_utils10.AST_NODE_TYPES.FunctionExpression) && (projection(source, callback) || projection(source, callback, "view")) && call.callee === access;
1554
+ });
1555
+ cache.set(variable, projected);
1556
+ return projected;
1345
1557
  }
1346
- function privatePredicateBooleanFix(sourceCode, node, annotation, filename) {
1347
- if (!annotation.typeAnnotation || !retainsNamedTypeUses(sourceCode, annotation.typeAnnotation) || node.type !== import_utils11.AST_NODE_TYPES.FunctionDeclaration || node.id === null || !isUnusedPrivateBinding(sourceCode, node, node.id, filename) || sourceCode.getCommentsInside(annotation).length > 0) return null;
1348
- const text = `boolean${sourceCode.getText(annotation).replace(/[^\r\n\u2028\u2029]/gu, "")}`;
1349
- const neighbor = Math.max(0, annotation.range[0] - 1);
1350
- const before = sourceCode.text.slice(neighbor, annotation.range[1] + 1).match(/\r\n|[\r\n\u2028\u2029]/gu) ?? [];
1351
- const after = (sourceCode.text.slice(neighbor, annotation.range[0]) + text + sourceCode.text.slice(annotation.range[1], annotation.range[1] + 1)).match(/\r\n|[\r\n\u2028\u2029]/gu) ?? [];
1352
- if (before.length !== after.length || before.some((ending, index) => ending !== after[index])) return null;
1353
- return (fixer) => fixer.replaceText(annotation, text);
1558
+ function clientInteraction(source, node, callable) {
1559
+ if (node.type === import_utils10.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils10.AST_NODE_TYPES.FunctionExpression || node.type === import_utils10.AST_NODE_TYPES.FunctionDeclaration)
1560
+ return false;
1561
+ if (node.type === import_utils10.AST_NODE_TYPES.CallExpression && (reactHook(source, node.callee, "useState") || reactHook(source, node.callee, "useReducer")))
1562
+ return true;
1563
+ if (node.type === import_utils10.AST_NODE_TYPES.JSXOpeningElement && node.name.type === import_utils10.AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.name.name) && node.attributes.some(
1564
+ (attribute) => attribute.type === import_utils10.AST_NODE_TYPES.JSXAttribute && attribute.name.type === import_utils10.AST_NODE_TYPES.JSXIdentifier && DOM_EVENTS.has(attribute.name.name) && attribute.value?.type === import_utils10.AST_NODE_TYPES.JSXExpressionContainer && attribute.value.expression.type !== import_utils10.AST_NODE_TYPES.JSXEmptyExpression && callable(attribute.value.expression)
1565
+ ))
1566
+ return true;
1567
+ return forEachOwnAstChild(
1568
+ node,
1569
+ (child) => clientInteraction(source, child, callable),
1570
+ (key) => key !== "tokens" && key !== "comments"
1571
+ );
1354
1572
  }
1355
1573
 
1356
1574
  // src/rules/no-readonly-prop-state.ts
1575
+ var import_utils11 = require("@typescript-eslint/utils");
1576
+ var import_typescript8 = __toESM(require("typescript"), 1);
1357
1577
  var BEFORE2 = "import { useState } from 'react'; export function Status({ status }: { status: string }) { const [savedStatus] = useState(status); return <p>{savedStatus}</p>; }";
1358
1578
  var AFTER2 = "export function Status({ status }: { status: string }) { return <p>{status}</p>; }";
1359
1579
  var CONFIG2 = {
1360
1580
  path: "tsconfig.json",
1361
1581
  source: '{"compilerOptions":{"strict":true,"target":"ESNext","module":"ESNext","moduleResolution":"Bundler","jsx":"preserve"},"include":["src/**/*"]}'
1362
1582
  };
1363
- var OPAQUE_TYPES = import_typescript4.default.TypeFlags.Any | import_typescript4.default.TypeFlags.Unknown | import_typescript4.default.TypeFlags.Never | import_typescript4.default.TypeFlags.TypeParameter | import_typescript4.default.TypeFlags.Conditional | import_typescript4.default.TypeFlags.IndexedAccess | import_typescript4.default.TypeFlags.Substitution;
1583
+ var PRIMITIVE_TYPES = import_typescript8.default.TypeFlags.StringLike | import_typescript8.default.TypeFlags.NumberLike | import_typescript8.default.TypeFlags.BigIntLike | import_typescript8.default.TypeFlags.BooleanLike | import_typescript8.default.TypeFlags.ESSymbolLike | import_typescript8.default.TypeFlags.Null | import_typescript8.default.TypeFlags.Undefined;
1364
1584
  var MAX_TYPE_DEPTH = 16;
1365
- var FUNCTION_MEMBERS = ["apply", "bind", "call"];
1366
1585
  var NO_READONLY_PROP_STATE_DOCUMENTATION = {
1367
1586
  defaultLevel: "warning",
1368
1587
  summary: "Review props copied into state without a usable updater.",
@@ -1372,11 +1591,12 @@ var NO_READONLY_PROP_STATE_DOCUMENTATION = {
1372
1591
  limitations: [
1373
1592
  "Advisory only: initial snapshots can be intentional. There is no automatic fix because replacing state with current props changes how later updates behave.",
1374
1593
  "Recognizes direct React useState imports and default/namespace member calls, including renamed imports, through lexical binding identity. Checks a direct array destructure in a function containing its own JSX and a direct first-parameter property path, or a zero-argument synchronous lazy initializer returning that path.",
1375
- "Eager initializers require parser-owned TypeScript services and a non-callable type without Any, unknown or unresolved generics. Callable unions, constructors and legacy function-like types exposing apply/bind/call are excluded because React executes function arguments as lazy initializers. Explicit zero-argument lazy callbacks returning the prop directly do not require type information. Type annotations cannot prove runtime identity under opaque casts; lifecycle changes stay manual.",
1376
- "An updater read, escape, reassignment or nontrivial destructuring excludes the finding. Unused state values remain owned by unused-variable checks. Opaque initialization, property aliases, optional/dynamic paths, rest/default bindings, dynamic eval, non-JSX hooks, generated source and tests are outside scope. This does not ban interactive useState or replace the upstream set-state-in-effect rule."
1594
+ "Eager initializers require parser-owned TypeScript services and primitive types, including unions composed entirely of primitives. Object and void types can hide callable values through structural assignment or ignored return values, so eager nonprimitive values, Any, unknown and unresolved generics are excluded. React executes function arguments as lazy initializers. Explicit zero-argument lazy callbacks returning a prop directly remain supported for all value types without type services. Opaque casts cannot prove runtime identity; lifecycle changes stay manual.",
1595
+ "An updater read, escape, reassignment or nontrivial destructuring excludes the finding. Unused state values remain owned by unused-variable checks. Files containing direct eval are excluded because it can observe or change lexical bindings. Indirect eval and properties named eval do not establish lexical access. Opaque initialization, property aliases, optional/dynamic paths, rest/default bindings, non-JSX hooks, generated source and tests are outside scope. This does not ban interactive useState or replace the upstream set-state-in-effect rule."
1377
1596
  ],
1378
1597
  references: [
1379
1598
  "https://react.dev/learn/choosing-the-state-structure",
1599
+ "https://react.dev/reference/react/useState",
1380
1600
  "https://react.dev/reference/eslint-plugin-react-hooks/lints/set-state-in-effect"
1381
1601
  ],
1382
1602
  examples: [
@@ -1414,19 +1634,19 @@ var no_readonly_prop_state_default = createRule({
1414
1634
  defaultOptions: [],
1415
1635
  create(context) {
1416
1636
  if (isGeneratedFile(context, context.sourceCode.text) || isTestFile(context) || !context.sourceCode.ast.body.some(
1417
- (statement) => statement.type === import_utils12.AST_NODE_TYPES.ImportDeclaration && statement.source.value === "react" && statement.importKind !== "type"
1418
- ) || hasIdentifierNamed(context.sourceCode.ast, "eval"))
1637
+ (statement) => statement.type === import_utils11.AST_NODE_TYPES.ImportDeclaration && statement.source.value === "react" && statement.importKind !== "type"
1638
+ ))
1419
1639
  return {};
1420
1640
  return {
1421
1641
  CallExpression(node) {
1422
1642
  if (node.optional || node.arguments.length !== 1 || !reactHook(context.sourceCode, node.callee, "useState"))
1423
1643
  return;
1424
1644
  const declaration = outerExpression(node).parent;
1425
- if (declaration.type !== import_utils12.AST_NODE_TYPES.VariableDeclarator || declaration.parent.kind !== "const" || !hasReadonlyStateBinding(context.sourceCode, declaration))
1645
+ if (declaration.type !== import_utils11.AST_NODE_TYPES.VariableDeclarator || declaration.parent.kind !== "const" || !hasReadonlyStateBinding(context.sourceCode, declaration))
1426
1646
  return;
1427
1647
  const component = renderFunction(node);
1428
1648
  const argument = node.arguments[0];
1429
- if (component === null || argument === void 0 || argument.type === import_utils12.AST_NODE_TYPES.SpreadElement)
1649
+ if (component === null || argument === void 0 || argument.type === import_utils11.AST_NODE_TYPES.SpreadElement)
1430
1650
  return;
1431
1651
  const initial = initializerValue(argument);
1432
1652
  if (initial === null || !parameterPath(
@@ -1436,12 +1656,12 @@ var no_readonly_prop_state_default = createRule({
1436
1656
  ))
1437
1657
  return;
1438
1658
  const lazy = unwrapExpression(argument);
1439
- if (lazy.type !== import_utils12.AST_NODE_TYPES.ArrowFunctionExpression && lazy.type !== import_utils12.AST_NODE_TYPES.FunctionExpression) {
1659
+ if (lazy.type !== import_utils11.AST_NODE_TYPES.ArrowFunctionExpression && lazy.type !== import_utils11.AST_NODE_TYPES.FunctionExpression) {
1440
1660
  if (!context.sourceCode.parserServices?.program || !context.sourceCode.parserServices.esTreeNodeToTSNodeMap)
1441
1661
  return;
1442
1662
  const services = getTypeServices(context);
1443
1663
  const type = services.program.getTypeChecker().getTypeAtLocation(services.esTreeNodeToTSNodeMap.get(initial));
1444
- if (!isNonCallableType(type)) return;
1664
+ if (!isPrimitiveType(type)) return;
1445
1665
  }
1446
1666
  context.report({ node, messageId: "readonlyPropState" });
1447
1667
  }
@@ -1449,9 +1669,9 @@ var no_readonly_prop_state_default = createRule({
1449
1669
  }
1450
1670
  });
1451
1671
  function hasReadonlyStateBinding(source, declaration) {
1452
- if (declaration.id.type !== import_utils12.AST_NODE_TYPES.ArrayPattern) return false;
1672
+ if (declaration.id.type !== import_utils11.AST_NODE_TYPES.ArrayPattern) return false;
1453
1673
  const [value, setter] = declaration.id.elements;
1454
- if (value?.type !== import_utils12.AST_NODE_TYPES.Identifier || declaration.id.elements.length > 2 || setter !== void 0 && setter !== null && setter.type !== import_utils12.AST_NODE_TYPES.Identifier)
1674
+ if (value?.type !== import_utils11.AST_NODE_TYPES.Identifier || declaration.id.elements.length > 2 || setter !== void 0 && setter !== null && setter.type !== import_utils11.AST_NODE_TYPES.Identifier)
1455
1675
  return false;
1456
1676
  const variables = source.getDeclaredVariables(declaration);
1457
1677
  const state = variables.find(
@@ -1461,7 +1681,7 @@ function hasReadonlyStateBinding(source, declaration) {
1461
1681
  (reference) => reference.isRead() && !typeOnlyReference(reference)
1462
1682
  ))
1463
1683
  return false;
1464
- if (setter?.type === import_utils12.AST_NODE_TYPES.Identifier) {
1684
+ if (setter?.type === import_utils11.AST_NODE_TYPES.Identifier) {
1465
1685
  const updater = variables.find(
1466
1686
  (variable) => variable.identifiers.includes(setter)
1467
1687
  );
@@ -1474,21 +1694,22 @@ function hasReadonlyStateBinding(source, declaration) {
1474
1694
  }
1475
1695
  function initializerValue(node) {
1476
1696
  node = unwrapExpression(node);
1477
- if (node.type !== import_utils12.AST_NODE_TYPES.ArrowFunctionExpression && node.type !== import_utils12.AST_NODE_TYPES.FunctionExpression)
1697
+ if (node.type !== import_utils11.AST_NODE_TYPES.ArrowFunctionExpression && node.type !== import_utils11.AST_NODE_TYPES.FunctionExpression)
1478
1698
  return node;
1479
1699
  if (node.async || node.generator || node.params.length !== 0) return null;
1480
- if (node.body.type !== import_utils12.AST_NODE_TYPES.BlockStatement) return node.body;
1700
+ if (node.body.type !== import_utils11.AST_NODE_TYPES.BlockStatement) return node.body;
1481
1701
  const [statement] = node.body.body;
1482
- return node.body.body.length === 1 && statement?.type === import_utils12.AST_NODE_TYPES.ReturnStatement ? statement.argument : null;
1702
+ return node.body.body.length === 1 && statement?.type === import_utils11.AST_NODE_TYPES.ReturnStatement ? statement.argument : null;
1483
1703
  }
1484
- function isNonCallableType(type, depth = 0) {
1485
- if (depth >= MAX_TYPE_DEPTH || (type.flags & OPAQUE_TYPES) !== 0 || type.getCallSignatures().length !== 0 || type.getConstructSignatures().length !== 0 || FUNCTION_MEMBERS.every((member3) => type.getProperty(member3) !== void 0))
1486
- return false;
1487
- return !type.isUnionOrIntersection() || type.types.every((member3) => isNonCallableType(member3, depth + 1));
1704
+ function isPrimitiveType(type, depth = 0) {
1705
+ if (depth >= MAX_TYPE_DEPTH) return false;
1706
+ if (type.isIntersection())
1707
+ return type.getCallSignatures().length === 0 && type.getConstructSignatures().length === 0 && type.types.some((member3) => isPrimitiveType(member3, depth + 1));
1708
+ return type.isUnion() ? type.types.every((member3) => isPrimitiveType(member3, depth + 1)) : (type.flags & PRIMITIVE_TYPES) !== 0;
1488
1709
  }
1489
1710
 
1490
1711
  // src/rules/no-runtime-typeof.ts
1491
- var import_utils13 = require("@typescript-eslint/utils");
1712
+ var import_utils12 = require("@typescript-eslint/utils");
1492
1713
  var NO_RUNTIME_TYPEOF_DOCUMENTATION = {
1493
1714
  defaultLevel: "error",
1494
1715
  summary: "Prefer Zod boundary schemas or discriminated unions over runtime typeof checks.",
@@ -1606,9 +1827,9 @@ var no_runtime_typeof_default = createRule({
1606
1827
  UnaryExpression(node) {
1607
1828
  if (node.operator !== "typeof") return;
1608
1829
  const parent = node.parent;
1609
- if (node.argument.type === import_utils13.AST_NODE_TYPES.Identifier && parent.type === import_utils13.AST_NODE_TYPES.BinaryExpression && ["===", "!==", "==", "!="].includes(parent.operator)) {
1830
+ if (node.argument.type === import_utils12.AST_NODE_TYPES.Identifier && parent.type === import_utils12.AST_NODE_TYPES.BinaryExpression && ["===", "!==", "==", "!="].includes(parent.operator)) {
1610
1831
  const other = parent.left === node ? parent.right : parent.left;
1611
- if (other.type === import_utils13.AST_NODE_TYPES.Literal && other.value === "undefined" && !import_utils13.ASTUtils.findVariable(context.sourceCode.getScope(node.argument), node.argument.name)?.defs.length) return;
1832
+ if (other.type === import_utils12.AST_NODE_TYPES.Literal && other.value === "undefined" && !import_utils12.ASTUtils.findVariable(context.sourceCode.getScope(node.argument), node.argument.name)?.defs.length) return;
1612
1833
  }
1613
1834
  context.report({ node, messageId: "runtimeTypeof" });
1614
1835
  }
@@ -1619,7 +1840,7 @@ var no_runtime_typeof_default = createRule({
1619
1840
  // src/rules/_is-frontend-source.ts
1620
1841
  var import_node_fs = require("fs");
1621
1842
  var import_node_path2 = require("path");
1622
- var import_utils14 = require("@typescript-eslint/utils");
1843
+ var import_utils13 = require("@typescript-eslint/utils");
1623
1844
  var FRONTEND_PACKAGES = /* @__PURE__ */ new Set(["react", "react-dom", "next", "preact", "vue", "svelte", "@angular/core", "solid-js", "@sveltejs/kit", "astro"]);
1624
1845
  var FRONTEND_IMPORT = /^(?:react(?:-dom)?|next|preact|vue|svelte|@angular\/core|solid-js|@sveltejs\/kit)(?:\/|$)/u;
1625
1846
  function isFrontendSource(context) {
@@ -1647,15 +1868,15 @@ function declaresFrontend(value) {
1647
1868
  }
1648
1869
  function frontendModule(program) {
1649
1870
  return program.body.some(
1650
- (statement) => statement.type === import_utils14.AST_NODE_TYPES.ExpressionStatement && (statement.directive === "use client" || statement.directive === "use server") || statement.type === import_utils14.AST_NODE_TYPES.ImportDeclaration && FRONTEND_IMPORT.test(statement.source.value)
1871
+ (statement) => statement.type === import_utils13.AST_NODE_TYPES.ExpressionStatement && (statement.directive === "use client" || statement.directive === "use server") || statement.type === import_utils13.AST_NODE_TYPES.ImportDeclaration && FRONTEND_IMPORT.test(statement.source.value)
1651
1872
  );
1652
1873
  }
1653
1874
 
1654
1875
  // src/rules/no-test-comments.ts
1655
- var import_utils17 = require("@typescript-eslint/utils");
1876
+ var import_utils16 = require("@typescript-eslint/utils");
1656
1877
 
1657
1878
  // src/rules/_comments.ts
1658
- var import_utils15 = require("@typescript-eslint/utils");
1879
+ var import_utils14 = require("@typescript-eslint/utils");
1659
1880
  var REF_RE = /https?:\/\/|\bRFC[- ]?\d+|\bPEP[- ]?\d+|\bCVE-\d{4}|\b(?!UTF-|SHA-|ISO-|AES-|CRC-|MD-|PCM-|EOF-|API-|BASE-)[A-Z][A-Z0-9]{1,9}-\d[A-Z0-9]{0,5}\b|(?<![&\w])#\d{2,6}\b|@[a-z][\w.-]*\.(?:us|com|ai|io|net|org|dev)\b/;
1660
1881
  var VERSION_RE = /(?:>=|<=|==|<|>)\s*v?\d+\.\d+|\bv\d+\.\d+|\b(?:since|until|as of)\s+(?:v?\d+\.\d+|Python\s*\d)/i;
1661
1882
  var UNITS_RE = /[~<>]?\d+(?:\.\d+)?\s?(?:ms|s\b|sec\b|seconds?\b|min\b|minutes?\b|hours?\b|days?\b|KB|MB|MiB|GiB|kHz|Hz|bytes?\b|bit\b|-bit\b|%|px\b|rps\b|qps\b)|\b[1-5]xx\b|\b(?:301|302|304|307|308|400|401|403|404|405|409|410|412|422|425|429|500|501|502|503|504)\b/;
@@ -1741,10 +1962,10 @@ var NARRATION_MAX_WORDS = 6;
1741
1962
  var NARRATION_MIN_CONTENT = 1;
1742
1963
  var TOKEN_PLURAL_MIN = 4;
1743
1964
  var RESTATABLE_STATEMENTS = /* @__PURE__ */ new Set([
1744
- import_utils15.AST_NODE_TYPES.ExpressionStatement,
1745
- import_utils15.AST_NODE_TYPES.ReturnStatement,
1746
- import_utils15.AST_NODE_TYPES.ThrowStatement,
1747
- import_utils15.AST_NODE_TYPES.VariableDeclaration
1965
+ import_utils14.AST_NODE_TYPES.ExpressionStatement,
1966
+ import_utils14.AST_NODE_TYPES.ReturnStatement,
1967
+ import_utils14.AST_NODE_TYPES.ThrowStatement,
1968
+ import_utils14.AST_NODE_TYPES.VariableDeclaration
1748
1969
  ]);
1749
1970
  var NARRATION_VERB_RE = /^(?:add|append|assign|build|calculate|call|check|clear|close|compute|convert|copy|count|create|declare|decrement|define|delete|extract|fetch|filter|find|format|generate|get|handle|increment|init|initialise|initialize|insert|iterate|join|load|log|loop|make|map|merge|open|parse|print|process|push|read|remove|render|reset|return|save|send|set|setup|sort|split|start|stop|store|update|validate|wrap|write)(?:s|es|d|ed|ing)?$/i;
1750
1971
  var NARRATION_STOPWORDS = /* @__PURE__ */ new Set([
@@ -1803,12 +2024,12 @@ function restatableStatementBelow(comment, sourceCode) {
1803
2024
  function restatableStatementNodeBelow(comment, sourceCode) {
1804
2025
  const token = sourceCode.getTokenAfter(comment, { includeComments: false });
1805
2026
  if (token === null || token.loc.start.line !== comment.loc.end.line + 1) return null;
1806
- for (let node = sourceCode.getNodeByRangeIndex(token.range[0]); node != null && node.type !== import_utils15.AST_NODE_TYPES.Program; node = node.parent) {
2027
+ for (let node = sourceCode.getNodeByRangeIndex(token.range[0]); node != null && node.type !== import_utils14.AST_NODE_TYPES.Program; node = node.parent) {
1807
2028
  if (!RESTATABLE_STATEMENTS.has(node.type)) continue;
1808
2029
  if (node.loc.start.line !== token.loc.start.line || node.loc.end.line !== node.loc.start.line) {
1809
2030
  return null;
1810
2031
  }
1811
- if (node.type === import_utils15.AST_NODE_TYPES.VariableDeclaration && isTrivialInitializer(node)) {
2032
+ if (node.type === import_utils14.AST_NODE_TYPES.VariableDeclaration && isTrivialInitializer(node)) {
1812
2033
  return null;
1813
2034
  }
1814
2035
  return node;
@@ -1818,8 +2039,8 @@ function restatableStatementNodeBelow(comment, sourceCode) {
1818
2039
  function isTrivialInitializer(node) {
1819
2040
  return node.declarations.every((declarator) => {
1820
2041
  const init = declarator.init;
1821
- if (init == null || init.type === import_utils15.AST_NODE_TYPES.Literal) return true;
1822
- return init.type === import_utils15.AST_NODE_TYPES.ArrayExpression && init.elements.length === 0 || init.type === import_utils15.AST_NODE_TYPES.ObjectExpression && init.properties.length === 0;
2042
+ if (init == null || init.type === import_utils14.AST_NODE_TYPES.Literal) return true;
2043
+ return init.type === import_utils14.AST_NODE_TYPES.ArrayExpression && init.elements.length === 0 || init.type === import_utils14.AST_NODE_TYPES.ObjectExpression && init.properties.length === 0;
1823
2044
  });
1824
2045
  }
1825
2046
  function restatesStatementHead(body3, statement) {
@@ -1846,7 +2067,7 @@ function headTokens(source) {
1846
2067
  }
1847
2068
 
1848
2069
  // src/rules/_comment-edits.ts
1849
- var import_utils16 = require("@typescript-eslint/utils");
2070
+ var import_utils15 = require("@typescript-eslint/utils");
1850
2071
  function physicalLineEnd(text, offset) {
1851
2072
  const newline = text.indexOf("\n", offset);
1852
2073
  return newline < 0 ? text.length : newline;
@@ -1969,7 +2190,7 @@ function ownsTestComments(context) {
1969
2190
  if (!isTestFile(context)) return false;
1970
2191
  const filename = scopedFilename(context);
1971
2192
  const unambiguous = /(?:^|\/)(?:tests?|__tests__|fixtures|__fixtures__|__mocks__)\//u.test(filename) || /\.(?:test|spec|e2e|integration)\.[cm]?[jt]sx?$/u.test(filename);
1972
- const framework = context.sourceCode.ast.body.some((statement) => statement.type === import_utils17.AST_NODE_TYPES.ImportDeclaration && statement.importKind !== "type" && (statement.specifiers.length === 0 || statement.specifiers.some((specifier) => specifier.type !== import_utils17.AST_NODE_TYPES.ImportSpecifier || specifier.importKind !== "type")) && ["vitest", "@jest/globals", "@playwright/test", "bun:test", "node:test"].includes(statement.source.value));
2193
+ const framework = context.sourceCode.ast.body.some((statement) => statement.type === import_utils16.AST_NODE_TYPES.ImportDeclaration && statement.importKind !== "type" && (statement.specifiers.length === 0 || statement.specifiers.some((specifier) => specifier.type !== import_utils16.AST_NODE_TYPES.ImportSpecifier || specifier.importKind !== "type")) && ["vitest", "@jest/globals", "@playwright/test", "bun:test", "node:test"].includes(statement.source.value));
1973
2194
  return unambiguous || framework;
1974
2195
  }
1975
2196
  var no_test_comments_default = createRule({
@@ -2152,7 +2373,7 @@ function emptyCommentRange(text, comment) {
2152
2373
  }
2153
2374
 
2154
2375
  // src/rules/prefer-dependency-interface.ts
2155
- var import_utils18 = require("@typescript-eslint/utils");
2376
+ var import_utils17 = require("@typescript-eslint/utils");
2156
2377
  var PREFER_DEPENDENCY_INTERFACE_DOCUMENTATION = {
2157
2378
  defaultLevel: "warning",
2158
2379
  summary: "Annotate retained collaborators with their existing interface when the consumer uses only that contract.",
@@ -2177,31 +2398,31 @@ var prefer_dependency_interface_default = createRule({
2177
2398
  if (isGeneratedFile(context, context.sourceCode.text)) return {};
2178
2399
  function contract(node) {
2179
2400
  const concrete = definition(node);
2180
- if (concrete?.type !== import_utils18.AST_NODE_TYPES.ClassDeclaration || concrete.abstract || concrete.superClass !== null || concrete.decorators.length !== 0 || concrete.typeParameters !== void 0 || concrete.implements.length !== 1) return null;
2401
+ if (concrete?.type !== import_utils17.AST_NODE_TYPES.ClassDeclaration || concrete.abstract || concrete.superClass !== null || concrete.decorators.length !== 0 || concrete.typeParameters !== void 0 || concrete.implements.length !== 1) return null;
2181
2402
  const heritage = concrete.implements[0];
2182
- if (heritage?.expression.type !== import_utils18.AST_NODE_TYPES.Identifier) return null;
2403
+ if (heritage?.expression.type !== import_utils17.AST_NODE_TYPES.Identifier) return null;
2183
2404
  const port = definition(heritage.expression);
2184
- return port?.type === import_utils18.AST_NODE_TYPES.TSInterfaceDeclaration && port.extends.length === 0 && port.typeParameters === void 0 ? port : null;
2405
+ return port?.type === import_utils17.AST_NODE_TYPES.TSInterfaceDeclaration && port.extends.length === 0 && port.typeParameters === void 0 ? port : null;
2185
2406
  }
2186
2407
  function definition(node) {
2187
- const variable = import_utils18.ASTUtils.findVariable(context.sourceCode.getScope(node), node.name);
2408
+ const variable = import_utils17.ASTUtils.findVariable(context.sourceCode.getScope(node), node.name);
2188
2409
  return variable?.defs.length === 1 ? variable.defs[0]?.node ?? null : null;
2189
2410
  }
2190
2411
  function usesOnlyInterface(owner, name, port) {
2191
2412
  const members = /* @__PURE__ */ new Set();
2192
2413
  for (const member3 of port.body.body) {
2193
- if (member3.type !== import_utils18.AST_NODE_TYPES.TSMethodSignature && member3.type !== import_utils18.AST_NODE_TYPES.TSPropertySignature || member3.computed || member3.key.type !== import_utils18.AST_NODE_TYPES.Identifier) return false;
2414
+ if (member3.type !== import_utils17.AST_NODE_TYPES.TSMethodSignature && member3.type !== import_utils17.AST_NODE_TYPES.TSPropertySignature || member3.computed || member3.key.type !== import_utils17.AST_NODE_TYPES.Identifier) return false;
2194
2415
  members.add(member3.key.name);
2195
2416
  }
2196
2417
  let uses = 0;
2197
2418
  let compatible = true;
2198
2419
  function visit(node) {
2199
- if (node.type === import_utils18.AST_NODE_TYPES.MemberExpression && node.object.type === import_utils18.AST_NODE_TYPES.ThisExpression && import_utils18.ASTUtils.getPropertyName(node) === name) {
2420
+ if (node.type === import_utils17.AST_NODE_TYPES.MemberExpression && node.object.type === import_utils17.AST_NODE_TYPES.ThisExpression && import_utils17.ASTUtils.getPropertyName(node) === name) {
2200
2421
  uses += 1;
2201
2422
  const parent = node.parent;
2202
- if (parent.type !== import_utils18.AST_NODE_TYPES.MemberExpression || parent.object !== node || !members.has(import_utils18.ASTUtils.getPropertyName(parent) ?? "") || parent.parent.type === import_utils18.AST_NODE_TYPES.AssignmentExpression && parent.parent.left === parent || parent.parent.type === import_utils18.AST_NODE_TYPES.UpdateExpression) compatible = false;
2423
+ if (parent.type !== import_utils17.AST_NODE_TYPES.MemberExpression || parent.object !== node || !members.has(import_utils17.ASTUtils.getPropertyName(parent) ?? "") || parent.parent.type === import_utils17.AST_NODE_TYPES.AssignmentExpression && parent.parent.left === parent || parent.parent.type === import_utils17.AST_NODE_TYPES.UpdateExpression) compatible = false;
2203
2424
  }
2204
- if (node !== owner && (node.type === import_utils18.AST_NODE_TYPES.ClassDeclaration || node.type === import_utils18.AST_NODE_TYPES.ClassExpression)) return;
2425
+ if (node !== owner && (node.type === import_utils17.AST_NODE_TYPES.ClassDeclaration || node.type === import_utils17.AST_NODE_TYPES.ClassExpression)) return;
2205
2426
  forEachOwnAstChild(node, visit);
2206
2427
  }
2207
2428
  visit(owner);
@@ -2211,9 +2432,9 @@ var prefer_dependency_interface_default = createRule({
2211
2432
  TSParameterProperty(node) {
2212
2433
  const parameter = node.parameter;
2213
2434
  const constructor = node.parent.parent;
2214
- if (!node.readonly || node.accessibility !== "private" || node.decorators.length !== 0 || parameter.type !== import_utils18.AST_NODE_TYPES.Identifier || parameter.typeAnnotation?.typeAnnotation.type !== import_utils18.AST_NODE_TYPES.TSTypeReference || parameter.typeAnnotation.typeAnnotation.typeName.type !== import_utils18.AST_NODE_TYPES.Identifier || constructor.type !== import_utils18.AST_NODE_TYPES.MethodDefinition || constructor.kind !== "constructor" || constructor.value.body?.body.length !== 0 || constructor.parent.type !== import_utils18.AST_NODE_TYPES.ClassBody) return;
2435
+ if (!node.readonly || node.accessibility !== "private" || node.decorators.length !== 0 || parameter.type !== import_utils17.AST_NODE_TYPES.Identifier || parameter.typeAnnotation?.typeAnnotation.type !== import_utils17.AST_NODE_TYPES.TSTypeReference || parameter.typeAnnotation.typeAnnotation.typeName.type !== import_utils17.AST_NODE_TYPES.Identifier || constructor.type !== import_utils17.AST_NODE_TYPES.MethodDefinition || constructor.kind !== "constructor" || constructor.value.body?.body.length !== 0 || constructor.parent.type !== import_utils17.AST_NODE_TYPES.ClassBody) return;
2215
2436
  const owner = constructor.parent.parent;
2216
- if (owner.type !== import_utils18.AST_NODE_TYPES.ClassDeclaration && owner.type !== import_utils18.AST_NODE_TYPES.ClassExpression) return;
2437
+ if (owner.type !== import_utils17.AST_NODE_TYPES.ClassDeclaration && owner.type !== import_utils17.AST_NODE_TYPES.ClassExpression) return;
2217
2438
  if (owner.decorators.length !== 0 || owner.typeParameters !== void 0) return;
2218
2439
  const port = contract(parameter.typeAnnotation.typeAnnotation.typeName);
2219
2440
  if (port !== null && usesOnlyInterface(owner, parameter.name, port)) context.report({ node: parameter.typeAnnotation, messageId: "interface", data: { contract: port.id.name } });
@@ -2223,7 +2444,7 @@ var prefer_dependency_interface_default = createRule({
2223
2444
  });
2224
2445
 
2225
2446
  // src/rules/no-mutating-input-with-result.ts
2226
- var import_utils19 = require("@typescript-eslint/utils");
2447
+ var import_utils18 = require("@typescript-eslint/utils");
2227
2448
  var NO_MUTATING_INPUT_WITH_RESULT_DOCUMENTATION = {
2228
2449
  defaultLevel: "warning",
2229
2450
  summary: "Return replacement object values instead of writing input fields in result-returning functions.",
@@ -2241,8 +2462,8 @@ var NO_MUTATING_INPUT_WITH_RESULT_DOCUMENTATION = {
2241
2462
  ]
2242
2463
  };
2243
2464
  function command(annotation) {
2244
- if (annotation.type === import_utils19.AST_NODE_TYPES.TSVoidKeyword || annotation.type === import_utils19.AST_NODE_TYPES.TSUndefinedKeyword || annotation.type === import_utils19.AST_NODE_TYPES.TSNeverKeyword) return true;
2245
- if (annotation.type === import_utils19.AST_NODE_TYPES.TSTypeReference && annotation.typeName.type === import_utils19.AST_NODE_TYPES.Identifier && annotation.typeName.name === "Promise" && annotation.typeArguments?.params.length === 1) {
2465
+ if (annotation.type === import_utils18.AST_NODE_TYPES.TSVoidKeyword || annotation.type === import_utils18.AST_NODE_TYPES.TSUndefinedKeyword || annotation.type === import_utils18.AST_NODE_TYPES.TSNeverKeyword) return true;
2466
+ if (annotation.type === import_utils18.AST_NODE_TYPES.TSTypeReference && annotation.typeName.type === import_utils18.AST_NODE_TYPES.Identifier && annotation.typeName.name === "Promise" && annotation.typeArguments?.params.length === 1) {
2246
2467
  const result = annotation.typeArguments.params[0];
2247
2468
  return result !== void 0 && command(result);
2248
2469
  }
@@ -2257,35 +2478,35 @@ function fields(annotation, sourceCode) {
2257
2478
  return names;
2258
2479
  }
2259
2480
  function membersOf(annotation, sourceCode) {
2260
- if (annotation.type === import_utils19.AST_NODE_TYPES.TSTypeLiteral) return annotation.members;
2261
- if (annotation.type !== import_utils19.AST_NODE_TYPES.TSTypeReference || annotation.typeName.type !== import_utils19.AST_NODE_TYPES.Identifier || annotation.typeArguments !== void 0) return [];
2262
- const variable = import_utils19.ASTUtils.findVariable(sourceCode.getScope(annotation.typeName), annotation.typeName.name);
2481
+ if (annotation.type === import_utils18.AST_NODE_TYPES.TSTypeLiteral) return annotation.members;
2482
+ if (annotation.type !== import_utils18.AST_NODE_TYPES.TSTypeReference || annotation.typeName.type !== import_utils18.AST_NODE_TYPES.Identifier || annotation.typeArguments !== void 0) return [];
2483
+ const variable = import_utils18.ASTUtils.findVariable(sourceCode.getScope(annotation.typeName), annotation.typeName.name);
2263
2484
  if (variable?.defs.length !== 1) return [];
2264
2485
  const definition = variable.defs[0]?.node;
2265
2486
  switch (definition?.type) {
2266
- case import_utils19.AST_NODE_TYPES.TSInterfaceDeclaration:
2487
+ case import_utils18.AST_NODE_TYPES.TSInterfaceDeclaration:
2267
2488
  return definition.extends.length === 0 && definition.typeParameters === void 0 ? definition.body.body : [];
2268
- case import_utils19.AST_NODE_TYPES.TSTypeAliasDeclaration:
2269
- return definition.typeParameters === void 0 && definition.typeAnnotation.type === import_utils19.AST_NODE_TYPES.TSTypeLiteral ? definition.typeAnnotation.members : [];
2270
- case import_utils19.AST_NODE_TYPES.ClassDeclaration:
2489
+ case import_utils18.AST_NODE_TYPES.TSTypeAliasDeclaration:
2490
+ return definition.typeParameters === void 0 && definition.typeAnnotation.type === import_utils18.AST_NODE_TYPES.TSTypeLiteral ? definition.typeAnnotation.members : [];
2491
+ case import_utils18.AST_NODE_TYPES.ClassDeclaration:
2271
2492
  return definition.superClass === null && definition.typeParameters === void 0 && definition.decorators.length === 0 ? definition.body.body : [];
2272
2493
  default:
2273
2494
  return [];
2274
2495
  }
2275
2496
  }
2276
2497
  function mutableField(member3) {
2277
- if (member3.type !== import_utils19.AST_NODE_TYPES.TSPropertySignature && member3.type !== import_utils19.AST_NODE_TYPES.PropertyDefinition || member3.readonly || member3.computed) return null;
2278
- if (member3.type === import_utils19.AST_NODE_TYPES.PropertyDefinition && (member3.static || member3.accessibility === "private" || member3.accessibility === "protected")) return null;
2279
- if (member3.key.type === import_utils19.AST_NODE_TYPES.Identifier) return member3.key.name;
2280
- return member3.key.type === import_utils19.AST_NODE_TYPES.Literal && (typeof member3.key.value === "string" || typeof member3.key.value === "number") ? String(member3.key.value) : null;
2498
+ if (member3.type !== import_utils18.AST_NODE_TYPES.TSPropertySignature && member3.type !== import_utils18.AST_NODE_TYPES.PropertyDefinition || member3.readonly || member3.computed) return null;
2499
+ if (member3.type === import_utils18.AST_NODE_TYPES.PropertyDefinition && (member3.static || member3.accessibility === "private" || member3.accessibility === "protected")) return null;
2500
+ if (member3.key.type === import_utils18.AST_NODE_TYPES.Identifier) return member3.key.name;
2501
+ return member3.key.type === import_utils18.AST_NODE_TYPES.Literal && (typeof member3.key.value === "string" || typeof member3.key.value === "number") ? String(member3.key.value) : null;
2281
2502
  }
2282
2503
  function walkBody(node, visit) {
2283
- if (node.type === import_utils19.AST_NODE_TYPES.FunctionDeclaration || node.type === import_utils19.AST_NODE_TYPES.FunctionExpression || node.type === import_utils19.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils19.AST_NODE_TYPES.ClassDeclaration || node.type === import_utils19.AST_NODE_TYPES.ClassExpression) return;
2504
+ if (node.type === import_utils18.AST_NODE_TYPES.FunctionDeclaration || node.type === import_utils18.AST_NODE_TYPES.FunctionExpression || node.type === import_utils18.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils18.AST_NODE_TYPES.ClassDeclaration || node.type === import_utils18.AST_NODE_TYPES.ClassExpression) return;
2284
2505
  visit(node);
2285
- if (node.type === import_utils19.AST_NODE_TYPES.BlockStatement) {
2506
+ if (node.type === import_utils18.AST_NODE_TYPES.BlockStatement) {
2286
2507
  for (const statement of node.body) {
2287
2508
  walkBody(statement, visit);
2288
- if (statement.type === import_utils19.AST_NODE_TYPES.ReturnStatement || statement.type === import_utils19.AST_NODE_TYPES.ThrowStatement) break;
2509
+ if (statement.type === import_utils18.AST_NODE_TYPES.ReturnStatement || statement.type === import_utils18.AST_NODE_TYPES.ThrowStatement) break;
2289
2510
  }
2290
2511
  return;
2291
2512
  }
@@ -2297,15 +2518,15 @@ function walkBody(node, visit) {
2297
2518
  forEachOwnAstChild(node, (child) => walkBody(child, visit), (key) => key !== "typeAnnotation" && key !== "returnType");
2298
2519
  }
2299
2520
  function selectedChildren(node) {
2300
- if (node.type === import_utils19.AST_NODE_TYPES.IfStatement && node.test.type === import_utils19.AST_NODE_TYPES.Literal) {
2521
+ if (node.type === import_utils18.AST_NODE_TYPES.IfStatement && node.test.type === import_utils18.AST_NODE_TYPES.Literal) {
2301
2522
  const branch = node.test.value ? node.consequent : node.alternate;
2302
2523
  return branch === null ? [node.test] : [node.test, branch];
2303
2524
  }
2304
- if (node.type === import_utils19.AST_NODE_TYPES.LogicalExpression && node.left.type === import_utils19.AST_NODE_TYPES.Literal) {
2525
+ if (node.type === import_utils18.AST_NODE_TYPES.LogicalExpression && node.left.type === import_utils18.AST_NODE_TYPES.Literal) {
2305
2526
  const skips = node.operator === "&&" && !node.left.value || node.operator === "||" && !!node.left.value || node.operator === "??" && node.left.value !== null;
2306
2527
  return skips ? [node.left] : [node.left, node.right];
2307
2528
  }
2308
- if (node.type === import_utils19.AST_NODE_TYPES.ConditionalExpression && node.test.type === import_utils19.AST_NODE_TYPES.Literal) return [node.test, node.test.value ? node.consequent : node.alternate];
2529
+ if (node.type === import_utils18.AST_NODE_TYPES.ConditionalExpression && node.test.type === import_utils18.AST_NODE_TYPES.Literal) return [node.test, node.test.value ? node.consequent : node.alternate];
2309
2530
  return null;
2310
2531
  }
2311
2532
  var no_mutating_input_with_result_default = createRule({
@@ -2326,23 +2547,23 @@ var no_mutating_input_with_result_default = createRule({
2326
2547
  if (annotation === void 0 || command(annotation) || node.body === void 0) return;
2327
2548
  const inputs = /* @__PURE__ */ new Map();
2328
2549
  for (const parameter of node.params) {
2329
- if (parameter.type !== import_utils19.AST_NODE_TYPES.Identifier || parameter.typeAnnotation === void 0) continue;
2330
- const variable = import_utils19.ASTUtils.findVariable(sourceCode.getScope(parameter), parameter.name);
2550
+ if (parameter.type !== import_utils18.AST_NODE_TYPES.Identifier || parameter.typeAnnotation === void 0) continue;
2551
+ const variable = import_utils18.ASTUtils.findVariable(sourceCode.getScope(parameter), parameter.name);
2331
2552
  if (variable === null || variable.references.some((reference) => reference.isWrite())) continue;
2332
2553
  const names = fields(parameter.typeAnnotation.typeAnnotation, sourceCode);
2333
2554
  if (names.size > 0) inputs.set(variable, names);
2334
2555
  }
2335
2556
  if (inputs.size === 0) return;
2336
- let returned2 = node.body.type !== import_utils19.AST_NODE_TYPES.BlockStatement;
2557
+ let returned2 = node.body.type !== import_utils18.AST_NODE_TYPES.BlockStatement;
2337
2558
  const writes = [];
2338
2559
  walkBody(node.body, (current) => {
2339
- if (current.type === import_utils19.AST_NODE_TYPES.ReturnStatement && current.argument !== null) returned2 = true;
2340
- const candidate2 = current.type === import_utils19.AST_NODE_TYPES.AssignmentExpression ? current.left : current.type === import_utils19.AST_NODE_TYPES.UpdateExpression || current.type === import_utils19.AST_NODE_TYPES.UnaryExpression && current.operator === "delete" ? current.argument : null;
2560
+ if (current.type === import_utils18.AST_NODE_TYPES.ReturnStatement && current.argument !== null) returned2 = true;
2561
+ const candidate2 = current.type === import_utils18.AST_NODE_TYPES.AssignmentExpression ? current.left : current.type === import_utils18.AST_NODE_TYPES.UpdateExpression || current.type === import_utils18.AST_NODE_TYPES.UnaryExpression && current.operator === "delete" ? current.argument : null;
2341
2562
  if (candidate2 === null) return;
2342
2563
  const target = unwrapExpression(candidate2);
2343
- if (target.type !== import_utils19.AST_NODE_TYPES.MemberExpression || target.object.type !== import_utils19.AST_NODE_TYPES.Identifier) return;
2344
- const variable = import_utils19.ASTUtils.findVariable(sourceCode.getScope(target.object), target.object.name);
2345
- const property = import_utils19.ASTUtils.getPropertyName(target);
2564
+ if (target.type !== import_utils18.AST_NODE_TYPES.MemberExpression || target.object.type !== import_utils18.AST_NODE_TYPES.Identifier) return;
2565
+ const variable = import_utils18.ASTUtils.findVariable(sourceCode.getScope(target.object), target.object.name);
2566
+ const property = import_utils18.ASTUtils.getPropertyName(target);
2346
2567
  if (variable !== null && property !== null && inputs.get(variable)?.has(property)) writes.push({ node: target, name: target.object.name });
2347
2568
  });
2348
2569
  const first = writes[0];
@@ -2353,26 +2574,26 @@ var no_mutating_input_with_result_default = createRule({
2353
2574
  });
2354
2575
 
2355
2576
  // src/rules/no-negative-only-http-status-assertion.ts
2356
- var import_utils24 = require("@typescript-eslint/utils");
2577
+ var import_utils23 = require("@typescript-eslint/utils");
2357
2578
 
2358
2579
  // src/rules/_native-fetch-reference.ts
2359
- var import_utils22 = require("@typescript-eslint/utils");
2580
+ var import_utils21 = require("@typescript-eslint/utils");
2360
2581
 
2361
2582
  // src/rules/_native-runtime-unchanged.ts
2362
- var import_utils21 = require("@typescript-eslint/utils");
2583
+ var import_utils20 = require("@typescript-eslint/utils");
2363
2584
 
2364
2585
  // src/rules/_static-string.ts
2365
- var import_utils20 = require("@typescript-eslint/utils");
2586
+ var import_utils19 = require("@typescript-eslint/utils");
2366
2587
  function staticString(node) {
2367
2588
  if (node === void 0) return null;
2368
2589
  const value = unwrapExpression(node);
2369
- if (value.type === import_utils20.AST_NODE_TYPES.Literal && typeof value.value === "string") return value.value;
2370
- return value.type === import_utils20.AST_NODE_TYPES.TemplateLiteral && value.expressions.length === 0 ? value.quasis[0]?.value.cooked ?? null : null;
2590
+ if (value.type === import_utils19.AST_NODE_TYPES.Literal && typeof value.value === "string") return value.value;
2591
+ return value.type === import_utils19.AST_NODE_TYPES.TemplateLiteral && value.expressions.length === 0 ? value.quasis[0]?.value.cooked ?? null : null;
2371
2592
  }
2372
2593
  var SCOPED_STRING_VALUES = /* @__PURE__ */ new WeakMap();
2373
2594
  function scopedStaticString(node, sourceCode) {
2374
2595
  let value = unwrapExpression(node);
2375
- if (value.type !== import_utils20.AST_NODE_TYPES.Identifier) return staticString(value);
2596
+ if (value.type !== import_utils19.AST_NODE_TYPES.Identifier) return staticString(value);
2376
2597
  let values = SCOPED_STRING_VALUES.get(sourceCode);
2377
2598
  if (values === void 0) {
2378
2599
  values = /* @__PURE__ */ new WeakMap();
@@ -2381,8 +2602,8 @@ function scopedStaticString(node, sourceCode) {
2381
2602
  const seen = /* @__PURE__ */ new Set();
2382
2603
  const pending = [];
2383
2604
  let result = null;
2384
- while (value.type === import_utils20.AST_NODE_TYPES.Identifier) {
2385
- const binding3 = import_utils20.ASTUtils.findVariable(sourceCode.getScope(value), value.name);
2605
+ while (value.type === import_utils19.AST_NODE_TYPES.Identifier) {
2606
+ const binding3 = import_utils19.ASTUtils.findVariable(sourceCode.getScope(value), value.name);
2386
2607
  if (binding3 === null || seen.has(binding3)) break;
2387
2608
  if (values.has(binding3)) {
2388
2609
  result = values.get(binding3) ?? null;
@@ -2391,17 +2612,17 @@ function scopedStaticString(node, sourceCode) {
2391
2612
  seen.add(binding3);
2392
2613
  pending.push(binding3);
2393
2614
  const definition = binding3.defs.length === 1 ? binding3.defs[0] : void 0;
2394
- if (definition?.type !== "Variable" || definition.node.id.type !== import_utils20.AST_NODE_TYPES.Identifier || definition.node.init === null || binding3.references.some((reference) => reference.isWrite() && reference.init !== true)) break;
2615
+ if (definition?.type !== "Variable" || definition.node.id.type !== import_utils19.AST_NODE_TYPES.Identifier || definition.node.init === null || binding3.references.some((reference) => reference.isWrite() && reference.init !== true)) break;
2395
2616
  value = unwrapExpression(definition.node.init);
2396
- if (value.type !== import_utils20.AST_NODE_TYPES.Identifier) result = staticString(value);
2617
+ if (value.type !== import_utils19.AST_NODE_TYPES.Identifier) result = staticString(value);
2397
2618
  }
2398
2619
  for (const binding3 of pending) values.set(binding3, result);
2399
2620
  return result;
2400
2621
  }
2401
2622
  function staticPropertyName(node, sourceCode) {
2402
- const direct = import_utils20.ASTUtils.getPropertyName(node);
2623
+ const direct = import_utils19.ASTUtils.getPropertyName(node);
2403
2624
  if (direct !== null || !node.computed) return direct;
2404
- const key = node.type === import_utils20.AST_NODE_TYPES.MemberExpression ? node.property : node.key;
2625
+ const key = node.type === import_utils19.AST_NODE_TYPES.MemberExpression ? node.property : node.key;
2405
2626
  return scopedStaticString(key, sourceCode);
2406
2627
  }
2407
2628
 
@@ -2412,7 +2633,7 @@ function nativeRuntimeUnchanged(sourceCode, name) {
2412
2633
  const index = runtimeIndex(sourceCode);
2413
2634
  const cached = index.results.get(name);
2414
2635
  if (cached !== void 0) return cached;
2415
- const changed = index.nodes.some((node) => node.type === import_utils21.AST_NODE_TYPES.MemberExpression && staticPropertyName(node, sourceCode) === "constructor" || name === "fetch" && node.type === import_utils21.AST_NODE_TYPES.Property && node.parent.type === import_utils21.AST_NODE_TYPES.ObjectPattern && staticPropertyName(node, sourceCode) === "constructor" || name === "RegExp" && node.type === import_utils21.AST_NODE_TYPES.Literal && "regex" in node) || index.references.some((reference) => (name !== "fetch" || !typeOnlyReference(reference)) && unsafeReference(reference.identifier, sourceCode, name, index));
2636
+ const changed = index.nodes.some((node) => node.type === import_utils20.AST_NODE_TYPES.MemberExpression && staticPropertyName(node, sourceCode) === "constructor" || name === "fetch" && node.type === import_utils20.AST_NODE_TYPES.Property && node.parent.type === import_utils20.AST_NODE_TYPES.ObjectPattern && staticPropertyName(node, sourceCode) === "constructor" || name === "RegExp" && node.type === import_utils20.AST_NODE_TYPES.Literal && "regex" in node) || index.references.some((reference) => (name !== "fetch" || !typeOnlyReference(reference)) && unsafeReference(reference.identifier, sourceCode, name, index));
2416
2637
  index.results.set(name, !changed);
2417
2638
  return !changed;
2418
2639
  }
@@ -2441,8 +2662,8 @@ function unsafeReference(node, sourceCode, name, index) {
2441
2662
  if (!GLOBAL_OBJECTS.has(node.name)) return false;
2442
2663
  const value = outerExpression(node);
2443
2664
  const property = value.parent;
2444
- if (name === "fetch" && property?.type === import_utils21.AST_NODE_TYPES.UnaryExpression && property.operator === "typeof") return false;
2445
- if (property?.type !== import_utils21.AST_NODE_TYPES.MemberExpression || property.object !== value) {
2665
+ if (name === "fetch" && property?.type === import_utils20.AST_NODE_TYPES.UnaryExpression && property.operator === "typeof") return false;
2666
+ if (property?.type !== import_utils20.AST_NODE_TYPES.MemberExpression || property.object !== value) {
2446
2667
  return name !== "fetch" || !fetchProjection(value, sourceCode, index);
2447
2668
  }
2448
2669
  const key = staticPropertyName(property, sourceCode);
@@ -2451,21 +2672,21 @@ function unsafeReference(node, sourceCode, name, index) {
2451
2672
  return key === name && !(name === "fetch" ? fetchRead(property, sourceCode, index) : nativeRead(property, name));
2452
2673
  }
2453
2674
  function ambient(node, sourceCode) {
2454
- const variable = import_utils21.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
2675
+ const variable = import_utils20.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
2455
2676
  return variable === null || variable.defs.length === 0;
2456
2677
  }
2457
2678
  function fetchUse(node, sourceCode) {
2458
2679
  const value = outerExpression(node);
2459
2680
  const parent = value.parent;
2460
- if (parent?.type === import_utils21.AST_NODE_TYPES.CallExpression && parent.callee === value || parent?.type === import_utils21.AST_NODE_TYPES.UnaryExpression && parent.operator === "typeof") return true;
2461
- if (parent?.type !== import_utils21.AST_NODE_TYPES.VariableDeclarator || parent.init !== value || parent.id.type !== import_utils21.AST_NODE_TYPES.Identifier) return false;
2681
+ if (parent?.type === import_utils20.AST_NODE_TYPES.CallExpression && parent.callee === value || parent?.type === import_utils20.AST_NODE_TYPES.UnaryExpression && parent.operator === "typeof") return true;
2682
+ if (parent?.type !== import_utils20.AST_NODE_TYPES.VariableDeclarator || parent.init !== value || parent.id.type !== import_utils20.AST_NODE_TYPES.Identifier) return false;
2462
2683
  return stableConstBinding(parent.id, sourceCode) ?? false;
2463
2684
  }
2464
2685
  function stableConstBinding(node, sourceCode) {
2465
- const binding3 = import_utils21.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
2686
+ const binding3 = import_utils20.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
2466
2687
  if (binding3 === null || binding3.defs.length !== 1) return null;
2467
2688
  const [definition] = binding3.defs;
2468
- return definition?.type === "Variable" && definition.parent.kind === "const" && definition.node.init !== null && definition.parent.parent.type !== import_utils21.AST_NODE_TYPES.ExportNamedDeclaration && !binding3.references.some((reference) => reference.isWrite() && reference.init !== true) ? binding3 : null;
2689
+ return definition?.type === "Variable" && definition.parent.kind === "const" && definition.node.init !== null && definition.parent.parent.type !== import_utils20.AST_NODE_TYPES.ExportNamedDeclaration && !binding3.references.some((reference) => reference.isWrite() && reference.init !== true) ? binding3 : null;
2469
2690
  }
2470
2691
  function fetchRead(node, sourceCode, index) {
2471
2692
  const use = fetchUse(node, sourceCode);
@@ -2508,18 +2729,18 @@ function fetchAliasCaptures(binding3, sourceCode) {
2508
2729
  }
2509
2730
  function fetchProjection(node, sourceCode, index) {
2510
2731
  const declaration = node.parent;
2511
- if (declaration?.type !== import_utils21.AST_NODE_TYPES.VariableDeclarator || declaration.init !== node || declaration.id.type !== import_utils21.AST_NODE_TYPES.ObjectPattern || declaration.id.properties.length !== 1) return false;
2732
+ if (declaration?.type !== import_utils20.AST_NODE_TYPES.VariableDeclarator || declaration.init !== node || declaration.id.type !== import_utils20.AST_NODE_TYPES.ObjectPattern || declaration.id.properties.length !== 1) return false;
2512
2733
  const [property] = declaration.id.properties;
2513
- if (property?.type !== import_utils21.AST_NODE_TYPES.Property || staticPropertyName(property, sourceCode) !== "fetch" || property.value.type !== import_utils21.AST_NODE_TYPES.Identifier) return false;
2734
+ if (property?.type !== import_utils20.AST_NODE_TYPES.Property || staticPropertyName(property, sourceCode) !== "fetch" || property.value.type !== import_utils20.AST_NODE_TYPES.Identifier) return false;
2514
2735
  const binding3 = stableConstBinding(property.value, sourceCode);
2515
2736
  return binding3 !== null && fetchAliasRead(binding3, sourceCode, index);
2516
2737
  }
2517
2738
  function nativeRead(node, name) {
2518
2739
  const value = outerExpression(node);
2519
2740
  const parent = value.parent;
2520
- if (parent?.type === import_utils21.AST_NODE_TYPES.UnaryExpression && parent.operator === "typeof") return true;
2741
+ if (parent?.type === import_utils20.AST_NODE_TYPES.UnaryExpression && parent.operator === "typeof") return true;
2521
2742
  if (name !== "Error") return false;
2522
- return parent?.type === import_utils21.AST_NODE_TYPES.NewExpression && parent.callee === value || parent?.type === import_utils21.AST_NODE_TYPES.BinaryExpression && parent.operator === "instanceof" && parent.right === value;
2743
+ return parent?.type === import_utils20.AST_NODE_TYPES.NewExpression && parent.callee === value || parent?.type === import_utils20.AST_NODE_TYPES.BinaryExpression && parent.operator === "instanceof" && parent.right === value;
2523
2744
  }
2524
2745
 
2525
2746
  // src/rules/_native-fetch-reference.ts
@@ -2529,34 +2750,34 @@ function nativeFetchReference(node, sourceCode) {
2529
2750
  }
2530
2751
  function lexicalFetchReference(node, sourceCode, seen = /* @__PURE__ */ new Set()) {
2531
2752
  const expression = unwrapExpression(node);
2532
- if (expression.type === import_utils22.AST_NODE_TYPES.MemberExpression) {
2753
+ if (expression.type === import_utils21.AST_NODE_TYPES.MemberExpression) {
2533
2754
  return staticPropertyName(expression, sourceCode) === "fetch" && globalReceiver(expression.object, sourceCode);
2534
2755
  }
2535
- if (expression.type !== import_utils22.AST_NODE_TYPES.Identifier) return false;
2536
- const binding3 = import_utils22.ASTUtils.findVariable(sourceCode.getScope(expression), expression.name);
2756
+ if (expression.type !== import_utils21.AST_NODE_TYPES.Identifier) return false;
2757
+ const binding3 = import_utils21.ASTUtils.findVariable(sourceCode.getScope(expression), expression.name);
2537
2758
  if (binding3 === null || binding3.defs.length === 0) return expression.name === "fetch";
2538
2759
  if (seen.has(binding3) || seen.size >= 8 || binding3.defs.length !== 1 || binding3.references.some((reference) => reference.isWrite() && reference.init !== true)) return false;
2539
2760
  seen.add(binding3);
2540
2761
  const [definition] = binding3.defs;
2541
2762
  if (definition?.type !== "Variable" || definition.parent.kind !== "const" || definition.node.init === null) return false;
2542
- if (definition.node.id.type === import_utils22.AST_NODE_TYPES.Identifier) {
2763
+ if (definition.node.id.type === import_utils21.AST_NODE_TYPES.Identifier) {
2543
2764
  return lexicalFetchReference(definition.node.init, sourceCode, seen);
2544
2765
  }
2545
- return definition.node.id.type === import_utils22.AST_NODE_TYPES.ObjectPattern && globalReceiver(definition.node.init, sourceCode) && definition.node.id.properties.some((property) => property.type === import_utils22.AST_NODE_TYPES.Property && staticPropertyName(property, sourceCode) === "fetch" && property.value.type === import_utils22.AST_NODE_TYPES.Identifier && import_utils22.ASTUtils.findVariable(sourceCode.getScope(property.value), property.value.name) === binding3);
2766
+ return definition.node.id.type === import_utils21.AST_NODE_TYPES.ObjectPattern && globalReceiver(definition.node.init, sourceCode) && definition.node.id.properties.some((property) => property.type === import_utils21.AST_NODE_TYPES.Property && staticPropertyName(property, sourceCode) === "fetch" && property.value.type === import_utils21.AST_NODE_TYPES.Identifier && import_utils21.ASTUtils.findVariable(sourceCode.getScope(property.value), property.value.name) === binding3);
2546
2767
  }
2547
2768
  function globalReceiver(node, sourceCode) {
2548
2769
  const receiver = unwrapExpression(node);
2549
- return receiver.type === import_utils22.AST_NODE_TYPES.Identifier && GLOBAL_RECEIVERS2.has(receiver.name) && !import_utils22.ASTUtils.findVariable(sourceCode.getScope(receiver), receiver.name)?.defs.length;
2770
+ return receiver.type === import_utils21.AST_NODE_TYPES.Identifier && GLOBAL_RECEIVERS2.has(receiver.name) && !import_utils21.ASTUtils.findVariable(sourceCode.getScope(receiver), receiver.name)?.defs.length;
2550
2771
  }
2551
2772
 
2552
2773
  // src/rules/_test-mock-provenance.ts
2553
- var import_utils23 = require("@typescript-eslint/utils");
2774
+ var import_utils22 = require("@typescript-eslint/utils");
2554
2775
  function importedTestMockNamespace(source, identifier) {
2555
- const binding3 = import_utils23.ASTUtils.findVariable(source.getScope(identifier), identifier.name);
2776
+ const binding3 = import_utils22.ASTUtils.findVariable(source.getScope(identifier), identifier.name);
2556
2777
  const importedBinding = runtimeImportBinding(binding3);
2557
- if (importedBinding === null || importedBinding.specifier.type !== import_utils23.AST_NODE_TYPES.ImportSpecifier) return null;
2778
+ if (importedBinding === null || importedBinding.specifier.type !== import_utils22.AST_NODE_TYPES.ImportSpecifier) return null;
2558
2779
  const specifier = importedBinding.specifier;
2559
- const imported = specifier.imported.type === import_utils23.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
2780
+ const imported = specifier.imported.type === import_utils22.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
2560
2781
  const module2 = importedBinding.module;
2561
2782
  if (module2 === "vitest" && (imported === "vi" || imported === "vitest")) return "vitest";
2562
2783
  if (module2 === "@jest/globals" && imported === "jest") return "jest";
@@ -2564,12 +2785,12 @@ function importedTestMockNamespace(source, identifier) {
2564
2785
  }
2565
2786
  function isUnshadowedTestMockGlobal(source, identifier) {
2566
2787
  if (identifier.name !== "vi" && identifier.name !== "jest") return false;
2567
- const binding3 = import_utils23.ASTUtils.findVariable(source.getScope(identifier), identifier.name);
2788
+ const binding3 = import_utils22.ASTUtils.findVariable(source.getScope(identifier), identifier.name);
2568
2789
  return binding3 === null || binding3.defs.length === 0 && !binding3.references.some((reference) => reference.isWrite());
2569
2790
  }
2570
2791
  var TEST_FRAMEWORK_MODULES = /* @__PURE__ */ new Set(["@jest/globals", "@playwright/test", "bun:test", "node:test", "vitest"]);
2571
2792
  function runtimeTestFrameworkName(source, identifier, kind) {
2572
- const binding3 = import_utils23.ASTUtils.findVariable(source.getScope(identifier), identifier.name);
2793
+ const binding3 = import_utils22.ASTUtils.findVariable(source.getScope(identifier), identifier.name);
2573
2794
  if (binding3 === null || binding3.defs.length === 0) {
2574
2795
  return binding3?.references.some((reference) => reference.isWrite()) ? null : identifier.name;
2575
2796
  }
@@ -2577,22 +2798,22 @@ function runtimeTestFrameworkName(source, identifier, kind) {
2577
2798
  if (importedBinding === null) return null;
2578
2799
  const { specifier, module: module2 } = importedBinding;
2579
2800
  const isNodeAssertion = kind === "assertion" && (module2 === "node:assert" || module2 === "node:assert/strict");
2580
- if (specifier.type === import_utils23.AST_NODE_TYPES.ImportSpecifier) {
2801
+ if (specifier.type === import_utils22.AST_NODE_TYPES.ImportSpecifier) {
2581
2802
  if (isNodeAssertion) return "assert";
2582
2803
  if (!TEST_FRAMEWORK_MODULES.has(module2)) return null;
2583
- const imported = specifier.imported.type === import_utils23.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
2804
+ const imported = specifier.imported.type === import_utils22.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
2584
2805
  return imported;
2585
2806
  }
2586
2807
  if (isNodeAssertion) return "assert";
2587
- return kind === "test" && module2 === "node:test" && specifier.type === import_utils23.AST_NODE_TYPES.ImportDefaultSpecifier ? "test" : null;
2808
+ return kind === "test" && module2 === "node:test" && specifier.type === import_utils22.AST_NODE_TYPES.ImportDefaultSpecifier ? "test" : null;
2588
2809
  }
2589
2810
  function runtimeImportBinding(binding3) {
2590
2811
  if (binding3?.defs.length !== 1) return null;
2591
2812
  const definition = binding3.defs[0];
2592
- if (definition?.type !== "ImportBinding" || definition.parent.type !== import_utils23.AST_NODE_TYPES.ImportDeclaration || definition.parent.importKind === "type") return null;
2813
+ if (definition?.type !== "ImportBinding" || definition.parent.type !== import_utils22.AST_NODE_TYPES.ImportDeclaration || definition.parent.importKind === "type") return null;
2593
2814
  const specifier = definition.node;
2594
- if (specifier.type !== import_utils23.AST_NODE_TYPES.ImportSpecifier && specifier.type !== import_utils23.AST_NODE_TYPES.ImportDefaultSpecifier && specifier.type !== import_utils23.AST_NODE_TYPES.ImportNamespaceSpecifier) return null;
2595
- if (specifier.type === import_utils23.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type") return null;
2815
+ if (specifier.type !== import_utils22.AST_NODE_TYPES.ImportSpecifier && specifier.type !== import_utils22.AST_NODE_TYPES.ImportDefaultSpecifier && specifier.type !== import_utils22.AST_NODE_TYPES.ImportNamespaceSpecifier) return null;
2816
+ if (specifier.type === import_utils22.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type") return null;
2596
2817
  return { module: definition.parent.source.value, specifier };
2597
2818
  }
2598
2819
  function vitestFixtureTestName(source, identifier) {
@@ -2600,24 +2821,24 @@ function vitestFixtureTestName(source, identifier) {
2600
2821
  }
2601
2822
  function fixtureTestName(node, source, seen) {
2602
2823
  node = unwrapExpression(node);
2603
- if (node.type === import_utils23.AST_NODE_TYPES.CallExpression) {
2824
+ if (node.type === import_utils22.AST_NODE_TYPES.CallExpression) {
2604
2825
  const callee = unwrapExpression(node.callee);
2605
- return !node.optional && callee.type === import_utils23.AST_NODE_TYPES.MemberExpression && !callee.optional && import_utils23.ASTUtils.getPropertyName(callee) === "extend" && node.arguments.length > 0 && !node.arguments.some((argument) => argument.type === import_utils23.AST_NODE_TYPES.SpreadElement) ? fixtureTestName(callee.object, source, seen) : null;
2826
+ return !node.optional && callee.type === import_utils22.AST_NODE_TYPES.MemberExpression && !callee.optional && import_utils22.ASTUtils.getPropertyName(callee) === "extend" && node.arguments.length > 0 && !node.arguments.some((argument) => argument.type === import_utils22.AST_NODE_TYPES.SpreadElement) ? fixtureTestName(callee.object, source, seen) : null;
2606
2827
  }
2607
- if (node.type !== import_utils23.AST_NODE_TYPES.Identifier) return null;
2608
- const binding3 = import_utils23.ASTUtils.findVariable(source.getScope(node), node.name);
2828
+ if (node.type !== import_utils22.AST_NODE_TYPES.Identifier) return null;
2829
+ const binding3 = import_utils22.ASTUtils.findVariable(source.getScope(node), node.name);
2609
2830
  if (binding3 === null || seen.has(binding3) || !unchangedFixtureApi(binding3)) return null;
2610
2831
  seen.add(binding3);
2611
2832
  const imported = runtimeImportBinding(binding3);
2612
- if (imported?.module === "vitest" && imported.specifier.type === import_utils23.AST_NODE_TYPES.ImportSpecifier) {
2833
+ if (imported?.module === "vitest" && imported.specifier.type === import_utils22.AST_NODE_TYPES.ImportSpecifier) {
2613
2834
  const name = imported.specifier.imported;
2614
- const value = name.type === import_utils23.AST_NODE_TYPES.Identifier ? name.name : name.value;
2835
+ const value = name.type === import_utils22.AST_NODE_TYPES.Identifier ? name.name : name.value;
2615
2836
  return value === "test" || value === "it" ? value : null;
2616
2837
  }
2617
2838
  const definition = binding3.defs[0];
2618
- if (binding3.defs.length !== 1 || definition?.node.type !== import_utils23.AST_NODE_TYPES.VariableDeclarator || definition.node.id.type !== import_utils23.AST_NODE_TYPES.Identifier || definition.node.parent.kind !== "const" || definition.node.init === null || definition.node.init.range[1] > node.range[0]) return null;
2839
+ if (binding3.defs.length !== 1 || definition?.node.type !== import_utils22.AST_NODE_TYPES.VariableDeclarator || definition.node.id.type !== import_utils22.AST_NODE_TYPES.Identifier || definition.node.parent.kind !== "const" || definition.node.init === null || definition.node.init.range[1] > node.range[0]) return null;
2619
2840
  const initializer = unwrapExpression(definition.node.init);
2620
- return initializer.type === import_utils23.AST_NODE_TYPES.CallExpression ? fixtureTestName(initializer, source, seen) : null;
2841
+ return initializer.type === import_utils22.AST_NODE_TYPES.CallExpression ? fixtureTestName(initializer, source, seen) : null;
2621
2842
  }
2622
2843
  var FIXTURE_API_STABILITY = /* @__PURE__ */ new WeakMap();
2623
2844
  function unchangedFixtureApi(binding3) {
@@ -2627,9 +2848,9 @@ function unchangedFixtureApi(binding3) {
2627
2848
  if (reference.isWrite()) return reference.init === true;
2628
2849
  if (reference.isTypeReference && !reference.isValueReference) return true;
2629
2850
  let use = outerExpression(reference.identifier);
2630
- while (use.parent?.type === import_utils23.AST_NODE_TYPES.MemberExpression && use.parent.object === use) use = outerExpression(use.parent);
2851
+ while (use.parent?.type === import_utils22.AST_NODE_TYPES.MemberExpression && use.parent.object === use) use = outerExpression(use.parent);
2631
2852
  const parent = use.parent;
2632
- return parent?.type === import_utils23.AST_NODE_TYPES.CallExpression && parent.callee === use || parent?.type === import_utils23.AST_NODE_TYPES.ExportSpecifier || parent?.type === import_utils23.AST_NODE_TYPES.ExportDefaultDeclaration || parent?.type === import_utils23.AST_NODE_TYPES.TSTypeQuery || parent?.type === import_utils23.AST_NODE_TYPES.UnaryExpression && parent.operator === "typeof";
2853
+ return parent?.type === import_utils22.AST_NODE_TYPES.CallExpression && parent.callee === use || parent?.type === import_utils22.AST_NODE_TYPES.ExportSpecifier || parent?.type === import_utils22.AST_NODE_TYPES.ExportDefaultDeclaration || parent?.type === import_utils22.AST_NODE_TYPES.TSTypeQuery || parent?.type === import_utils22.AST_NODE_TYPES.UnaryExpression && parent.operator === "typeof";
2633
2854
  });
2634
2855
  FIXTURE_API_STABILITY.set(binding3, unchanged);
2635
2856
  return unchanged;
@@ -2659,72 +2880,72 @@ var NO_NEGATIVE_ONLY_HTTP_STATUS_ASSERTION_DOCUMENTATION = {
2659
2880
  ]
2660
2881
  };
2661
2882
  function statusAssertion(source, call) {
2662
- if (call.arguments.length !== 1 || call.arguments[0]?.type !== import_utils24.AST_NODE_TYPES.Literal || typeof call.arguments[0].value !== "number" || call.callee.type !== import_utils24.AST_NODE_TYPES.MemberExpression) return null;
2663
- const matcher = import_utils24.ASTUtils.getPropertyName(call.callee);
2883
+ if (call.arguments.length !== 1 || call.arguments[0]?.type !== import_utils23.AST_NODE_TYPES.Literal || typeof call.arguments[0].value !== "number" || call.callee.type !== import_utils23.AST_NODE_TYPES.MemberExpression) return null;
2884
+ const matcher = import_utils23.ASTUtils.getPropertyName(call.callee);
2664
2885
  if (matcher === null) return null;
2665
2886
  let object = unwrapExpression(call.callee.object);
2666
- const negative = object.type === import_utils24.AST_NODE_TYPES.MemberExpression && import_utils24.ASTUtils.getPropertyName(object) === "not";
2667
- if (negative && object.type === import_utils24.AST_NODE_TYPES.MemberExpression) object = unwrapExpression(object.object);
2668
- if (object.type !== import_utils24.AST_NODE_TYPES.CallExpression || object.arguments.length !== 1 || object.callee.type !== import_utils24.AST_NODE_TYPES.Identifier || runtimeTestFrameworkName(source, object.callee, "assertion") !== "expect") return null;
2887
+ const negative = object.type === import_utils23.AST_NODE_TYPES.MemberExpression && import_utils23.ASTUtils.getPropertyName(object) === "not";
2888
+ if (negative && object.type === import_utils23.AST_NODE_TYPES.MemberExpression) object = unwrapExpression(object.object);
2889
+ if (object.type !== import_utils23.AST_NODE_TYPES.CallExpression || object.arguments.length !== 1 || object.callee.type !== import_utils23.AST_NODE_TYPES.Identifier || runtimeTestFrameworkName(source, object.callee, "assertion") !== "expect") return null;
2669
2890
  const argument = object.arguments[0];
2670
- const response = argument === void 0 || argument.type === import_utils24.AST_NODE_TYPES.SpreadElement ? null : fetchResponse(source, argument);
2891
+ const response = argument === void 0 || argument.type === import_utils23.AST_NODE_TYPES.SpreadElement ? null : fetchResponse(source, argument);
2671
2892
  return response === null ? null : { response, expected: call.arguments[0].value, matcher, negative };
2672
2893
  }
2673
2894
  function fetchResponse(source, value) {
2674
2895
  const node = unwrapExpression(value);
2675
- if (node.type !== import_utils24.AST_NODE_TYPES.MemberExpression || import_utils24.ASTUtils.getPropertyName(node) !== "status" || node.object.type !== import_utils24.AST_NODE_TYPES.Identifier) return null;
2896
+ if (node.type !== import_utils23.AST_NODE_TYPES.MemberExpression || import_utils23.ASTUtils.getPropertyName(node) !== "status" || node.object.type !== import_utils23.AST_NODE_TYPES.Identifier) return null;
2676
2897
  return responseBinding(source, node.object);
2677
2898
  }
2678
2899
  function responseBinding(source, node, seen = /* @__PURE__ */ new Set()) {
2679
- const variable = import_utils24.ASTUtils.findVariable(source.getScope(node), node.name);
2900
+ const variable = import_utils23.ASTUtils.findVariable(source.getScope(node), node.name);
2680
2901
  const definition = variable?.defs[0]?.node;
2681
2902
  if (variable?.defs.length !== 1 || seen.has(variable) || variable.references.some((reference) => reference.isWrite() && !reference.init)) return null;
2682
2903
  seen.add(variable);
2683
2904
  const parameter = variable.defs[0];
2684
- if (parameter?.type === "Parameter" && parameter.name.type === import_utils24.AST_NODE_TYPES.Identifier) {
2905
+ if (parameter?.type === "Parameter" && parameter.name.type === import_utils23.AST_NODE_TYPES.Identifier) {
2685
2906
  const annotation = parameter.name.typeAnnotation?.typeAnnotation;
2686
- return annotation?.type === import_utils24.AST_NODE_TYPES.TSTypeReference && annotation.typeName.type === import_utils24.AST_NODE_TYPES.Identifier && annotation.typeName.name === "Response" && (import_utils24.ASTUtils.findVariable(source.getScope(annotation.typeName), "Response")?.defs.length ?? 0) === 0 ? variable : null;
2907
+ return annotation?.type === import_utils23.AST_NODE_TYPES.TSTypeReference && annotation.typeName.type === import_utils23.AST_NODE_TYPES.Identifier && annotation.typeName.name === "Response" && (import_utils23.ASTUtils.findVariable(source.getScope(annotation.typeName), "Response")?.defs.length ?? 0) === 0 ? variable : null;
2687
2908
  }
2688
- if (definition?.type !== import_utils24.AST_NODE_TYPES.VariableDeclarator || definition.parent.kind !== "const" || definition.init === null) return null;
2909
+ if (definition?.type !== import_utils23.AST_NODE_TYPES.VariableDeclarator || definition.parent.kind !== "const" || definition.init === null) return null;
2689
2910
  let initial = unwrapExpression(definition.init);
2690
- if (initial.type === import_utils24.AST_NODE_TYPES.AwaitExpression) initial = unwrapExpression(initial.argument);
2691
- if (initial.type === import_utils24.AST_NODE_TYPES.Identifier) return responseBinding(source, initial, seen);
2911
+ if (initial.type === import_utils23.AST_NODE_TYPES.AwaitExpression) initial = unwrapExpression(initial.argument);
2912
+ if (initial.type === import_utils23.AST_NODE_TYPES.Identifier) return responseBinding(source, initial, seen);
2692
2913
  return nativeResponse(initial, source) ? variable : null;
2693
2914
  }
2694
2915
  function nativeResponse(initial, source) {
2695
- if (initial.type === import_utils24.AST_NODE_TYPES.NewExpression && initial.callee.type === import_utils24.AST_NODE_TYPES.Identifier && initial.callee.name === "Response" && (import_utils24.ASTUtils.findVariable(source.getScope(initial.callee), "Response")?.defs.length ?? 0) === 0) return true;
2696
- if (initial.type === import_utils24.AST_NODE_TYPES.CallExpression && nativeFetchReference(initial.callee, source)) return true;
2697
- if (initial.type !== import_utils24.AST_NODE_TYPES.CallExpression || initial.callee.type !== import_utils24.AST_NODE_TYPES.Identifier) return false;
2916
+ if (initial.type === import_utils23.AST_NODE_TYPES.NewExpression && initial.callee.type === import_utils23.AST_NODE_TYPES.Identifier && initial.callee.name === "Response" && (import_utils23.ASTUtils.findVariable(source.getScope(initial.callee), "Response")?.defs.length ?? 0) === 0) return true;
2917
+ if (initial.type === import_utils23.AST_NODE_TYPES.CallExpression && nativeFetchReference(initial.callee, source)) return true;
2918
+ if (initial.type !== import_utils23.AST_NODE_TYPES.CallExpression || initial.callee.type !== import_utils23.AST_NODE_TYPES.Identifier) return false;
2698
2919
  const callee = initial.callee;
2699
- const binding3 = import_utils24.ASTUtils.findVariable(source.getScope(callee), callee.name);
2920
+ const binding3 = import_utils23.ASTUtils.findVariable(source.getScope(callee), callee.name);
2700
2921
  if ((binding3?.defs.length ?? 0) === 0) return callee.name === "fetch";
2701
2922
  const imported = binding3?.defs[0];
2702
- if (binding3?.defs.length !== 1 || imported?.type !== "ImportBinding" || imported.parent.type !== import_utils24.AST_NODE_TYPES.ImportDeclaration || imported.parent.importKind === "type" || !FETCH_MODULES.has(imported.parent.source.value)) return false;
2923
+ if (binding3?.defs.length !== 1 || imported?.type !== "ImportBinding" || imported.parent.type !== import_utils23.AST_NODE_TYPES.ImportDeclaration || imported.parent.importKind === "type" || !FETCH_MODULES.has(imported.parent.source.value)) return false;
2703
2924
  const specifier = imported.node;
2704
- if (specifier.type === import_utils24.AST_NODE_TYPES.ImportDefaultSpecifier) return imported.parent.source.value === "node-fetch";
2705
- if (specifier.type !== import_utils24.AST_NODE_TYPES.ImportSpecifier || specifier.importKind === "type") return false;
2706
- const importedName7 = specifier.imported.type === import_utils24.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
2925
+ if (specifier.type === import_utils23.AST_NODE_TYPES.ImportDefaultSpecifier) return imported.parent.source.value === "node-fetch";
2926
+ if (specifier.type !== import_utils23.AST_NODE_TYPES.ImportSpecifier || specifier.importKind === "type") return false;
2927
+ const importedName7 = specifier.imported.type === import_utils23.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
2707
2928
  return importedName7 === "fetch";
2708
2929
  }
2709
2930
  function enclosingTest(source, node) {
2710
2931
  for (let current = node.parent; current != null; current = current.parent) {
2711
- if (current.type === import_utils24.AST_NODE_TYPES.FunctionDeclaration) return null;
2712
- if (current.type !== import_utils24.AST_NODE_TYPES.ArrowFunctionExpression && current.type !== import_utils24.AST_NODE_TYPES.FunctionExpression) continue;
2932
+ if (current.type === import_utils23.AST_NODE_TYPES.FunctionDeclaration) return null;
2933
+ if (current.type !== import_utils23.AST_NODE_TYPES.ArrowFunctionExpression && current.type !== import_utils23.AST_NODE_TYPES.FunctionExpression) continue;
2713
2934
  const registration2 = directArgumentCall(current);
2714
2935
  const callee = registration2?.callee;
2715
- if (callee?.type !== import_utils24.AST_NODE_TYPES.Identifier) return null;
2936
+ if (callee?.type !== import_utils23.AST_NODE_TYPES.Identifier) return null;
2716
2937
  const name = runtimeTestFrameworkName(source, callee, "test") ?? vitestFixtureTestName(source, callee);
2717
2938
  return name === "test" || name === "it" ? current : null;
2718
2939
  }
2719
2940
  return null;
2720
2941
  }
2721
2942
  function hasExactStatus(source, test, response) {
2722
- if (test.body.type !== import_utils24.AST_NODE_TYPES.BlockStatement) return false;
2943
+ if (test.body.type !== import_utils23.AST_NODE_TYPES.BlockStatement) return false;
2723
2944
  return test.body.body.some((statement) => {
2724
- if (statement.type !== import_utils24.AST_NODE_TYPES.ExpressionStatement) return false;
2945
+ if (statement.type !== import_utils23.AST_NODE_TYPES.ExpressionStatement) return false;
2725
2946
  let expression = unwrapExpression(statement.expression);
2726
- if (expression.type === import_utils24.AST_NODE_TYPES.AwaitExpression) expression = unwrapExpression(expression.argument);
2727
- if (expression.type !== import_utils24.AST_NODE_TYPES.CallExpression) return false;
2947
+ if (expression.type === import_utils23.AST_NODE_TYPES.AwaitExpression) expression = unwrapExpression(expression.argument);
2948
+ if (expression.type !== import_utils23.AST_NODE_TYPES.CallExpression) return false;
2728
2949
  const assertion = statusAssertion(source, expression);
2729
2950
  return assertion !== null && assertion.response === response && !assertion.negative && EXACT_MATCHERS.has(assertion.matcher) && Number.isInteger(assertion.expected) && assertion.expected >= HTTP_STATUS_MIN && assertion.expected <= SERVER_ERROR_MAX;
2730
2951
  });
@@ -2755,7 +2976,7 @@ var no_negative_only_http_status_assertion_default = createRule({
2755
2976
  });
2756
2977
 
2757
2978
  // src/rules/prefer-test-fixture-reuse.ts
2758
- var import_utils25 = require("@typescript-eslint/utils");
2979
+ var import_utils24 = require("@typescript-eslint/utils");
2759
2980
  var MAX_DEPTH = 8;
2760
2981
  var FRAMEWORKS = /* @__PURE__ */ new Set(["vitest", "@playwright/test"]);
2761
2982
  var TEST_MODIFIERS = /* @__PURE__ */ new Set(["only", "skip", "concurrent", "sequential"]);
@@ -2777,24 +2998,24 @@ var PREFER_TEST_FIXTURE_REUSE_DOCUMENTATION = {
2777
2998
  ]
2778
2999
  };
2779
3000
  function stableBinding(source, identifier) {
2780
- const variable = import_utils25.ASTUtils.findVariable(source.getScope(identifier), identifier.name);
3001
+ const variable = import_utils24.ASTUtils.findVariable(source.getScope(identifier), identifier.name);
2781
3002
  if (variable?.defs.length !== 1 || variable.references.some((reference) => reference.isWrite() && !reference.init)) return null;
2782
3003
  return variable;
2783
3004
  }
2784
3005
  function constructorBinding(source, node, depth = 0) {
2785
3006
  node = unwrapExpression(node);
2786
- if (node.type !== import_utils25.AST_NODE_TYPES.Identifier || depth >= MAX_DEPTH) return null;
3007
+ if (node.type !== import_utils24.AST_NODE_TYPES.Identifier || depth >= MAX_DEPTH) return null;
2787
3008
  const variable = stableBinding(source, node);
2788
3009
  const definition = variable?.defs[0];
2789
3010
  if (variable === null || definition === void 0) return null;
2790
3011
  if (definition.type === "ClassName") return variable;
2791
- if (definition.type === "ImportBinding" && definition.parent.type === import_utils25.AST_NODE_TYPES.ImportDeclaration && definition.parent.importKind !== "type" && (definition.node.type !== import_utils25.AST_NODE_TYPES.ImportSpecifier || definition.node.importKind !== "type")) return variable;
2792
- if (definition.node.type === import_utils25.AST_NODE_TYPES.VariableDeclarator && definition.node.parent.kind === "const" && definition.node.init !== null && definition.node.range[1] < node.range[0]) return constructorBinding(source, definition.node.init, depth + 1);
3012
+ if (definition.type === "ImportBinding" && definition.parent.type === import_utils24.AST_NODE_TYPES.ImportDeclaration && definition.parent.importKind !== "type" && (definition.node.type !== import_utils24.AST_NODE_TYPES.ImportSpecifier || definition.node.importKind !== "type")) return variable;
3013
+ if (definition.node.type === import_utils24.AST_NODE_TYPES.VariableDeclarator && definition.node.parent.kind === "const" && definition.node.init !== null && definition.node.range[1] < node.range[0]) return constructorBinding(source, definition.node.init, depth + 1);
2793
3014
  return null;
2794
3015
  }
2795
3016
  function fixtureApi(source, expression, depth = 0) {
2796
3017
  const node = unwrapExpression(expression);
2797
- if (node.type !== import_utils25.AST_NODE_TYPES.Identifier || depth >= MAX_DEPTH) return null;
3018
+ if (node.type !== import_utils24.AST_NODE_TYPES.Identifier || depth >= MAX_DEPTH) return null;
2798
3019
  const variable = stableBinding(source, node);
2799
3020
  const definition = variable?.defs[0];
2800
3021
  if (variable === null || definition === void 0) return null;
@@ -2806,35 +3027,35 @@ function fixtureApi(source, expression, depth = 0) {
2806
3027
  }
2807
3028
  function importedFixtureApi(variable) {
2808
3029
  const definition = variable.defs[0];
2809
- if (definition?.type === "ImportBinding" && definition.parent.type === import_utils25.AST_NODE_TYPES.ImportDeclaration && FRAMEWORKS.has(definition.parent.source.value) && definition.parent.importKind !== "type" && definition.node.type === import_utils25.AST_NODE_TYPES.ImportSpecifier && definition.node.importKind !== "type") {
3030
+ if (definition?.type === "ImportBinding" && definition.parent.type === import_utils24.AST_NODE_TYPES.ImportDeclaration && FRAMEWORKS.has(definition.parent.source.value) && definition.parent.importKind !== "type" && definition.node.type === import_utils24.AST_NODE_TYPES.ImportSpecifier && definition.node.importKind !== "type") {
2810
3031
  const imported = definition.node.imported;
2811
- const name = imported.type === import_utils25.AST_NODE_TYPES.Identifier ? imported.name : imported.value;
3032
+ const name = imported.type === import_utils24.AST_NODE_TYPES.Identifier ? imported.name : imported.value;
2812
3033
  return name === "test" || name === "it";
2813
3034
  }
2814
3035
  return false;
2815
3036
  }
2816
3037
  function fixtureExtension(declaration, before) {
2817
- if (declaration.type !== import_utils25.AST_NODE_TYPES.VariableDeclarator || declaration.parent.kind !== "const" || declaration.init === null || declaration.range[1] >= before) return null;
3038
+ if (declaration.type !== import_utils24.AST_NODE_TYPES.VariableDeclarator || declaration.parent.kind !== "const" || declaration.init === null || declaration.range[1] >= before) return null;
2818
3039
  const initial = unwrapExpression(declaration.init);
2819
- if (initial.type !== import_utils25.AST_NODE_TYPES.CallExpression || initial.optional || initial.arguments.length !== 1 || initial.callee.type !== import_utils25.AST_NODE_TYPES.MemberExpression || initial.callee.optional || import_utils25.ASTUtils.getPropertyName(initial.callee) !== "extend") return null;
3040
+ if (initial.type !== import_utils24.AST_NODE_TYPES.CallExpression || initial.optional || initial.arguments.length !== 1 || initial.callee.type !== import_utils24.AST_NODE_TYPES.MemberExpression || initial.callee.optional || import_utils24.ASTUtils.getPropertyName(initial.callee) !== "extend") return null;
2820
3041
  const declarations = initial.arguments[0];
2821
- if (declarations?.type !== import_utils25.AST_NODE_TYPES.ObjectExpression || declarations.properties.some((property) => property.type !== import_utils25.AST_NODE_TYPES.Property || property.computed || property.kind !== "init")) return null;
3042
+ if (declarations?.type !== import_utils24.AST_NODE_TYPES.ObjectExpression || declarations.properties.some((property) => property.type !== import_utils24.AST_NODE_TYPES.Property || property.computed || property.kind !== "init")) return null;
2822
3043
  return { receiver: initial.callee.object, declarations };
2823
3044
  }
2824
3045
  function fixtureApiStable(variable) {
2825
3046
  return !variable.references.some((reference) => {
2826
3047
  if (reference.isWrite() || reference.isTypeReference && !reference.isValueReference) return false;
2827
3048
  let use = reference.identifier;
2828
- while (use.parent?.type === import_utils25.AST_NODE_TYPES.MemberExpression && use.parent.object === use) use = use.parent;
2829
- return use.parent?.type !== import_utils25.AST_NODE_TYPES.CallExpression || use.parent.callee !== use;
3049
+ while (use.parent?.type === import_utils24.AST_NODE_TYPES.MemberExpression && use.parent.object === use) use = use.parent;
3050
+ return use.parent?.type !== import_utils24.AST_NODE_TYPES.CallExpression || use.parent.callee !== use;
2830
3051
  });
2831
3052
  }
2832
3053
  function fixtureConstructors(source, declarations, inherited) {
2833
3054
  const result = new Map(inherited);
2834
3055
  for (const property of declarations.properties) {
2835
- if (property.type !== import_utils25.AST_NODE_TYPES.Property || property.computed || property.value.type === import_utils25.AST_NODE_TYPES.AssignmentPattern) continue;
2836
- const name = import_utils25.ASTUtils.getPropertyName(property);
2837
- if (name === null || property.value.type === import_utils25.AST_NODE_TYPES.TSEmptyBodyFunctionExpression) continue;
3056
+ if (property.type !== import_utils24.AST_NODE_TYPES.Property || property.computed || property.value.type === import_utils24.AST_NODE_TYPES.AssignmentPattern) continue;
3057
+ const name = import_utils24.ASTUtils.getPropertyName(property);
3058
+ if (name === null || property.value.type === import_utils24.AST_NODE_TYPES.TSEmptyBodyFunctionExpression) continue;
2838
3059
  const constructor = fixtureConstructor(source, property.value);
2839
3060
  if (constructor === null) result.delete(name);
2840
3061
  else result.set(name, constructor);
@@ -2843,24 +3064,24 @@ function fixtureConstructors(source, declarations, inherited) {
2843
3064
  }
2844
3065
  function fixtureConstructor(source, value) {
2845
3066
  value = unwrapExpression(value);
2846
- if (value.type !== import_utils25.AST_NODE_TYPES.ArrowFunctionExpression && value.type !== import_utils25.AST_NODE_TYPES.FunctionExpression) return newConstructor(source, value);
3067
+ if (value.type !== import_utils24.AST_NODE_TYPES.ArrowFunctionExpression && value.type !== import_utils24.AST_NODE_TYPES.FunctionExpression) return newConstructor(source, value);
2847
3068
  const use = value.params[1];
2848
- if (use?.type !== import_utils25.AST_NODE_TYPES.Identifier) return null;
3069
+ if (use?.type !== import_utils24.AST_NODE_TYPES.Identifier) return null;
2849
3070
  const binding3 = stableBinding(source, use);
2850
- const calls = scopeNodes(value.body, source).filter((node) => node.type === import_utils25.AST_NODE_TYPES.CallExpression && !node.optional && node.arguments.length === 1 && node.callee.type === import_utils25.AST_NODE_TYPES.Identifier && stableBinding(source, node.callee) === binding3);
3071
+ const calls = scopeNodes(value.body, source).filter((node) => node.type === import_utils24.AST_NODE_TYPES.CallExpression && !node.optional && node.arguments.length === 1 && node.callee.type === import_utils24.AST_NODE_TYPES.Identifier && stableBinding(source, node.callee) === binding3);
2851
3072
  if (calls.length !== 1 || binding3 === null) return null;
2852
3073
  const argument = calls[0]?.arguments[0];
2853
- return argument === void 0 || argument.type === import_utils25.AST_NODE_TYPES.SpreadElement ? null : newConstructor(source, argument);
3074
+ return argument === void 0 || argument.type === import_utils24.AST_NODE_TYPES.SpreadElement ? null : newConstructor(source, argument);
2854
3075
  }
2855
3076
  function newConstructor(source, expression) {
2856
3077
  const value = unwrapExpression(expression);
2857
- if (value.type === import_utils25.AST_NODE_TYPES.NewExpression) return constructorBinding(source, value.callee);
2858
- if (value.type !== import_utils25.AST_NODE_TYPES.Identifier) return null;
3078
+ if (value.type === import_utils24.AST_NODE_TYPES.NewExpression) return constructorBinding(source, value.callee);
3079
+ if (value.type !== import_utils24.AST_NODE_TYPES.Identifier) return null;
2859
3080
  const variable = stableBinding(source, value);
2860
3081
  const declaration = variable?.defs[0]?.node;
2861
- if (declaration?.type !== import_utils25.AST_NODE_TYPES.VariableDeclarator || declaration.parent.kind !== "const" || declaration.init === null || declaration.range[1] >= value.range[0]) return null;
3082
+ if (declaration?.type !== import_utils24.AST_NODE_TYPES.VariableDeclarator || declaration.parent.kind !== "const" || declaration.init === null || declaration.range[1] >= value.range[0]) return null;
2862
3083
  const initial = unwrapExpression(declaration.init);
2863
- return initial.type === import_utils25.AST_NODE_TYPES.NewExpression ? constructorBinding(source, initial.callee) : null;
3084
+ return initial.type === import_utils24.AST_NODE_TYPES.NewExpression ? constructorBinding(source, initial.callee) : null;
2864
3085
  }
2865
3086
  function scopeNodes(root, source) {
2866
3087
  const result = [];
@@ -2869,7 +3090,7 @@ function scopeNodes(root, source) {
2869
3090
  const node = pending.pop();
2870
3091
  if (node === void 0) continue;
2871
3092
  result.push(node);
2872
- if (node !== root && (node.type === import_utils25.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils25.AST_NODE_TYPES.FunctionExpression || node.type === import_utils25.AST_NODE_TYPES.FunctionDeclaration || node.type === import_utils25.AST_NODE_TYPES.ClassDeclaration || node.type === import_utils25.AST_NODE_TYPES.ClassExpression)) continue;
3093
+ if (node !== root && (node.type === import_utils24.AST_NODE_TYPES.ArrowFunctionExpression || node.type === import_utils24.AST_NODE_TYPES.FunctionExpression || node.type === import_utils24.AST_NODE_TYPES.FunctionDeclaration || node.type === import_utils24.AST_NODE_TYPES.ClassDeclaration || node.type === import_utils24.AST_NODE_TYPES.ClassExpression)) continue;
2873
3094
  for (const key of source.visitorKeys[node.type] ?? []) {
2874
3095
  const value = Reflect.get(node, key);
2875
3096
  if (Array.isArray(value)) pending.push(...value.filter(isNode2));
@@ -2883,13 +3104,13 @@ function isNode2(value) {
2883
3104
  }
2884
3105
  function testApiCallee(expression) {
2885
3106
  let node = unwrapExpression(expression);
2886
- while (node.type === import_utils25.AST_NODE_TYPES.MemberExpression && !node.optional && TEST_MODIFIERS.has(import_utils25.ASTUtils.getPropertyName(node) ?? "")) node = unwrapExpression(node.object);
3107
+ while (node.type === import_utils24.AST_NODE_TYPES.MemberExpression && !node.optional && TEST_MODIFIERS.has(import_utils24.ASTUtils.getPropertyName(node) ?? "")) node = unwrapExpression(node.object);
2887
3108
  return node;
2888
3109
  }
2889
3110
  function requestingFunction(node) {
2890
3111
  for (let current = node.parent; current != null; current = current.parent) {
2891
- if (current.type === import_utils25.AST_NODE_TYPES.ArrowFunctionExpression || current.type === import_utils25.AST_NODE_TYPES.FunctionExpression) return current;
2892
- if (current.type === import_utils25.AST_NODE_TYPES.FunctionDeclaration) return null;
3112
+ if (current.type === import_utils24.AST_NODE_TYPES.ArrowFunctionExpression || current.type === import_utils24.AST_NODE_TYPES.FunctionExpression) return current;
3113
+ if (current.type === import_utils24.AST_NODE_TYPES.FunctionDeclaration) return null;
2893
3114
  }
2894
3115
  return null;
2895
3116
  }
@@ -2911,13 +3132,13 @@ var prefer_test_fixture_reuse_default = createRule({
2911
3132
  const call = functionNode === null ? null : directArgumentCall(functionNode);
2912
3133
  if (functionNode === null || call === null) return;
2913
3134
  const parameter = functionNode.params[0];
2914
- if (parameter?.type !== import_utils25.AST_NODE_TYPES.ObjectPattern) return;
3135
+ if (parameter?.type !== import_utils24.AST_NODE_TYPES.ObjectPattern) return;
2915
3136
  const entries = fixtureApi(context.sourceCode, testApiCallee(call.callee));
2916
3137
  const constructor = constructorBinding(context.sourceCode, node.callee);
2917
3138
  if (entries === null || constructor === null) return;
2918
3139
  for (const property of parameter.properties) {
2919
- if (property.type !== import_utils25.AST_NODE_TYPES.Property || property.computed) continue;
2920
- const name = import_utils25.ASTUtils.getPropertyName(property);
3140
+ if (property.type !== import_utils24.AST_NODE_TYPES.Property || property.computed) continue;
3141
+ const name = import_utils24.ASTUtils.getPropertyName(property);
2921
3142
  if (name !== null && entries.get(name) === constructor) {
2922
3143
  context.report({ node, messageId: "reuseFixture", data: { fixture: name } });
2923
3144
  return;
@@ -2929,7 +3150,7 @@ var prefer_test_fixture_reuse_default = createRule({
2929
3150
  });
2930
3151
 
2931
3152
  // src/rules/no-return-disposed-resource.ts
2932
- var import_utils26 = require("@typescript-eslint/utils");
3153
+ var import_utils25 = require("@typescript-eslint/utils");
2933
3154
  var NO_RETURN_DISPOSED_RESOURCE_DOCUMENTATION = {
2934
3155
  defaultLevel: "warning",
2935
3156
  summary: "Do not return a resource whose using declaration disposes it before the caller receives it.",
@@ -2949,16 +3170,16 @@ var NO_RETURN_DISPOSED_RESOURCE_DOCUMENTATION = {
2949
3170
  };
2950
3171
  function owningFunction(node) {
2951
3172
  for (let current = node.parent; current != null; current = current.parent) {
2952
- if (current.type === import_utils26.AST_NODE_TYPES.FunctionDeclaration || current.type === import_utils26.AST_NODE_TYPES.FunctionExpression || current.type === import_utils26.AST_NODE_TYPES.ArrowFunctionExpression) return current;
3173
+ if (current.type === import_utils25.AST_NODE_TYPES.FunctionDeclaration || current.type === import_utils25.AST_NODE_TYPES.FunctionExpression || current.type === import_utils25.AST_NODE_TYPES.ArrowFunctionExpression) return current;
2953
3174
  }
2954
3175
  return null;
2955
3176
  }
2956
3177
  function resourceOwner(source, value, seen = /* @__PURE__ */ new Set()) {
2957
3178
  const node = unwrapExpression(value);
2958
- if (node.type !== import_utils26.AST_NODE_TYPES.Identifier) return null;
2959
- const variable = import_utils26.ASTUtils.findVariable(source.getScope(node), node.name);
3179
+ if (node.type !== import_utils25.AST_NODE_TYPES.Identifier) return null;
3180
+ const variable = import_utils25.ASTUtils.findVariable(source.getScope(node), node.name);
2960
3181
  const definition = variable?.defs[0];
2961
- if (variable === null || variable?.defs.length !== 1 || definition === void 0 || seen.has(variable) || variable.references.some((reference) => reference.isWrite() && !reference.init) || definition.node.type !== import_utils26.AST_NODE_TYPES.VariableDeclarator) return null;
3182
+ if (variable === null || variable?.defs.length !== 1 || definition === void 0 || seen.has(variable) || variable.references.some((reference) => reference.isWrite() && !reference.init) || definition.node.type !== import_utils25.AST_NODE_TYPES.VariableDeclarator) return null;
2962
3183
  const declaration = definition.node;
2963
3184
  if (declaration.parent.kind === "using" || declaration.parent.kind === "await using") return declaration;
2964
3185
  if (declaration.parent.kind !== "const" || declaration.init === null || declaration.range[1] >= node.range[0]) return null;
@@ -2987,7 +3208,7 @@ var no_return_disposed_resource_default = createRule({
2987
3208
  });
2988
3209
 
2989
3210
  // src/rules/require-jwt-lifetime.ts
2990
- var import_utils27 = require("@typescript-eslint/utils");
3211
+ var import_utils26 = require("@typescript-eslint/utils");
2991
3212
  var REQUIRE_JWT_LIFETIME_DOCUMENTATION = {
2992
3213
  defaultLevel: "warning",
2993
3214
  summary: "Require an expiration claim or a maximum token age when returning a verified JWT.",
@@ -3015,36 +3236,36 @@ var require_jwt_lifetime_default = createRule({
3015
3236
  function inspect(input) {
3016
3237
  if (input === null) return;
3017
3238
  let node = unwrapExpression(input);
3018
- if (node.type === import_utils27.AST_NODE_TYPES.AwaitExpression) node = unwrapExpression(node.argument);
3019
- if (node.type !== import_utils27.AST_NODE_TYPES.CallExpression || !isVerifier(node.callee)) return;
3239
+ if (node.type === import_utils26.AST_NODE_TYPES.AwaitExpression) node = unwrapExpression(node.argument);
3240
+ if (node.type !== import_utils26.AST_NODE_TYPES.CallExpression || !isVerifier(node.callee)) return;
3020
3241
  if (!missingLifetime(node.arguments[2])) return;
3021
3242
  context.report({ node, messageId: "lifetime" });
3022
3243
  }
3023
3244
  function isVerifier(node) {
3024
3245
  node = unwrapExpression(node);
3025
- if (node.type === import_utils27.AST_NODE_TYPES.Identifier) {
3026
- const variable = import_utils27.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
3246
+ if (node.type === import_utils26.AST_NODE_TYPES.Identifier) {
3247
+ const variable = import_utils26.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
3027
3248
  const declaration = variable?.defs[0]?.node;
3028
- return variable?.defs.length === 1 && declaration?.type === import_utils27.AST_NODE_TYPES.ImportSpecifier && declaration.parent.type === import_utils27.AST_NODE_TYPES.ImportDeclaration && declaration.importKind !== "type" && declaration.parent.importKind !== "type" && declaration.parent.source.value === "jose" && declaration.imported.type === import_utils27.AST_NODE_TYPES.Identifier && declaration.imported.name === "jwtVerify";
3249
+ return variable?.defs.length === 1 && declaration?.type === import_utils26.AST_NODE_TYPES.ImportSpecifier && declaration.parent.type === import_utils26.AST_NODE_TYPES.ImportDeclaration && declaration.importKind !== "type" && declaration.parent.importKind !== "type" && declaration.parent.source.value === "jose" && declaration.imported.type === import_utils26.AST_NODE_TYPES.Identifier && declaration.imported.name === "jwtVerify";
3029
3250
  }
3030
- if (node.type !== import_utils27.AST_NODE_TYPES.MemberExpression || import_utils27.ASTUtils.getPropertyName(node) !== "jwtVerify" || node.object.type !== import_utils27.AST_NODE_TYPES.Identifier) return false;
3031
- const definition = import_utils27.ASTUtils.findVariable(sourceCode.getScope(node.object), node.object.name)?.defs[0]?.node;
3032
- return definition?.type === import_utils27.AST_NODE_TYPES.ImportNamespaceSpecifier && definition.parent.importKind !== "type" && definition.parent.source.value === "jose";
3251
+ if (node.type !== import_utils26.AST_NODE_TYPES.MemberExpression || import_utils26.ASTUtils.getPropertyName(node) !== "jwtVerify" || node.object.type !== import_utils26.AST_NODE_TYPES.Identifier) return false;
3252
+ const definition = import_utils26.ASTUtils.findVariable(sourceCode.getScope(node.object), node.object.name)?.defs[0]?.node;
3253
+ return definition?.type === import_utils26.AST_NODE_TYPES.ImportNamespaceSpecifier && definition.parent.importKind !== "type" && definition.parent.source.value === "jose";
3033
3254
  }
3034
3255
  function missingLifetime(options) {
3035
3256
  if (options === void 0) return true;
3036
- if (options.type !== import_utils27.AST_NODE_TYPES.ObjectExpression || options.properties.some((property) => property.type !== import_utils27.AST_NODE_TYPES.Property || property.computed)) return false;
3037
- return !options.properties.some((property) => property.type === import_utils27.AST_NODE_TYPES.Property && lifetimeProperty(property));
3257
+ if (options.type !== import_utils26.AST_NODE_TYPES.ObjectExpression || options.properties.some((property) => property.type !== import_utils26.AST_NODE_TYPES.Property || property.computed)) return false;
3258
+ return !options.properties.some((property) => property.type === import_utils26.AST_NODE_TYPES.Property && lifetimeProperty(property));
3038
3259
  }
3039
3260
  function lifetimeProperty(property) {
3040
- const name = property.key.type === import_utils27.AST_NODE_TYPES.Identifier ? property.key.name : property.key.type === import_utils27.AST_NODE_TYPES.Literal ? property.key.value : null;
3261
+ const name = property.key.type === import_utils26.AST_NODE_TYPES.Identifier ? property.key.name : property.key.type === import_utils26.AST_NODE_TYPES.Literal ? property.key.value : null;
3041
3262
  if (name === "maxTokenAge") {
3042
- if (property.value.type !== import_utils27.AST_NODE_TYPES.Literal) return true;
3263
+ if (property.value.type !== import_utils26.AST_NODE_TYPES.Literal) return true;
3043
3264
  return typeof property.value.value === "number" && Number.isFinite(property.value.value) || typeof property.value.value === "string" && property.value.value.trim() !== "";
3044
3265
  }
3045
3266
  if (name !== "requiredClaims") return false;
3046
- if (property.value.type !== import_utils27.AST_NODE_TYPES.ArrayExpression || property.value.elements.some((element) => element?.type !== import_utils27.AST_NODE_TYPES.Literal)) return true;
3047
- return property.value.elements.some((element) => element?.type === import_utils27.AST_NODE_TYPES.Literal && element.value === "exp");
3267
+ if (property.value.type !== import_utils26.AST_NODE_TYPES.ArrayExpression || property.value.elements.some((element) => element?.type !== import_utils26.AST_NODE_TYPES.Literal)) return true;
3268
+ return property.value.elements.some((element) => element?.type === import_utils26.AST_NODE_TYPES.Literal && element.value === "exp");
3048
3269
  }
3049
3270
  return {
3050
3271
  ReturnStatement(node) {
@@ -3058,7 +3279,7 @@ var require_jwt_lifetime_default = createRule({
3058
3279
  });
3059
3280
 
3060
3281
  // src/rules/no-discarded-validation-result.ts
3061
- var import_utils28 = require("@typescript-eslint/utils");
3282
+ var import_utils27 = require("@typescript-eslint/utils");
3062
3283
 
3063
3284
  // src/rules/_zod.ts
3064
3285
  var ZOD_SCHEMA_NAME_RE = /Schema$|^Z[A-Z]/;
@@ -3094,52 +3315,52 @@ var no_discarded_validation_result_default = createRule({
3094
3315
  function schema(node, depth = 0) {
3095
3316
  if (depth > 24) return null;
3096
3317
  node = unwrapExpression(node);
3097
- if (node.type === import_utils28.AST_NODE_TYPES.Identifier) {
3098
- const variable = import_utils28.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
3318
+ if (node.type === import_utils27.AST_NODE_TYPES.Identifier) {
3319
+ const variable = import_utils27.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
3099
3320
  const definition = variable?.defs[0]?.node;
3100
3321
  if (variable?.defs.length !== 1) return null;
3101
- if (definition?.type === import_utils28.AST_NODE_TYPES.ImportSpecifier && definition.parent.type === import_utils28.AST_NODE_TYPES.ImportDeclaration && definition.importKind !== "type" && definition.parent.importKind !== "type" && isZodModule(definition.parent.source.value)) return { changed: false };
3102
- if (definition?.type === import_utils28.AST_NODE_TYPES.ImportNamespaceSpecifier && definition.parent.importKind !== "type" && isZodModule(definition.parent.source.value)) return { changed: false };
3103
- if (definition?.type === import_utils28.AST_NODE_TYPES.VariableDeclarator && definition.parent.kind === "const" && definition.init !== null && definition.range[1] < node.range[0] && !variable.references.some((reference) => reference.isWrite() && !reference.init)) return schema(definition.init, depth + 1);
3322
+ if (definition?.type === import_utils27.AST_NODE_TYPES.ImportSpecifier && definition.parent.type === import_utils27.AST_NODE_TYPES.ImportDeclaration && definition.importKind !== "type" && definition.parent.importKind !== "type" && isZodModule(definition.parent.source.value)) return { changed: false };
3323
+ if (definition?.type === import_utils27.AST_NODE_TYPES.ImportNamespaceSpecifier && definition.parent.importKind !== "type" && isZodModule(definition.parent.source.value)) return { changed: false };
3324
+ if (definition?.type === import_utils27.AST_NODE_TYPES.VariableDeclarator && definition.parent.kind === "const" && definition.init !== null && definition.range[1] < node.range[0] && !variable.references.some((reference) => reference.isWrite() && !reference.init)) return schema(definition.init, depth + 1);
3104
3325
  return null;
3105
3326
  }
3106
- if (node.type === import_utils28.AST_NODE_TYPES.MemberExpression) {
3327
+ if (node.type === import_utils27.AST_NODE_TYPES.MemberExpression) {
3107
3328
  const owner2 = schema(node.object, depth + 1);
3108
3329
  return owner2;
3109
3330
  }
3110
- if (node.type !== import_utils28.AST_NODE_TYPES.CallExpression) return null;
3331
+ if (node.type !== import_utils27.AST_NODE_TYPES.CallExpression) return null;
3111
3332
  const owner = schema(node.callee, depth + 1);
3112
3333
  if (owner === null) return null;
3113
- const invokedChange = node.callee.type === import_utils28.AST_NODE_TYPES.MemberExpression && CHANGING.has(import_utils28.ASTUtils.getPropertyName(node.callee) ?? "");
3114
- const coerced = node.callee.type === import_utils28.AST_NODE_TYPES.MemberExpression && coercionNamespace(node.callee.object);
3334
+ const invokedChange = node.callee.type === import_utils27.AST_NODE_TYPES.MemberExpression && CHANGING.has(import_utils27.ASTUtils.getPropertyName(node.callee) ?? "");
3335
+ const coerced = node.callee.type === import_utils27.AST_NODE_TYPES.MemberExpression && coercionNamespace(node.callee.object);
3115
3336
  const changedArgument = node.arguments.some((argument) => {
3116
- if (argument.type === import_utils28.AST_NODE_TYPES.ArrayExpression) return argument.elements.some((element) => element !== null && schema(element, depth + 1)?.changed === true);
3117
- if (argument.type === import_utils28.AST_NODE_TYPES.ObjectExpression) return argument.properties.some((property) => property.type === import_utils28.AST_NODE_TYPES.Property && schema(property.value, depth + 1)?.changed === true);
3337
+ if (argument.type === import_utils27.AST_NODE_TYPES.ArrayExpression) return argument.elements.some((element) => element !== null && schema(element, depth + 1)?.changed === true);
3338
+ if (argument.type === import_utils27.AST_NODE_TYPES.ObjectExpression) return argument.properties.some((property) => property.type === import_utils27.AST_NODE_TYPES.Property && schema(property.value, depth + 1)?.changed === true);
3118
3339
  return schema(argument, depth + 1)?.changed === true;
3119
3340
  });
3120
3341
  return { changed: owner.changed || invokedChange || coerced || changedArgument };
3121
3342
  }
3122
3343
  function coercionNamespace(node) {
3123
3344
  let namespace = false;
3124
- if (node.type === import_utils28.AST_NODE_TYPES.MemberExpression && import_utils28.ASTUtils.getPropertyName(node) === "coerce") {
3345
+ if (node.type === import_utils27.AST_NODE_TYPES.MemberExpression && import_utils27.ASTUtils.getPropertyName(node) === "coerce") {
3125
3346
  namespace = true;
3126
3347
  node = node.object;
3127
3348
  }
3128
- if (node.type !== import_utils28.AST_NODE_TYPES.Identifier) return false;
3129
- const variable = import_utils28.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
3349
+ if (node.type !== import_utils27.AST_NODE_TYPES.Identifier) return false;
3350
+ const variable = import_utils27.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
3130
3351
  const definition = variable?.defs[0]?.node;
3131
- if (variable?.defs.length !== 1 || definition === void 0 || definition.parent.type !== import_utils28.AST_NODE_TYPES.ImportDeclaration || definition.parent.importKind === "type" || !isZodModule(definition.parent.source.value)) return false;
3132
- if (definition.type === import_utils28.AST_NODE_TYPES.ImportNamespaceSpecifier) return namespace;
3133
- if (definition.type !== import_utils28.AST_NODE_TYPES.ImportSpecifier || definition.importKind === "type") return false;
3134
- const name = definition.imported.type === import_utils28.AST_NODE_TYPES.Identifier ? definition.imported.name : definition.imported.value;
3352
+ if (variable?.defs.length !== 1 || definition === void 0 || definition.parent.type !== import_utils27.AST_NODE_TYPES.ImportDeclaration || definition.parent.importKind === "type" || !isZodModule(definition.parent.source.value)) return false;
3353
+ if (definition.type === import_utils27.AST_NODE_TYPES.ImportNamespaceSpecifier) return namespace;
3354
+ if (definition.type !== import_utils27.AST_NODE_TYPES.ImportSpecifier || definition.importKind === "type") return false;
3355
+ const name = definition.imported.type === import_utils27.AST_NODE_TYPES.Identifier ? definition.imported.name : definition.imported.value;
3135
3356
  return namespace ? name === "z" : name === "coerce";
3136
3357
  }
3137
3358
  return {
3138
3359
  ExpressionStatement(statement) {
3139
3360
  let expression = unwrapExpression(statement.expression);
3140
- if (expression.type === import_utils28.AST_NODE_TYPES.AwaitExpression) expression = unwrapExpression(expression.argument);
3141
- if (expression.type !== import_utils28.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils28.AST_NODE_TYPES.MemberExpression) return;
3142
- const method = import_utils28.ASTUtils.getPropertyName(expression.callee);
3361
+ if (expression.type === import_utils27.AST_NODE_TYPES.AwaitExpression) expression = unwrapExpression(expression.argument);
3362
+ if (expression.type !== import_utils27.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils27.AST_NODE_TYPES.MemberExpression) return;
3363
+ const method = import_utils27.ASTUtils.getPropertyName(expression.callee);
3143
3364
  if (!(/* @__PURE__ */ new Set(["parse", "parseAsync", "safeParse", "safeParseAsync"])).has(method ?? "")) return;
3144
3365
  const owner = schema(expression.callee.object);
3145
3366
  if (owner !== null && (owner.changed || method?.startsWith("safe") === true)) context.report({ node: expression, messageId: "discarded" });
@@ -3149,7 +3370,7 @@ var no_discarded_validation_result_default = createRule({
3149
3370
  });
3150
3371
 
3151
3372
  // src/rules/production-derived-test-cases.ts
3152
- var import_utils29 = require("@typescript-eslint/utils");
3373
+ var import_utils28 = require("@typescript-eslint/utils");
3153
3374
  var MEMBERSHIP = /(?:^|_)(?:ALLOWED|ELIGIBLE|REQUIRED|SUPPORTED)(?:_|$)/u;
3154
3375
  var SUPPORT_PATH = /(?:^|[/_.-])(?:tests?|fixtures?|fakes?|mocks?|stubs?|__tests__)(?:[/_.-]|$)/u;
3155
3376
  var PRODUCTION_DERIVED_TEST_CASES_DOCUMENTATION = {
@@ -3184,52 +3405,52 @@ var production_derived_test_cases_default = createRule({
3184
3405
  const tables = [];
3185
3406
  const asserted = /* @__PURE__ */ new Set();
3186
3407
  function binding3(node) {
3187
- return import_utils29.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
3408
+ return import_utils28.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
3188
3409
  }
3189
3410
  function importedName7(node, module2) {
3190
3411
  const variable = binding3(node);
3191
3412
  const specifier = variable?.defs[0]?.node;
3192
- if (variable?.defs.length !== 1 || specifier?.type !== import_utils29.AST_NODE_TYPES.ImportSpecifier || specifier.importKind === "type" || specifier.parent.type !== import_utils29.AST_NODE_TYPES.ImportDeclaration || specifier.parent.importKind === "type" || specifier.parent.source.value !== module2 || variable.references.some((reference) => reference.isWrite())) return null;
3193
- return specifier.imported.type === import_utils29.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
3413
+ if (variable?.defs.length !== 1 || specifier?.type !== import_utils28.AST_NODE_TYPES.ImportSpecifier || specifier.importKind === "type" || specifier.parent.type !== import_utils28.AST_NODE_TYPES.ImportDeclaration || specifier.parent.importKind === "type" || specifier.parent.source.value !== module2 || variable.references.some((reference) => reference.isWrite())) return null;
3414
+ return specifier.imported.type === import_utils28.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
3194
3415
  }
3195
3416
  function production(node) {
3196
3417
  node = unwrapExpression(node);
3197
- if (node.type !== import_utils29.AST_NODE_TYPES.Identifier) return null;
3418
+ if (node.type !== import_utils28.AST_NODE_TYPES.Identifier) return null;
3198
3419
  const variable = binding3(node);
3199
3420
  const specifier = variable?.defs[0]?.node;
3200
- if (variable?.defs.length !== 1 || specifier?.type !== import_utils29.AST_NODE_TYPES.ImportSpecifier || specifier.importKind === "type" || specifier.parent.type !== import_utils29.AST_NODE_TYPES.ImportDeclaration || specifier.parent.importKind === "type" || !specifier.parent.source.value.startsWith(".") || SUPPORT_PATH.test(specifier.parent.source.value) || variable.references.some((reference) => reference.isWrite())) return null;
3201
- const name = specifier.imported.type === import_utils29.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
3421
+ if (variable?.defs.length !== 1 || specifier?.type !== import_utils28.AST_NODE_TYPES.ImportSpecifier || specifier.importKind === "type" || specifier.parent.type !== import_utils28.AST_NODE_TYPES.ImportDeclaration || specifier.parent.importKind === "type" || !specifier.parent.source.value.startsWith(".") || SUPPORT_PATH.test(specifier.parent.source.value) || variable.references.some((reference) => reference.isWrite())) return null;
3422
+ const name = specifier.imported.type === import_utils28.AST_NODE_TYPES.Identifier ? specifier.imported.name : specifier.imported.value;
3202
3423
  return MEMBERSHIP.test(name) && !name.endsWith("REGISTRY") ? variable : null;
3203
3424
  }
3204
3425
  function runner(node) {
3205
3426
  node = unwrapExpression(node);
3206
- while (node.type === import_utils29.AST_NODE_TYPES.MemberExpression && ["only", "skip", "concurrent", "sequential"].includes(import_utils29.ASTUtils.getPropertyName(node) ?? "")) node = unwrapExpression(node.object);
3207
- if (node.type !== import_utils29.AST_NODE_TYPES.Identifier) return false;
3427
+ while (node.type === import_utils28.AST_NODE_TYPES.MemberExpression && ["only", "skip", "concurrent", "sequential"].includes(import_utils28.ASTUtils.getPropertyName(node) ?? "")) node = unwrapExpression(node.object);
3428
+ if (node.type !== import_utils28.AST_NODE_TYPES.Identifier) return false;
3208
3429
  const name = importedName7(node, "vitest");
3209
3430
  return name === "test" || name === "it" || vitestFixtureTestName(sourceCode, node) !== null;
3210
3431
  }
3211
3432
  function caseTable(node) {
3212
- return node.type === import_utils29.AST_NODE_TYPES.CallExpression && node.callee.type === import_utils29.AST_NODE_TYPES.MemberExpression && ["each", "for"].includes(import_utils29.ASTUtils.getPropertyName(node.callee) ?? "") && runner(node.callee.object);
3433
+ return node.type === import_utils28.AST_NODE_TYPES.CallExpression && node.callee.type === import_utils28.AST_NODE_TYPES.MemberExpression && ["each", "for"].includes(import_utils28.ASTUtils.getPropertyName(node.callee) ?? "") && runner(node.callee.object);
3213
3434
  }
3214
3435
  function literalTable(node, seen = /* @__PURE__ */ new Set()) {
3215
3436
  node = unwrapExpression(node);
3216
3437
  if (seen.has(node)) return false;
3217
3438
  seen.add(node);
3218
- if (node.type === import_utils29.AST_NODE_TYPES.Identifier) {
3439
+ if (node.type === import_utils28.AST_NODE_TYPES.Identifier) {
3219
3440
  const variable = binding3(node);
3220
3441
  const definition = variable?.defs[0]?.node;
3221
- return variable?.defs.length === 1 && definition?.type === import_utils29.AST_NODE_TYPES.VariableDeclarator && definition.parent.kind === "const" && definition.init !== null && definition.range[1] < node.range[0] && variable.references.every((reference) => reference.init || !reference.isWrite() && reference.identifier.parent.type === import_utils29.AST_NODE_TYPES.CallExpression && (caseTable(reference.identifier.parent) || reference.identifier.parent.callee.type === import_utils29.AST_NODE_TYPES.Identifier && importedName7(reference.identifier.parent.callee, "vitest") === "expect" || reference.identifier.parent.callee.type === import_utils29.AST_NODE_TYPES.MemberExpression && ["toEqual", "toStrictEqual"].includes(import_utils29.ASTUtils.getPropertyName(reference.identifier.parent.callee) ?? ""))) && literalTable(definition.init, seen);
3442
+ return variable?.defs.length === 1 && definition?.type === import_utils28.AST_NODE_TYPES.VariableDeclarator && definition.parent.kind === "const" && definition.init !== null && definition.range[1] < node.range[0] && variable.references.every((reference) => reference.init || !reference.isWrite() && reference.identifier.parent.type === import_utils28.AST_NODE_TYPES.CallExpression && (caseTable(reference.identifier.parent) || reference.identifier.parent.callee.type === import_utils28.AST_NODE_TYPES.Identifier && importedName7(reference.identifier.parent.callee, "vitest") === "expect" || reference.identifier.parent.callee.type === import_utils28.AST_NODE_TYPES.MemberExpression && ["toEqual", "toStrictEqual"].includes(import_utils28.ASTUtils.getPropertyName(reference.identifier.parent.callee) ?? ""))) && literalTable(definition.init, seen);
3222
3443
  }
3223
- return node.type === import_utils29.AST_NODE_TYPES.ArrayExpression && node.elements.every((element) => element?.type === import_utils29.AST_NODE_TYPES.Literal && !("regex" in element));
3444
+ return node.type === import_utils28.AST_NODE_TYPES.ArrayExpression && node.elements.every((element) => element?.type === import_utils28.AST_NODE_TYPES.Literal && !("regex" in element));
3224
3445
  }
3225
3446
  function unconditional(node) {
3226
3447
  const statement = node.parent;
3227
- if (statement.type !== import_utils29.AST_NODE_TYPES.ExpressionStatement) return false;
3228
- if (statement.parent.type === import_utils29.AST_NODE_TYPES.Program) return true;
3448
+ if (statement.type !== import_utils28.AST_NODE_TYPES.ExpressionStatement) return false;
3449
+ if (statement.parent.type === import_utils28.AST_NODE_TYPES.Program) return true;
3229
3450
  const block = statement.parent;
3230
- if (block.type !== import_utils29.AST_NODE_TYPES.BlockStatement || block.parent.type !== import_utils29.AST_NODE_TYPES.ArrowFunctionExpression && block.parent.type !== import_utils29.AST_NODE_TYPES.FunctionExpression) return false;
3451
+ if (block.type !== import_utils28.AST_NODE_TYPES.BlockStatement || block.parent.type !== import_utils28.AST_NODE_TYPES.ArrowFunctionExpression && block.parent.type !== import_utils28.AST_NODE_TYPES.FunctionExpression) return false;
3231
3452
  const call = block.parent.parent;
3232
- return call.type === import_utils29.AST_NODE_TYPES.CallExpression && runner(call.callee);
3453
+ return call.type === import_utils28.AST_NODE_TYPES.CallExpression && runner(call.callee);
3233
3454
  }
3234
3455
  return {
3235
3456
  CallExpression(node) {
@@ -3237,9 +3458,9 @@ var production_derived_test_cases_default = createRule({
3237
3458
  const variable2 = production(node.arguments[0]);
3238
3459
  if (variable2 !== null) tables.push({ node, variable: variable2 });
3239
3460
  }
3240
- if (node.callee.type !== import_utils29.AST_NODE_TYPES.MemberExpression || !["toEqual", "toStrictEqual"].includes(import_utils29.ASTUtils.getPropertyName(node.callee) ?? "") || node.arguments.length !== 1 || node.arguments[0] === void 0 || !literalTable(node.arguments[0]) || !unconditional(node)) return;
3461
+ if (node.callee.type !== import_utils28.AST_NODE_TYPES.MemberExpression || !["toEqual", "toStrictEqual"].includes(import_utils28.ASTUtils.getPropertyName(node.callee) ?? "") || node.arguments.length !== 1 || node.arguments[0] === void 0 || !literalTable(node.arguments[0]) || !unconditional(node)) return;
3241
3462
  const expect = node.callee.object;
3242
- if (expect.type !== import_utils29.AST_NODE_TYPES.CallExpression || expect.callee.type !== import_utils29.AST_NODE_TYPES.Identifier || importedName7(expect.callee, "vitest") !== "expect" || expect.arguments.length !== 1 || expect.arguments[0] === void 0) return;
3463
+ if (expect.type !== import_utils28.AST_NODE_TYPES.CallExpression || expect.callee.type !== import_utils28.AST_NODE_TYPES.Identifier || importedName7(expect.callee, "vitest") !== "expect" || expect.arguments.length !== 1 || expect.arguments[0] === void 0) return;
3243
3464
  const variable = production(expect.arguments[0]);
3244
3465
  if (variable !== null) asserted.add(variable);
3245
3466
  },
@@ -3251,14 +3472,14 @@ var production_derived_test_cases_default = createRule({
3251
3472
  });
3252
3473
 
3253
3474
  // src/rules/require-constrained-schema-integer.ts
3254
- var import_utils30 = require("@typescript-eslint/utils");
3475
+ var import_utils29 = require("@typescript-eslint/utils");
3255
3476
  var FIELD_MINIMUMS = /* @__PURE__ */ new Map([["limit", 1], ["version", 0]]);
3256
3477
  var NUMBER_FACTORIES = /* @__PURE__ */ new Set(["number", "int", "int32", "uint32"]);
3257
3478
  var PRESERVING = /* @__PURE__ */ new Set(["optional", "nullable", "nullish", "default", "catch", "readonly", "brand", "describe", "meta", "max", "lte", "lt", "finite", "safe", "multipleOf"]);
3258
3479
  function numericLiteral(node) {
3259
3480
  node = unwrapExpression(node);
3260
- if (node.type === import_utils30.AST_NODE_TYPES.Literal && typeof node.value === "number") return node.value;
3261
- if (node.type === import_utils30.AST_NODE_TYPES.UnaryExpression && (node.operator === "-" || node.operator === "+")) {
3481
+ if (node.type === import_utils29.AST_NODE_TYPES.Literal && typeof node.value === "number") return node.value;
3482
+ if (node.type === import_utils29.AST_NODE_TYPES.UnaryExpression && (node.operator === "-" || node.operator === "+")) {
3262
3483
  const value = numericLiteral(node.argument);
3263
3484
  return value === null ? null : node.operator === "-" ? -value : value;
3264
3485
  }
@@ -3295,35 +3516,35 @@ var require_constrained_schema_integer_default = createRule({
3295
3516
  const sourceCode = context.sourceCode;
3296
3517
  function factory(node) {
3297
3518
  node = unwrapExpression(node);
3298
- if (node.type === import_utils30.AST_NODE_TYPES.Identifier) {
3519
+ if (node.type === import_utils29.AST_NODE_TYPES.Identifier) {
3299
3520
  const definition2 = imported(node);
3300
- return definition2?.type === import_utils30.AST_NODE_TYPES.ImportSpecifier ? definition2.imported.type === import_utils30.AST_NODE_TYPES.Identifier ? definition2.imported.name : definition2.imported.value : null;
3521
+ return definition2?.type === import_utils29.AST_NODE_TYPES.ImportSpecifier ? definition2.imported.type === import_utils29.AST_NODE_TYPES.Identifier ? definition2.imported.name : definition2.imported.value : null;
3301
3522
  }
3302
- if (node.type !== import_utils30.AST_NODE_TYPES.MemberExpression) return null;
3523
+ if (node.type !== import_utils29.AST_NODE_TYPES.MemberExpression) return null;
3303
3524
  let receiver = unwrapExpression(node.object);
3304
- if (receiver.type === import_utils30.AST_NODE_TYPES.MemberExpression && import_utils30.ASTUtils.getPropertyName(receiver) === "coerce") receiver = unwrapExpression(receiver.object);
3305
- if (receiver.type !== import_utils30.AST_NODE_TYPES.Identifier) return null;
3525
+ if (receiver.type === import_utils29.AST_NODE_TYPES.MemberExpression && import_utils29.ASTUtils.getPropertyName(receiver) === "coerce") receiver = unwrapExpression(receiver.object);
3526
+ if (receiver.type !== import_utils29.AST_NODE_TYPES.Identifier) return null;
3306
3527
  const definition = imported(receiver);
3307
- if (definition === null || definition.type === import_utils30.AST_NODE_TYPES.ImportSpecifier && (definition.imported.type === import_utils30.AST_NODE_TYPES.Identifier ? definition.imported.name : definition.imported.value) !== "z") return null;
3308
- return import_utils30.ASTUtils.getPropertyName(node);
3528
+ if (definition === null || definition.type === import_utils29.AST_NODE_TYPES.ImportSpecifier && (definition.imported.type === import_utils29.AST_NODE_TYPES.Identifier ? definition.imported.name : definition.imported.value) !== "z") return null;
3529
+ return import_utils29.ASTUtils.getPropertyName(node);
3309
3530
  }
3310
3531
  function imported(identifier) {
3311
- const variable = import_utils30.ASTUtils.findVariable(sourceCode.getScope(identifier), identifier.name);
3532
+ const variable = import_utils29.ASTUtils.findVariable(sourceCode.getScope(identifier), identifier.name);
3312
3533
  const definition = variable?.defs[0]?.node;
3313
- if (variable?.defs.length !== 1 || definition?.type !== import_utils30.AST_NODE_TYPES.ImportSpecifier && definition?.type !== import_utils30.AST_NODE_TYPES.ImportNamespaceSpecifier || definition.parent.type !== import_utils30.AST_NODE_TYPES.ImportDeclaration || definition.parent.importKind === "type" || !isZodModule(definition.parent.source.value)) return null;
3314
- return definition.type === import_utils30.AST_NODE_TYPES.ImportSpecifier && definition.importKind === "type" ? null : definition;
3534
+ if (variable?.defs.length !== 1 || definition?.type !== import_utils29.AST_NODE_TYPES.ImportSpecifier && definition?.type !== import_utils29.AST_NODE_TYPES.ImportNamespaceSpecifier || definition.parent.type !== import_utils29.AST_NODE_TYPES.ImportDeclaration || definition.parent.importKind === "type" || !isZodModule(definition.parent.source.value)) return null;
3535
+ return definition.type === import_utils29.AST_NODE_TYPES.ImportSpecifier && definition.importKind === "type" ? null : definition;
3315
3536
  }
3316
3537
  function constrained(value, minimum) {
3317
3538
  const calls = [];
3318
3539
  value = unwrapExpression(value);
3319
- while (value.type === import_utils30.AST_NODE_TYPES.CallExpression) {
3540
+ while (value.type === import_utils29.AST_NODE_TYPES.CallExpression) {
3320
3541
  const name = factory(value.callee);
3321
3542
  if (name !== null) {
3322
3543
  return chainContract(name, calls, minimum);
3323
3544
  }
3324
3545
  const callee = unwrapExpression(value.callee);
3325
- if (callee.type !== import_utils30.AST_NODE_TYPES.MemberExpression) return null;
3326
- const method = import_utils30.ASTUtils.getPropertyName(callee);
3546
+ if (callee.type !== import_utils29.AST_NODE_TYPES.MemberExpression) return null;
3547
+ const method = import_utils29.ASTUtils.getPropertyName(callee);
3327
3548
  if (method === null) return null;
3328
3549
  calls.push({ method, call: value });
3329
3550
  value = unwrapExpression(callee.object);
@@ -3348,7 +3569,7 @@ var require_constrained_schema_integer_default = createRule({
3348
3569
  }
3349
3570
  function lowerBound(call, minimum, exclusive) {
3350
3571
  const argument = call.arguments[0];
3351
- if (argument === void 0 || argument.type === import_utils30.AST_NODE_TYPES.SpreadElement) return null;
3572
+ if (argument === void 0 || argument.type === import_utils29.AST_NODE_TYPES.SpreadElement) return null;
3352
3573
  const bound = numericLiteral(argument);
3353
3574
  return bound === null || bound >= minimum - (exclusive ? 1 : 0);
3354
3575
  }
@@ -3357,10 +3578,10 @@ var require_constrained_schema_integer_default = createRule({
3357
3578
  const name = factory(node.callee);
3358
3579
  if (name === null || !["object", "strictObject", "looseObject"].includes(name) || node.arguments.length !== 1) return;
3359
3580
  const shape = node.arguments[0];
3360
- if (shape?.type !== import_utils30.AST_NODE_TYPES.ObjectExpression) return;
3581
+ if (shape?.type !== import_utils29.AST_NODE_TYPES.ObjectExpression) return;
3361
3582
  for (const property of shape.properties) {
3362
- if (property.type !== import_utils30.AST_NODE_TYPES.Property || property.computed || property.kind !== "init" || property.method) continue;
3363
- const field = import_utils30.ASTUtils.getPropertyName(property);
3583
+ if (property.type !== import_utils29.AST_NODE_TYPES.Property || property.computed || property.kind !== "init" || property.method) continue;
3584
+ const field = import_utils29.ASTUtils.getPropertyName(property);
3364
3585
  const minimum = field === null ? void 0 : FIELD_MINIMUMS.get(field);
3365
3586
  if (minimum === void 0 || field === null || constrained(property.value, minimum) !== false) continue;
3366
3587
  context.report({ node: property, messageId: "constrainInteger", data: { field, minimum } });
@@ -3371,7 +3592,7 @@ var require_constrained_schema_integer_default = createRule({
3371
3592
  });
3372
3593
 
3373
3594
  // src/rules/no-generic-json-parser.ts
3374
- var import_utils31 = require("@typescript-eslint/utils");
3595
+ var import_utils30 = require("@typescript-eslint/utils");
3375
3596
  var OPEN_FACTORIES = /* @__PURE__ */ new Set(["any", "unknown", "json", "record", "partialRecord"]);
3376
3597
  var WRAPPERS = /* @__PURE__ */ new Set(["optional", "nullable", "nullish", "default", "catch", "readonly", "brand", "describe", "meta"]);
3377
3598
  var NO_GENERIC_JSON_PARSER_DOCUMENTATION = {
@@ -3404,60 +3625,60 @@ var no_generic_json_parser_default = createRule({
3404
3625
  if (isGeneratedFile(context, context.sourceCode.text)) return {};
3405
3626
  const sourceCode = context.sourceCode;
3406
3627
  function binding3(node) {
3407
- return import_utils31.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
3628
+ return import_utils30.ASTUtils.findVariable(sourceCode.getScope(node), node.name);
3408
3629
  }
3409
3630
  function initializer(node) {
3410
3631
  const variable = binding3(node);
3411
3632
  const definition = variable?.defs[0];
3412
- if (variable?.defs.length !== 1 || definition?.node.type !== import_utils31.AST_NODE_TYPES.VariableDeclarator || definition.node.parent.kind !== "const" || definition.node.init === null || definition.node.range[1] >= node.range[0] || variable.references.some((reference) => reference.isWrite() && !reference.init)) return null;
3633
+ if (variable?.defs.length !== 1 || definition?.node.type !== import_utils30.AST_NODE_TYPES.VariableDeclarator || definition.node.parent.kind !== "const" || definition.node.init === null || definition.node.range[1] >= node.range[0] || variable.references.some((reference) => reference.isWrite() && !reference.init)) return null;
3413
3634
  return definition.node.init;
3414
3635
  }
3415
3636
  function parser(node, seen = /* @__PURE__ */ new Set(), awaited = false) {
3416
3637
  node = unwrapExpression(node);
3417
3638
  if (seen.has(node)) return null;
3418
3639
  seen.add(node);
3419
- if (node.type === import_utils31.AST_NODE_TYPES.AwaitExpression) return parser(node.argument, seen, true);
3420
- if (node.type === import_utils31.AST_NODE_TYPES.Identifier) {
3640
+ if (node.type === import_utils30.AST_NODE_TYPES.AwaitExpression) return parser(node.argument, seen, true);
3641
+ if (node.type === import_utils30.AST_NODE_TYPES.Identifier) {
3421
3642
  const value = initializer(node);
3422
3643
  return value === null ? null : parser(value, seen, awaited);
3423
3644
  }
3424
- if (node.type !== import_utils31.AST_NODE_TYPES.CallExpression || node.callee.type !== import_utils31.AST_NODE_TYPES.MemberExpression || !["parse", "parseAsync"].includes(import_utils31.ASTUtils.getPropertyName(node.callee) ?? "")) return null;
3425
- if (import_utils31.ASTUtils.getPropertyName(node.callee) === "parseAsync" && !awaited) return null;
3645
+ if (node.type !== import_utils30.AST_NODE_TYPES.CallExpression || node.callee.type !== import_utils30.AST_NODE_TYPES.MemberExpression || !["parse", "parseAsync"].includes(import_utils30.ASTUtils.getPropertyName(node.callee) ?? "")) return null;
3646
+ if (import_utils30.ASTUtils.getPropertyName(node.callee) === "parseAsync" && !awaited) return null;
3426
3647
  return openSchema(node.callee.object) ? node : null;
3427
3648
  }
3428
3649
  function openSchema(node, seen = /* @__PURE__ */ new Set()) {
3429
3650
  node = unwrapExpression(node);
3430
3651
  if (seen.has(node)) return false;
3431
3652
  seen.add(node);
3432
- if (node.type === import_utils31.AST_NODE_TYPES.Identifier) {
3653
+ if (node.type === import_utils30.AST_NODE_TYPES.Identifier) {
3433
3654
  const value = initializer(node);
3434
3655
  return value !== null && openSchema(value, seen);
3435
3656
  }
3436
- if (node.type !== import_utils31.AST_NODE_TYPES.CallExpression) return false;
3657
+ if (node.type !== import_utils30.AST_NODE_TYPES.CallExpression) return false;
3437
3658
  const name = factory(node.callee);
3438
3659
  if (name !== null) return OPEN_FACTORIES.has(name);
3439
3660
  const callee = unwrapExpression(node.callee);
3440
- return callee.type === import_utils31.AST_NODE_TYPES.MemberExpression && WRAPPERS.has(import_utils31.ASTUtils.getPropertyName(callee) ?? "") && openSchema(callee.object, seen);
3661
+ return callee.type === import_utils30.AST_NODE_TYPES.MemberExpression && WRAPPERS.has(import_utils30.ASTUtils.getPropertyName(callee) ?? "") && openSchema(callee.object, seen);
3441
3662
  }
3442
3663
  function factory(node) {
3443
3664
  node = unwrapExpression(node);
3444
- if (node.type === import_utils31.AST_NODE_TYPES.Identifier) {
3665
+ if (node.type === import_utils30.AST_NODE_TYPES.Identifier) {
3445
3666
  const definition2 = binding3(node)?.defs[0]?.node;
3446
- if (definition2?.type !== import_utils31.AST_NODE_TYPES.ImportSpecifier || definition2.parent.type !== import_utils31.AST_NODE_TYPES.ImportDeclaration || definition2.importKind === "type" || definition2.parent.importKind === "type" || !isZodModule(definition2.parent.source.value)) return null;
3447
- return definition2.imported.type === import_utils31.AST_NODE_TYPES.Identifier ? definition2.imported.name : definition2.imported.value;
3667
+ if (definition2?.type !== import_utils30.AST_NODE_TYPES.ImportSpecifier || definition2.parent.type !== import_utils30.AST_NODE_TYPES.ImportDeclaration || definition2.importKind === "type" || definition2.parent.importKind === "type" || !isZodModule(definition2.parent.source.value)) return null;
3668
+ return definition2.imported.type === import_utils30.AST_NODE_TYPES.Identifier ? definition2.imported.name : definition2.imported.value;
3448
3669
  }
3449
- if (node.type !== import_utils31.AST_NODE_TYPES.MemberExpression) return null;
3670
+ if (node.type !== import_utils30.AST_NODE_TYPES.MemberExpression) return null;
3450
3671
  const receiver = unwrapExpression(node.object);
3451
- if (receiver.type !== import_utils31.AST_NODE_TYPES.Identifier) return null;
3672
+ if (receiver.type !== import_utils30.AST_NODE_TYPES.Identifier) return null;
3452
3673
  const definition = binding3(receiver)?.defs[0]?.node;
3453
- if (definition === void 0 || definition.type !== import_utils31.AST_NODE_TYPES.ImportSpecifier && definition.type !== import_utils31.AST_NODE_TYPES.ImportNamespaceSpecifier || definition.parent.type !== import_utils31.AST_NODE_TYPES.ImportDeclaration || definition.parent.importKind === "type" || !isZodModule(definition.parent.source.value)) return null;
3454
- if (definition.type === import_utils31.AST_NODE_TYPES.ImportSpecifier && (definition.importKind === "type" || (definition.imported.type === import_utils31.AST_NODE_TYPES.Identifier ? definition.imported.name : definition.imported.value) !== "z")) return null;
3455
- return import_utils31.ASTUtils.getPropertyName(node);
3674
+ if (definition === void 0 || definition.type !== import_utils30.AST_NODE_TYPES.ImportSpecifier && definition.type !== import_utils30.AST_NODE_TYPES.ImportNamespaceSpecifier || definition.parent.type !== import_utils30.AST_NODE_TYPES.ImportDeclaration || definition.parent.importKind === "type" || !isZodModule(definition.parent.source.value)) return null;
3675
+ if (definition.type === import_utils30.AST_NODE_TYPES.ImportSpecifier && (definition.importKind === "type" || (definition.imported.type === import_utils30.AST_NODE_TYPES.Identifier ? definition.imported.name : definition.imported.value) !== "z")) return null;
3676
+ return import_utils30.ASTUtils.getPropertyName(node);
3456
3677
  }
3457
3678
  const reported = /* @__PURE__ */ new Set();
3458
3679
  return {
3459
3680
  MemberExpression(node) {
3460
- const field = import_utils31.ASTUtils.getPropertyName(node);
3681
+ const field = import_utils30.ASTUtils.getPropertyName(node);
3461
3682
  if (field === null) return;
3462
3683
  const call = parser(node.object);
3463
3684
  if (call === null || reported.has(call)) return;
@@ -3466,10 +3687,160 @@ var no_generic_json_parser_default = createRule({
3466
3687
  }
3467
3688
  };
3468
3689
  }
3469
- });
3690
+ });
3691
+
3692
+ // src/rules/no-redundant-local-alias.ts
3693
+ var import_utils33 = require("@typescript-eslint/utils");
3694
+
3695
+ // src/rules/_unused-private-binding.ts
3696
+ var import_utils32 = require("@typescript-eslint/utils");
3697
+
3698
+ // src/rules/_type-binding.ts
3699
+ var import_utils31 = require("@typescript-eslint/utils");
3700
+ function typeBinding(source, identifier) {
3701
+ let scope = source.getScope(identifier);
3702
+ while (scope !== null) {
3703
+ const variable = scope.set.get(identifier.name);
3704
+ if (variable !== void 0 && (variable.isTypeVariable || variable.defs.some((definition) => definition.isTypeDefinition))) {
3705
+ return variable;
3706
+ }
3707
+ scope = scope.upper;
3708
+ }
3709
+ return null;
3710
+ }
3711
+ var REFERENCE_INDEXES = /* @__PURE__ */ new WeakMap();
3712
+ function retainsNamedTypeUses(source, removed) {
3713
+ const manager = source.scopeManager;
3714
+ if (manager === null) return false;
3715
+ const index = referenceIndex(source, manager);
3716
+ for (const reference of referencesWithin(index.references, removed)) {
3717
+ if (!reference.isRead()) continue;
3718
+ const binding3 = reference.resolved;
3719
+ if (!binding3 || !reference.isTypeReference && !reference.isValueReference) return false;
3720
+ if (binding3.defs.length === 0) continue;
3721
+ const reads = publicReadExtents(index, binding3);
3722
+ const extent = reference.isTypeReference ? reference.isValueReference ? reads.both : reads.type : reads.value;
3723
+ if (extent === null || extent.minStart >= removed.range[0] && extent.maxEnd <= removed.range[1]) return false;
3724
+ }
3725
+ return true;
3726
+ }
3727
+ function referenceIndex(source, manager) {
3728
+ const cached = REFERENCE_INDEXES.get(source);
3729
+ if (cached?.manager === manager) return cached;
3730
+ const references = manager.scopes.flatMap((scope) => scope.references);
3731
+ references.sort((left, right) => left.identifier.range[0] - right.identifier.range[0]);
3732
+ const index = { manager, references, publicReads: /* @__PURE__ */ new Map() };
3733
+ REFERENCE_INDEXES.set(source, index);
3734
+ return index;
3735
+ }
3736
+ function* referencesWithin(references, removed) {
3737
+ let low = 0;
3738
+ let high = references.length;
3739
+ while (low < high) {
3740
+ const middle = low + Math.floor((high - low) / 2);
3741
+ const reference = references[middle];
3742
+ if (reference === void 0 || reference.identifier.range[0] >= removed.range[0]) high = middle;
3743
+ else low = middle + 1;
3744
+ }
3745
+ for (let index = low; index < references.length; index++) {
3746
+ const reference = references[index];
3747
+ if (reference === void 0) continue;
3748
+ if (reference.identifier.range[0] > removed.range[1]) break;
3749
+ if (insideTypeRange(reference.identifier, removed)) yield reference;
3750
+ }
3751
+ }
3752
+ function publicReadExtents(index, binding3) {
3753
+ const cached = index.publicReads.get(binding3);
3754
+ if (cached !== void 0) return cached;
3755
+ let type = null;
3756
+ let value = null;
3757
+ let both = null;
3758
+ for (const retained of binding3.references) {
3759
+ if (!retained.isRead() || !retained.isTypeReference && !retained.isValueReference || binding3.defs.some((definition) => insideTypeRange(retained.identifier, definition.node)) || !publicTypeUse(retained.identifier)) continue;
3760
+ if (retained.isTypeReference) type = extendExtent(type, retained.identifier);
3761
+ if (retained.isValueReference) value = extendExtent(value, retained.identifier);
3762
+ if (retained.isTypeReference && retained.isValueReference) both = extendExtent(both, retained.identifier);
3763
+ }
3764
+ const result = { type, value, both };
3765
+ index.publicReads.set(binding3, result);
3766
+ return result;
3767
+ }
3768
+ function extendExtent(extent, identifier) {
3769
+ return {
3770
+ minStart: Math.min(extent?.minStart ?? identifier.range[0], identifier.range[0]),
3771
+ maxEnd: Math.max(extent?.maxEnd ?? identifier.range[1], identifier.range[1])
3772
+ };
3773
+ }
3774
+ function publicTypeUse(identifier) {
3775
+ let node = identifier;
3776
+ while (node.parent) {
3777
+ if (node.type === import_utils31.AST_NODE_TYPES.TSTypeAnnotation || node.type === import_utils31.AST_NODE_TYPES.TSTypePredicate || node.type === import_utils31.AST_NODE_TYPES.TSAsExpression || node.type === import_utils31.AST_NODE_TYPES.TSTypeAssertion) return false;
3778
+ if (node.type === import_utils31.AST_NODE_TYPES.TSTypeAliasDeclaration) {
3779
+ return node.parent.type === import_utils31.AST_NODE_TYPES.ExportNamedDeclaration && node.parent.declaration === node && node.parent.parent.type === import_utils31.AST_NODE_TYPES.Program;
3780
+ }
3781
+ if (node.type === import_utils31.AST_NODE_TYPES.ExportSpecifier) {
3782
+ return node.parent.type === import_utils31.AST_NODE_TYPES.ExportNamedDeclaration && node.parent.source === null && node.parent.parent.type === import_utils31.AST_NODE_TYPES.Program;
3783
+ }
3784
+ node = node.parent;
3785
+ }
3786
+ return false;
3787
+ }
3788
+ function insideTypeRange(node, range) {
3789
+ return node.range[0] >= range.range[0] && node.range[1] <= range.range[1];
3790
+ }
3791
+
3792
+ // src/rules/_unused-private-binding.ts
3793
+ function isUnusedPrivateBinding(sourceCode, declaration, identifier, filename, allowedDeclarations = [declaration]) {
3794
+ if (/\.d\.[cm]?ts$/u.test(filename)) return false;
3795
+ const bindings = sourceCode.getDeclaredVariables(declaration).filter((binding3) => binding3.name === identifier.name);
3796
+ if (bindings.length === 0 || bindings.some((binding3) => binding3.defs.length !== allowedDeclarations.length || binding3.defs.some((definition) => !allowedDeclarations.includes(definition.node)) || binding3.eslintUsed || binding3.references.some((reference) => reference.isRead() || reference.init !== true))) return false;
3797
+ if (hasIdentifierNamed(sourceCode.ast, "eval")) return false;
3798
+ const statement = declaration.type === import_utils32.AST_NODE_TYPES.VariableDeclarator ? declaration.parent : declaration;
3799
+ if (statement.parent.type === import_utils32.AST_NODE_TYPES.ExportNamedDeclaration || statement.parent.type === import_utils32.AST_NODE_TYPES.ExportDefaultDeclaration) return false;
3800
+ if (statement.parent.type !== import_utils32.AST_NODE_TYPES.Program) return statement.parent.type === import_utils32.AST_NODE_TYPES.BlockStatement;
3801
+ return sourceCode.ast.body.some((node) => node.type === import_utils32.AST_NODE_TYPES.ImportDeclaration || node.type === import_utils32.AST_NODE_TYPES.ExportNamedDeclaration || node.type === import_utils32.AST_NODE_TYPES.ExportDefaultDeclaration || node.type === import_utils32.AST_NODE_TYPES.ExportAllDeclaration);
3802
+ }
3803
+ function hasOnlyDirectFactoryUses(variable) {
3804
+ return variable.references.every((reference) => {
3805
+ if (reference.isTypeReference && !reference.isValueReference) return true;
3806
+ const identifier = reference.identifier;
3807
+ const parent = identifier.parent;
3808
+ if (parent.type === import_utils32.AST_NODE_TYPES.CallExpression && parent.callee === identifier) return true;
3809
+ return parent.type === import_utils32.AST_NODE_TYPES.MemberExpression && parent.object === identifier && !parent.computed && parent.parent.type === import_utils32.AST_NODE_TYPES.CallExpression && parent.parent.callee === parent;
3810
+ });
3811
+ }
3812
+ var IDENTIFIER_NAMES = /* @__PURE__ */ new WeakMap();
3813
+ function hasIdentifierNamed(node, name) {
3814
+ let names = IDENTIFIER_NAMES.get(node);
3815
+ if (names === void 0) {
3816
+ const collected = /* @__PURE__ */ new Set();
3817
+ const pending = [node];
3818
+ const seen = /* @__PURE__ */ new WeakSet();
3819
+ while (pending.length > 0) {
3820
+ const current = pending.pop();
3821
+ if (current === void 0 || seen.has(current)) continue;
3822
+ seen.add(current);
3823
+ if (current.type === import_utils32.AST_NODE_TYPES.Identifier || current.type === import_utils32.AST_NODE_TYPES.JSXIdentifier) collected.add(current.name);
3824
+ forEachOwnAstChild(current, (child) => {
3825
+ pending.push(child);
3826
+ }, (key) => key !== "tokens" && key !== "comments");
3827
+ }
3828
+ names = collected;
3829
+ IDENTIFIER_NAMES.set(node, names);
3830
+ }
3831
+ return names.has(name);
3832
+ }
3833
+ function privatePredicateBooleanFix(sourceCode, node, annotation, filename) {
3834
+ if (!annotation.typeAnnotation || !retainsNamedTypeUses(sourceCode, annotation.typeAnnotation) || node.type !== import_utils32.AST_NODE_TYPES.FunctionDeclaration || node.id === null || !isUnusedPrivateBinding(sourceCode, node, node.id, filename) || sourceCode.getCommentsInside(annotation).length > 0) return null;
3835
+ const text = `boolean${sourceCode.getText(annotation).replace(/[^\r\n\u2028\u2029]/gu, "")}`;
3836
+ const neighbor = Math.max(0, annotation.range[0] - 1);
3837
+ const before = sourceCode.text.slice(neighbor, annotation.range[1] + 1).match(/\r\n|[\r\n\u2028\u2029]/gu) ?? [];
3838
+ const after = (sourceCode.text.slice(neighbor, annotation.range[0]) + text + sourceCode.text.slice(annotation.range[1], annotation.range[1] + 1)).match(/\r\n|[\r\n\u2028\u2029]/gu) ?? [];
3839
+ if (before.length !== after.length || before.some((ending, index) => ending !== after[index])) return null;
3840
+ return (fixer) => fixer.replaceText(annotation, text);
3841
+ }
3470
3842
 
3471
3843
  // src/rules/no-redundant-local-alias.ts
3472
- var import_utils32 = require("@typescript-eslint/utils");
3473
3844
  var NO_REDUNDANT_LOCAL_ALIAS_DOCUMENTATION = {
3474
3845
  defaultLevel: "warning",
3475
3846
  summary: "Pass the original local into an object field instead of creating a single-use rename.",
@@ -3491,24 +3862,24 @@ var NO_REDUNDANT_LOCAL_ALIAS_DOCUMENTATION = {
3491
3862
  function stableSource(variable, alias) {
3492
3863
  const definition = variable.defs[0];
3493
3864
  if (variable.defs.length !== 1 || definition === void 0 || variable.references.some((reference) => reference.isWrite() && !reference.init)) return false;
3494
- return definition.type === "Parameter" || definition.node.type === import_utils32.AST_NODE_TYPES.VariableDeclarator && definition.node.parent.kind === "const" && definition.node.init !== null && definition.node.range[1] < alias.range[0];
3865
+ return definition.type === "Parameter" || definition.node.type === import_utils33.AST_NODE_TYPES.VariableDeclarator && definition.node.parent.kind === "const" && definition.node.init !== null && definition.node.range[1] < alias.range[0];
3495
3866
  }
3496
3867
  var PRIMITIVE_PARAMETERS = /* @__PURE__ */ new Set([
3497
- import_utils32.AST_NODE_TYPES.TSStringKeyword,
3498
- import_utils32.AST_NODE_TYPES.TSNumberKeyword,
3499
- import_utils32.AST_NODE_TYPES.TSBooleanKeyword,
3500
- import_utils32.AST_NODE_TYPES.TSBigIntKeyword,
3501
- import_utils32.AST_NODE_TYPES.TSSymbolKeyword
3868
+ import_utils33.AST_NODE_TYPES.TSStringKeyword,
3869
+ import_utils33.AST_NODE_TYPES.TSNumberKeyword,
3870
+ import_utils33.AST_NODE_TYPES.TSBooleanKeyword,
3871
+ import_utils33.AST_NODE_TYPES.TSBigIntKeyword,
3872
+ import_utils33.AST_NODE_TYPES.TSSymbolKeyword
3502
3873
  ]);
3503
3874
  function closedPrimitiveReturnFix(sourceCode, node, property, source, target) {
3504
3875
  const statement = node.parent;
3505
3876
  const body3 = statement.parent;
3506
- if (body3.type !== import_utils32.AST_NODE_TYPES.BlockStatement) return null;
3877
+ if (body3.type !== import_utils33.AST_NODE_TYPES.BlockStatement) return null;
3507
3878
  const owner = body3.parent;
3508
- if (owner.type !== import_utils32.AST_NODE_TYPES.FunctionDeclaration || owner.parent.type !== import_utils32.AST_NODE_TYPES.Program || owner.id === null || owner.async || owner.generator || owner.typeParameters !== void 0 || owner.returnType !== void 0 || owner.params.length !== 1 || body3.body.length !== 2 || body3.body[0] !== statement || node.id.type !== import_utils32.AST_NODE_TYPES.Identifier || node.id.name === "__proto__" || node.init?.type !== import_utils32.AST_NODE_TYPES.Identifier || sourceCode.getCommentsInside(owner).length !== 0 || hasIdentifierNamed(sourceCode.ast, "eval")) return null;
3879
+ if (owner.type !== import_utils33.AST_NODE_TYPES.FunctionDeclaration || owner.parent.type !== import_utils33.AST_NODE_TYPES.Program || owner.id === null || owner.async || owner.generator || owner.typeParameters !== void 0 || owner.returnType !== void 0 || owner.params.length !== 1 || body3.body.length !== 2 || body3.body[0] !== statement || node.id.type !== import_utils33.AST_NODE_TYPES.Identifier || node.id.name === "__proto__" || node.init?.type !== import_utils33.AST_NODE_TYPES.Identifier || sourceCode.getCommentsInside(owner).length !== 0 || hasIdentifierNamed(sourceCode.ast, "eval")) return null;
3509
3880
  const parameter = owner.params[0];
3510
3881
  const returned2 = body3.body[1];
3511
- if (parameter?.type !== import_utils32.AST_NODE_TYPES.Identifier || parameter.optional === true || parameter.typeAnnotation === void 0 || !PRIMITIVE_PARAMETERS.has(parameter.typeAnnotation.typeAnnotation.type) || returned2?.type !== import_utils32.AST_NODE_TYPES.ReturnStatement || returned2.argument !== property.parent || property.parent.type !== import_utils32.AST_NODE_TYPES.ObjectExpression || property.parent.properties.length !== 1 || import_utils32.ASTUtils.findVariable(sourceCode.getScope(parameter), parameter.name) !== source || import_utils32.ASTUtils.findVariable(sourceCode.getScope(property), node.init.name) !== source || source.references.some((reference) => reference.isTypeReference) || target.references.some((reference) => reference.isTypeReference)) return null;
3882
+ if (parameter?.type !== import_utils33.AST_NODE_TYPES.Identifier || parameter.optional === true || parameter.typeAnnotation === void 0 || !PRIMITIVE_PARAMETERS.has(parameter.typeAnnotation.typeAnnotation.type) || returned2?.type !== import_utils33.AST_NODE_TYPES.ReturnStatement || returned2.argument !== property.parent || property.parent.type !== import_utils33.AST_NODE_TYPES.ObjectExpression || property.parent.properties.length !== 1 || import_utils33.ASTUtils.findVariable(sourceCode.getScope(parameter), parameter.name) !== source || import_utils33.ASTUtils.findVariable(sourceCode.getScope(property), node.init.name) !== source || source.references.some((reference) => reference.isTypeReference) || target.references.some((reference) => reference.isTypeReference)) return null;
3512
3883
  const name = owner.id.name;
3513
3884
  const bindings = sourceCode.getDeclaredVariables(owner).filter((binding3) => binding3.name === name);
3514
3885
  if (bindings.length !== 1 || bindings[0]?.defs.length !== 1 || bindings[0].defs[0]?.node !== owner || bindings[0].references.some((reference) => reference.isTypeReference)) return null;
@@ -3535,21 +3906,21 @@ var no_redundant_local_alias_default = createRule({
3535
3906
  defaultOptions: [],
3536
3907
  create(context) {
3537
3908
  if (isGeneratedFile(context, context.sourceCode.text)) return {};
3538
- const hasModuleSyntax = context.sourceCode.ast.body.some((candidate2) => candidate2.type === import_utils32.AST_NODE_TYPES.ImportDeclaration || candidate2.type === import_utils32.AST_NODE_TYPES.ExportNamedDeclaration || candidate2.type === import_utils32.AST_NODE_TYPES.ExportDefaultDeclaration || candidate2.type === import_utils32.AST_NODE_TYPES.ExportAllDeclaration);
3909
+ const hasModuleSyntax = context.sourceCode.ast.body.some((candidate2) => candidate2.type === import_utils33.AST_NODE_TYPES.ImportDeclaration || candidate2.type === import_utils33.AST_NODE_TYPES.ExportNamedDeclaration || candidate2.type === import_utils33.AST_NODE_TYPES.ExportDefaultDeclaration || candidate2.type === import_utils33.AST_NODE_TYPES.ExportAllDeclaration);
3539
3910
  return {
3540
3911
  VariableDeclarator(node) {
3541
- if (node.parent.kind !== "const" || node.parent.declarations.length !== 1 || node.id.type !== import_utils32.AST_NODE_TYPES.Identifier || node.id.typeAnnotation !== void 0 || node.init?.type !== import_utils32.AST_NODE_TYPES.Identifier) return;
3912
+ if (node.parent.kind !== "const" || node.parent.declarations.length !== 1 || node.id.type !== import_utils33.AST_NODE_TYPES.Identifier || node.id.typeAnnotation !== void 0 || node.init?.type !== import_utils33.AST_NODE_TYPES.Identifier) return;
3542
3913
  const scope = context.sourceCode.getScope(node);
3543
3914
  if (scope.variableScope.type !== "function") return;
3544
- const target = import_utils32.ASTUtils.findVariable(scope, node.id.name);
3545
- const source = import_utils32.ASTUtils.findVariable(scope, node.init.name);
3915
+ const target = import_utils33.ASTUtils.findVariable(scope, node.id.name);
3916
+ const source = import_utils33.ASTUtils.findVariable(scope, node.init.name);
3546
3917
  if (target === null || source === null || !stableSource(source, node)) return;
3547
3918
  const reads = target.references.filter((reference) => reference.isRead());
3548
3919
  if (reads.length !== 1 || target.references.some((reference) => reference.isWrite() && !reference.init)) return;
3549
3920
  const read = reads[0];
3550
3921
  if (read === void 0 || read.from.variableScope !== scope.variableScope) return;
3551
3922
  const property = read.identifier.parent;
3552
- if (property.type !== import_utils32.AST_NODE_TYPES.Property || !property.shorthand || property.value !== read.identifier || property.parent.type !== import_utils32.AST_NODE_TYPES.ObjectExpression || property.computed || property.method || property.kind !== "init") return;
3923
+ if (property.type !== import_utils33.AST_NODE_TYPES.Property || !property.shorthand || property.value !== read.identifier || property.parent.type !== import_utils33.AST_NODE_TYPES.ObjectExpression || property.computed || property.method || property.kind !== "init") return;
3553
3924
  context.report({ node, messageId: "redundantAlias", fix: hasModuleSyntax ? closedPrimitiveReturnFix(context.sourceCode, node, property, source, target) : null, data: { source: node.init.name, target: node.id.name } });
3554
3925
  }
3555
3926
  };
@@ -3557,14 +3928,14 @@ var no_redundant_local_alias_default = createRule({
3557
3928
  });
3558
3929
 
3559
3930
  // src/rules/no-mutating-container-transform.ts
3560
- var import_utils33 = require("@typescript-eslint/utils");
3931
+ var import_utils34 = require("@typescript-eslint/utils");
3561
3932
  var MUTATORS = /* @__PURE__ */ new Set(["copyWithin", "fill", "pop", "push", "reverse", "shift", "sort", "splice", "unshift"]);
3562
3933
  var PRIMITIVES = /* @__PURE__ */ new Set([
3563
- import_utils33.AST_NODE_TYPES.TSStringKeyword,
3564
- import_utils33.AST_NODE_TYPES.TSNumberKeyword,
3565
- import_utils33.AST_NODE_TYPES.TSBooleanKeyword,
3566
- import_utils33.AST_NODE_TYPES.TSBigIntKeyword,
3567
- import_utils33.AST_NODE_TYPES.TSSymbolKeyword
3934
+ import_utils34.AST_NODE_TYPES.TSStringKeyword,
3935
+ import_utils34.AST_NODE_TYPES.TSNumberKeyword,
3936
+ import_utils34.AST_NODE_TYPES.TSBooleanKeyword,
3937
+ import_utils34.AST_NODE_TYPES.TSBigIntKeyword,
3938
+ import_utils34.AST_NODE_TYPES.TSSymbolKeyword
3568
3939
  ]);
3569
3940
  var NO_MUTATING_CONTAINER_TRANSFORM_DOCUMENTATION = {
3570
3941
  defaultLevel: "warning",
@@ -3583,27 +3954,27 @@ var NO_MUTATING_CONTAINER_TRANSFORM_DOCUMENTATION = {
3583
3954
  ]
3584
3955
  };
3585
3956
  function arrayElement(node, sourceCode) {
3586
- if (node.type === import_utils33.AST_NODE_TYPES.TSArrayType) return node.elementType;
3587
- if (node.type === import_utils33.AST_NODE_TYPES.TSTypeReference && node.typeName.type === import_utils33.AST_NODE_TYPES.Identifier && (node.typeName.name === "Array" || node.typeName.name === "ReadonlyArray") && (import_utils33.ASTUtils.findVariable(sourceCode.getScope(node.typeName), node.typeName.name)?.defs.length ?? 0) === 0 && node.typeArguments?.params.length === 1) return node.typeArguments.params[0] ?? null;
3957
+ if (node.type === import_utils34.AST_NODE_TYPES.TSArrayType) return node.elementType;
3958
+ if (node.type === import_utils34.AST_NODE_TYPES.TSTypeReference && node.typeName.type === import_utils34.AST_NODE_TYPES.Identifier && (node.typeName.name === "Array" || node.typeName.name === "ReadonlyArray") && (import_utils34.ASTUtils.findVariable(sourceCode.getScope(node.typeName), node.typeName.name)?.defs.length ?? 0) === 0 && node.typeArguments?.params.length === 1) return node.typeArguments.params[0] ?? null;
3588
3959
  return null;
3589
3960
  }
3590
3961
  function returnsArray(node, sourceCode) {
3591
3962
  let annotation = node.returnType?.typeAnnotation;
3592
- if (annotation?.type === import_utils33.AST_NODE_TYPES.TSTypeReference && annotation.typeName.type === import_utils33.AST_NODE_TYPES.Identifier && annotation.typeName.name === "Promise" && (import_utils33.ASTUtils.findVariable(sourceCode.getScope(annotation.typeName), "Promise")?.defs.length ?? 0) === 0 && annotation.typeArguments?.params.length === 1) annotation = annotation.typeArguments.params[0];
3963
+ if (annotation?.type === import_utils34.AST_NODE_TYPES.TSTypeReference && annotation.typeName.type === import_utils34.AST_NODE_TYPES.Identifier && annotation.typeName.name === "Promise" && (import_utils34.ASTUtils.findVariable(sourceCode.getScope(annotation.typeName), "Promise")?.defs.length ?? 0) === 0 && annotation.typeArguments?.params.length === 1) annotation = annotation.typeArguments.params[0];
3593
3964
  return annotation !== void 0 && arrayElement(annotation, sourceCode) !== null;
3594
3965
  }
3595
3966
  function supported(statements) {
3596
3967
  return statements.every((statement) => {
3597
3968
  switch (statement.type) {
3598
- case import_utils33.AST_NODE_TYPES.ExpressionStatement:
3599
- case import_utils33.AST_NODE_TYPES.VariableDeclaration:
3600
- case import_utils33.AST_NODE_TYPES.ReturnStatement:
3601
- case import_utils33.AST_NODE_TYPES.ThrowStatement:
3602
- case import_utils33.AST_NODE_TYPES.EmptyStatement:
3969
+ case import_utils34.AST_NODE_TYPES.ExpressionStatement:
3970
+ case import_utils34.AST_NODE_TYPES.VariableDeclaration:
3971
+ case import_utils34.AST_NODE_TYPES.ReturnStatement:
3972
+ case import_utils34.AST_NODE_TYPES.ThrowStatement:
3973
+ case import_utils34.AST_NODE_TYPES.EmptyStatement:
3603
3974
  return true;
3604
- case import_utils33.AST_NODE_TYPES.BlockStatement:
3975
+ case import_utils34.AST_NODE_TYPES.BlockStatement:
3605
3976
  return supported(statement.body);
3606
- case import_utils33.AST_NODE_TYPES.IfStatement:
3977
+ case import_utils34.AST_NODE_TYPES.IfStatement:
3607
3978
  return supported([statement.consequent]) && (statement.alternate === null || supported([statement.alternate]));
3608
3979
  default:
3609
3980
  return false;
@@ -3624,13 +3995,13 @@ var no_mutating_container_transform_default = createRule({
3624
3995
  if (isGeneratedFile(context, context.sourceCode.text)) return {};
3625
3996
  const sourceCode = context.sourceCode;
3626
3997
  function binding3(node) {
3627
- return node.type === import_utils33.AST_NODE_TYPES.Identifier ? import_utils33.ASTUtils.findVariable(sourceCode.getScope(node), node.name) : null;
3998
+ return node.type === import_utils34.AST_NODE_TYPES.Identifier ? import_utils34.ASTUtils.findVariable(sourceCode.getScope(node), node.name) : null;
3628
3999
  }
3629
4000
  function inspect(node) {
3630
- if (node.body?.type !== import_utils33.AST_NODE_TYPES.BlockStatement || !returnsArray(node, sourceCode) || !supported(node.body.body)) return;
4001
+ if (node.body?.type !== import_utils34.AST_NODE_TYPES.BlockStatement || !returnsArray(node, sourceCode) || !supported(node.body.body)) return;
3631
4002
  const initial = /* @__PURE__ */ new Map();
3632
4003
  for (const parameter of node.params) {
3633
- if (parameter.type !== import_utils33.AST_NODE_TYPES.Identifier || parameter.typeAnnotation === void 0) continue;
4004
+ if (parameter.type !== import_utils34.AST_NODE_TYPES.Identifier || parameter.typeAnnotation === void 0) continue;
3634
4005
  const element = arrayElement(parameter.typeAnnotation.typeAnnotation, sourceCode);
3635
4006
  const variable = binding3(parameter);
3636
4007
  if (element !== null && PRIMITIVES.has(element.type) && variable !== null) initial.set(variable, parameter.name);
@@ -3643,26 +4014,26 @@ var no_mutating_container_transform_default = createRule({
3643
4014
  }
3644
4015
  function expression(current, state) {
3645
4016
  switch (current.type) {
3646
- case import_utils33.AST_NODE_TYPES.FunctionExpression:
3647
- case import_utils33.AST_NODE_TYPES.ArrowFunctionExpression:
3648
- case import_utils33.AST_NODE_TYPES.ClassExpression:
4017
+ case import_utils34.AST_NODE_TYPES.FunctionExpression:
4018
+ case import_utils34.AST_NODE_TYPES.ArrowFunctionExpression:
4019
+ case import_utils34.AST_NODE_TYPES.ClassExpression:
3649
4020
  return;
3650
- case import_utils33.AST_NODE_TYPES.AssignmentExpression:
4021
+ case import_utils34.AST_NODE_TYPES.AssignmentExpression:
3651
4022
  assignment(current, state);
3652
4023
  return;
3653
- case import_utils33.AST_NODE_TYPES.LogicalExpression:
4024
+ case import_utils34.AST_NODE_TYPES.LogicalExpression:
3654
4025
  logical(current, state);
3655
4026
  return;
3656
- case import_utils33.AST_NODE_TYPES.ConditionalExpression:
4027
+ case import_utils34.AST_NODE_TYPES.ConditionalExpression:
3657
4028
  conditional(current, state);
3658
4029
  return;
3659
- case import_utils33.AST_NODE_TYPES.UpdateExpression:
4030
+ case import_utils34.AST_NODE_TYPES.UpdateExpression:
3660
4031
  write(current.argument, state);
3661
4032
  break;
3662
- case import_utils33.AST_NODE_TYPES.UnaryExpression:
4033
+ case import_utils34.AST_NODE_TYPES.UnaryExpression:
3663
4034
  if (current.operator === "delete") write(current.argument, state);
3664
4035
  break;
3665
- case import_utils33.AST_NODE_TYPES.CallExpression:
4036
+ case import_utils34.AST_NODE_TYPES.CallExpression:
3666
4037
  mutationCall(current, state);
3667
4038
  break;
3668
4039
  default:
@@ -3682,13 +4053,13 @@ var no_mutating_container_transform_default = createRule({
3682
4053
  function logical(current, state) {
3683
4054
  expression(current.left, state);
3684
4055
  const left = unwrapExpression(current.left);
3685
- if (left.type === import_utils33.AST_NODE_TYPES.Literal && (current.operator === "&&" && !left.value || current.operator === "||" && !!left.value || current.operator === "??" && left.value !== null)) return;
4056
+ if (left.type === import_utils34.AST_NODE_TYPES.Literal && (current.operator === "&&" && !left.value || current.operator === "||" && !!left.value || current.operator === "??" && left.value !== null)) return;
3686
4057
  expression(current.right, state);
3687
4058
  }
3688
4059
  function conditional(current, state) {
3689
4060
  expression(current.test, state);
3690
4061
  const test = unwrapExpression(current.test);
3691
- if (test.type === import_utils33.AST_NODE_TYPES.Literal) {
4062
+ if (test.type === import_utils34.AST_NODE_TYPES.Literal) {
3692
4063
  expression(test.value ? current.consequent : current.alternate, state);
3693
4064
  return;
3694
4065
  }
@@ -3696,13 +4067,13 @@ var no_mutating_container_transform_default = createRule({
3696
4067
  expression(current.alternate, state);
3697
4068
  }
3698
4069
  function mutationCall(current, state) {
3699
- if (current.callee.type !== import_utils33.AST_NODE_TYPES.MemberExpression || !MUTATORS.has(import_utils33.ASTUtils.getPropertyName(current.callee) ?? "")) return;
4070
+ if (current.callee.type !== import_utils34.AST_NODE_TYPES.MemberExpression || !MUTATORS.has(import_utils34.ASTUtils.getPropertyName(current.callee) ?? "")) return;
3700
4071
  const parameter = origin(current.callee.object, state);
3701
4072
  if (parameter !== void 0 && first === null) first = { node: current, parameter };
3702
4073
  }
3703
4074
  function write(target, state) {
3704
4075
  target = unwrapExpression(target);
3705
- if (target.type !== import_utils33.AST_NODE_TYPES.MemberExpression || !target.computed && import_utils33.ASTUtils.getPropertyName(target) !== "length") return;
4076
+ if (target.type !== import_utils34.AST_NODE_TYPES.MemberExpression || !target.computed && import_utils34.ASTUtils.getPropertyName(target) !== "length") return;
3706
4077
  const parameter = origin(target.object, state);
3707
4078
  if (parameter !== void 0 && first === null) first = { node: target, parameter };
3708
4079
  }
@@ -3712,18 +4083,18 @@ var no_mutating_container_transform_default = createRule({
3712
4083
  }
3713
4084
  function statement(current, state) {
3714
4085
  switch (current.type) {
3715
- case import_utils33.AST_NODE_TYPES.BlockStatement:
4086
+ case import_utils34.AST_NODE_TYPES.BlockStatement:
3716
4087
  return statements(current.body, state);
3717
- case import_utils33.AST_NODE_TYPES.IfStatement:
4088
+ case import_utils34.AST_NODE_TYPES.IfStatement:
3718
4089
  return branch(current, state);
3719
- case import_utils33.AST_NODE_TYPES.VariableDeclaration:
4090
+ case import_utils34.AST_NODE_TYPES.VariableDeclaration:
3720
4091
  declarations(current, state);
3721
4092
  return false;
3722
- case import_utils33.AST_NODE_TYPES.ReturnStatement:
3723
- case import_utils33.AST_NODE_TYPES.ThrowStatement:
4093
+ case import_utils34.AST_NODE_TYPES.ReturnStatement:
4094
+ case import_utils34.AST_NODE_TYPES.ThrowStatement:
3724
4095
  if (current.argument !== null) expression(current.argument, state);
3725
4096
  return true;
3726
- case import_utils33.AST_NODE_TYPES.ExpressionStatement:
4097
+ case import_utils34.AST_NODE_TYPES.ExpressionStatement:
3727
4098
  expression(current.expression, state);
3728
4099
  return false;
3729
4100
  default:
@@ -3732,7 +4103,7 @@ var no_mutating_container_transform_default = createRule({
3732
4103
  }
3733
4104
  function branch(current, state) {
3734
4105
  expression(current.test, state);
3735
- if (current.test.type === import_utils33.AST_NODE_TYPES.Literal) return current.test.value ? statements([current.consequent], state) : current.alternate !== null && statements([current.alternate], state);
4106
+ if (current.test.type === import_utils34.AST_NODE_TYPES.Literal) return current.test.value ? statements([current.consequent], state) : current.alternate !== null && statements([current.alternate], state);
3736
4107
  const left = new Map(state);
3737
4108
  const right = new Map(state);
3738
4109
  const leftEnds = statements([current.consequent], left);
@@ -3767,60 +4138,8 @@ var no_mutating_container_transform_default = createRule({
3767
4138
  var import_utils36 = require("@typescript-eslint/utils");
3768
4139
  var import_typescript11 = __toESM(require("typescript"), 1);
3769
4140
 
3770
- // src/rules/_checked-native-source.ts
3771
- var import_typescript5 = __toESM(require("typescript"), 1);
3772
- var CHECKED = /* @__PURE__ */ new WeakMap();
3773
- var SINGLE_LINE_DIRECTIVE = /^\/\/\/?\s*@(?:ts-expect-error|ts-ignore)/u;
3774
- var MULTI_LINE_DIRECTIVE = /^[/*]*\s*@(?:ts-expect-error|ts-ignore)/u;
3775
- var SINGLE_LINE_PRAGMA = /^\/\/\/?\s*@([^\s:]+)(?:(?:[^\S\r\n]|:).*)?$/mu;
3776
- function currentNativeSource(sourceCode, services) {
3777
- const source = services.esTreeNodeToTSNodeMap.get(sourceCode.ast);
3778
- return import_typescript5.default.isSourceFile(source) && services.program.getSourceFile(source.fileName) === source && source.text === sourceCode.text ? source : null;
3779
- }
3780
- function checkedNativeSource(program, source) {
3781
- let files = CHECKED.get(program);
3782
- if (!files) {
3783
- files = /* @__PURE__ */ new WeakMap();
3784
- CHECKED.set(program, files);
3785
- }
3786
- const known2 = files.get(source);
3787
- if (known2 !== void 0) return known2;
3788
- const available = !program.getCompilerOptions().noCheck && !source.isDeclarationFile && (source.flags & (import_typescript5.default.NodeFlags.JavaScriptFile | import_typescript5.default.NodeFlags.JsonFile)) === 0 && !program.getProjectReferences()?.length && !program.getResolvedProjectReferences()?.length && program.getSourceFile(source.fileName) === source && !program.isSourceFileFromExternalLibrary(source) && !program.isSourceFileDefaultLibrary(source) && !program.getSyntacticDiagnostics(source).some((diagnostic) => diagnostic.category === import_typescript5.default.DiagnosticCategory.Error && diagnostic.file === source) && !checkingSuppressed(source) && !program.getSemanticDiagnostics(source).some((diagnostic) => diagnostic.category === import_typescript5.default.DiagnosticCategory.Error && diagnostic.file === source);
3789
- files.set(source, available);
3790
- return available;
3791
- }
3792
- function checkingSuppressed(source) {
3793
- if (!/@ts-/iu.test(source.text)) return false;
3794
- if (import_typescript5.default.getLeadingCommentRanges(source.text, 0)?.some((comment) => comment.kind === import_typescript5.default.SyntaxKind.SingleLineCommentTrivia && SINGLE_LINE_PRAGMA.exec(source.text.slice(comment.pos, comment.end))?.[1]?.toLowerCase() === "ts-nocheck")) return true;
3795
- const pending = [source];
3796
- while (pending.length) {
3797
- const node = pending.pop();
3798
- if (!node || import_typescript5.default.isJsxText(node) || import_typescript5.default.isJSDoc(node) || (node.flags & import_typescript5.default.NodeFlags.JSDoc) !== 0) continue;
3799
- if (!import_typescript5.default.isToken(node)) {
3800
- for (const child of node.getChildren(source)) pending.push(child);
3801
- continue;
3802
- }
3803
- if (tokenTriviaSuppressesChecking(node, source)) return true;
3804
- }
3805
- return false;
3806
- }
3807
- function tokenTriviaSuppressesChecking(node, source) {
3808
- const start = node.getStart(source);
3809
- for (const comment of [...import_typescript5.default.getLeadingCommentRanges(source.text, node.pos) ?? [], ...import_typescript5.default.getTrailingCommentRanges(source.text, node.pos) ?? []]) {
3810
- if (comment.pos < node.pos || comment.end > start) continue;
3811
- if (commentSuppressesChecking(source.text.slice(comment.pos, comment.end), comment.kind)) return true;
3812
- }
3813
- return false;
3814
- }
3815
- function commentSuppressesChecking(text, kind) {
3816
- if (kind === import_typescript5.default.SyntaxKind.SingleLineCommentTrivia) return SINGLE_LINE_DIRECTIVE.test(text);
3817
- let lastLine = text.length;
3818
- while (lastLine > 0 && !import_typescript5.default.isLineBreak(text.charCodeAt(lastLine - 1))) lastLine--;
3819
- return MULTI_LINE_DIRECTIVE.test(text.slice(lastLine).trimStart());
3820
- }
3821
-
3822
4141
  // src/rules/_closed-object-contract.ts
3823
- var import_typescript6 = __toESM(require("typescript"), 1);
4142
+ var import_typescript9 = __toESM(require("typescript"), 1);
3824
4143
  function closedObjectContract(type, checker, singlePropertyOrigins = false) {
3825
4144
  return visitContract(type, {
3826
4145
  checker,
@@ -3842,7 +4161,7 @@ function visitContract(type, proof) {
3842
4161
  function completeObject(type, proof) {
3843
4162
  if (!ordinaryObject(type, proof.checker)) return false;
3844
4163
  if (proof.origins && !singleOrigins(type, proof.origins)) return false;
3845
- const declarations = type.getSymbol()?.getDeclarations()?.filter((declaration) => import_typescript6.default.isInterfaceDeclaration(declaration) || import_typescript6.default.isTypeLiteralNode(declaration));
4164
+ const declarations = type.getSymbol()?.getDeclarations()?.filter((declaration) => import_typescript9.default.isInterfaceDeclaration(declaration) || import_typescript9.default.isTypeLiteralNode(declaration));
3846
4165
  if (!declarations?.length) return false;
3847
4166
  return declarations.every((declaration) => completeDeclaration(declaration, proof));
3848
4167
  }
@@ -3856,36 +4175,36 @@ function singleOrigins(type, origins) {
3856
4175
  return true;
3857
4176
  }
3858
4177
  function ordinaryObject(type, checker) {
3859
- if ((type.flags & import_typescript6.default.TypeFlags.Object) === 0 || type.isUnion() || checker.getIndexInfosOfType(type).length > 0) return false;
4178
+ if ((type.flags & import_typescript9.default.TypeFlags.Object) === 0 || type.isUnion() || checker.getIndexInfosOfType(type).length > 0) return false;
3860
4179
  const object = type;
3861
- if ((object.objectFlags & (import_typescript6.default.ObjectFlags.Class | import_typescript6.default.ObjectFlags.Mapped)) !== 0) return false;
3862
- if ((object.objectFlags & import_typescript6.default.ObjectFlags.Reference) !== 0 && checker.getTypeArguments(type).some((argument) => (argument.flags & (import_typescript6.default.TypeFlags.Any | import_typescript6.default.TypeFlags.Unknown | import_typescript6.default.TypeFlags.TypeParameter)) !== 0)) return false;
3863
- return checker.getSignaturesOfType(type, import_typescript6.default.SignatureKind.Call).length === 0 && checker.getSignaturesOfType(type, import_typescript6.default.SignatureKind.Construct).length === 0;
4180
+ if ((object.objectFlags & (import_typescript9.default.ObjectFlags.Class | import_typescript9.default.ObjectFlags.Mapped)) !== 0) return false;
4181
+ if ((object.objectFlags & import_typescript9.default.ObjectFlags.Reference) !== 0 && checker.getTypeArguments(type).some((argument) => (argument.flags & (import_typescript9.default.TypeFlags.Any | import_typescript9.default.TypeFlags.Unknown | import_typescript9.default.TypeFlags.TypeParameter)) !== 0)) return false;
4182
+ return checker.getSignaturesOfType(type, import_typescript9.default.SignatureKind.Call).length === 0 && checker.getSignaturesOfType(type, import_typescript9.default.SignatureKind.Construct).length === 0;
3864
4183
  }
3865
4184
  function completeDeclaration(declaration, proof) {
3866
4185
  if (!declaration.members.every((member3) => finiteMember(member3, proof.checker))) return false;
3867
- if (!import_typescript6.default.isInterfaceDeclaration(declaration)) return true;
4186
+ if (!import_typescript9.default.isInterfaceDeclaration(declaration)) return true;
3868
4187
  if (declaration.typeParameters?.length) return false;
3869
4188
  return (declaration.heritageClauses ?? []).every((heritage) => heritage.types.every((base) => visitContract(proof.checker.getTypeAtLocation(base), proof)));
3870
4189
  }
3871
4190
  function finiteMember(member3, checker) {
3872
- if (import_typescript6.default.isIndexSignatureDeclaration(member3)) return false;
3873
- if (!member3.name || !import_typescript6.default.isComputedPropertyName(member3.name)) return true;
3874
- return (checker.getTypeAtLocation(member3.name.expression).flags & (import_typescript6.default.TypeFlags.StringLiteral | import_typescript6.default.TypeFlags.NumberLiteral | import_typescript6.default.TypeFlags.UniqueESSymbol)) !== 0;
4191
+ if (import_typescript9.default.isIndexSignatureDeclaration(member3)) return false;
4192
+ if (!member3.name || !import_typescript9.default.isComputedPropertyName(member3.name)) return true;
4193
+ return (checker.getTypeAtLocation(member3.name.expression).flags & (import_typescript9.default.TypeFlags.StringLiteral | import_typescript9.default.TypeFlags.NumberLiteral | import_typescript9.default.TypeFlags.UniqueESSymbol)) !== 0;
3875
4194
  }
3876
4195
 
3877
4196
  // src/rules/_private-consumer-fix.ts
3878
- var import_utils34 = require("@typescript-eslint/utils");
3879
- var import_typescript7 = __toESM(require("typescript"), 1);
3880
- var UNSAFE = import_typescript7.default.TypeFlags.Any | import_typescript7.default.TypeFlags.Unknown | import_typescript7.default.TypeFlags.Never | import_typescript7.default.TypeFlags.TypeParameter | import_typescript7.default.TypeFlags.Conditional | import_typescript7.default.TypeFlags.IndexedAccess | import_typescript7.default.TypeFlags.Substitution;
4197
+ var import_utils35 = require("@typescript-eslint/utils");
4198
+ var import_typescript10 = __toESM(require("typescript"), 1);
4199
+ var UNSAFE = import_typescript10.default.TypeFlags.Any | import_typescript10.default.TypeFlags.Unknown | import_typescript10.default.TypeFlags.Never | import_typescript10.default.TypeFlags.TypeParameter | import_typescript10.default.TypeFlags.Conditional | import_typescript10.default.TypeFlags.IndexedAccess | import_typescript10.default.TypeFlags.Substitution;
3881
4200
  function validConsumerFixCalls(node, parameter, sourceCode, services) {
3882
4201
  if (sourceCode.getAllComments().some((comment) => /@ts-(?:expect-error|ignore|nocheck)\b/u.test(comment.value))) return false;
3883
- const owner = node.type === import_utils34.AST_NODE_TYPES.FunctionDeclaration ? node : node.parent;
3884
- if (owner.type !== import_utils34.AST_NODE_TYPES.FunctionDeclaration && owner.type !== import_utils34.AST_NODE_TYPES.VariableDeclarator) return false;
4202
+ const owner = node.type === import_utils35.AST_NODE_TYPES.FunctionDeclaration ? node : node.parent;
4203
+ if (owner.type !== import_utils35.AST_NODE_TYPES.FunctionDeclaration && owner.type !== import_utils35.AST_NODE_TYPES.VariableDeclarator) return false;
3885
4204
  const binding3 = sourceCode.getDeclaredVariables(owner).find((variable) => variable.defs.some((definition) => definition.node === owner && (definition.type === "FunctionName" || definition.type === "Variable")));
3886
4205
  if (!binding3) return false;
3887
4206
  const declaration = services.esTreeNodeToTSNodeMap.get(node);
3888
- if (!import_typescript7.default.isFunctionDeclaration(declaration) && !import_typescript7.default.isArrowFunction(declaration) || parameter.parent !== declaration || declaration.parameters.some((entry) => import_typescript7.default.isIdentifier(entry.name) && entry.name.text === "this")) return false;
4207
+ if (!import_typescript10.default.isFunctionDeclaration(declaration) && !import_typescript10.default.isArrowFunction(declaration) || parameter.parent !== declaration || declaration.parameters.some((entry) => import_typescript10.default.isIdentifier(entry.name) && entry.name.text === "this")) return false;
3889
4208
  const selected = declaration.parameters.indexOf(parameter);
3890
4209
  if (selected < 0) return false;
3891
4210
  const checker = services.program.getTypeChecker();
@@ -3901,7 +4220,7 @@ function validConsumerFixCalls(node, parameter, sourceCode, services) {
3901
4220
  const validArguments = (call) => {
3902
4221
  if (declaration.parameters.length > 1) {
3903
4222
  const nativeCall = services.esTreeNodeToTSNodeMap.get(call);
3904
- if (!import_typescript7.default.isCallExpression(nativeCall) || checker.getResolvedSignature(nativeCall)?.declaration !== declaration) return false;
4223
+ if (!import_typescript10.default.isCallExpression(nativeCall) || checker.getResolvedSignature(nativeCall)?.declaration !== declaration) return false;
3905
4224
  }
3906
4225
  return call.arguments.every((argument, index) => {
3907
4226
  const target = originals[index];
@@ -3917,7 +4236,7 @@ function validConsumerFixCalls(node, parameter, sourceCode, services) {
3917
4236
  continue;
3918
4237
  }
3919
4238
  const call = reference.identifier.parent;
3920
- if (reference.isTypeReference || !reference.isReadOnly() || call.type !== import_utils34.AST_NODE_TYPES.CallExpression || call.callee !== reference.identifier || call.optional || call.typeArguments || call.arguments.length !== declaration.parameters.length || !call.arguments.every((argument) => argument.type === import_utils34.AST_NODE_TYPES.Identifier) || !validArguments(call)) return false;
4239
+ if (reference.isTypeReference || !reference.isReadOnly() || call.type !== import_utils35.AST_NODE_TYPES.CallExpression || call.callee !== reference.identifier || call.optional || call.typeArguments || call.arguments.length !== declaration.parameters.length || !call.arguments.every((argument) => argument.type === import_utils35.AST_NODE_TYPES.Identifier) || !validArguments(call)) return false;
3921
4240
  calls += 1;
3922
4241
  }
3923
4242
  return calls > 0;
@@ -3968,250 +4287,6 @@ function minimalConsumerFix(sourceCode, annotation, removed) {
3968
4287
  return sameLineTerminators(sourceCode, annotation, text) ? (fixer) => fixer.replaceText(annotation, text) : null;
3969
4288
  }
3970
4289
 
3971
- // src/rules/_private-scalar-consumer.ts
3972
- var import_utils35 = require("@typescript-eslint/utils");
3973
- var import_typescript10 = __toESM(require("typescript"), 1);
3974
-
3975
- // src/rules/_scalar-parameter-view.ts
3976
- var import_typescript9 = __toESM(require("typescript"), 1);
3977
-
3978
- // src/rules/_native-const-value.ts
3979
- var import_typescript8 = __toESM(require("typescript"), 1);
3980
- function constInitializer(declaration) {
3981
- if (!declaration || !import_typescript8.default.isVariableDeclaration(declaration) || !import_typescript8.default.isVariableDeclarationList(declaration.parent) || (declaration.parent.flags & import_typescript8.default.NodeFlags.BlockScoped) !== import_typescript8.default.NodeFlags.Const) return void 0;
3982
- let initializer = declaration.initializer;
3983
- while (initializer && import_typescript8.default.isParenthesizedExpression(initializer)) initializer = initializer.expression;
3984
- return initializer;
3985
- }
3986
- function unassertedValue(node) {
3987
- let value = node;
3988
- while (import_typescript8.default.isParenthesizedExpression(value) || import_typescript8.default.isAsExpression(value) || import_typescript8.default.isTypeAssertionExpression(value) || import_typescript8.default.isNonNullExpression(value) || import_typescript8.default.isSatisfiesExpression(value)) value = value.expression;
3989
- return value;
3990
- }
3991
-
3992
- // src/rules/_scalar-parameter-view.ts
3993
- var SCALAR_OPERATORS = /* @__PURE__ */ new Set([
3994
- import_typescript9.default.SyntaxKind.PlusToken,
3995
- import_typescript9.default.SyntaxKind.MinusToken,
3996
- import_typescript9.default.SyntaxKind.AsteriskToken,
3997
- import_typescript9.default.SyntaxKind.SlashToken,
3998
- import_typescript9.default.SyntaxKind.PercentToken,
3999
- import_typescript9.default.SyntaxKind.AsteriskAsteriskToken,
4000
- import_typescript9.default.SyntaxKind.LessThanToken,
4001
- import_typescript9.default.SyntaxKind.LessThanEqualsToken,
4002
- import_typescript9.default.SyntaxKind.GreaterThanToken,
4003
- import_typescript9.default.SyntaxKind.GreaterThanEqualsToken,
4004
- import_typescript9.default.SyntaxKind.EqualsEqualsEqualsToken,
4005
- import_typescript9.default.SyntaxKind.ExclamationEqualsEqualsToken,
4006
- import_typescript9.default.SyntaxKind.EqualsEqualsToken,
4007
- import_typescript9.default.SyntaxKind.ExclamationEqualsToken,
4008
- import_typescript9.default.SyntaxKind.AmpersandAmpersandToken,
4009
- import_typescript9.default.SyntaxKind.BarBarToken,
4010
- import_typescript9.default.SyntaxKind.QuestionQuestionToken
4011
- ]);
4012
- var SCALAR_PREFIXES = /* @__PURE__ */ new Set([import_typescript9.default.SyntaxKind.PlusToken, import_typescript9.default.SyntaxKind.MinusToken, import_typescript9.default.SyntaxKind.ExclamationToken, import_typescript9.default.SyntaxKind.TildeToken]);
4013
- var RETURNED_OPERANDS = /* @__PURE__ */ new Set([import_typescript9.default.SyntaxKind.AmpersandAmpersandToken, import_typescript9.default.SyntaxKind.BarBarToken, import_typescript9.default.SyntaxKind.QuestionQuestionToken]);
4014
- function scalarParameterView(parameter, body3, checker) {
4015
- return parameterReads(parameter, body3, checker, true);
4016
- }
4017
- function scalarParameterReads(parameter, body3, checker, callProgram, auxiliaries) {
4018
- return parameterReads(parameter, body3, checker, false, callProgram, auxiliaries);
4019
- }
4020
- function parameterReads(parameter, body3, checker, jsx, callProgram, auxiliaries) {
4021
- if (parameter.dotDotDotToken || parameter.initializer || import_typescript9.default.isArrayBindingPattern(parameter.name)) return null;
4022
- const root = import_typescript9.default.isIdentifier(parameter.name) ? checker.getSymbolAtLocation(parameter.name) : void 0;
4023
- if (import_typescript9.default.isIdentifier(parameter.name) && !root) return null;
4024
- const reads = /* @__PURE__ */ new Set();
4025
- const aliases = parameterAliases(parameter.name, checker, reads);
4026
- if (!aliases) return null;
4027
- const expression = returnedExpression(body3);
4028
- const view = { checker, props: checker.getTypeAtLocation(parameter), root, aliases, reads, callProgram, auxiliaries };
4029
- return expression && scalarView(expression, view, jsx) ? reads : null;
4030
- }
4031
- function scalarType(type, allowUndefined = true) {
4032
- if (type.isUnion()) return type.types.every((part) => scalarType(part, allowUndefined));
4033
- const flags = import_typescript9.default.TypeFlags.StringLike | import_typescript9.default.TypeFlags.NumberLike | import_typescript9.default.TypeFlags.BooleanLike | import_typescript9.default.TypeFlags.BigIntLike | import_typescript9.default.TypeFlags.Null;
4034
- return (type.flags & (allowUndefined ? flags | import_typescript9.default.TypeFlags.Undefined : flags)) !== 0;
4035
- }
4036
- function parameterAliases(name, checker, reads) {
4037
- const aliases = /* @__PURE__ */ new Map();
4038
- if (import_typescript9.default.isIdentifier(name)) return aliases;
4039
- for (const element of name.elements) {
4040
- const key = element.propertyName ?? element.name;
4041
- if (element.dotDotDotToken || element.initializer || !import_typescript9.default.isIdentifier(element.name) || !import_typescript9.default.isIdentifier(key) && !import_typescript9.default.isStringLiteralLike(key) && !import_typescript9.default.isNumericLiteral(key)) return null;
4042
- const binding3 = checker.getSymbolAtLocation(element.name);
4043
- if (!binding3) return null;
4044
- reads.add(key.text);
4045
- aliases.set(binding3, key.text);
4046
- }
4047
- return aliases;
4048
- }
4049
- function returnedExpression(body3) {
4050
- if (!import_typescript9.default.isBlock(body3)) return body3;
4051
- const statement = body3.statements.length === 1 ? body3.statements[0] : void 0;
4052
- return statement && import_typescript9.default.isReturnStatement(statement) ? statement.expression : void 0;
4053
- }
4054
- function scalarView(node, view, jsx = false) {
4055
- if (scalarLiteral(node)) return true;
4056
- if (import_typescript9.default.isCallExpression(node)) return !jsx && scalarCall(node, view);
4057
- if (import_typescript9.default.isJsxExpression(node)) return !node.dotDotDotToken && (!node.expression || scalarView(node.expression, view, jsx));
4058
- if (import_typescript9.default.isIdentifier(node)) {
4059
- const binding3 = view.checker.getSymbolAtLocation(node);
4060
- if (binding3 && view.auxiliaries?.has(binding3)) return scalarType(view.checker.getTypeAtLocation(node));
4061
- const key = binding3 && view.aliases.get(binding3);
4062
- return key !== void 0 && readField(node, key, view);
4063
- }
4064
- if (import_typescript9.default.isPropertyAccessExpression(node) || import_typescript9.default.isElementAccessExpression(node)) return memberRead(node, view);
4065
- return scalarOperation(node, view, jsx);
4066
- }
4067
- function scalarOperation(node, view, jsx) {
4068
- if (import_typescript9.default.isParenthesizedExpression(node) || import_typescript9.default.isNonNullExpression(node)) return scalarView(node.expression, view, jsx);
4069
- if (import_typescript9.default.isTypeOfExpression(node)) return scalarView(node.expression, view);
4070
- if (import_typescript9.default.isConditionalExpression(node)) return scalarView(node.condition, view) && scalarView(node.whenTrue, view, jsx) && scalarView(node.whenFalse, view, jsx);
4071
- if (import_typescript9.default.isBinaryExpression(node)) return binaryView(node, view, jsx);
4072
- if (import_typescript9.default.isPrefixUnaryExpression(node)) return SCALAR_PREFIXES.has(node.operator) && scalarView(node.operand, view);
4073
- if (import_typescript9.default.isTemplateExpression(node)) return node.templateSpans.every((span) => scalarView(span.expression, view));
4074
- return jsx && jsxView(node, view);
4075
- }
4076
- function scalarCall(node, view) {
4077
- if (!view.callProgram || node.questionDotToken || node.typeArguments?.length || !import_typescript9.default.isIdentifier(node.expression) || !node.arguments.length || node.arguments.some(import_typescript9.default.isSpreadElement)) return false;
4078
- const declarations = view.checker.getSymbolAtLocation(node.expression)?.declarations;
4079
- const declaration = declarations?.length === 1 ? declarations[0] : void 0;
4080
- const helper = declaration && localHelper(declaration);
4081
- if (!helper || helper.getSourceFile() !== node.getSourceFile() || helper.typeParameters?.length || !helper.type || !node.arguments.every((argument) => scalarView(argument, view))) return false;
4082
- if (!checkedNativeSource(view.callProgram, node.getSourceFile())) return false;
4083
- const signature = view.checker.getResolvedSignature(node);
4084
- return signature?.declaration === helper && !view.checker.getTypePredicateOfSignature(signature) && scalarType(view.checker.getTypeAtLocation(node));
4085
- }
4086
- function localHelper(node) {
4087
- if (import_typescript9.default.isFunctionDeclaration(node)) return node.body && import_typescript9.default.isSourceFile(node.parent) ? node : void 0;
4088
- if (!import_typescript9.default.isVariableDeclaration(node) || node.type || !node.initializer || constInitializer(node) !== node.initializer || !import_typescript9.default.isArrowFunction(node.initializer) || !import_typescript9.default.isVariableStatement(node.parent.parent) || !import_typescript9.default.isSourceFile(node.parent.parent.parent)) return void 0;
4089
- return node.initializer;
4090
- }
4091
- function binaryView(node, view, jsx) {
4092
- const returned2 = jsx && RETURNED_OPERANDS.has(node.operatorToken.kind);
4093
- return SCALAR_OPERATORS.has(node.operatorToken.kind) && scalarView(node.left, view, returned2) && scalarView(node.right, view, returned2);
4094
- }
4095
- function scalarLiteral(node) {
4096
- return import_typescript9.default.isStringLiteralLike(node) || import_typescript9.default.isNumericLiteral(node) || import_typescript9.default.isBigIntLiteral(node) || import_typescript9.default.isJsxText(node) || node.kind === import_typescript9.default.SyntaxKind.TrueKeyword || node.kind === import_typescript9.default.SyntaxKind.FalseKeyword || node.kind === import_typescript9.default.SyntaxKind.NullKeyword;
4097
- }
4098
- function memberRead(node, view) {
4099
- if (!view.root || !import_typescript9.default.isIdentifier(node.expression) || view.checker.getSymbolAtLocation(node.expression) !== view.root) return false;
4100
- const key = import_typescript9.default.isPropertyAccessExpression(node) ? node.name.text : node.argumentExpression && (import_typescript9.default.isStringLiteralLike(node.argumentExpression) || import_typescript9.default.isNumericLiteral(node.argumentExpression)) ? node.argumentExpression.text : void 0;
4101
- return key !== void 0 && readField(node, key, view);
4102
- }
4103
- function readField(node, key, view) {
4104
- if (!view.checker.getPropertyOfType(view.props, key) || !scalarType(view.checker.getTypeAtLocation(node))) return false;
4105
- view.reads.add(key);
4106
- return true;
4107
- }
4108
- function jsxView(node, view) {
4109
- if (import_typescript9.default.isJsxFragment(node)) return node.children.every((child) => scalarView(child, view, true));
4110
- if (import_typescript9.default.isJsxElement(node)) return jsxView(node.openingElement, view) && node.children.every((child) => scalarView(child, view, true));
4111
- if (!import_typescript9.default.isJsxOpeningElement(node) && !import_typescript9.default.isJsxSelfClosingElement(node)) return false;
4112
- if (!import_typescript9.default.isIdentifier(node.tagName) || !/^[a-z][A-Za-z0-9]*$/u.test(node.tagName.text)) return false;
4113
- return node.attributes.properties.every((attribute) => intrinsicAttribute(attribute, view));
4114
- }
4115
- function intrinsicAttribute(attribute, view) {
4116
- return import_typescript9.default.isJsxAttribute(attribute) && import_typescript9.default.isIdentifier(attribute.name) && attribute.name.text !== "is" && (!attribute.initializer || scalarView(attribute.initializer, view));
4117
- }
4118
-
4119
- // src/rules/_private-scalar-consumer.ts
4120
- function directEval(node) {
4121
- let callee = unwrapExpression(node.callee);
4122
- while (callee.type === import_utils35.AST_NODE_TYPES.TSInstantiationExpression) callee = unwrapExpression(callee.expression);
4123
- return callee.type === import_utils35.AST_NODE_TYPES.Identifier && callee.name === "eval";
4124
- }
4125
- function primitiveKeyword(node) {
4126
- return node !== void 0 && (node.kind === import_typescript10.default.SyntaxKind.StringKeyword || node.kind === import_typescript10.default.SyntaxKind.NumberKeyword || node.kind === import_typescript10.default.SyntaxKind.BooleanKeyword || node.kind === import_typescript10.default.SyntaxKind.BigIntKeyword);
4127
- }
4128
- function nullishPrimitiveUnion(node) {
4129
- return node !== void 0 && import_typescript10.default.isUnionTypeNode(node) && node.types.length === 2 && node.types.some(primitiveKeyword) && node.types.some((part) => part.kind === import_typescript10.default.SyntaxKind.UndefinedKeyword || import_typescript10.default.isLiteralTypeNode(part) && part.literal.kind === import_typescript10.default.SyntaxKind.NullKeyword);
4130
- }
4131
- function consumerAnnotation(node, auxiliaryScalars = false) {
4132
- if (node.params.length !== 1) {
4133
- if (!auxiliaryScalars) return void 0;
4134
- let annotation;
4135
- for (const parameter2 of node.params) {
4136
- if (parameter2.type !== import_utils35.AST_NODE_TYPES.Identifier && parameter2.type !== import_utils35.AST_NODE_TYPES.ObjectPattern) continue;
4137
- const current = parameter2.typeAnnotation?.typeAnnotation;
4138
- if (current?.type !== import_utils35.AST_NODE_TYPES.TSTypeLiteral) continue;
4139
- if (annotation) return void 0;
4140
- annotation = current;
4141
- }
4142
- return annotation;
4143
- }
4144
- const parameter = node.params[0];
4145
- return parameter?.type === import_utils35.AST_NODE_TYPES.Identifier || parameter?.type === import_utils35.AST_NODE_TYPES.ObjectPattern ? parameter.typeAnnotation?.typeAnnotation : void 0;
4146
- }
4147
- function exportedSymbols(source, checker) {
4148
- const symbol = checker.getSymbolAtLocation(source);
4149
- return new Set(symbol ? checker.getExportsOfModule(symbol).map((entry) => (entry.flags & import_typescript10.default.SymbolFlags.Alias) !== 0 ? checker.getAliasedSymbol(entry) : entry) : []);
4150
- }
4151
- function privateScalarConsumer(node, sourceCode, services, exports2, options = {}) {
4152
- const native = services.esTreeNodeToTSNodeMap.get(node);
4153
- if (!import_typescript10.default.isFunctionDeclaration(native) && !import_typescript10.default.isArrowFunction(native) || !native.body) return null;
4154
- let parameter = native.parameters[0];
4155
- if (native.parameters.length !== 1) {
4156
- const annotation = consumerAnnotation(node, options.auxiliaryScalars);
4157
- const selected = annotation && services.esTreeNodeToTSNodeMap.get(annotation);
4158
- parameter = native.parameters.find((entry) => entry.type === selected);
4159
- }
4160
- if (!parameter || !independentSignature(native, parameter, options.auxiliaryScalars === true)) return null;
4161
- const checker = services.program.getTypeChecker();
4162
- if (!import_typescript10.default.isExternalModule(native.getSourceFile()) || !services.program.getCompilerOptions().strict) return null;
4163
- if (!privateDirectCallable(node, native, sourceCode, checker, exports2)) return null;
4164
- const signature = checker.getSignatureFromDeclaration(native);
4165
- if (!signature || signature.typeParameters?.length || checker.getTypePredicateOfSignature(signature)) return null;
4166
- const expression = returnedExpression(native.body);
4167
- if (!expression || !checker.isTypeAssignableTo(checker.getTypeAtLocation(expression), checker.getReturnTypeOfSignature(signature))) return null;
4168
- const auxiliaries = native.parameters.length > 1 ? auxiliaryBindings(native, parameter, checker) : void 0;
4169
- if (auxiliaries === null) return null;
4170
- const reads = scalarParameterReads(parameter, native.body, checker, options.scalarCalls ? services.program : void 0, auxiliaries);
4171
- return reads?.size ? { parameter, reads } : null;
4172
- }
4173
- function privateDirectCallable(node, native, sourceCode, checker, exports2) {
4174
- const binding3 = callableBinding(node, sourceCode);
4175
- if (!binding3 || binding3.defs.length !== 1) return false;
4176
- const name = import_typescript10.default.isFunctionDeclaration(native) ? native.name : import_typescript10.default.isVariableDeclaration(native.parent) ? native.parent.name : void 0;
4177
- const symbol = name && checker.getSymbolAtLocation(name);
4178
- return symbol !== void 0 && symbol.declarations?.length === 1 && !exports2.has(symbol) && directCalls(binding3, native.parameters.length);
4179
- }
4180
- function independentSignature(native, selected, auxiliaryScalars) {
4181
- if (!auxiliaryScalars && native.parameters.length !== 1 || native.typeParameters?.length || native.asteriskToken || native.modifiers?.length || !primitiveKeyword(native.type)) return false;
4182
- return native.parameters.every((parameter) => parameter.type !== void 0 && !parameter.modifiers?.length && !parameter.questionToken && !parameter.initializer && !parameter.dotDotDotToken && (!import_typescript10.default.isIdentifier(parameter.name) || parameter.name.text !== "this") && (parameter === selected || import_typescript10.default.isIdentifier(parameter.name) && primitiveKeyword(parameter.type)));
4183
- }
4184
- function auxiliaryBindings(native, selected, checker) {
4185
- const bindings = /* @__PURE__ */ new Set();
4186
- for (const parameter of native.parameters) {
4187
- if (parameter === selected) continue;
4188
- const symbol = import_typescript10.default.isIdentifier(parameter.name) ? checker.getSymbolAtLocation(parameter.name) : void 0;
4189
- if (!symbol || symbol.declarations?.length !== 1 || symbol.declarations[0] !== parameter || bindings.has(symbol)) return null;
4190
- bindings.add(symbol);
4191
- }
4192
- return bindings;
4193
- }
4194
- function callableBinding(node, sourceCode) {
4195
- if (node.type === import_utils35.AST_NODE_TYPES.FunctionDeclaration) {
4196
- if (node.parent.type !== import_utils35.AST_NODE_TYPES.Program) return void 0;
4197
- return sourceCode.getDeclaredVariables(node).find((variable) => variable.defs.some((definition) => definition.type === "FunctionName" && definition.node === node));
4198
- }
4199
- const declaration = node.parent;
4200
- if (declaration.type !== import_utils35.AST_NODE_TYPES.VariableDeclarator || declaration.init !== node || declaration.id.type !== import_utils35.AST_NODE_TYPES.Identifier || declaration.id.typeAnnotation || declaration.parent.kind !== "const" || declaration.parent.parent.type !== import_utils35.AST_NODE_TYPES.Program) return void 0;
4201
- return sourceCode.getDeclaredVariables(declaration).find((variable) => variable.defs.some((definition) => definition.type === "Variable" && definition.node === declaration));
4202
- }
4203
- function directCalls(binding3, arity) {
4204
- let calls = 0;
4205
- const stable2 = stableValueBinding(binding3, (reference) => {
4206
- const identifier = reference.identifier;
4207
- const call = identifier.parent;
4208
- if (reference.isTypeReference || !reference.isReadOnly() || call.type !== import_utils35.AST_NODE_TYPES.CallExpression || call.callee !== identifier || call.optional || call.typeArguments || call.arguments.length !== arity || !call.arguments.every((argument) => argument.type === import_utils35.AST_NODE_TYPES.Identifier)) return false;
4209
- calls += 1;
4210
- return true;
4211
- });
4212
- return stable2 && calls > 0;
4213
- }
4214
-
4215
4290
  // src/rules/no-redundant-consumer-union.ts
4216
4291
  var CONFIG3 = { path: "tsconfig.json", source: '{"compilerOptions":{"strict":true,"target":"ESNext","module":"ESNext","moduleResolution":"Bundler"}}' };
4217
4292
  var EXAMPLE = 'export {}; interface Animal {readonly name: string} interface Dog extends Animal {readonly breed: string} export type KeptDog = Dog; const dog: Dog = {name: "Ada", breed: "Collie"}; function label(value: Dog | Animal): string {return value.name;} label(dog);';
@@ -5539,7 +5614,7 @@ function isSearchParamReceiver(call, services) {
5539
5614
  // package.json
5540
5615
  var package_default = {
5541
5616
  name: "@sarj/eslint-plugin",
5542
- version: "18.0.3",
5617
+ version: "18.0.5",
5543
5618
  packageManager: "npm@12.2.1",
5544
5619
  description: "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
5545
5620
  type: "module",
@@ -28703,7 +28778,7 @@ var import_utils165 = require("@typescript-eslint/utils");
28703
28778
 
28704
28779
  // src/rules/_existing-type-alias-fix.ts
28705
28780
  var import_utils164 = require("@typescript-eslint/utils");
28706
- var PRIMITIVE_TYPES = /* @__PURE__ */ new Set([
28781
+ var PRIMITIVE_TYPES2 = /* @__PURE__ */ new Set([
28707
28782
  "TSStringKeyword",
28708
28783
  "TSNumberKeyword",
28709
28784
  "TSBooleanKeyword",
@@ -28760,7 +28835,7 @@ function tokenSignature(sourceCode, node) {
28760
28835
  );
28761
28836
  }
28762
28837
  function closedType(node) {
28763
- if (PRIMITIVE_TYPES.has(node.type)) return true;
28838
+ if (PRIMITIVE_TYPES2.has(node.type)) return true;
28764
28839
  switch (node.type) {
28765
28840
  case import_utils164.AST_NODE_TYPES.TSLiteralType:
28766
28841
  return node.literal.type === import_utils164.AST_NODE_TYPES.Literal || node.literal.type === import_utils164.AST_NODE_TYPES.UnaryExpression && node.literal.operator === "-" && node.literal.argument.type === import_utils164.AST_NODE_TYPES.Literal;
@@ -30748,8 +30823,8 @@ var memberValidationPolarity = (test, access) => {
30748
30823
  }
30749
30824
  if (test.type === import_utils173.AST_NODE_TYPES.BinaryExpression) {
30750
30825
  const isMatchingTypeof = (node) => node.type === import_utils173.AST_NODE_TYPES.UnaryExpression && node.operator === "typeof" && isSamePlainMember(node.argument, access);
30751
- const isPrimitiveType = (node) => node.type === import_utils173.AST_NODE_TYPES.Literal && typeof node.value === "string" && PRIMITIVE_TYPEOF_RESULTS.has(node.value);
30752
- if (!(isMatchingTypeof(test.left) && isPrimitiveType(test.right) || isMatchingTypeof(test.right) && isPrimitiveType(test.left))) {
30826
+ const isPrimitiveType2 = (node) => node.type === import_utils173.AST_NODE_TYPES.Literal && typeof node.value === "string" && PRIMITIVE_TYPEOF_RESULTS.has(node.value);
30827
+ if (!(isMatchingTypeof(test.left) && isPrimitiveType2(test.right) || isMatchingTypeof(test.right) && isPrimitiveType2(test.left))) {
30753
30828
  return null;
30754
30829
  }
30755
30830
  if (test.operator === "===" || test.operator === "==") {