@sarj/eslint-plugin 15.6.1 → 15.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2517,6 +2517,25 @@ var hasThrowingCallOrNew = (node) => subtreeMatches(
2517
2517
  function isBareCallStatement(stmt) {
2518
2518
  return stmt.type === AST_NODE_TYPES9.ExpressionStatement && unwrap(stmt.expression).type === AST_NODE_TYPES9.CallExpression;
2519
2519
  }
2520
+ function isSimpleCatchFinallyOrchestration(node) {
2521
+ const handler = node.handler;
2522
+ const finalizer = node.finalizer;
2523
+ return handler !== null && handler.param === null && isSingleSimpleCall(handler.body.body) && finalizer !== null && isSingleSimpleCall(finalizer.body);
2524
+ }
2525
+ function isSingleSimpleCall(body2) {
2526
+ const statement = body2[0];
2527
+ return body2.length === 1 && statement !== void 0 && isSimpleBareCallStatement(statement);
2528
+ }
2529
+ function isSimpleBareCallStatement(stmt) {
2530
+ if (!isBareCallStatement(stmt)) {
2531
+ return false;
2532
+ }
2533
+ return !subtreeMatches(
2534
+ stmt,
2535
+ (node) => node.type === AST_NODE_TYPES9.ArrowFunctionExpression || node.type === AST_NODE_TYPES9.FunctionExpression || node.type === AST_NODE_TYPES9.AssignmentExpression || node.type === AST_NODE_TYPES9.UpdateExpression || node.type === AST_NODE_TYPES9.AwaitExpression,
2536
+ true
2537
+ );
2538
+ }
2520
2539
  function handlerRethrows(handler) {
2521
2540
  if (handler === null) {
2522
2541
  return false;
@@ -2688,6 +2707,9 @@ var no_fat_try_blocks_default = createRule({
2688
2707
  if (handlerRethrows(node.handler)) {
2689
2708
  return;
2690
2709
  }
2710
+ if (isSimpleCatchFinallyOrchestration(node)) {
2711
+ return;
2712
+ }
2691
2713
  if (isTerminalErrorBoundary(node)) {
2692
2714
  return;
2693
2715
  }
@@ -5610,9 +5632,9 @@ var no_restated_jsdoc_default = createRule({
5610
5632
  continue;
5611
5633
  }
5612
5634
  if ((paramTags.length > 0 || returnTags.length > 0) && documentsTypedFunction(sourceCode, comment)) continue;
5613
- const nameTokens = tokensOf([declaration.name]);
5635
+ const nameTokens2 = tokensOf([declaration.name]);
5614
5636
  const paramTokens = tokensOf(declaration.params);
5615
- const known = /* @__PURE__ */ new Set([...nameTokens, ...paramTokens]);
5637
+ const known = /* @__PURE__ */ new Set([...nameTokens2, ...paramTokens]);
5616
5638
  let addsNothing = covered(describedText, known);
5617
5639
  for (const tag of paramTags) {
5618
5640
  const text = tag.text.replace(/^\{[^}]*\}\s*/, "");
@@ -5627,7 +5649,7 @@ var no_restated_jsdoc_default = createRule({
5627
5649
  addsNothing = false;
5628
5650
  break;
5629
5651
  }
5630
- const own = /* @__PURE__ */ new Set([...splitIdentifier(path.split(".").pop() ?? ""), ...nameTokens]);
5652
+ const own = /* @__PURE__ */ new Set([...splitIdentifier(path.split(".").pop() ?? ""), ...nameTokens2]);
5631
5653
  if (!covered(match[2] ?? "", own)) {
5632
5654
  addsNothing = false;
5633
5655
  break;
@@ -10820,8 +10842,133 @@ var prefer_non_nullable_collection_default = createRule({
10820
10842
  }
10821
10843
  });
10822
10844
 
10845
+ // src/rules/prefer-await-in-async-return.ts
10846
+ import {
10847
+ ESLintUtils as ESLintUtils3,
10848
+ AST_NODE_TYPES as AST_NODE_TYPES45
10849
+ } from "@typescript-eslint/utils";
10850
+ import * as ts2 from "typescript";
10851
+ var preferAwaitInAsyncReturnDocumentation = {
10852
+ summary: "Prefer explicit `await` when an async function directly returns one typed Promise `.then` transform.",
10853
+ rationale: "Mixing a directly returned Promise callback into otherwise async control flow makes sequencing and failures harder to read.",
10854
+ remediation: "Await the Promise, then return the transformed value with ordinary async statements.",
10855
+ category: "maintainability",
10856
+ since: "15.6.3",
10857
+ limitations: [
10858
+ "Only a single directly returned `.then` call with an inline callback is checked.",
10859
+ "The receiver must be proven Promise-like by TypeScript; untyped files and larger chains are intentionally ignored."
10860
+ ],
10861
+ examples: [
10862
+ {
10863
+ id: "explicit-async-transform",
10864
+ title: "Use explicit async control flow",
10865
+ outcome: "no-match",
10866
+ files: [{
10867
+ path: "src/load.ts",
10868
+ source: "async function load() { const value = await Promise.resolve(1); return value + 1; }"
10869
+ }],
10870
+ focusPath: "src/load.ts",
10871
+ expectedCount: 0,
10872
+ public: true
10873
+ },
10874
+ {
10875
+ id: "returned-then-transform",
10876
+ title: "Do not directly return a Promise callback chain from async code",
10877
+ outcome: "match",
10878
+ files: [{
10879
+ path: "src/load.ts",
10880
+ source: "async function load() { return Promise.resolve(1).then((value) => value + 1); }"
10881
+ }],
10882
+ focusPath: "src/load.ts",
10883
+ expectedCount: 1,
10884
+ public: true
10885
+ }
10886
+ ]
10887
+ };
10888
+ function isDirectAsyncReturn(node) {
10889
+ const parent = node.parent;
10890
+ if (parent.type === AST_NODE_TYPES45.ArrowFunctionExpression && parent.body === node) {
10891
+ return parent.async && !parent.generator;
10892
+ }
10893
+ if (parent.type !== AST_NODE_TYPES45.ReturnStatement || parent.argument !== node) {
10894
+ return false;
10895
+ }
10896
+ let owner = parent.parent;
10897
+ while (owner !== void 0 && !isRuntimeFunction(owner)) {
10898
+ owner = owner.parent;
10899
+ }
10900
+ return owner !== void 0 && owner.async && !owner.generator;
10901
+ }
10902
+ function isRuntimeFunction(node) {
10903
+ return node.type === AST_NODE_TYPES45.ArrowFunctionExpression || node.type === AST_NODE_TYPES45.FunctionDeclaration || node.type === AST_NODE_TYPES45.FunctionExpression;
10904
+ }
10905
+ function promiseThenReceiver(node) {
10906
+ const callee = node.callee;
10907
+ if (callee.type !== AST_NODE_TYPES45.MemberExpression || callee.computed || callee.optional || callee.property.type !== AST_NODE_TYPES45.Identifier || callee.property.name !== "then" || node.optional || node.arguments.length !== 1) {
10908
+ return null;
10909
+ }
10910
+ const callback = node.arguments[0];
10911
+ if (callback === void 0 || callback.type !== AST_NODE_TYPES45.ArrowFunctionExpression && callback.type !== AST_NODE_TYPES45.FunctionExpression) {
10912
+ return null;
10913
+ }
10914
+ return callee.object;
10915
+ }
10916
+ function isProvenPromiseLike(node, services) {
10917
+ const checker = services.program.getTypeChecker();
10918
+ const tsNode = services.esTreeNodeToTSNodeMap.get(node);
10919
+ const receiverType = checker.getTypeAtLocation(tsNode);
10920
+ if ((receiverType.flags & (ts2.TypeFlags.Any | ts2.TypeFlags.Unknown | ts2.TypeFlags.Never)) !== 0) {
10921
+ return false;
10922
+ }
10923
+ const thenSymbol = checker.getPropertyOfType(receiverType, "then");
10924
+ const hasBuiltInPromiseDeclaration = thenSymbol?.declarations?.some(
10925
+ (declaration) => {
10926
+ let owner = declaration.parent;
10927
+ while (owner !== void 0 && !ts2.isInterfaceDeclaration(owner)) {
10928
+ owner = owner.parent;
10929
+ }
10930
+ return owner !== void 0 && (owner.name.text === "Promise" || owner.name.text === "PromiseLike") && services.program.isSourceFileDefaultLibrary(owner.getSourceFile());
10931
+ }
10932
+ ) ?? false;
10933
+ return hasBuiltInPromiseDeclaration;
10934
+ }
10935
+ var prefer_await_in_async_return_default = createRule({
10936
+ name: "prefer-await-in-async-return",
10937
+ documentation: preferAwaitInAsyncReturnDocumentation,
10938
+ meta: {
10939
+ type: "suggestion",
10940
+ docs: {
10941
+ description: "Prefer explicit `await` when an async function directly returns one typed Promise `.then` transform."
10942
+ },
10943
+ schema: [],
10944
+ messages: {
10945
+ preferAwait: "This async function directly returns a Promise `.then` transform. Await the Promise, then return the transformed value with explicit async control flow."
10946
+ }
10947
+ },
10948
+ defaultOptions: [],
10949
+ create(context) {
10950
+ let services;
10951
+ try {
10952
+ services = ESLintUtils3.getParserServices(context);
10953
+ } catch {
10954
+ services = null;
10955
+ }
10956
+ if (services === null) return {};
10957
+ return {
10958
+ CallExpression(node) {
10959
+ if (!isDirectAsyncReturn(node)) return;
10960
+ const receiver = promiseThenReceiver(node);
10961
+ if (receiver === null || !isProvenPromiseLike(receiver, services)) {
10962
+ return;
10963
+ }
10964
+ context.report({ node, messageId: "preferAwait" });
10965
+ }
10966
+ };
10967
+ }
10968
+ });
10969
+
10823
10970
  // src/rules/prefer-schema-for-api-payload.ts
10824
- import { AST_NODE_TYPES as AST_NODE_TYPES45 } from "@typescript-eslint/utils";
10971
+ import { AST_NODE_TYPES as AST_NODE_TYPES46 } from "@typescript-eslint/utils";
10825
10972
  var preferSchemaForApiPayloadDocumentation = {
10826
10973
  summary: "Require Zod (or similar) schema validation on `response.json()` / `JSON.parse()` results before property access.",
10827
10974
  rationale: "External JSON is untrusted at runtime even when its expected TypeScript shape is known statically.",
@@ -10836,9 +10983,9 @@ var preferSchemaForApiPayloadDocumentation = {
10836
10983
  var unwrap4 = (node) => {
10837
10984
  let current = node;
10838
10985
  while (current !== null && current !== void 0) {
10839
- if (current.type === AST_NODE_TYPES45.TSAsExpression || current.type === AST_NODE_TYPES45.TSTypeAssertion || current.type === AST_NODE_TYPES45.TSNonNullExpression || current.type === AST_NODE_TYPES45.TSSatisfiesExpression) {
10986
+ if (current.type === AST_NODE_TYPES46.TSAsExpression || current.type === AST_NODE_TYPES46.TSTypeAssertion || current.type === AST_NODE_TYPES46.TSNonNullExpression || current.type === AST_NODE_TYPES46.TSSatisfiesExpression) {
10840
10987
  current = current.expression;
10841
- } else if (current.type === AST_NODE_TYPES45.ChainExpression) {
10988
+ } else if (current.type === AST_NODE_TYPES46.ChainExpression) {
10842
10989
  current = current.expression;
10843
10990
  } else {
10844
10991
  break;
@@ -10853,23 +11000,23 @@ var PROMISE_CHAIN_METHODS = /* @__PURE__ */ new Set([
10853
11000
  ]);
10854
11001
  var isSchemaParseReference = (node) => {
10855
11002
  const inner = unwrap4(node);
10856
- return inner !== null && inner.type === AST_NODE_TYPES45.MemberExpression && !inner.computed && inner.property.type === AST_NODE_TYPES45.Identifier && (inner.property.name === "parse" || inner.property.name === "safeParse");
11003
+ return inner !== null && inner.type === AST_NODE_TYPES46.MemberExpression && !inner.computed && inner.property.type === AST_NODE_TYPES46.Identifier && (inner.property.name === "parse" || inner.property.name === "safeParse");
10857
11004
  };
10858
11005
  var isRawPayloadSource = (node, isKnownLocalText) => {
10859
11006
  let current = unwrap4(node);
10860
11007
  if (current === null) return false;
10861
- if (current.type === AST_NODE_TYPES45.AwaitExpression) {
11008
+ if (current.type === AST_NODE_TYPES46.AwaitExpression) {
10862
11009
  current = unwrap4(current.argument);
10863
11010
  }
10864
- if (current === null || current.type !== AST_NODE_TYPES45.CallExpression) {
11011
+ if (current === null || current.type !== AST_NODE_TYPES46.CallExpression) {
10865
11012
  return false;
10866
11013
  }
10867
11014
  const callee = unwrap4(current.callee);
10868
- if (callee === null || callee.type !== AST_NODE_TYPES45.MemberExpression) {
11015
+ if (callee === null || callee.type !== AST_NODE_TYPES46.MemberExpression) {
10869
11016
  return false;
10870
11017
  }
10871
11018
  const property = unwrap4(callee.property);
10872
- if (property === null || property.type !== AST_NODE_TYPES45.Identifier) {
11019
+ if (property === null || property.type !== AST_NODE_TYPES46.Identifier) {
10873
11020
  return false;
10874
11021
  }
10875
11022
  if (property.name === "json") {
@@ -10879,17 +11026,17 @@ var isRawPayloadSource = (node, isKnownLocalText) => {
10879
11026
  return !current.arguments.some(isSchemaParseReference) && isRawPayloadSource(callee.object);
10880
11027
  }
10881
11028
  const object = unwrap4(callee.object);
10882
- return property.name === "parse" && object !== null && object.type === AST_NODE_TYPES45.Identifier && object.name === "JSON" && !isLocalFileRead(current.arguments[0]) && isKnownLocalText?.(current.arguments[0]) !== true;
11029
+ return property.name === "parse" && object !== null && object.type === AST_NODE_TYPES46.Identifier && object.name === "JSON" && !isLocalFileRead(current.arguments[0]) && isKnownLocalText?.(current.arguments[0]) !== true;
10883
11030
  };
10884
11031
  var FILE_READ_RE = /^(readFile|readFileSync|readJson|readJsonSync|readJSON)$/;
10885
11032
  var isDirectLocalFileRead = (node) => {
10886
11033
  let current = unwrap4(node);
10887
- if (current?.type === AST_NODE_TYPES45.AwaitExpression) {
11034
+ if (current?.type === AST_NODE_TYPES46.AwaitExpression) {
10888
11035
  current = unwrap4(current.argument);
10889
11036
  }
10890
- if (current?.type !== AST_NODE_TYPES45.CallExpression) return false;
11037
+ if (current?.type !== AST_NODE_TYPES46.CallExpression) return false;
10891
11038
  const callee = unwrap4(current.callee);
10892
- const name = callee?.type === AST_NODE_TYPES45.Identifier ? callee.name : callee?.type === AST_NODE_TYPES45.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES45.Identifier ? callee.property.name : null;
11039
+ const name = callee?.type === AST_NODE_TYPES46.Identifier ? callee.name : callee?.type === AST_NODE_TYPES46.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES46.Identifier ? callee.property.name : null;
10893
11040
  return name !== null && FILE_READ_RE.test(name);
10894
11041
  };
10895
11042
  var isLocalFileRead = (node) => {
@@ -10916,15 +11063,15 @@ var isLocalFileRead = (node) => {
10916
11063
  var ASSERTION_CALLEE_RE = /^(expect|assert|should|invariant)$/;
10917
11064
  var isInsideAssertion = (node) => {
10918
11065
  for (let current = node.parent; current !== void 0 && current !== null; current = current.parent) {
10919
- if (current.type !== AST_NODE_TYPES45.CallExpression) continue;
11066
+ if (current.type !== AST_NODE_TYPES46.CallExpression) continue;
10920
11067
  let callee = current.callee;
10921
- while (callee.type === AST_NODE_TYPES45.MemberExpression) {
11068
+ while (callee.type === AST_NODE_TYPES46.MemberExpression) {
10922
11069
  callee = callee.object;
10923
11070
  }
10924
- if (callee.type === AST_NODE_TYPES45.CallExpression) {
11071
+ if (callee.type === AST_NODE_TYPES46.CallExpression) {
10925
11072
  callee = callee.callee;
10926
11073
  }
10927
- if (callee.type === AST_NODE_TYPES45.Identifier && ASSERTION_CALLEE_RE.test(callee.name)) {
11074
+ if (callee.type === AST_NODE_TYPES46.Identifier && ASSERTION_CALLEE_RE.test(callee.name)) {
10928
11075
  return true;
10929
11076
  }
10930
11077
  }
@@ -10943,22 +11090,22 @@ var GUARD_NAME_RE = /^(?:is|validate|parse|assert|decode|coerce)[A-Z]/;
10943
11090
  var isValidationRead = (node) => {
10944
11091
  let current = node;
10945
11092
  let parent = current.parent;
10946
- while (parent !== null && parent !== void 0 && (parent.type === AST_NODE_TYPES45.TSAsExpression || parent.type === AST_NODE_TYPES45.TSTypeAssertion || parent.type === AST_NODE_TYPES45.TSNonNullExpression || parent.type === AST_NODE_TYPES45.TSSatisfiesExpression || parent.type === AST_NODE_TYPES45.ChainExpression)) {
11093
+ while (parent !== null && parent !== void 0 && (parent.type === AST_NODE_TYPES46.TSAsExpression || parent.type === AST_NODE_TYPES46.TSTypeAssertion || parent.type === AST_NODE_TYPES46.TSNonNullExpression || parent.type === AST_NODE_TYPES46.TSSatisfiesExpression || parent.type === AST_NODE_TYPES46.ChainExpression)) {
10947
11094
  current = parent;
10948
11095
  parent = parent.parent;
10949
11096
  }
10950
11097
  if (parent === null || parent === void 0) return false;
10951
- if (parent.type === AST_NODE_TYPES45.UnaryExpression && parent.operator === "typeof" && parent.argument === current) {
11098
+ if (parent.type === AST_NODE_TYPES46.UnaryExpression && parent.operator === "typeof" && parent.argument === current) {
10952
11099
  return true;
10953
11100
  }
10954
- if (parent.type !== AST_NODE_TYPES45.CallExpression || !parent.arguments.some((arg) => arg === current)) {
11101
+ if (parent.type !== AST_NODE_TYPES46.CallExpression || !parent.arguments.some((arg) => arg === current)) {
10955
11102
  return false;
10956
11103
  }
10957
11104
  const callee = parent.callee;
10958
- if (callee.type === AST_NODE_TYPES45.MemberExpression && !callee.computed && callee.object.type === AST_NODE_TYPES45.Identifier && callee.object.name === "Array" && callee.property.type === AST_NODE_TYPES45.Identifier && callee.property.name === "isArray") {
11105
+ if (callee.type === AST_NODE_TYPES46.MemberExpression && !callee.computed && callee.object.type === AST_NODE_TYPES46.Identifier && callee.object.name === "Array" && callee.property.type === AST_NODE_TYPES46.Identifier && callee.property.name === "isArray") {
10959
11106
  return parent.arguments.length === 1;
10960
11107
  }
10961
- return callee.type === AST_NODE_TYPES45.Identifier && GUARD_NAME_RE.test(callee.name);
11108
+ return callee.type === AST_NODE_TYPES46.Identifier && GUARD_NAME_RE.test(callee.name);
10962
11109
  };
10963
11110
  var PRIMITIVE_TYPEOF_RESULTS = /* @__PURE__ */ new Set([
10964
11111
  "bigint",
@@ -10969,13 +11116,13 @@ var PRIMITIVE_TYPEOF_RESULTS = /* @__PURE__ */ new Set([
10969
11116
  "undefined"
10970
11117
  ]);
10971
11118
  var bindingValidationPolarity = (test, bindingName) => {
10972
- if (test.type === AST_NODE_TYPES45.UnaryExpression && test.operator === "!") {
11119
+ if (test.type === AST_NODE_TYPES46.UnaryExpression && test.operator === "!") {
10973
11120
  const inner = bindingValidationPolarity(test.argument, bindingName);
10974
11121
  return inner === "valid-when-true" ? "valid-when-false" : inner === "valid-when-false" ? "valid-when-true" : null;
10975
11122
  }
10976
- if (test.type === AST_NODE_TYPES45.BinaryExpression) {
10977
- const typeofName = (node) => node.type === AST_NODE_TYPES45.UnaryExpression && node.operator === "typeof" && node.argument.type === AST_NODE_TYPES45.Identifier ? node.argument.name : null;
10978
- const literalType = (node) => node.type === AST_NODE_TYPES45.Literal && typeof node.value === "string" && PRIMITIVE_TYPEOF_RESULTS.has(node.value) ? node.value : null;
11123
+ if (test.type === AST_NODE_TYPES46.BinaryExpression) {
11124
+ const typeofName = (node) => node.type === AST_NODE_TYPES46.UnaryExpression && node.operator === "typeof" && node.argument.type === AST_NODE_TYPES46.Identifier ? node.argument.name : null;
11125
+ const literalType = (node) => node.type === AST_NODE_TYPES46.Literal && typeof node.value === "string" && PRIMITIVE_TYPEOF_RESULTS.has(node.value) ? node.value : null;
10979
11126
  const matches = typeofName(test.left) === bindingName && literalType(test.right) !== null || typeofName(test.right) === bindingName && literalType(test.left) !== null;
10980
11127
  if (!matches) return null;
10981
11128
  if (test.operator === "===" || test.operator === "==") {
@@ -10983,9 +11130,9 @@ var bindingValidationPolarity = (test, bindingName) => {
10983
11130
  }
10984
11131
  return test.operator === "!==" || test.operator === "!=" ? "valid-when-false" : null;
10985
11132
  }
10986
- return test.type === AST_NODE_TYPES45.CallExpression && test.arguments.length === 1 && test.arguments[0]?.type === AST_NODE_TYPES45.Identifier && test.arguments[0].name === bindingName && test.callee.type === AST_NODE_TYPES45.MemberExpression && !test.callee.computed && test.callee.object.type === AST_NODE_TYPES45.Identifier && test.callee.object.name === "Array" && test.callee.property.type === AST_NODE_TYPES45.Identifier && test.callee.property.name === "isArray" ? "valid-when-true" : null;
11133
+ return test.type === AST_NODE_TYPES46.CallExpression && test.arguments.length === 1 && test.arguments[0]?.type === AST_NODE_TYPES46.Identifier && test.arguments[0].name === bindingName && test.callee.type === AST_NODE_TYPES46.MemberExpression && !test.callee.computed && test.callee.object.type === AST_NODE_TYPES46.Identifier && test.callee.object.name === "Array" && test.callee.property.type === AST_NODE_TYPES46.Identifier && test.callee.property.name === "isArray" ? "valid-when-true" : null;
10987
11134
  };
10988
- var plainMemberAccess = (node) => node.type === AST_NODE_TYPES45.MemberExpression && !node.computed && node.object.type === AST_NODE_TYPES45.Identifier && node.property.type === AST_NODE_TYPES45.Identifier ? { object: node.object.name, property: node.property.name } : null;
11135
+ var plainMemberAccess = (node) => node.type === AST_NODE_TYPES46.MemberExpression && !node.computed && node.object.type === AST_NODE_TYPES46.Identifier && node.property.type === AST_NODE_TYPES46.Identifier ? { object: node.object.name, property: node.property.name } : null;
10989
11136
  var isSamePlainMember = (node, access) => {
10990
11137
  const candidate = plainMemberAccess(node);
10991
11138
  return candidate !== null && candidate.object === access.object && candidate.property === access.property;
@@ -10993,19 +11140,19 @@ var isSamePlainMember = (node, access) => {
10993
11140
  var nodeWithin2 = (node, container) => node.range[0] >= container.range[0] && node.range[1] <= container.range[1];
10994
11141
  var isUseWithinValidatedBranch = (node, bindingName) => {
10995
11142
  for (let current = node.parent; current !== void 0 && current !== null; current = current.parent) {
10996
- if (current.type === AST_NODE_TYPES45.ConditionalExpression) {
11143
+ if (current.type === AST_NODE_TYPES46.ConditionalExpression) {
10997
11144
  const polarity = bindingValidationPolarity(current.test, bindingName);
10998
11145
  if (polarity === "valid-when-true" && nodeWithin2(node, current.consequent) || polarity === "valid-when-false" && nodeWithin2(node, current.alternate)) {
10999
11146
  return true;
11000
11147
  }
11001
11148
  }
11002
- if (current.type === AST_NODE_TYPES45.IfStatement) {
11149
+ if (current.type === AST_NODE_TYPES46.IfStatement) {
11003
11150
  const polarity = bindingValidationPolarity(current.test, bindingName);
11004
11151
  if (polarity === "valid-when-true" && nodeWithin2(node, current.consequent) || polarity === "valid-when-false" && current.alternate !== null && nodeWithin2(node, current.alternate)) {
11005
11152
  return true;
11006
11153
  }
11007
11154
  }
11008
- if (current.type === AST_NODE_TYPES45.FunctionDeclaration || current.type === AST_NODE_TYPES45.FunctionExpression || current.type === AST_NODE_TYPES45.ArrowFunctionExpression) {
11155
+ if (current.type === AST_NODE_TYPES46.FunctionDeclaration || current.type === AST_NODE_TYPES46.FunctionExpression || current.type === AST_NODE_TYPES46.ArrowFunctionExpression) {
11009
11156
  return false;
11010
11157
  }
11011
11158
  }
@@ -11013,32 +11160,32 @@ var isUseWithinValidatedBranch = (node, bindingName) => {
11013
11160
  };
11014
11161
  var isMemberUseWithinValidatedBranch = (node, access) => {
11015
11162
  for (let current = node.parent; current !== void 0 && current !== null; current = current.parent) {
11016
- if (current.type === AST_NODE_TYPES45.ConditionalExpression) {
11163
+ if (current.type === AST_NODE_TYPES46.ConditionalExpression) {
11017
11164
  const polarity = memberValidationPolarity(current.test, access);
11018
11165
  if (polarity === "valid-when-true" && nodeWithin2(node, current.consequent) || polarity === "valid-when-false" && nodeWithin2(node, current.alternate)) {
11019
11166
  return true;
11020
11167
  }
11021
11168
  }
11022
- if (current.type === AST_NODE_TYPES45.IfStatement) {
11169
+ if (current.type === AST_NODE_TYPES46.IfStatement) {
11023
11170
  const polarity = memberValidationPolarity(current.test, access);
11024
11171
  if (polarity === "valid-when-true" && nodeWithin2(node, current.consequent) || polarity === "valid-when-false" && current.alternate !== null && nodeWithin2(node, current.alternate)) {
11025
11172
  return true;
11026
11173
  }
11027
11174
  }
11028
- if (current.type === AST_NODE_TYPES45.FunctionDeclaration || current.type === AST_NODE_TYPES45.FunctionExpression || current.type === AST_NODE_TYPES45.ArrowFunctionExpression) {
11175
+ if (current.type === AST_NODE_TYPES46.FunctionDeclaration || current.type === AST_NODE_TYPES46.FunctionExpression || current.type === AST_NODE_TYPES46.ArrowFunctionExpression) {
11029
11176
  return false;
11030
11177
  }
11031
11178
  }
11032
11179
  return false;
11033
11180
  };
11034
11181
  var memberValidationPolarity = (test, access) => {
11035
- if (test.type === AST_NODE_TYPES45.UnaryExpression && test.operator === "!") {
11182
+ if (test.type === AST_NODE_TYPES46.UnaryExpression && test.operator === "!") {
11036
11183
  const inner = memberValidationPolarity(test.argument, access);
11037
11184
  return inner === "valid-when-true" ? "valid-when-false" : inner === "valid-when-false" ? "valid-when-true" : null;
11038
11185
  }
11039
- if (test.type === AST_NODE_TYPES45.BinaryExpression) {
11040
- const isMatchingTypeof = (node) => node.type === AST_NODE_TYPES45.UnaryExpression && node.operator === "typeof" && isSamePlainMember(node.argument, access);
11041
- const isPrimitiveType = (node) => node.type === AST_NODE_TYPES45.Literal && typeof node.value === "string" && PRIMITIVE_TYPEOF_RESULTS.has(node.value);
11186
+ if (test.type === AST_NODE_TYPES46.BinaryExpression) {
11187
+ const isMatchingTypeof = (node) => node.type === AST_NODE_TYPES46.UnaryExpression && node.operator === "typeof" && isSamePlainMember(node.argument, access);
11188
+ const isPrimitiveType = (node) => node.type === AST_NODE_TYPES46.Literal && typeof node.value === "string" && PRIMITIVE_TYPEOF_RESULTS.has(node.value);
11042
11189
  if (!(isMatchingTypeof(test.left) && isPrimitiveType(test.right) || isMatchingTypeof(test.right) && isPrimitiveType(test.left))) {
11043
11190
  return null;
11044
11191
  }
@@ -11047,15 +11194,15 @@ var memberValidationPolarity = (test, access) => {
11047
11194
  }
11048
11195
  return test.operator === "!==" || test.operator === "!=" ? "valid-when-false" : null;
11049
11196
  }
11050
- return test.type === AST_NODE_TYPES45.CallExpression && test.arguments.length === 1 && test.arguments[0] !== void 0 && test.arguments[0].type !== AST_NODE_TYPES45.SpreadElement && isSamePlainMember(test.arguments[0], access) && test.callee.type === AST_NODE_TYPES45.MemberExpression && !test.callee.computed && test.callee.object.type === AST_NODE_TYPES45.Identifier && test.callee.object.name === "Array" && test.callee.property.type === AST_NODE_TYPES45.Identifier && test.callee.property.name === "isArray" ? "valid-when-true" : null;
11197
+ return test.type === AST_NODE_TYPES46.CallExpression && test.arguments.length === 1 && test.arguments[0] !== void 0 && test.arguments[0].type !== AST_NODE_TYPES46.SpreadElement && isSamePlainMember(test.arguments[0], access) && test.callee.type === AST_NODE_TYPES46.MemberExpression && !test.callee.computed && test.callee.object.type === AST_NODE_TYPES46.Identifier && test.callee.object.name === "Array" && test.callee.property.type === AST_NODE_TYPES46.Identifier && test.callee.property.name === "isArray" ? "valid-when-true" : null;
11051
11198
  };
11052
11199
  var isFullyValidatedExtractedBinding = (member, source, context) => {
11053
11200
  const isValidationReference = (identifier) => {
11054
11201
  for (let current = identifier.parent; current !== void 0 && current !== null; current = current.parent) {
11055
- if ((current.type === AST_NODE_TYPES45.BinaryExpression || current.type === AST_NODE_TYPES45.CallExpression || current.type === AST_NODE_TYPES45.UnaryExpression) && bindingValidationPolarity(current, identifier.name) !== null) {
11202
+ if ((current.type === AST_NODE_TYPES46.BinaryExpression || current.type === AST_NODE_TYPES46.CallExpression || current.type === AST_NODE_TYPES46.UnaryExpression) && bindingValidationPolarity(current, identifier.name) !== null) {
11056
11203
  return true;
11057
11204
  }
11058
- if (current.type !== AST_NODE_TYPES45.UnaryExpression && current.type !== AST_NODE_TYPES45.MemberExpression && current.type !== AST_NODE_TYPES45.CallExpression) {
11205
+ if (current.type !== AST_NODE_TYPES46.UnaryExpression && current.type !== AST_NODE_TYPES46.MemberExpression && current.type !== AST_NODE_TYPES46.CallExpression) {
11059
11206
  return false;
11060
11207
  }
11061
11208
  }
@@ -11063,7 +11210,7 @@ var isFullyValidatedExtractedBinding = (member, source, context) => {
11063
11210
  };
11064
11211
  const isGuardedUse = (identifier) => {
11065
11212
  for (let current = identifier.parent; current !== void 0 && current !== null; current = current.parent) {
11066
- if (current.type === AST_NODE_TYPES45.ConditionalExpression) {
11213
+ if (current.type === AST_NODE_TYPES46.ConditionalExpression) {
11067
11214
  const polarity = bindingValidationPolarity(current.test, identifier.name);
11068
11215
  if (polarity === "valid-when-true" && nodeWithin2(identifier, current.consequent)) {
11069
11216
  return true;
@@ -11072,7 +11219,7 @@ var isFullyValidatedExtractedBinding = (member, source, context) => {
11072
11219
  return true;
11073
11220
  }
11074
11221
  }
11075
- if (current.type === AST_NODE_TYPES45.IfStatement) {
11222
+ if (current.type === AST_NODE_TYPES46.IfStatement) {
11076
11223
  const polarity = bindingValidationPolarity(current.test, identifier.name);
11077
11224
  if (polarity === "valid-when-true" && nodeWithin2(identifier, current.consequent)) {
11078
11225
  return true;
@@ -11081,14 +11228,14 @@ var isFullyValidatedExtractedBinding = (member, source, context) => {
11081
11228
  return true;
11082
11229
  }
11083
11230
  }
11084
- if (current.type === AST_NODE_TYPES45.FunctionDeclaration || current.type === AST_NODE_TYPES45.FunctionExpression || current.type === AST_NODE_TYPES45.ArrowFunctionExpression) {
11231
+ if (current.type === AST_NODE_TYPES46.FunctionDeclaration || current.type === AST_NODE_TYPES46.FunctionExpression || current.type === AST_NODE_TYPES46.ArrowFunctionExpression) {
11085
11232
  return false;
11086
11233
  }
11087
11234
  }
11088
11235
  return false;
11089
11236
  };
11090
11237
  const declarator = member.parent;
11091
- if (declarator.type !== AST_NODE_TYPES45.VariableDeclarator || declarator.init !== member || declarator.id.type !== AST_NODE_TYPES45.Identifier || declarator.parent.type !== AST_NODE_TYPES45.VariableDeclaration || declarator.parent.kind !== "const") {
11238
+ if (declarator.type !== AST_NODE_TYPES46.VariableDeclarator || declarator.init !== member || declarator.id.type !== AST_NODE_TYPES46.Identifier || declarator.parent.type !== AST_NODE_TYPES46.VariableDeclaration || declarator.parent.kind !== "const") {
11092
11239
  return false;
11093
11240
  }
11094
11241
  const extracted = context.sourceCode.getDeclaredVariables(declarator)[0];
@@ -11096,7 +11243,7 @@ var isFullyValidatedExtractedBinding = (member, source, context) => {
11096
11243
  let hasValueUse = false;
11097
11244
  for (const reference of extracted.references) {
11098
11245
  const identifier = reference.identifier;
11099
- if (identifier.type !== AST_NODE_TYPES45.Identifier) return false;
11246
+ if (identifier.type !== AST_NODE_TYPES46.Identifier) return false;
11100
11247
  if (nodeWithin2(identifier, declarator)) continue;
11101
11248
  if (isValidationReference(identifier)) continue;
11102
11249
  hasValueUse = true;
@@ -11109,17 +11256,17 @@ var isGuardTestPosition = (node) => {
11109
11256
  let parent = current.parent;
11110
11257
  while (parent !== void 0 && parent !== null) {
11111
11258
  switch (parent.type) {
11112
- case AST_NODE_TYPES45.UnaryExpression:
11113
- case AST_NODE_TYPES45.LogicalExpression:
11114
- case AST_NODE_TYPES45.ChainExpression:
11259
+ case AST_NODE_TYPES46.UnaryExpression:
11260
+ case AST_NODE_TYPES46.LogicalExpression:
11261
+ case AST_NODE_TYPES46.ChainExpression:
11115
11262
  current = parent;
11116
11263
  parent = parent.parent;
11117
11264
  continue;
11118
- case AST_NODE_TYPES45.IfStatement:
11119
- case AST_NODE_TYPES45.ConditionalExpression:
11120
- case AST_NODE_TYPES45.WhileStatement:
11121
- case AST_NODE_TYPES45.DoWhileStatement:
11122
- case AST_NODE_TYPES45.ForStatement:
11265
+ case AST_NODE_TYPES46.IfStatement:
11266
+ case AST_NODE_TYPES46.ConditionalExpression:
11267
+ case AST_NODE_TYPES46.WhileStatement:
11268
+ case AST_NODE_TYPES46.DoWhileStatement:
11269
+ case AST_NODE_TYPES46.ForStatement:
11123
11270
  return parent.test === current;
11124
11271
  default:
11125
11272
  return false;
@@ -11129,7 +11276,7 @@ var isGuardTestPosition = (node) => {
11129
11276
  };
11130
11277
  var unvalidatedVariableRef = (node, scope, tracked) => {
11131
11278
  const unwrapped = unwrap4(node);
11132
- if (unwrapped === null || unwrapped.type !== AST_NODE_TYPES45.Identifier) {
11279
+ if (unwrapped === null || unwrapped.type !== AST_NODE_TYPES46.Identifier) {
11133
11280
  return null;
11134
11281
  }
11135
11282
  const variable = findVariable2(scope, unwrapped.name);
@@ -11158,7 +11305,7 @@ var prefer_schema_for_api_payload_default = createRule({
11158
11305
  const localFileTextVariables = /* @__PURE__ */ new Set();
11159
11306
  const localFileTextRef = (node, scope) => {
11160
11307
  const unwrapped = unwrap4(node);
11161
- if (unwrapped?.type !== AST_NODE_TYPES45.Identifier) return null;
11308
+ if (unwrapped?.type !== AST_NODE_TYPES46.Identifier) return null;
11162
11309
  const variable = findVariable2(scope, unwrapped.name);
11163
11310
  return variable !== null && localFileTextVariables.has(variable) ? variable : null;
11164
11311
  };
@@ -11227,7 +11374,7 @@ var prefer_schema_for_api_payload_default = createRule({
11227
11374
  return {
11228
11375
  VariableDeclarator(node) {
11229
11376
  const scope = context.sourceCode.getScope(node);
11230
- if (node.id.type === AST_NODE_TYPES45.Identifier) {
11377
+ if (node.id.type === AST_NODE_TYPES46.Identifier) {
11231
11378
  const variable = context.sourceCode.getDeclaredVariables(node)[0];
11232
11379
  if (variable !== void 0) {
11233
11380
  updateLocalFileText(variable, node.init, scope);
@@ -11235,7 +11382,7 @@ var prefer_schema_for_api_payload_default = createRule({
11235
11382
  trackInitializer(node, scope);
11236
11383
  return;
11237
11384
  }
11238
- if (node.id.type === AST_NODE_TYPES45.ObjectPattern || node.id.type === AST_NODE_TYPES45.ArrayPattern) {
11385
+ if (node.id.type === AST_NODE_TYPES46.ObjectPattern || node.id.type === AST_NODE_TYPES46.ArrayPattern) {
11239
11386
  if (isRawPayloadSource(
11240
11387
  node.init,
11241
11388
  (candidate) => localFileTextRef(candidate, scope) !== null
@@ -11252,7 +11399,7 @@ var prefer_schema_for_api_payload_default = createRule({
11252
11399
  },
11253
11400
  AssignmentExpression(node) {
11254
11401
  const scope = context.sourceCode.getScope(node);
11255
- if (node.left.type === AST_NODE_TYPES45.Identifier) {
11402
+ if (node.left.type === AST_NODE_TYPES46.Identifier) {
11256
11403
  const variable = findVariable2(scope, node.left.name);
11257
11404
  if (variable === null) return;
11258
11405
  const isLocalText = (candidate) => localFileTextRef(candidate, scope) !== null;
@@ -11266,7 +11413,7 @@ var prefer_schema_for_api_payload_default = createRule({
11266
11413
  }
11267
11414
  return;
11268
11415
  }
11269
- if (node.left.type === AST_NODE_TYPES45.ObjectPattern || node.left.type === AST_NODE_TYPES45.ArrayPattern) {
11416
+ if (node.left.type === AST_NODE_TYPES46.ObjectPattern || node.left.type === AST_NODE_TYPES46.ArrayPattern) {
11270
11417
  if (isRawPayloadSource(
11271
11418
  node.right,
11272
11419
  (candidate) => localFileTextRef(candidate, scope) !== null
@@ -11286,15 +11433,15 @@ var prefer_schema_for_api_payload_default = createRule({
11286
11433
  }
11287
11434
  },
11288
11435
  CallExpression(node) {
11289
- if (node.callee.type !== AST_NODE_TYPES45.Identifier) return;
11436
+ if (node.callee.type !== AST_NODE_TYPES46.Identifier) return;
11290
11437
  if (!GUARD_NAME_RE.test(node.callee.name) && !isGuardTestPosition(node)) {
11291
11438
  return;
11292
11439
  }
11293
11440
  const scope = context.sourceCode.getScope(node);
11294
11441
  for (const arg of node.arguments) {
11295
- if (arg.type === AST_NODE_TYPES45.SpreadElement) continue;
11442
+ if (arg.type === AST_NODE_TYPES46.SpreadElement) continue;
11296
11443
  const unwrapped = unwrap4(arg);
11297
- if (unwrapped === null || unwrapped.type !== AST_NODE_TYPES45.Identifier) {
11444
+ if (unwrapped === null || unwrapped.type !== AST_NODE_TYPES46.Identifier) {
11298
11445
  continue;
11299
11446
  }
11300
11447
  const variable = findVariable2(scope, unwrapped.name);
@@ -11311,14 +11458,14 @@ var prefer_schema_for_api_payload_default = createRule({
11311
11458
  (candidate) => localFileTextRef(candidate, scope) !== null
11312
11459
  )) {
11313
11460
  const parent = node.parent;
11314
- if (parent.type === AST_NODE_TYPES45.CallExpression && parent.callee === node && node.property.type === AST_NODE_TYPES45.Identifier && (node.property.name === "parse" || node.property.name === "safeParse" || PROMISE_CHAIN_METHODS.has(node.property.name))) {
11461
+ if (parent.type === AST_NODE_TYPES46.CallExpression && parent.callee === node && node.property.type === AST_NODE_TYPES46.Identifier && (node.property.name === "parse" || node.property.name === "safeParse" || PROMISE_CHAIN_METHODS.has(node.property.name))) {
11315
11462
  return;
11316
11463
  }
11317
11464
  context.report({ node, messageId: "unparsedJsonAccess" });
11318
11465
  return;
11319
11466
  }
11320
- const variable = obj?.type === AST_NODE_TYPES45.Identifier ? unvalidatedVariableRef(obj, scope, unvalidatedVariables) : null;
11321
- if (variable !== null && obj?.type === AST_NODE_TYPES45.Identifier) {
11467
+ const variable = obj?.type === AST_NODE_TYPES46.Identifier ? unvalidatedVariableRef(obj, scope, unvalidatedVariables) : null;
11468
+ if (variable !== null && obj?.type === AST_NODE_TYPES46.Identifier) {
11322
11469
  if (isUseWithinValidatedBranch(node, obj.name)) {
11323
11470
  return;
11324
11471
  }
@@ -11338,7 +11485,7 @@ var prefer_schema_for_api_payload_default = createRule({
11338
11485
  });
11339
11486
 
11340
11487
  // src/rules/prefer-semantic-colors.ts
11341
- import { AST_NODE_TYPES as AST_NODE_TYPES46 } from "@typescript-eslint/utils";
11488
+ import { AST_NODE_TYPES as AST_NODE_TYPES47 } from "@typescript-eslint/utils";
11342
11489
  import { existsSync, readdirSync, readFileSync } from "fs";
11343
11490
  import { dirname, join, parse } from "path";
11344
11491
 
@@ -11450,7 +11597,7 @@ var SVG_EXEMPT_COLOR_VALUES = /* @__PURE__ */ new Set([
11450
11597
  var isInsideSvg = (node) => {
11451
11598
  let current = node.parent;
11452
11599
  while (current !== void 0 && current !== null) {
11453
- if (current.type === AST_NODE_TYPES46.JSXElement) {
11600
+ if (current.type === AST_NODE_TYPES47.JSXElement) {
11454
11601
  const name = jsxElementName(current);
11455
11602
  if (name !== null && isSvgLikeElementName(name)) return true;
11456
11603
  }
@@ -11460,8 +11607,8 @@ var isInsideSvg = (node) => {
11460
11607
  };
11461
11608
  function jsxElementName(node) {
11462
11609
  const name = node.openingElement.name;
11463
- if (name.type === AST_NODE_TYPES46.JSXIdentifier) return name.name;
11464
- if (name.type === AST_NODE_TYPES46.JSXMemberExpression && name.property.type === AST_NODE_TYPES46.JSXIdentifier) {
11610
+ if (name.type === AST_NODE_TYPES47.JSXIdentifier) return name.name;
11611
+ if (name.type === AST_NODE_TYPES47.JSXMemberExpression && name.property.type === AST_NODE_TYPES47.JSXIdentifier) {
11465
11612
  return name.property.name;
11466
11613
  }
11467
11614
  return null;
@@ -11487,7 +11634,7 @@ function isSvgLikeElementName(name) {
11487
11634
  var isInsideIconFactoryPath = (node) => {
11488
11635
  let current = node.parent;
11489
11636
  while (current !== void 0 && current !== null) {
11490
- if (current.type === AST_NODE_TYPES46.Property && propName(current.key) === "path" && current.parent.type === AST_NODE_TYPES46.ObjectExpression && current.parent.parent.type === AST_NODE_TYPES46.CallExpression && current.parent.parent.callee.type === AST_NODE_TYPES46.Identifier && current.parent.parent.callee.name === "createIcon") {
11637
+ if (current.type === AST_NODE_TYPES47.Property && propName(current.key) === "path" && current.parent.type === AST_NODE_TYPES47.ObjectExpression && current.parent.parent.type === AST_NODE_TYPES47.CallExpression && current.parent.parent.callee.type === AST_NODE_TYPES47.Identifier && current.parent.parent.callee.name === "createIcon") {
11491
11638
  return true;
11492
11639
  }
11493
11640
  current = current.parent;
@@ -11621,12 +11768,12 @@ var expandWorkspaceGlob = (root, glob) => {
11621
11768
  return readdirSync(parent, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => join(parent, entry.name));
11622
11769
  };
11623
11770
  var propName = (key) => {
11624
- if (key.type === AST_NODE_TYPES46.Identifier) return key.name;
11625
- if (key.type === AST_NODE_TYPES46.Literal && typeof key.value === "string") return key.value;
11771
+ if (key.type === AST_NODE_TYPES47.Identifier) return key.name;
11772
+ if (key.type === AST_NODE_TYPES47.Literal && typeof key.value === "string") return key.value;
11626
11773
  return null;
11627
11774
  };
11628
11775
  var staticallyImportsEmailOrPdfRenderer = (program) => program.body.some((statement) => {
11629
- if (statement.type !== AST_NODE_TYPES46.ImportDeclaration && statement.type !== AST_NODE_TYPES46.ExportNamedDeclaration && statement.type !== AST_NODE_TYPES46.ExportAllDeclaration) {
11776
+ if (statement.type !== AST_NODE_TYPES47.ImportDeclaration && statement.type !== AST_NODE_TYPES47.ExportNamedDeclaration && statement.type !== AST_NODE_TYPES47.ExportAllDeclaration) {
11630
11777
  return false;
11631
11778
  }
11632
11779
  return statement.source !== null && typeof statement.source.value === "string" && EMAIL_OR_PDF_MODULE_RE.test(statement.source.value);
@@ -11679,27 +11826,27 @@ var prefer_semantic_colors_default = createRule({
11679
11826
  const checkClassNode = (node) => {
11680
11827
  if (node === null) return;
11681
11828
  switch (node.type) {
11682
- case AST_NODE_TYPES46.Literal:
11829
+ case AST_NODE_TYPES47.Literal:
11683
11830
  if (typeof node.value === "string") reportClasses(node.value, node);
11684
11831
  break;
11685
- case AST_NODE_TYPES46.TemplateLiteral:
11832
+ case AST_NODE_TYPES47.TemplateLiteral:
11686
11833
  for (const quasi of node.quasis) reportClasses(quasi.value.cooked ?? "", quasi);
11687
11834
  break;
11688
- case AST_NODE_TYPES46.ArrayExpression:
11835
+ case AST_NODE_TYPES47.ArrayExpression:
11689
11836
  for (const element of node.elements) {
11690
- if (element !== null && element.type !== AST_NODE_TYPES46.SpreadElement) checkClassNode(element);
11837
+ if (element !== null && element.type !== AST_NODE_TYPES47.SpreadElement) checkClassNode(element);
11691
11838
  }
11692
11839
  break;
11693
- case AST_NODE_TYPES46.ObjectExpression:
11840
+ case AST_NODE_TYPES47.ObjectExpression:
11694
11841
  for (const property of node.properties) {
11695
- if (property.type === AST_NODE_TYPES46.Property) checkClassNode(property.value);
11842
+ if (property.type === AST_NODE_TYPES47.Property) checkClassNode(property.value);
11696
11843
  }
11697
11844
  break;
11698
- case AST_NODE_TYPES46.ConditionalExpression:
11845
+ case AST_NODE_TYPES47.ConditionalExpression:
11699
11846
  checkClassNode(node.consequent);
11700
11847
  checkClassNode(node.alternate);
11701
11848
  break;
11702
- case AST_NODE_TYPES46.LogicalExpression:
11849
+ case AST_NODE_TYPES47.LogicalExpression:
11703
11850
  checkClassNode(node.right);
11704
11851
  break;
11705
11852
  default:
@@ -11707,32 +11854,32 @@ var prefer_semantic_colors_default = createRule({
11707
11854
  }
11708
11855
  };
11709
11856
  const checkColorValueNode = (node) => {
11710
- if (node.type === AST_NODE_TYPES46.Literal && typeof node.value === "string" && RAW_COLOR_VALUE_RE.test(node.value) && !CSS_VAR_REFERENCE_RE.test(node.value)) {
11857
+ if (node.type === AST_NODE_TYPES47.Literal && typeof node.value === "string" && RAW_COLOR_VALUE_RE.test(node.value) && !CSS_VAR_REFERENCE_RE.test(node.value)) {
11711
11858
  report(node, "inlineColor", { value: node.value });
11712
11859
  }
11713
11860
  };
11714
11861
  return {
11715
11862
  "JSXAttribute[name.name='className']"(node) {
11716
11863
  if (node.value === null) return;
11717
- if (node.value.type === AST_NODE_TYPES46.Literal) checkClassNode(node.value);
11718
- else if (node.value.type === AST_NODE_TYPES46.JSXExpressionContainer) {
11719
- if (node.value.expression.type !== AST_NODE_TYPES46.JSXEmptyExpression) {
11864
+ if (node.value.type === AST_NODE_TYPES47.Literal) checkClassNode(node.value);
11865
+ else if (node.value.type === AST_NODE_TYPES47.JSXExpressionContainer) {
11866
+ if (node.value.expression.type !== AST_NODE_TYPES47.JSXEmptyExpression) {
11720
11867
  checkClassNode(node.value.expression);
11721
11868
  }
11722
11869
  }
11723
11870
  },
11724
11871
  CallExpression(node) {
11725
- if (node.callee.type === AST_NODE_TYPES46.Identifier && node.callee.name === "require" && node.arguments[0]?.type === AST_NODE_TYPES46.Literal && typeof node.arguments[0].value === "string" && EMAIL_OR_PDF_MODULE_RE.test(node.arguments[0].value)) {
11872
+ if (node.callee.type === AST_NODE_TYPES47.Identifier && node.callee.name === "require" && node.arguments[0]?.type === AST_NODE_TYPES47.Literal && typeof node.arguments[0].value === "string" && EMAIL_OR_PDF_MODULE_RE.test(node.arguments[0].value)) {
11726
11873
  importsEmailOrPdfRenderer = true;
11727
11874
  }
11728
- if (node.callee.type === AST_NODE_TYPES46.Identifier && CLASS_FNS.has(node.callee.name)) {
11875
+ if (node.callee.type === AST_NODE_TYPES47.Identifier && CLASS_FNS.has(node.callee.name)) {
11729
11876
  for (const arg of node.arguments) {
11730
- if (arg.type !== AST_NODE_TYPES46.SpreadElement) checkClassNode(arg);
11877
+ if (arg.type !== AST_NODE_TYPES47.SpreadElement) checkClassNode(arg);
11731
11878
  }
11732
11879
  }
11733
11880
  },
11734
11881
  VariableDeclarator(node) {
11735
- if (node.id.type === AST_NODE_TYPES46.Identifier && CLASS_NAME_RE.test(node.id.name)) {
11882
+ if (node.id.type === AST_NODE_TYPES47.Identifier && CLASS_NAME_RE.test(node.id.name)) {
11736
11883
  checkClassNode(node.init);
11737
11884
  }
11738
11885
  },
@@ -11742,9 +11889,9 @@ var prefer_semantic_colors_default = createRule({
11742
11889
  },
11743
11890
  // SVG artwork colors are exempt; component presentation colors still report.
11744
11891
  "JSXAttribute[name.name=/^(fill|stroke|color)$/]"(node) {
11745
- if (node.value?.type !== AST_NODE_TYPES46.Literal) return;
11892
+ if (node.value?.type !== AST_NODE_TYPES47.Literal) return;
11746
11893
  const owner = node.parent.name;
11747
- if (owner.type === AST_NODE_TYPES46.JSXIdentifier && SVG_SHAPE_PRIMITIVES.has(owner.name)) {
11894
+ if (owner.type === AST_NODE_TYPES47.JSXIdentifier && SVG_SHAPE_PRIMITIVES.has(owner.name)) {
11748
11895
  return;
11749
11896
  }
11750
11897
  if (typeof node.value.value === "string" && SVG_EXEMPT_COLOR_VALUES.has(node.value.value.toLowerCase())) {
@@ -11758,7 +11905,7 @@ var prefer_semantic_colors_default = createRule({
11758
11905
  if (name !== null && STYLE_COLOR_PROPS.has(name)) checkColorValueNode(node.value);
11759
11906
  },
11760
11907
  ImportExpression(node) {
11761
- if (node.source.type === AST_NODE_TYPES46.Literal && typeof node.source.value === "string" && EMAIL_OR_PDF_MODULE_RE.test(node.source.value)) {
11908
+ if (node.source.type === AST_NODE_TYPES47.Literal && typeof node.source.value === "string" && EMAIL_OR_PDF_MODULE_RE.test(node.source.value)) {
11762
11909
  importsEmailOrPdfRenderer = true;
11763
11910
  }
11764
11911
  },
@@ -11960,7 +12107,7 @@ var prefer_server_actions_default = createRule({
11960
12107
  });
11961
12108
 
11962
12109
  // src/rules/prefer-whole-object-assertion.ts
11963
- import { AST_NODE_TYPES as AST_NODE_TYPES47 } from "@typescript-eslint/utils";
12110
+ import { AST_NODE_TYPES as AST_NODE_TYPES48 } from "@typescript-eslint/utils";
11964
12111
  var MERGEABLE_MATCHERS = /* @__PURE__ */ new Set(["toBe", "toEqual", "toStrictEqual"]);
11965
12112
  var SYNTHETIC_LITERAL_MATCHERS = /* @__PURE__ */ new Map([
11966
12113
  ["toBeNull", "null"],
@@ -11985,11 +12132,11 @@ var preferWholeObjectAssertionDocumentation = {
11985
12132
  };
11986
12133
  function literalText(node, getText) {
11987
12134
  switch (node.type) {
11988
- case AST_NODE_TYPES47.Literal:
12135
+ case AST_NODE_TYPES48.Literal:
11989
12136
  return "regex" in node ? null : getText(node);
11990
- case AST_NODE_TYPES47.TemplateLiteral:
12137
+ case AST_NODE_TYPES48.TemplateLiteral:
11991
12138
  return node.expressions.length === 0 ? getText(node) : null;
11992
- case AST_NODE_TYPES47.UnaryExpression:
12139
+ case AST_NODE_TYPES48.UnaryExpression:
11993
12140
  return NUMERIC_SIGNS2.has(node.operator) && literalText(node.argument, getText) !== null ? getText(node) : null;
11994
12141
  default:
11995
12142
  return null;
@@ -11997,15 +12144,15 @@ function literalText(node, getText) {
11997
12144
  }
11998
12145
  function isPureReceiver(node) {
11999
12146
  switch (node.type) {
12000
- case AST_NODE_TYPES47.Identifier:
12001
- case AST_NODE_TYPES47.ThisExpression:
12147
+ case AST_NODE_TYPES48.Identifier:
12148
+ case AST_NODE_TYPES48.ThisExpression:
12002
12149
  return true;
12003
- case AST_NODE_TYPES47.MemberExpression:
12150
+ case AST_NODE_TYPES48.MemberExpression:
12004
12151
  if (node.optional) {
12005
12152
  return false;
12006
12153
  }
12007
12154
  if (node.computed) {
12008
- return node.property.type === AST_NODE_TYPES47.Literal && isPureReceiver(node.object);
12155
+ return node.property.type === AST_NODE_TYPES48.Literal && isPureReceiver(node.object);
12009
12156
  }
12010
12157
  return isPureReceiver(node.object);
12011
12158
  default:
@@ -12013,7 +12160,7 @@ function isPureReceiver(node) {
12013
12160
  }
12014
12161
  }
12015
12162
  function literalIndex(node) {
12016
- if (node.type !== AST_NODE_TYPES47.Literal || typeof node.value !== "number") {
12163
+ if (node.type !== AST_NODE_TYPES48.Literal || typeof node.value !== "number") {
12017
12164
  return null;
12018
12165
  }
12019
12166
  return Number.isInteger(node.value) && node.value >= 0 ? node.value : null;
@@ -12040,24 +12187,24 @@ var prefer_whole_object_assertion_default = createRule({
12040
12187
  }
12041
12188
  const { sourceCode } = context;
12042
12189
  function parseAssertion(statement) {
12043
- if (statement.type !== AST_NODE_TYPES47.ExpressionStatement) {
12190
+ if (statement.type !== AST_NODE_TYPES48.ExpressionStatement) {
12044
12191
  return null;
12045
12192
  }
12046
12193
  const call = statement.expression;
12047
- if (call.type !== AST_NODE_TYPES47.CallExpression) {
12194
+ if (call.type !== AST_NODE_TYPES48.CallExpression) {
12048
12195
  return null;
12049
12196
  }
12050
12197
  const callee = call.callee;
12051
- if (callee.type !== AST_NODE_TYPES47.MemberExpression || callee.computed || callee.property.type !== AST_NODE_TYPES47.Identifier) {
12198
+ if (callee.type !== AST_NODE_TYPES48.MemberExpression || callee.computed || callee.property.type !== AST_NODE_TYPES48.Identifier) {
12052
12199
  return null;
12053
12200
  }
12054
12201
  const matcher = callee.property.name;
12055
12202
  const expectCall = callee.object;
12056
- if (expectCall.type !== AST_NODE_TYPES47.CallExpression || expectCall.callee.type !== AST_NODE_TYPES47.Identifier || expectCall.callee.name !== "expect" || expectCall.arguments.length !== 1) {
12203
+ if (expectCall.type !== AST_NODE_TYPES48.CallExpression || expectCall.callee.type !== AST_NODE_TYPES48.Identifier || expectCall.callee.name !== "expect" || expectCall.arguments.length !== 1) {
12057
12204
  return null;
12058
12205
  }
12059
12206
  const actual = expectCall.arguments[0];
12060
- if (actual === void 0 || actual.type !== AST_NODE_TYPES47.MemberExpression || actual.optional) {
12207
+ if (actual === void 0 || actual.type !== AST_NODE_TYPES48.MemberExpression || actual.optional) {
12061
12208
  return null;
12062
12209
  }
12063
12210
  if (!isPureReceiver(actual.object)) {
@@ -12071,7 +12218,7 @@ var prefer_whole_object_assertion_default = createRule({
12071
12218
  }
12072
12219
  key = { kind: "index", index };
12073
12220
  } else {
12074
- if (actual.property.type !== AST_NODE_TYPES47.Identifier || COLLECTION_PROPERTIES.has(actual.property.name) || LITERAL_KEY_HAZARDS.has(actual.property.name)) {
12221
+ if (actual.property.type !== AST_NODE_TYPES48.Identifier || COLLECTION_PROPERTIES.has(actual.property.name) || LITERAL_KEY_HAZARDS.has(actual.property.name)) {
12075
12222
  return null;
12076
12223
  }
12077
12224
  key = { kind: "property", name: actual.property.name };
@@ -12084,7 +12231,7 @@ var prefer_whole_object_assertion_default = createRule({
12084
12231
  return null;
12085
12232
  }
12086
12233
  const expected = call.arguments[0];
12087
- if (call.arguments.length !== 1 || expected === void 0 || expected.type === AST_NODE_TYPES47.SpreadElement) {
12234
+ if (call.arguments.length !== 1 || expected === void 0 || expected.type === AST_NODE_TYPES48.SpreadElement) {
12088
12235
  return null;
12089
12236
  }
12090
12237
  const literal = literalText(expected, (node) => sourceCode.getText(node));
@@ -12199,7 +12346,7 @@ var prefer_whole_object_assertion_default = createRule({
12199
12346
  });
12200
12347
 
12201
12348
  // src/rules/prefer-zod-infer.ts
12202
- import { AST_NODE_TYPES as AST_NODE_TYPES48 } from "@typescript-eslint/utils";
12349
+ import { AST_NODE_TYPES as AST_NODE_TYPES49 } from "@typescript-eslint/utils";
12203
12350
  var preferZodInferDocumentation = {
12204
12351
  summary: "Derive a type from its Zod schema with `z.infer` instead of hand-writing a twin declaration beside it.",
12205
12352
  rationale: "A derived type stays synchronized when the runtime schema changes.",
@@ -12223,6 +12370,14 @@ var OPTIONAL_MODIFIERS = /* @__PURE__ */ new Set([
12223
12370
  "nullish"
12224
12371
  ]);
12225
12372
  var NULLABLE_MODIFIERS = /* @__PURE__ */ new Set(["nullable", "nullish"]);
12373
+ var DOMAIN_PRESERVING_MODIFIERS = /* @__PURE__ */ new Set([
12374
+ ...SHAPE_PRESERVING_METHODS,
12375
+ ...OPTIONAL_MODIFIERS,
12376
+ ...NULLABLE_MODIFIERS,
12377
+ "catch",
12378
+ "default",
12379
+ "prefault"
12380
+ ]);
12226
12381
  var RESHAPING_MODIFIERS = /* @__PURE__ */ new Set([
12227
12382
  "transform",
12228
12383
  "pipe",
@@ -12244,45 +12399,146 @@ var ZOD_TYPE_CONSTRAINTS = /* @__PURE__ */ new Set([
12244
12399
  "Schema"
12245
12400
  ]);
12246
12401
  var LEAF_NODE_TYPES = {
12247
- string: [AST_NODE_TYPES48.TSStringKeyword],
12248
- email: [AST_NODE_TYPES48.TSStringKeyword],
12249
- url: [AST_NODE_TYPES48.TSStringKeyword],
12250
- uuid: [AST_NODE_TYPES48.TSStringKeyword],
12251
- ulid: [AST_NODE_TYPES48.TSStringKeyword],
12252
- cuid: [AST_NODE_TYPES48.TSStringKeyword],
12253
- cuid2: [AST_NODE_TYPES48.TSStringKeyword],
12254
- nanoid: [AST_NODE_TYPES48.TSStringKeyword],
12255
- iso: [AST_NODE_TYPES48.TSStringKeyword],
12256
- number: [AST_NODE_TYPES48.TSNumberKeyword],
12257
- int: [AST_NODE_TYPES48.TSNumberKeyword],
12258
- float32: [AST_NODE_TYPES48.TSNumberKeyword],
12259
- float64: [AST_NODE_TYPES48.TSNumberKeyword],
12260
- boolean: [AST_NODE_TYPES48.TSBooleanKeyword],
12261
- bigint: [AST_NODE_TYPES48.TSBigIntKeyword],
12262
- symbol: [AST_NODE_TYPES48.TSSymbolKeyword],
12263
- any: [AST_NODE_TYPES48.TSAnyKeyword],
12264
- unknown: [AST_NODE_TYPES48.TSUnknownKeyword],
12265
- never: [AST_NODE_TYPES48.TSNeverKeyword],
12266
- void: [AST_NODE_TYPES48.TSVoidKeyword],
12267
- null: [AST_NODE_TYPES48.TSNullKeyword],
12268
- undefined: [AST_NODE_TYPES48.TSUndefinedKeyword],
12269
- literal: [AST_NODE_TYPES48.TSLiteralType],
12270
- date: [AST_NODE_TYPES48.TSTypeReference],
12271
- array: [AST_NODE_TYPES48.TSArrayType, AST_NODE_TYPES48.TSTypeReference],
12272
- tuple: [AST_NODE_TYPES48.TSTupleType],
12273
- object: [AST_NODE_TYPES48.TSTypeLiteral, AST_NODE_TYPES48.TSTypeReference],
12274
- strictObject: [AST_NODE_TYPES48.TSTypeLiteral, AST_NODE_TYPES48.TSTypeReference],
12275
- looseObject: [AST_NODE_TYPES48.TSTypeLiteral, AST_NODE_TYPES48.TSTypeReference],
12276
- record: [AST_NODE_TYPES48.TSTypeReference, AST_NODE_TYPES48.TSTypeLiteral],
12277
- map: [AST_NODE_TYPES48.TSTypeReference],
12278
- set: [AST_NODE_TYPES48.TSTypeReference],
12279
- promise: [AST_NODE_TYPES48.TSTypeReference],
12280
- enum: [AST_NODE_TYPES48.TSUnionType, AST_NODE_TYPES48.TSTypeReference, AST_NODE_TYPES48.TSLiteralType],
12281
- nativeEnum: [AST_NODE_TYPES48.TSUnionType, AST_NODE_TYPES48.TSTypeReference, AST_NODE_TYPES48.TSLiteralType],
12282
- union: [AST_NODE_TYPES48.TSUnionType, AST_NODE_TYPES48.TSTypeReference],
12283
- discriminatedUnion: [AST_NODE_TYPES48.TSUnionType, AST_NODE_TYPES48.TSTypeReference],
12284
- intersection: [AST_NODE_TYPES48.TSIntersectionType, AST_NODE_TYPES48.TSTypeReference]
12285
- };
12402
+ string: [AST_NODE_TYPES49.TSStringKeyword],
12403
+ email: [AST_NODE_TYPES49.TSStringKeyword],
12404
+ url: [AST_NODE_TYPES49.TSStringKeyword],
12405
+ uuid: [AST_NODE_TYPES49.TSStringKeyword],
12406
+ ulid: [AST_NODE_TYPES49.TSStringKeyword],
12407
+ cuid: [AST_NODE_TYPES49.TSStringKeyword],
12408
+ cuid2: [AST_NODE_TYPES49.TSStringKeyword],
12409
+ nanoid: [AST_NODE_TYPES49.TSStringKeyword],
12410
+ iso: [AST_NODE_TYPES49.TSStringKeyword],
12411
+ number: [AST_NODE_TYPES49.TSNumberKeyword],
12412
+ int: [AST_NODE_TYPES49.TSNumberKeyword],
12413
+ float32: [AST_NODE_TYPES49.TSNumberKeyword],
12414
+ float64: [AST_NODE_TYPES49.TSNumberKeyword],
12415
+ boolean: [AST_NODE_TYPES49.TSBooleanKeyword],
12416
+ bigint: [AST_NODE_TYPES49.TSBigIntKeyword],
12417
+ symbol: [AST_NODE_TYPES49.TSSymbolKeyword],
12418
+ any: [AST_NODE_TYPES49.TSAnyKeyword],
12419
+ unknown: [AST_NODE_TYPES49.TSUnknownKeyword],
12420
+ never: [AST_NODE_TYPES49.TSNeverKeyword],
12421
+ void: [AST_NODE_TYPES49.TSVoidKeyword],
12422
+ null: [AST_NODE_TYPES49.TSNullKeyword],
12423
+ undefined: [AST_NODE_TYPES49.TSUndefinedKeyword],
12424
+ literal: [AST_NODE_TYPES49.TSLiteralType],
12425
+ date: [AST_NODE_TYPES49.TSTypeReference],
12426
+ array: [AST_NODE_TYPES49.TSArrayType, AST_NODE_TYPES49.TSTypeReference],
12427
+ tuple: [AST_NODE_TYPES49.TSTupleType],
12428
+ object: [AST_NODE_TYPES49.TSTypeLiteral, AST_NODE_TYPES49.TSTypeReference],
12429
+ strictObject: [AST_NODE_TYPES49.TSTypeLiteral, AST_NODE_TYPES49.TSTypeReference],
12430
+ looseObject: [AST_NODE_TYPES49.TSTypeLiteral, AST_NODE_TYPES49.TSTypeReference],
12431
+ record: [AST_NODE_TYPES49.TSTypeReference, AST_NODE_TYPES49.TSTypeLiteral],
12432
+ map: [AST_NODE_TYPES49.TSTypeReference],
12433
+ set: [AST_NODE_TYPES49.TSTypeReference],
12434
+ promise: [AST_NODE_TYPES49.TSTypeReference],
12435
+ enum: [AST_NODE_TYPES49.TSUnionType, AST_NODE_TYPES49.TSTypeReference, AST_NODE_TYPES49.TSLiteralType],
12436
+ nativeEnum: [AST_NODE_TYPES49.TSUnionType, AST_NODE_TYPES49.TSTypeReference, AST_NODE_TYPES49.TSLiteralType],
12437
+ union: [AST_NODE_TYPES49.TSUnionType, AST_NODE_TYPES49.TSTypeReference],
12438
+ discriminatedUnion: [AST_NODE_TYPES49.TSUnionType, AST_NODE_TYPES49.TSTypeReference],
12439
+ intersection: [AST_NODE_TYPES49.TSIntersectionType, AST_NODE_TYPES49.TSTypeReference]
12440
+ };
12441
+ function primitiveLiteralKey(node) {
12442
+ if (node.type !== AST_NODE_TYPES49.Literal) {
12443
+ return null;
12444
+ }
12445
+ if (node.value === null) {
12446
+ return "null";
12447
+ }
12448
+ switch (typeof node.value) {
12449
+ case "string":
12450
+ return `string:${node.value}`;
12451
+ case "number":
12452
+ return `number:${String(node.value)}`;
12453
+ case "boolean":
12454
+ return `boolean:${String(node.value)}`;
12455
+ case "bigint":
12456
+ return `bigint:${String(node.value)}`;
12457
+ default:
12458
+ return null;
12459
+ }
12460
+ }
12461
+ function exactDomain(keys) {
12462
+ if (keys.length === 0 || keys.some((key) => key === null)) {
12463
+ return null;
12464
+ }
12465
+ const domain = new Set(keys);
12466
+ return domain.size === keys.length ? domain : null;
12467
+ }
12468
+ function staticZodDomain(leaf, call) {
12469
+ if (leaf === null || call === null) {
12470
+ return void 0;
12471
+ }
12472
+ if (leaf === "literal") {
12473
+ const [argument] = call.arguments;
12474
+ if (argument === void 0 || argument.type === AST_NODE_TYPES49.SpreadElement) {
12475
+ return null;
12476
+ }
12477
+ if (argument.type === AST_NODE_TYPES49.ArrayExpression) {
12478
+ return exactDomain(
12479
+ argument.elements.map(
12480
+ (element) => element === null || element.type === AST_NODE_TYPES49.SpreadElement ? null : primitiveLiteralKey(element)
12481
+ )
12482
+ );
12483
+ }
12484
+ return exactDomain([primitiveLiteralKey(argument)]);
12485
+ }
12486
+ if (leaf === "enum") {
12487
+ const [argument] = call.arguments;
12488
+ if (argument === void 0 || argument.type === AST_NODE_TYPES49.SpreadElement) {
12489
+ return null;
12490
+ }
12491
+ if (argument.type === AST_NODE_TYPES49.ArrayExpression) {
12492
+ return exactDomain(
12493
+ argument.elements.map((element) => {
12494
+ if (element === null || element.type === AST_NODE_TYPES49.SpreadElement) {
12495
+ return null;
12496
+ }
12497
+ const key = primitiveLiteralKey(element);
12498
+ return key?.startsWith("string:") === true ? key : null;
12499
+ })
12500
+ );
12501
+ }
12502
+ if (argument.type === AST_NODE_TYPES49.ObjectExpression) {
12503
+ return exactDomain(
12504
+ argument.properties.map((property) => {
12505
+ if (property.type !== AST_NODE_TYPES49.Property || property.computed || property.kind !== "init" || property.method || property.shorthand) {
12506
+ return null;
12507
+ }
12508
+ const key = primitiveLiteralKey(property.value);
12509
+ return key?.startsWith("string:") === true ? key : null;
12510
+ })
12511
+ );
12512
+ }
12513
+ return null;
12514
+ }
12515
+ if (leaf === "nativeEnum" || leaf === "union" || leaf === "discriminatedUnion") {
12516
+ return null;
12517
+ }
12518
+ return void 0;
12519
+ }
12520
+ function sameDomain(left, right) {
12521
+ if (left.size !== right.size) {
12522
+ return false;
12523
+ }
12524
+ for (const value of left) {
12525
+ if (!right.has(value)) {
12526
+ return false;
12527
+ }
12528
+ }
12529
+ return true;
12530
+ }
12531
+ function isExportedDeclaration(node) {
12532
+ return node.parent?.type === AST_NODE_TYPES49.ExportNamedDeclaration;
12533
+ }
12534
+ function isModuleLevelConst(node) {
12535
+ const declaration = node.parent;
12536
+ if (declaration.type !== AST_NODE_TYPES49.VariableDeclaration || declaration.kind !== "const") {
12537
+ return false;
12538
+ }
12539
+ const container = declaration.parent;
12540
+ return container.type === AST_NODE_TYPES49.Program || container.type === AST_NODE_TYPES49.ExportNamedDeclaration && container.parent.type === AST_NODE_TYPES49.Program;
12541
+ }
12286
12542
  function normalizeSchemaName(name) {
12287
12543
  return name.replace(/Schema$/i, "").replace(/^Z(?=[A-Z])/, "").toLowerCase();
12288
12544
  }
@@ -12290,20 +12546,20 @@ function normalizeTypeName(name) {
12290
12546
  return name.replace(/Type$/, "").toLowerCase();
12291
12547
  }
12292
12548
  function unwrapNullish(annotation) {
12293
- if (annotation.type !== AST_NODE_TYPES48.TSUnionType) {
12549
+ if (annotation.type !== AST_NODE_TYPES49.TSUnionType) {
12294
12550
  return {
12295
12551
  core: annotation,
12296
- nullable: annotation.type === AST_NODE_TYPES48.TSNullKeyword
12552
+ nullable: annotation.type === AST_NODE_TYPES49.TSNullKeyword
12297
12553
  };
12298
12554
  }
12299
12555
  const rest = [];
12300
12556
  let nullable = false;
12301
12557
  for (const member of annotation.types) {
12302
- if (member.type === AST_NODE_TYPES48.TSNullKeyword) {
12558
+ if (member.type === AST_NODE_TYPES49.TSNullKeyword) {
12303
12559
  nullable = true;
12304
12560
  continue;
12305
12561
  }
12306
- if (member.type === AST_NODE_TYPES48.TSUndefinedKeyword) {
12562
+ if (member.type === AST_NODE_TYPES49.TSUndefinedKeyword) {
12307
12563
  continue;
12308
12564
  }
12309
12565
  rest.push(member);
@@ -12313,7 +12569,18 @@ function unwrapNullish(annotation) {
12313
12569
  }
12314
12570
  return { core: rest.length === 0 ? null : annotation, nullable };
12315
12571
  }
12316
- function leafAgrees(leaf, annotation) {
12572
+ function leafAgrees(field, annotation) {
12573
+ if (field.domain === null) {
12574
+ return false;
12575
+ }
12576
+ if (field.domain !== void 0) {
12577
+ if (annotation === null) {
12578
+ return false;
12579
+ }
12580
+ const annotationDomain = typeLiteralDomain(annotation);
12581
+ return annotationDomain !== null && sameDomain(field.domain, annotationDomain);
12582
+ }
12583
+ const { leaf } = field;
12317
12584
  if (leaf === null || annotation === null) {
12318
12585
  return null;
12319
12586
  }
@@ -12326,10 +12593,51 @@ function leafAgrees(leaf, annotation) {
12326
12593
  return null;
12327
12594
  }
12328
12595
  if (leaf === "date") {
12329
- return core.type === AST_NODE_TYPES48.TSTypeReference && core.typeName.type === AST_NODE_TYPES48.Identifier && core.typeName.name === "Date";
12596
+ return core.type === AST_NODE_TYPES49.TSTypeReference && core.typeName.type === AST_NODE_TYPES49.Identifier && core.typeName.name === "Date";
12330
12597
  }
12331
12598
  return expected.includes(core.type);
12332
12599
  }
12600
+ function typeLiteralDomain(annotation) {
12601
+ const members = annotation.type === AST_NODE_TYPES49.TSUnionType ? annotation.types : [annotation];
12602
+ const keys = [];
12603
+ for (const member of members) {
12604
+ if (member.type === AST_NODE_TYPES49.TSNullKeyword) {
12605
+ continue;
12606
+ }
12607
+ if (member.type !== AST_NODE_TYPES49.TSLiteralType) {
12608
+ return null;
12609
+ }
12610
+ keys.push(primitiveLiteralKey(member.literal));
12611
+ }
12612
+ return exactDomain(keys);
12613
+ }
12614
+ function staticStringUnionDomain(node) {
12615
+ if (node.type !== AST_NODE_TYPES49.TSUnionType) {
12616
+ return null;
12617
+ }
12618
+ const keys = node.types.map((member) => {
12619
+ if (member.type !== AST_NODE_TYPES49.TSLiteralType) {
12620
+ return null;
12621
+ }
12622
+ const key = primitiveLiteralKey(member.literal);
12623
+ return key?.startsWith("string:") === true ? key : null;
12624
+ });
12625
+ const domain = exactDomain(keys);
12626
+ return domain !== null && domain.size >= 2 ? domain : null;
12627
+ }
12628
+ function nameTokens(name) {
12629
+ return name.replace(/([a-z\d])([A-Z])/gu, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/gu, "$1 $2").split(/[^A-Za-z\d]+/u).filter((token) => token !== "").map((token) => token.toLowerCase());
12630
+ }
12631
+ function schemaNameTokens(name) {
12632
+ const tokens = nameTokens(name);
12633
+ const withoutPrefix = tokens[0] === "z" ? tokens.slice(1) : tokens;
12634
+ return withoutPrefix.at(-1) === "schema" ? withoutPrefix.slice(0, -1) : withoutPrefix;
12635
+ }
12636
+ function endsWithTokens(candidate, suffix) {
12637
+ return suffix.length >= 2 && candidate.length >= suffix.length && suffix.every(
12638
+ (segment, index) => candidate[candidate.length - suffix.length + index] === segment
12639
+ );
12640
+ }
12333
12641
  var prefer_zod_infer_default = createRule({
12334
12642
  name: "prefer-zod-infer",
12335
12643
  documentation: preferZodInferDocumentation,
@@ -12352,7 +12660,8 @@ var prefer_zod_infer_default = createRule({
12352
12660
  }
12353
12661
  ],
12354
12662
  messages: {
12355
- handWrittenTwin: "`{{typeName}}` restates the shape of the Zod schema `{{schemaName}}` declared in this module. Derive it instead \u2014 `type {{typeName}} = z.infer<typeof {{schemaName}}>` \u2014 so a field added to the schema cannot silently leave the type behind."
12663
+ handWrittenTwin: "`{{typeName}}` restates the shape of the Zod schema `{{schemaName}}` declared in this module. Derive it instead \u2014 `type {{typeName}} = z.infer<typeof {{schemaName}}>` \u2014 so a field added to the schema cannot silently leave the type behind.",
12664
+ repeatedEnumUnion: "`{{propertyName}}` repeats the literal domain already named by `{{typeName}}` and `{{schemaName}}` in multiple object types. Reuse `{{typeName}}` so the accepted values have one source of truth."
12356
12665
  }
12357
12666
  },
12358
12667
  defaultOptions: [{}],
@@ -12366,20 +12675,23 @@ var prefer_zod_infer_default = createRule({
12366
12675
  }
12367
12676
  const zodNamespaces = /* @__PURE__ */ new Set();
12368
12677
  const schemas = [];
12678
+ const enumSchemas = [];
12679
+ const inferredAliases = [];
12680
+ const literalUnionOccurrences = [];
12369
12681
  const typeDeclarations = [];
12370
12682
  const constrainedTypeNames = /* @__PURE__ */ new Set();
12371
12683
  const reshapedSchemaNames = /* @__PURE__ */ new Set();
12372
12684
  function zodCallChain(node) {
12373
12685
  const chain = [];
12374
12686
  let current = node;
12375
- while (current.type === AST_NODE_TYPES48.CallExpression) {
12687
+ while (current.type === AST_NODE_TYPES49.CallExpression) {
12376
12688
  const callee = current.callee;
12377
- if (callee.type !== AST_NODE_TYPES48.MemberExpression || callee.computed || callee.property.type !== AST_NODE_TYPES48.Identifier) {
12689
+ if (callee.type !== AST_NODE_TYPES49.MemberExpression || callee.computed || callee.property.type !== AST_NODE_TYPES49.Identifier) {
12378
12690
  return null;
12379
12691
  }
12380
12692
  chain.push(current);
12381
12693
  const receiver = callee.object;
12382
- if (receiver.type === AST_NODE_TYPES48.Identifier) {
12694
+ if (receiver.type === AST_NODE_TYPES49.Identifier) {
12383
12695
  return zodNamespaces.has(receiver.name) ? chain.reverse() : null;
12384
12696
  }
12385
12697
  current = receiver;
@@ -12388,32 +12700,97 @@ var prefer_zod_infer_default = createRule({
12388
12700
  }
12389
12701
  function methodName2(call) {
12390
12702
  const callee = call.callee;
12391
- return callee.type === AST_NODE_TYPES48.MemberExpression && callee.property.type === AST_NODE_TYPES48.Identifier ? callee.property.name : "";
12703
+ return callee.type === AST_NODE_TYPES49.MemberExpression && callee.property.type === AST_NODE_TYPES49.Identifier ? callee.property.name : "";
12704
+ }
12705
+ function recordZodImport(node) {
12706
+ if (!isZodModule(node.source.value)) {
12707
+ return;
12708
+ }
12709
+ for (const specifier of node.specifiers) {
12710
+ if (specifier.type === AST_NODE_TYPES49.ImportNamespaceSpecifier || specifier.type === AST_NODE_TYPES49.ImportDefaultSpecifier || specifier.type === AST_NODE_TYPES49.ImportSpecifier && specifier.imported.type === AST_NODE_TYPES49.Identifier && specifier.imported.name === "z") {
12711
+ zodNamespaces.add(specifier.local.name);
12712
+ }
12713
+ }
12392
12714
  }
12393
12715
  function schemaField(node) {
12394
12716
  const modifiers = [];
12395
12717
  let current = node;
12396
12718
  let leaf = null;
12397
- while (current.type === AST_NODE_TYPES48.CallExpression) {
12719
+ let leafCall = null;
12720
+ while (current.type === AST_NODE_TYPES49.CallExpression) {
12398
12721
  const callee = current.callee;
12399
- if (callee.type !== AST_NODE_TYPES48.MemberExpression || callee.computed || callee.property.type !== AST_NODE_TYPES48.Identifier) {
12722
+ if (callee.type !== AST_NODE_TYPES49.MemberExpression || callee.computed || callee.property.type !== AST_NODE_TYPES49.Identifier) {
12400
12723
  break;
12401
12724
  }
12402
12725
  const receiver = callee.object;
12403
- if (receiver.type === AST_NODE_TYPES48.Identifier && zodNamespaces.has(receiver.name)) {
12726
+ if (receiver.type === AST_NODE_TYPES49.Identifier && zodNamespaces.has(receiver.name)) {
12404
12727
  leaf = callee.property.name;
12728
+ leafCall = current;
12405
12729
  break;
12406
12730
  }
12407
12731
  modifiers.push(callee.property.name);
12408
12732
  current = receiver;
12409
12733
  }
12410
12734
  return {
12735
+ domain: modifiers.every(
12736
+ (name) => DOMAIN_PRESERVING_MODIFIERS.has(name)
12737
+ ) ? staticZodDomain(leaf, leafCall) : null,
12411
12738
  leaf,
12412
12739
  optional: modifiers.some((name) => OPTIONAL_MODIFIERS.has(name)),
12413
12740
  nullable: modifiers.some((name) => NULLABLE_MODIFIERS.has(name)),
12414
12741
  reshaped: modifiers.some((name) => RESHAPING_MODIFIERS.has(name))
12415
12742
  };
12416
12743
  }
12744
+ function enumSchemaDomain(init) {
12745
+ const chain = zodCallChain(init);
12746
+ if (chain === null || chain.length !== 1) {
12747
+ return null;
12748
+ }
12749
+ const [call] = chain;
12750
+ if (call === void 0 || methodName2(call) !== "enum") {
12751
+ return null;
12752
+ }
12753
+ const domain = staticZodDomain("enum", call);
12754
+ return domain instanceof Set && domain.size >= 2 ? domain : null;
12755
+ }
12756
+ function inferredSchemaName(node) {
12757
+ if (node.type !== AST_NODE_TYPES49.TSTypeReference || node.typeName.type !== AST_NODE_TYPES49.TSQualifiedName || node.typeName.left.type !== AST_NODE_TYPES49.Identifier || !zodNamespaces.has(node.typeName.left.name) || node.typeName.right.name !== "infer") {
12758
+ return null;
12759
+ }
12760
+ const arguments_ = node.typeArguments?.params ?? [];
12761
+ const [argument] = arguments_;
12762
+ return arguments_.length === 1 && argument?.type === AST_NODE_TYPES49.TSTypeQuery && argument.exprName.type === AST_NODE_TYPES49.Identifier ? argument.exprName.name : null;
12763
+ }
12764
+ function recordLiteralUnions(members, owner, ownerName, exported) {
12765
+ for (const member of members) {
12766
+ if (member.type !== AST_NODE_TYPES49.TSPropertySignature || member.computed || member.optional || member.readonly || member.typeAnnotation === void 0) {
12767
+ continue;
12768
+ }
12769
+ const key = member.key;
12770
+ const propertyName3 = key.type === AST_NODE_TYPES49.Identifier ? key.name : key.type === AST_NODE_TYPES49.Literal && typeof key.value === "string" ? key.value : null;
12771
+ if (propertyName3 === null) {
12772
+ continue;
12773
+ }
12774
+ const propertyTokens = nameTokens(propertyName3);
12775
+ if (propertyTokens.length < 2) {
12776
+ continue;
12777
+ }
12778
+ const annotation = member.typeAnnotation.typeAnnotation;
12779
+ const domain = staticStringUnionDomain(annotation);
12780
+ if (domain === null || annotation.type !== AST_NODE_TYPES49.TSUnionType) {
12781
+ continue;
12782
+ }
12783
+ literalUnionOccurrences.push({
12784
+ domain,
12785
+ exported,
12786
+ node: annotation,
12787
+ owner,
12788
+ ownerName,
12789
+ propertyName: propertyName3,
12790
+ propertyTokens
12791
+ });
12792
+ }
12793
+ }
12417
12794
  function schemaFields(init) {
12418
12795
  const chain = zodCallChain(init);
12419
12796
  if (chain === null || chain.length === 0) {
@@ -12431,16 +12808,16 @@ var prefer_zod_infer_default = createRule({
12431
12808
  return null;
12432
12809
  }
12433
12810
  const shape = base.arguments[0];
12434
- if (shape === void 0 || shape.type !== AST_NODE_TYPES48.ObjectExpression) {
12811
+ if (shape === void 0 || shape.type !== AST_NODE_TYPES49.ObjectExpression) {
12435
12812
  return null;
12436
12813
  }
12437
12814
  const fields = /* @__PURE__ */ new Map();
12438
12815
  for (const property of shape.properties) {
12439
- if (property.type !== AST_NODE_TYPES48.Property || property.computed) {
12816
+ if (property.type !== AST_NODE_TYPES49.Property || property.computed) {
12440
12817
  return null;
12441
12818
  }
12442
12819
  const { key } = property;
12443
- const name = key.type === AST_NODE_TYPES48.Identifier ? key.name : key.type === AST_NODE_TYPES48.Literal && typeof key.value === "string" ? key.value : null;
12820
+ const name = key.type === AST_NODE_TYPES49.Identifier ? key.name : key.type === AST_NODE_TYPES49.Literal && typeof key.value === "string" ? key.value : null;
12444
12821
  if (name === null) {
12445
12822
  return null;
12446
12823
  }
@@ -12451,11 +12828,11 @@ var prefer_zod_infer_default = createRule({
12451
12828
  function typeMembers(members) {
12452
12829
  const result = /* @__PURE__ */ new Map();
12453
12830
  for (const member of members) {
12454
- if (member.type !== AST_NODE_TYPES48.TSPropertySignature || member.computed) {
12831
+ if (member.type !== AST_NODE_TYPES49.TSPropertySignature || member.computed) {
12455
12832
  return null;
12456
12833
  }
12457
12834
  const { key } = member;
12458
- const name = key.type === AST_NODE_TYPES48.Identifier ? key.name : key.type === AST_NODE_TYPES48.Literal && typeof key.value === "string" ? key.value : null;
12835
+ const name = key.type === AST_NODE_TYPES49.Identifier ? key.name : key.type === AST_NODE_TYPES49.Literal && typeof key.value === "string" ? key.value : null;
12459
12836
  if (name === null) {
12460
12837
  return null;
12461
12838
  }
@@ -12470,8 +12847,8 @@ var prefer_zod_infer_default = createRule({
12470
12847
  return result.size === 0 ? null : result;
12471
12848
  }
12472
12849
  function collectConstrainedNames(node) {
12473
- if (node.type === AST_NODE_TYPES48.TSTypeReference) {
12474
- if (node.typeName.type === AST_NODE_TYPES48.Identifier) {
12850
+ if (node.type === AST_NODE_TYPES49.TSTypeReference) {
12851
+ if (node.typeName.type === AST_NODE_TYPES49.Identifier) {
12475
12852
  constrainedTypeNames.add(node.typeName.name);
12476
12853
  }
12477
12854
  for (const argument of node.typeArguments?.params ?? []) {
@@ -12479,11 +12856,11 @@ var prefer_zod_infer_default = createRule({
12479
12856
  }
12480
12857
  return;
12481
12858
  }
12482
- if (node.type === AST_NODE_TYPES48.TSArrayType) {
12859
+ if (node.type === AST_NODE_TYPES49.TSArrayType) {
12483
12860
  collectConstrainedNames(node.elementType);
12484
12861
  return;
12485
12862
  }
12486
- if (node.type === AST_NODE_TYPES48.TSUnionType || node.type === AST_NODE_TYPES48.TSIntersectionType) {
12863
+ if (node.type === AST_NODE_TYPES49.TSUnionType || node.type === AST_NODE_TYPES49.TSIntersectionType) {
12487
12864
  for (const member of node.types) {
12488
12865
  collectConstrainedNames(member);
12489
12866
  }
@@ -12514,7 +12891,7 @@ var prefer_zod_infer_default = createRule({
12514
12891
  if (member.readonly) {
12515
12892
  return false;
12516
12893
  }
12517
- const agrees = leafAgrees(field.leaf, member.annotation);
12894
+ const agrees = leafAgrees(field, member.annotation);
12518
12895
  if (agrees === false) {
12519
12896
  return false;
12520
12897
  }
@@ -12525,35 +12902,42 @@ var prefer_zod_infer_default = createRule({
12525
12902
  return agreements > 0;
12526
12903
  }
12527
12904
  return {
12528
- ImportDeclaration(node) {
12529
- if (!isZodModule(node.source.value)) {
12530
- return;
12531
- }
12532
- for (const specifier of node.specifiers) {
12533
- if (specifier.type === AST_NODE_TYPES48.ImportNamespaceSpecifier || specifier.type === AST_NODE_TYPES48.ImportDefaultSpecifier || specifier.type === AST_NODE_TYPES48.ImportSpecifier && specifier.imported.type === AST_NODE_TYPES48.Identifier && specifier.imported.name === "z") {
12534
- zodNamespaces.add(specifier.local.name);
12905
+ Program(node) {
12906
+ for (const statement of node.body) {
12907
+ if (statement.type === AST_NODE_TYPES49.ImportDeclaration) {
12908
+ recordZodImport(statement);
12535
12909
  }
12536
12910
  }
12537
12911
  },
12912
+ ImportDeclaration(node) {
12913
+ recordZodImport(node);
12914
+ },
12538
12915
  VariableDeclarator(node) {
12539
- if (node.id.type !== AST_NODE_TYPES48.Identifier || node.init == null) {
12916
+ if (node.id.type !== AST_NODE_TYPES49.Identifier || node.init == null) {
12540
12917
  return;
12541
12918
  }
12542
12919
  const fields = schemaFields(node.init);
12543
12920
  if (fields !== null) {
12544
12921
  schemas.push({ name: node.id.name, fields });
12545
12922
  }
12923
+ if (isModuleLevelConst(node)) {
12924
+ const domain = enumSchemaDomain(node.init);
12925
+ const tokens = schemaNameTokens(node.id.name);
12926
+ if (domain !== null && tokens.length >= 2) {
12927
+ enumSchemas.push({ domain, name: node.id.name, tokens });
12928
+ }
12929
+ }
12546
12930
  },
12547
12931
  /** Records `XSchema.transform(...)` and equivalent module-level reshaping. */
12548
12932
  "MemberExpression[computed=false]"(node) {
12549
- if (node.object.type === AST_NODE_TYPES48.Identifier && node.property.type === AST_NODE_TYPES48.Identifier && MODULE_LEVEL_RESHAPERS.has(node.property.name)) {
12933
+ if (node.object.type === AST_NODE_TYPES49.Identifier && node.property.type === AST_NODE_TYPES49.Identifier && MODULE_LEVEL_RESHAPERS.has(node.property.name)) {
12550
12934
  reshapedSchemaNames.add(node.object.name);
12551
12935
  }
12552
12936
  },
12553
12937
  /** Records every type argument carried by a Zod constraint. */
12554
12938
  TSTypeReference(node) {
12555
12939
  const { typeName } = node;
12556
- const referenced = typeName.type === AST_NODE_TYPES48.Identifier ? typeName.name : typeName.type === AST_NODE_TYPES48.TSQualifiedName && typeName.right.type === AST_NODE_TYPES48.Identifier ? typeName.right.name : null;
12940
+ const referenced = typeName.type === AST_NODE_TYPES49.Identifier ? typeName.name : typeName.type === AST_NODE_TYPES49.TSQualifiedName && typeName.right.type === AST_NODE_TYPES49.Identifier ? typeName.right.name : null;
12557
12941
  if (referenced === null || !ZOD_TYPE_CONSTRAINTS.has(referenced)) {
12558
12942
  return;
12559
12943
  }
@@ -12569,20 +12953,38 @@ var prefer_zod_infer_default = createRule({
12569
12953
  if (members !== null) {
12570
12954
  typeDeclarations.push({ name: node.id.name, node: node.id, members });
12571
12955
  }
12956
+ recordLiteralUnions(
12957
+ node.body.body,
12958
+ node,
12959
+ node.id.name,
12960
+ isExportedDeclaration(node)
12961
+ );
12572
12962
  },
12573
12963
  TSTypeAliasDeclaration(node) {
12574
- if (node.typeParameters !== void 0 || node.typeAnnotation.type !== AST_NODE_TYPES48.TSTypeLiteral) {
12964
+ const schemaName = inferredSchemaName(node.typeAnnotation);
12965
+ if (schemaName !== null) {
12966
+ inferredAliases.push({
12967
+ exported: isExportedDeclaration(node),
12968
+ schemaName,
12969
+ typeName: node.id.name
12970
+ });
12971
+ }
12972
+ if (node.typeParameters !== void 0 || node.typeAnnotation.type !== AST_NODE_TYPES49.TSTypeLiteral) {
12575
12973
  return;
12576
12974
  }
12577
12975
  const members = typeMembers(node.typeAnnotation.members);
12578
12976
  if (members !== null) {
12579
12977
  typeDeclarations.push({ name: node.id.name, node: node.id, members });
12580
12978
  }
12979
+ recordLiteralUnions(
12980
+ node.typeAnnotation.members,
12981
+ node,
12982
+ node.id.name,
12983
+ isExportedDeclaration(node)
12984
+ );
12581
12985
  },
12582
12986
  "Program:exit"() {
12583
- if (schemas.length === 0 || typeDeclarations.length === 0) {
12584
- return;
12585
- }
12987
+ const twinTypeNames = /* @__PURE__ */ new Set();
12586
12988
  const byName = /* @__PURE__ */ new Map();
12587
12989
  for (const schema of schemas) {
12588
12990
  const key = normalizeSchemaName(schema.name);
@@ -12604,12 +13006,62 @@ var prefer_zod_infer_default = createRule({
12604
13006
  if (!isTwin(schema.fields, declaration.members)) {
12605
13007
  continue;
12606
13008
  }
13009
+ twinTypeNames.add(declaration.name);
12607
13010
  context.report({
12608
13011
  node: declaration.node,
12609
13012
  messageId: "handWrittenTwin",
12610
13013
  data: { typeName: declaration.name, schemaName: schema.name }
12611
13014
  });
12612
13015
  }
13016
+ const aliasesBySchema = /* @__PURE__ */ new Map();
13017
+ for (const alias of inferredAliases) {
13018
+ const aliases = aliasesBySchema.get(alias.schemaName) ?? [];
13019
+ aliases.push(alias);
13020
+ aliasesBySchema.set(alias.schemaName, aliases);
13021
+ }
13022
+ const groups = /* @__PURE__ */ new Map();
13023
+ for (const occurrence of literalUnionOccurrences) {
13024
+ const { ownerName } = occurrence;
13025
+ if (twinTypeNames.has(ownerName ?? "") || ownerName !== null && ignorePatterns.some((pattern) => pattern.test(ownerName))) {
13026
+ continue;
13027
+ }
13028
+ const candidates = enumSchemas.filter(
13029
+ (schema2) => sameDomain(schema2.domain, occurrence.domain) && endsWithTokens(schema2.tokens, occurrence.propertyTokens) && (aliasesBySchema.get(schema2.name)?.length ?? 0) === 1
13030
+ );
13031
+ const [schema] = candidates;
13032
+ if (candidates.length !== 1 || schema === void 0) {
13033
+ continue;
13034
+ }
13035
+ const [alias] = aliasesBySchema.get(schema.name) ?? [];
13036
+ if (alias === void 0 || occurrence.exported && !alias.exported) {
13037
+ continue;
13038
+ }
13039
+ const key = `${schema.name}\0${occurrence.propertyName}`;
13040
+ const group = groups.get(key);
13041
+ if (group === void 0) {
13042
+ groups.set(key, { alias, occurrences: [occurrence], schema });
13043
+ } else {
13044
+ group.occurrences.push(occurrence);
13045
+ }
13046
+ }
13047
+ for (const { alias, occurrences, schema } of groups.values()) {
13048
+ if (new Set(occurrences.map(({ ownerName }) => ownerName)).size < 2 || new Set(occurrences.map(({ owner }) => owner)).size < 2) {
13049
+ continue;
13050
+ }
13051
+ const [first] = occurrences;
13052
+ if (first === void 0) {
13053
+ continue;
13054
+ }
13055
+ context.report({
13056
+ node: first.node,
13057
+ messageId: "repeatedEnumUnion",
13058
+ data: {
13059
+ propertyName: first.propertyName,
13060
+ schemaName: schema.name,
13061
+ typeName: alias.typeName
13062
+ }
13063
+ });
13064
+ }
12613
13065
  }
12614
13066
  };
12615
13067
  }
@@ -12617,10 +13069,10 @@ var prefer_zod_infer_default = createRule({
12617
13069
 
12618
13070
  // src/rules/require-assert-never.ts
12619
13071
  import {
12620
- ESLintUtils as ESLintUtils3,
12621
- AST_NODE_TYPES as AST_NODE_TYPES49
13072
+ ESLintUtils as ESLintUtils4,
13073
+ AST_NODE_TYPES as AST_NODE_TYPES50
12622
13074
  } from "@typescript-eslint/utils";
12623
- import ts2 from "typescript";
13075
+ import ts3 from "typescript";
12624
13076
  var requireAssertNeverDocumentation = {
12625
13077
  summary: "Require an empty switch default to call `assertNever` so discriminated unions remain exhaustive at compile time.",
12626
13078
  rationale: "An empty default silently accepts new union members instead of making the compiler identify the missing case.",
@@ -12632,14 +13084,14 @@ var requireAssertNeverDocumentation = {
12632
13084
  ]
12633
13085
  };
12634
13086
  var isRuntimeHandlingStatement = (statement) => {
12635
- if (statement.type === AST_NODE_TYPES49.EmptyStatement) return false;
12636
- if (statement.type === AST_NODE_TYPES49.BreakStatement) {
13087
+ if (statement.type === AST_NODE_TYPES50.EmptyStatement) return false;
13088
+ if (statement.type === AST_NODE_TYPES50.BreakStatement) {
12637
13089
  return statement.label !== null;
12638
13090
  }
12639
- if (statement.type === AST_NODE_TYPES49.TSTypeAliasDeclaration || statement.type === AST_NODE_TYPES49.TSInterfaceDeclaration) {
13091
+ if (statement.type === AST_NODE_TYPES50.TSTypeAliasDeclaration || statement.type === AST_NODE_TYPES50.TSInterfaceDeclaration) {
12640
13092
  return false;
12641
13093
  }
12642
- if (statement.type === AST_NODE_TYPES49.BlockStatement) {
13094
+ if (statement.type === AST_NODE_TYPES50.BlockStatement) {
12643
13095
  return statement.body.some(isRuntimeHandlingStatement);
12644
13096
  }
12645
13097
  return true;
@@ -12655,7 +13107,7 @@ var isCommentOnlyNoopDefault = (defaultCase, sourceCode) => {
12655
13107
  return colonToken !== null && sourceCode.getCommentsAfter(colonToken).length > 0;
12656
13108
  }
12657
13109
  const only = defaultCase.consequent[0];
12658
- if (only !== void 0 && defaultCase.consequent.length === 1 && only.type === AST_NODE_TYPES49.BlockStatement && !only.body.some(isRuntimeHandlingStatement)) {
13110
+ if (only !== void 0 && defaultCase.consequent.length === 1 && only.type === AST_NODE_TYPES50.BlockStatement && !only.body.some(isRuntimeHandlingStatement)) {
12659
13111
  return sourceCode.getCommentsInside(only).length > 0;
12660
13112
  }
12661
13113
  return false;
@@ -12667,7 +13119,7 @@ function isExhaustiveFiniteSwitch(node, services) {
12667
13119
  const constituents = discriminantType.isUnion() ? discriminantType.types : [discriminantType];
12668
13120
  if (!discriminantType.isUnion() || constituents.length < 2) return false;
12669
13121
  if (constituents.every(
12670
- (constituent) => (constituent.flags & ts2.TypeFlags.BooleanLiteral) !== 0
13122
+ (constituent) => (constituent.flags & ts3.TypeFlags.BooleanLiteral) !== 0
12671
13123
  )) {
12672
13124
  return false;
12673
13125
  }
@@ -12691,7 +13143,7 @@ function isExhaustiveFiniteSwitch(node, services) {
12691
13143
  return [...expected].every((key) => handled.has(key));
12692
13144
  }
12693
13145
  function finiteTypeKey(type, checker) {
12694
- const finiteFlags = ts2.TypeFlags.StringLiteral | ts2.TypeFlags.NumberLiteral | ts2.TypeFlags.BooleanLiteral | ts2.TypeFlags.EnumLiteral | ts2.TypeFlags.UniqueESSymbol | ts2.TypeFlags.Null | ts2.TypeFlags.Undefined;
13146
+ const finiteFlags = ts3.TypeFlags.StringLiteral | ts3.TypeFlags.NumberLiteral | ts3.TypeFlags.BooleanLiteral | ts3.TypeFlags.EnumLiteral | ts3.TypeFlags.UniqueESSymbol | ts3.TypeFlags.Null | ts3.TypeFlags.Undefined;
12695
13147
  return (type.flags & finiteFlags) !== 0 ? checker.typeToString(type) : null;
12696
13148
  }
12697
13149
  var require_assert_never_default = createRule({
@@ -12711,7 +13163,7 @@ var require_assert_never_default = createRule({
12711
13163
  create(context) {
12712
13164
  let services;
12713
13165
  try {
12714
- services = ESLintUtils3.getParserServices(context);
13166
+ services = ESLintUtils4.getParserServices(context);
12715
13167
  } catch {
12716
13168
  services = null;
12717
13169
  }
@@ -12738,7 +13190,7 @@ var require_assert_never_default = createRule({
12738
13190
  });
12739
13191
 
12740
13192
  // src/rules/require-fetch-timeout.ts
12741
- import { AST_NODE_TYPES as AST_NODE_TYPES50, ASTUtils as ASTUtils13 } from "@typescript-eslint/utils";
13193
+ import { AST_NODE_TYPES as AST_NODE_TYPES51, ASTUtils as ASTUtils13 } from "@typescript-eslint/utils";
12742
13194
  var requireFetchTimeoutDocumentation = {
12743
13195
  summary: "Require an abort `signal` (e.g. `AbortSignal.timeout(ms)`) on global `fetch()` calls so stalled upstreams cannot hang the caller forever.",
12744
13196
  rationale: "An unbounded request can occupy work indefinitely when an upstream stalls.",
@@ -12764,14 +13216,14 @@ function matchesAnyPattern3(filename, patterns) {
12764
13216
  return false;
12765
13217
  }
12766
13218
  function initProvablyLacksSignal(init) {
12767
- if (init.type !== AST_NODE_TYPES50.ObjectExpression) {
13219
+ if (init.type !== AST_NODE_TYPES51.ObjectExpression) {
12768
13220
  return false;
12769
13221
  }
12770
13222
  for (const prop of init.properties) {
12771
- if (prop.type === AST_NODE_TYPES50.SpreadElement) {
13223
+ if (prop.type === AST_NODE_TYPES51.SpreadElement) {
12772
13224
  return false;
12773
13225
  }
12774
- if (prop.key.type === AST_NODE_TYPES50.Identifier && prop.key.name === "signal" || prop.key.type === AST_NODE_TYPES50.Literal && prop.key.value === "signal") {
13226
+ if (prop.key.type === AST_NODE_TYPES51.Identifier && prop.key.name === "signal" || prop.key.type === AST_NODE_TYPES51.Literal && prop.key.value === "signal") {
12775
13227
  return false;
12776
13228
  }
12777
13229
  if (prop.computed) {
@@ -12781,7 +13233,7 @@ function initProvablyLacksSignal(init) {
12781
13233
  return true;
12782
13234
  }
12783
13235
  function isInlineUrl(node, resolvesToGlobal) {
12784
- return node.type === AST_NODE_TYPES50.Literal && typeof node.value === "string" || node.type === AST_NODE_TYPES50.TemplateLiteral || node.type === AST_NODE_TYPES50.NewExpression && node.callee.type === AST_NODE_TYPES50.Identifier && node.callee.name === "URL" && resolvesToGlobal(node.callee);
13236
+ return node.type === AST_NODE_TYPES51.Literal && typeof node.value === "string" || node.type === AST_NODE_TYPES51.TemplateLiteral || node.type === AST_NODE_TYPES51.NewExpression && node.callee.type === AST_NODE_TYPES51.Identifier && node.callee.name === "URL" && resolvesToGlobal(node.callee);
12785
13237
  }
12786
13238
  var require_fetch_timeout_default = createRule({
12787
13239
  name: "require-fetch-timeout",
@@ -12823,10 +13275,10 @@ var require_fetch_timeout_default = createRule({
12823
13275
  return variable === null || variable.defs.length === 0;
12824
13276
  }
12825
13277
  function isGlobalFetchCall2(callee) {
12826
- if (callee.type === AST_NODE_TYPES50.Identifier) {
13278
+ if (callee.type === AST_NODE_TYPES51.Identifier) {
12827
13279
  return callee.name === "fetch" && resolvesToGlobal(callee);
12828
13280
  }
12829
- return callee.type === AST_NODE_TYPES50.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES50.Identifier && callee.property.name === "fetch" && callee.object.type === AST_NODE_TYPES50.Identifier && GLOBAL_OBJECTS2.has(callee.object.name) && resolvesToGlobal(callee.object);
13281
+ return callee.type === AST_NODE_TYPES51.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES51.Identifier && callee.property.name === "fetch" && callee.object.type === AST_NODE_TYPES51.Identifier && GLOBAL_OBJECTS2.has(callee.object.name) && resolvesToGlobal(callee.object);
12830
13282
  }
12831
13283
  function localConstInitProvablyLacksSignal(identifier) {
12832
13284
  const variable = ASTUtils13.findVariable(
@@ -12835,14 +13287,14 @@ var require_fetch_timeout_default = createRule({
12835
13287
  );
12836
13288
  if (variable?.defs.length !== 1) return false;
12837
13289
  const definition = variable.defs[0];
12838
- if (definition?.type !== "Variable" || definition.parent.kind !== "const" || definition.node.init?.type !== AST_NODE_TYPES50.ObjectExpression || !initProvablyLacksSignal(definition.node.init)) {
13290
+ if (definition?.type !== "Variable" || definition.parent.kind !== "const" || definition.node.init?.type !== AST_NODE_TYPES51.ObjectExpression || !initProvablyLacksSignal(definition.node.init)) {
12839
13291
  return false;
12840
13292
  }
12841
13293
  for (const reference of variable.references) {
12842
13294
  const ref = reference.identifier;
12843
13295
  if (ref === identifier || ref === definition.name) continue;
12844
13296
  const member = ref.parent;
12845
- if (member.type !== AST_NODE_TYPES50.MemberExpression || member.object !== ref || member.computed || member.property.type !== AST_NODE_TYPES50.Identifier || member.property.name === "signal" || member.parent.type !== AST_NODE_TYPES50.AssignmentExpression || member.parent.left !== member) {
13297
+ if (member.type !== AST_NODE_TYPES51.MemberExpression || member.object !== ref || member.computed || member.property.type !== AST_NODE_TYPES51.Identifier || member.property.name === "signal" || member.parent.type !== AST_NODE_TYPES51.AssignmentExpression || member.parent.left !== member) {
12846
13298
  return false;
12847
13299
  }
12848
13300
  }
@@ -12857,7 +13309,7 @@ var require_fetch_timeout_default = createRule({
12857
13309
  if (node.arguments.length === 1 && first !== void 0 && !isInlineUrl(first, resolvesToGlobal)) {
12858
13310
  return;
12859
13311
  }
12860
- if (init === void 0 || initProvablyLacksSignal(init) || init.type === AST_NODE_TYPES50.Identifier && localConstInitProvablyLacksSignal(init)) {
13312
+ if (init === void 0 || initProvablyLacksSignal(init) || init.type === AST_NODE_TYPES51.Identifier && localConstInitProvablyLacksSignal(init)) {
12861
13313
  context.report({ node, messageId: "missingSignal" });
12862
13314
  }
12863
13315
  }
@@ -12866,7 +13318,7 @@ var require_fetch_timeout_default = createRule({
12866
13318
  });
12867
13319
 
12868
13320
  // src/rules/require-port-for-service.ts
12869
- import { AST_NODE_TYPES as AST_NODE_TYPES51 } from "@typescript-eslint/utils";
13321
+ import { AST_NODE_TYPES as AST_NODE_TYPES52 } from "@typescript-eslint/utils";
12870
13322
  var requirePortForServiceDocumentation = {
12871
13323
  summary: "Advise when an exported service with injected collaborators has public methods not covered by its declared ports.",
12872
13324
  rationale: "A declared port keeps consumers coupled to the service capability instead of its concrete implementation.",
@@ -12891,45 +13343,45 @@ var ROUTER_FACTORY_NAME = "Router";
12891
13343
  var FRAMEWORK_HTTP_TYPES = /* @__PURE__ */ new Set(["Request", "Response", "NextFunction"]);
12892
13344
  var STORAGE_ASSIGNMENT_OPERATORS = /* @__PURE__ */ new Set(["=", "&&=", "??=", "||="]);
12893
13345
  var staticMemberName4 = (member) => {
12894
- if (member.property.type === AST_NODE_TYPES51.PrivateIdentifier) return `#${member.property.name}`;
12895
- if (!member.computed && member.property.type === AST_NODE_TYPES51.Identifier) return member.property.name;
12896
- return member.computed && member.property.type === AST_NODE_TYPES51.Literal && typeof member.property.value === "string" ? member.property.value : null;
13346
+ if (member.property.type === AST_NODE_TYPES52.PrivateIdentifier) return `#${member.property.name}`;
13347
+ if (!member.computed && member.property.type === AST_NODE_TYPES52.Identifier) return member.property.name;
13348
+ return member.computed && member.property.type === AST_NODE_TYPES52.Literal && typeof member.property.value === "string" ? member.property.value : null;
12897
13349
  };
12898
13350
  var detachedValueExports = (program) => {
12899
13351
  const names = /* @__PURE__ */ new Set();
12900
13352
  for (const statement of program.body) {
12901
- if (statement.type === AST_NODE_TYPES51.ExportNamedDeclaration && statement.declaration === null && statement.source === null && statement.exportKind !== "type") {
13353
+ if (statement.type === AST_NODE_TYPES52.ExportNamedDeclaration && statement.declaration === null && statement.source === null && statement.exportKind !== "type") {
12902
13354
  for (const specifier of statement.specifiers) {
12903
13355
  if (specifier.exportKind !== "type") names.add(specifier.local.name);
12904
13356
  }
12905
- } else if (statement.type === AST_NODE_TYPES51.ExportDefaultDeclaration && statement.declaration.type === AST_NODE_TYPES51.Identifier) {
13357
+ } else if (statement.type === AST_NODE_TYPES52.ExportDefaultDeclaration && statement.declaration.type === AST_NODE_TYPES52.Identifier) {
12906
13358
  names.add(statement.declaration.name);
12907
- } else if (statement.type === AST_NODE_TYPES51.TSExportAssignment && statement.expression.type === AST_NODE_TYPES51.Identifier) {
13359
+ } else if (statement.type === AST_NODE_TYPES52.TSExportAssignment && statement.expression.type === AST_NODE_TYPES52.Identifier) {
12908
13360
  names.add(statement.expression.name);
12909
13361
  }
12910
13362
  }
12911
13363
  return names;
12912
13364
  };
12913
- var isExportedClass2 = (node, detached) => node.parent.type === AST_NODE_TYPES51.ExportNamedDeclaration || node.parent.type === AST_NODE_TYPES51.ExportDefaultDeclaration || node.id !== null && detached.has(node.id.name);
13365
+ var isExportedClass2 = (node, detached) => node.parent.type === AST_NODE_TYPES52.ExportNamedDeclaration || node.parent.type === AST_NODE_TYPES52.ExportDefaultDeclaration || node.id !== null && detached.has(node.id.name);
12914
13366
  var readTypeReference = (annotation) => {
12915
- if (annotation?.type === AST_NODE_TYPES51.TSUnionType) {
13367
+ if (annotation?.type === AST_NODE_TYPES52.TSUnionType) {
12916
13368
  const members = annotation.types.filter(
12917
- (member) => member.type !== AST_NODE_TYPES51.TSUndefinedKeyword && member.type !== AST_NODE_TYPES51.TSNullKeyword
13369
+ (member) => member.type !== AST_NODE_TYPES52.TSUndefinedKeyword && member.type !== AST_NODE_TYPES52.TSNullKeyword
12918
13370
  );
12919
13371
  annotation = members.length === 1 ? members[0] : void 0;
12920
13372
  }
12921
- if (annotation === void 0 || annotation.type !== AST_NODE_TYPES51.TSTypeReference) return null;
13373
+ if (annotation === void 0 || annotation.type !== AST_NODE_TYPES52.TSTypeReference) return null;
12922
13374
  const { typeName } = annotation;
12923
- const rightmost = typeName.type === AST_NODE_TYPES51.Identifier ? typeName.name : typeName.type === AST_NODE_TYPES51.TSQualifiedName ? typeName.right.name : null;
13375
+ const rightmost = typeName.type === AST_NODE_TYPES52.Identifier ? typeName.name : typeName.type === AST_NODE_TYPES52.TSQualifiedName ? typeName.right.name : null;
12924
13376
  if (rightmost === null) return null;
12925
13377
  return { typeName: rightmost, display: qualifiedName(typeName) };
12926
13378
  };
12927
- var qualifiedName = (name) => name.type === AST_NODE_TYPES51.Identifier ? name.name : name.type === AST_NODE_TYPES51.TSQualifiedName ? `${qualifiedName(name.left)}.${name.right.name}` : "";
13379
+ var qualifiedName = (name) => name.type === AST_NODE_TYPES52.Identifier ? name.name : name.type === AST_NODE_TYPES52.TSQualifiedName ? `${qualifiedName(name.left)}.${name.right.name}` : "";
12928
13380
  var propertySignatureTypes = (members) => {
12929
13381
  const types = /* @__PURE__ */ new Map();
12930
13382
  for (const member of members) {
12931
- if (member.type !== AST_NODE_TYPES51.TSPropertySignature) continue;
12932
- if (member.computed || member.key.type !== AST_NODE_TYPES51.Identifier) continue;
13383
+ if (member.type !== AST_NODE_TYPES52.TSPropertySignature) continue;
13384
+ if (member.computed || member.key.type !== AST_NODE_TYPES52.Identifier) continue;
12933
13385
  const reference = readTypeReference(member.typeAnnotation?.typeAnnotation);
12934
13386
  if (reference === null) continue;
12935
13387
  types.set(member.key.name, reference);
@@ -12940,18 +13392,18 @@ var fileTypeIndex = (program) => {
12940
13392
  const objects = /* @__PURE__ */ new Map();
12941
13393
  const functionAliases = /* @__PURE__ */ new Set();
12942
13394
  for (const statement of program.body) {
12943
- const declaration = statement.type === AST_NODE_TYPES51.ExportNamedDeclaration ? statement.declaration : statement;
12944
- if (declaration?.type === AST_NODE_TYPES51.TSInterfaceDeclaration) {
13395
+ const declaration = statement.type === AST_NODE_TYPES52.ExportNamedDeclaration ? statement.declaration : statement;
13396
+ if (declaration?.type === AST_NODE_TYPES52.TSInterfaceDeclaration) {
12945
13397
  objects.set(declaration.id.name, propertySignatureTypes(declaration.body.body));
12946
13398
  continue;
12947
13399
  }
12948
- if (declaration?.type !== AST_NODE_TYPES51.TSTypeAliasDeclaration) continue;
13400
+ if (declaration?.type !== AST_NODE_TYPES52.TSTypeAliasDeclaration) continue;
12949
13401
  const aliased = declaration.typeAnnotation;
12950
- if (aliased.type === AST_NODE_TYPES51.TSFunctionType || aliased.type === AST_NODE_TYPES51.TSConstructorType) {
13402
+ if (aliased.type === AST_NODE_TYPES52.TSFunctionType || aliased.type === AST_NODE_TYPES52.TSConstructorType) {
12951
13403
  functionAliases.add(declaration.id.name);
12952
13404
  continue;
12953
13405
  }
12954
- const literals = aliased.type === AST_NODE_TYPES51.TSTypeLiteral ? [aliased] : aliased.type === AST_NODE_TYPES51.TSIntersectionType ? aliased.types.filter((part) => part.type === AST_NODE_TYPES51.TSTypeLiteral) : [];
13406
+ const literals = aliased.type === AST_NODE_TYPES52.TSTypeLiteral ? [aliased] : aliased.type === AST_NODE_TYPES52.TSIntersectionType ? aliased.types.filter((part) => part.type === AST_NODE_TYPES52.TSTypeLiteral) : [];
12955
13407
  if (literals.length === 0) continue;
12956
13408
  const merged = /* @__PURE__ */ new Map();
12957
13409
  for (const literal of literals) {
@@ -12979,10 +13431,10 @@ var readConstructor = (ctor, declared, typeParameters) => {
12979
13431
  while (pending.length > 0) {
12980
13432
  const current = pending.pop();
12981
13433
  if (current === void 0) break;
12982
- if (current.type === AST_NODE_TYPES51.ArrowFunctionExpression || current.type === AST_NODE_TYPES51.FunctionExpression || current.type === AST_NODE_TYPES51.FunctionDeclaration || current.type === AST_NODE_TYPES51.ClassExpression || current.type === AST_NODE_TYPES51.ClassDeclaration) continue;
12983
- const expression = current.type === AST_NODE_TYPES51.ExpressionStatement ? current.expression : null;
12984
- const storedField = expression?.type === AST_NODE_TYPES51.AssignmentExpression && expression.left.type === AST_NODE_TYPES51.MemberExpression && expression.left.object.type === AST_NODE_TYPES51.ThisExpression ? staticMemberName4(expression.left) : null;
12985
- if (expression?.type !== AST_NODE_TYPES51.AssignmentExpression || !STORAGE_ASSIGNMENT_OPERATORS.has(expression.operator) || expression.left.type !== AST_NODE_TYPES51.MemberExpression || expression.left.object.type !== AST_NODE_TYPES51.ThisExpression || storedField === null) {
13434
+ if (current.type === AST_NODE_TYPES52.ArrowFunctionExpression || current.type === AST_NODE_TYPES52.FunctionExpression || current.type === AST_NODE_TYPES52.FunctionDeclaration || current.type === AST_NODE_TYPES52.ClassExpression || current.type === AST_NODE_TYPES52.ClassDeclaration) continue;
13435
+ const expression = current.type === AST_NODE_TYPES52.ExpressionStatement ? current.expression : null;
13436
+ const storedField = expression?.type === AST_NODE_TYPES52.AssignmentExpression && expression.left.type === AST_NODE_TYPES52.MemberExpression && expression.left.object.type === AST_NODE_TYPES52.ThisExpression ? staticMemberName4(expression.left) : null;
13437
+ if (expression?.type !== AST_NODE_TYPES52.AssignmentExpression || !STORAGE_ASSIGNMENT_OPERATORS.has(expression.operator) || expression.left.type !== AST_NODE_TYPES52.MemberExpression || expression.left.object.type !== AST_NODE_TYPES52.ThisExpression || storedField === null) {
12986
13438
  for (const key of Object.keys(current)) {
12987
13439
  if (key === "parent") continue;
12988
13440
  const value = current[key];
@@ -12995,14 +13447,14 @@ var readConstructor = (ctor, declared, typeParameters) => {
12995
13447
  continue;
12996
13448
  }
12997
13449
  let source = expression.right;
12998
- while (source.type === AST_NODE_TYPES51.TSNonNullExpression || source.type === AST_NODE_TYPES51.TSAsExpression || source.type === AST_NODE_TYPES51.TSSatisfiesExpression || source.type === AST_NODE_TYPES51.TSTypeAssertion) source = source.expression;
12999
- if (source.type === AST_NODE_TYPES51.NewExpression) {
13450
+ while (source.type === AST_NODE_TYPES52.TSNonNullExpression || source.type === AST_NODE_TYPES52.TSAsExpression || source.type === AST_NODE_TYPES52.TSSatisfiesExpression || source.type === AST_NODE_TYPES52.TSTypeAssertion) source = source.expression;
13451
+ if (source.type === AST_NODE_TYPES52.NewExpression) {
13000
13452
  constructedFields += 1;
13001
- } else if (source.type === AST_NODE_TYPES51.Identifier) {
13453
+ } else if (source.type === AST_NODE_TYPES52.Identifier) {
13002
13454
  const fields = storedFieldsFrom.get(source.name) ?? /* @__PURE__ */ new Set();
13003
13455
  fields.add(storedField);
13004
13456
  storedFieldsFrom.set(source.name, fields);
13005
- } else if (source.type === AST_NODE_TYPES51.MemberExpression && source.object.type === AST_NODE_TYPES51.Identifier) {
13457
+ } else if (source.type === AST_NODE_TYPES52.MemberExpression && source.object.type === AST_NODE_TYPES52.Identifier) {
13006
13458
  const fields = storedFieldsFrom.get(source.object.name) ?? /* @__PURE__ */ new Set();
13007
13459
  fields.add(storedField);
13008
13460
  storedFieldsFrom.set(source.object.name, fields);
@@ -13012,7 +13464,7 @@ var readConstructor = (ctor, declared, typeParameters) => {
13012
13464
  const collaborators = [];
13013
13465
  for (const parameter of ctor.value.params) {
13014
13466
  for (const reference of parameterCollaborators(parameter, declared)) {
13015
- const fields = parameter.type === AST_NODE_TYPES51.TSParameterProperty ? [reference.name] : [...storedFieldsFrom.get(reference.name) ?? []];
13467
+ const fields = parameter.type === AST_NODE_TYPES52.TSParameterProperty ? [reference.name] : [...storedFieldsFrom.get(reference.name) ?? []];
13016
13468
  if (fields.length === 0) continue;
13017
13469
  if (CONFIGISH_TYPE_RE.test(reference.typeName)) continue;
13018
13470
  if (CONFIGISH_NAME_RE.test(reference.name)) continue;
@@ -13027,8 +13479,8 @@ var readConstructor = (ctor, declared, typeParameters) => {
13027
13479
  };
13028
13480
  var parameterCollaborators = (parameter, declared) => {
13029
13481
  let target = parameter;
13030
- if (target.type === AST_NODE_TYPES51.AssignmentPattern) target = target.left;
13031
- if (target.type === AST_NODE_TYPES51.ObjectPattern) {
13482
+ if (target.type === AST_NODE_TYPES52.AssignmentPattern) target = target.left;
13483
+ if (target.type === AST_NODE_TYPES52.ObjectPattern) {
13032
13484
  return objectPatternCollaborators(target, declared);
13033
13485
  }
13034
13486
  const named2 = namedParameterCollaborator(parameter);
@@ -13036,9 +13488,9 @@ var parameterCollaborators = (parameter, declared) => {
13036
13488
  };
13037
13489
  var namedParameterCollaborator = (annotated) => {
13038
13490
  let target = annotated;
13039
- if (target.type === AST_NODE_TYPES51.TSParameterProperty) target = target.parameter;
13040
- if (target.type === AST_NODE_TYPES51.AssignmentPattern) target = target.left;
13041
- if (target.type !== AST_NODE_TYPES51.Identifier) return null;
13491
+ if (target.type === AST_NODE_TYPES52.TSParameterProperty) target = target.parameter;
13492
+ if (target.type === AST_NODE_TYPES52.AssignmentPattern) target = target.left;
13493
+ if (target.type !== AST_NODE_TYPES52.Identifier) return null;
13042
13494
  const reference = readTypeReference(target.typeAnnotation?.typeAnnotation);
13043
13495
  if (reference === null) return null;
13044
13496
  return { name: target.name, ...reference, fields: [] };
@@ -13050,11 +13502,11 @@ var objectPatternCollaborators = (pattern, declared) => {
13050
13502
  if (members === null) return [];
13051
13503
  const collaborators = [];
13052
13504
  for (const property of pattern.properties) {
13053
- if (property.type !== AST_NODE_TYPES51.Property || property.computed) continue;
13054
- if (property.key.type !== AST_NODE_TYPES51.Identifier) continue;
13505
+ if (property.type !== AST_NODE_TYPES52.Property || property.computed) continue;
13506
+ if (property.key.type !== AST_NODE_TYPES52.Identifier) continue;
13055
13507
  const key = property.key.name;
13056
- const bound = property.value.type === AST_NODE_TYPES51.AssignmentPattern ? property.value.left : property.value;
13057
- if (bound.type !== AST_NODE_TYPES51.Identifier) continue;
13508
+ const bound = property.value.type === AST_NODE_TYPES52.AssignmentPattern ? property.value.left : property.value;
13509
+ if (bound.type !== AST_NODE_TYPES52.Identifier) continue;
13058
13510
  if (CONFIGISH_NAME_RE.test(key)) continue;
13059
13511
  const reference = members.get(key);
13060
13512
  if (reference === void 0) continue;
@@ -13063,21 +13515,21 @@ var objectPatternCollaborators = (pattern, declared) => {
13063
13515
  return collaborators;
13064
13516
  };
13065
13517
  var bagMemberTypes = (annotation, declared) => {
13066
- if (annotation.type === AST_NODE_TYPES51.TSTypeLiteral) {
13518
+ if (annotation.type === AST_NODE_TYPES52.TSTypeLiteral) {
13067
13519
  return propertySignatureTypes(annotation.members);
13068
13520
  }
13069
- if (annotation.type !== AST_NODE_TYPES51.TSTypeReference || annotation.typeName.type !== AST_NODE_TYPES51.Identifier) {
13521
+ if (annotation.type !== AST_NODE_TYPES52.TSTypeReference || annotation.typeName.type !== AST_NODE_TYPES52.Identifier) {
13070
13522
  return null;
13071
13523
  }
13072
13524
  return declared().objects.get(annotation.typeName.name) ?? null;
13073
13525
  };
13074
13526
  var isFrameworkWiring = (body2) => subtreeHas(body2, (node) => {
13075
- if (node.type === AST_NODE_TYPES51.CallExpression) {
13527
+ if (node.type === AST_NODE_TYPES52.CallExpression) {
13076
13528
  const { callee } = node;
13077
- if (callee.type === AST_NODE_TYPES51.Identifier) return callee.name === ROUTER_FACTORY_NAME;
13078
- return callee.type === AST_NODE_TYPES51.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES51.Identifier && callee.property.name === ROUTER_FACTORY_NAME;
13529
+ if (callee.type === AST_NODE_TYPES52.Identifier) return callee.name === ROUTER_FACTORY_NAME;
13530
+ return callee.type === AST_NODE_TYPES52.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES52.Identifier && callee.property.name === ROUTER_FACTORY_NAME;
13079
13531
  }
13080
- return node.type === AST_NODE_TYPES51.TSTypeReference && node.typeName.type === AST_NODE_TYPES51.TSQualifiedName && FRAMEWORK_HTTP_TYPES.has(node.typeName.right.name);
13532
+ return node.type === AST_NODE_TYPES52.TSTypeReference && node.typeName.type === AST_NODE_TYPES52.TSQualifiedName && FRAMEWORK_HTTP_TYPES.has(node.typeName.right.name);
13081
13533
  });
13082
13534
  var subtreeHas = (root, found) => {
13083
13535
  let hit = false;
@@ -13104,19 +13556,19 @@ var invokedInstanceField = (call) => {
13104
13556
  const direct = instanceField(call.callee);
13105
13557
  if (direct !== null) return direct;
13106
13558
  let callee = call.callee;
13107
- while (callee.type === AST_NODE_TYPES51.ChainExpression || callee.type === AST_NODE_TYPES51.TSAsExpression || callee.type === AST_NODE_TYPES51.TSNonNullExpression || callee.type === AST_NODE_TYPES51.TSSatisfiesExpression || callee.type === AST_NODE_TYPES51.TSTypeAssertion) callee = callee.expression;
13108
- return callee.type === AST_NODE_TYPES51.MemberExpression ? instanceField(callee.object) : null;
13559
+ while (callee.type === AST_NODE_TYPES52.ChainExpression || callee.type === AST_NODE_TYPES52.TSAsExpression || callee.type === AST_NODE_TYPES52.TSNonNullExpression || callee.type === AST_NODE_TYPES52.TSSatisfiesExpression || callee.type === AST_NODE_TYPES52.TSTypeAssertion) callee = callee.expression;
13560
+ return callee.type === AST_NODE_TYPES52.MemberExpression ? instanceField(callee.object) : null;
13109
13561
  };
13110
13562
  var instanceField = (candidate) => {
13111
13563
  let node = candidate;
13112
- while (node.type === AST_NODE_TYPES51.ChainExpression || node.type === AST_NODE_TYPES51.TSAsExpression || node.type === AST_NODE_TYPES51.TSNonNullExpression || node.type === AST_NODE_TYPES51.TSSatisfiesExpression || node.type === AST_NODE_TYPES51.TSTypeAssertion) node = node.expression;
13113
- return node.type === AST_NODE_TYPES51.MemberExpression && node.object.type === AST_NODE_TYPES51.ThisExpression ? staticMemberName4(node) : null;
13564
+ while (node.type === AST_NODE_TYPES52.ChainExpression || node.type === AST_NODE_TYPES52.TSAsExpression || node.type === AST_NODE_TYPES52.TSNonNullExpression || node.type === AST_NODE_TYPES52.TSSatisfiesExpression || node.type === AST_NODE_TYPES52.TSTypeAssertion) node = node.expression;
13565
+ return node.type === AST_NODE_TYPES52.MemberExpression && node.object.type === AST_NODE_TYPES52.ThisExpression ? staticMemberName4(node) : null;
13114
13566
  };
13115
13567
  var behaviorallyInvokedFields = (body2) => {
13116
13568
  const invoked = /* @__PURE__ */ new Set();
13117
13569
  const visit = (current) => {
13118
- if (current.type === AST_NODE_TYPES51.ClassDeclaration || current.type === AST_NODE_TYPES51.ClassExpression || current.type === AST_NODE_TYPES51.FunctionDeclaration || current.type === AST_NODE_TYPES51.FunctionExpression) return;
13119
- if (current.type === AST_NODE_TYPES51.CallExpression) {
13570
+ if (current.type === AST_NODE_TYPES52.ClassDeclaration || current.type === AST_NODE_TYPES52.ClassExpression || current.type === AST_NODE_TYPES52.FunctionDeclaration || current.type === AST_NODE_TYPES52.FunctionExpression) return;
13571
+ if (current.type === AST_NODE_TYPES52.CallExpression) {
13120
13572
  const field = invokedInstanceField(current);
13121
13573
  if (field !== null) invoked.add(field);
13122
13574
  }
@@ -13129,14 +13581,14 @@ var behaviorallyInvokedFields = (body2) => {
13129
13581
  }
13130
13582
  };
13131
13583
  for (const member of body2.body) {
13132
- if (member.type === AST_NODE_TYPES51.StaticBlock || member.static) continue;
13133
- if (member.type === AST_NODE_TYPES51.MethodDefinition) {
13584
+ if (member.type === AST_NODE_TYPES52.StaticBlock || member.static) continue;
13585
+ if (member.type === AST_NODE_TYPES52.MethodDefinition) {
13134
13586
  if (member.value.body !== null && member.value.body !== void 0) visit(member.value.body);
13135
13587
  continue;
13136
13588
  }
13137
- if (member.type !== AST_NODE_TYPES51.PropertyDefinition || member.value === null) continue;
13589
+ if (member.type !== AST_NODE_TYPES52.PropertyDefinition || member.value === null) continue;
13138
13590
  visit(
13139
- member.value.type === AST_NODE_TYPES51.ArrowFunctionExpression ? member.value.body : member.value
13591
+ member.value.type === AST_NODE_TYPES52.ArrowFunctionExpression ? member.value.body : member.value
13140
13592
  );
13141
13593
  }
13142
13594
  return invoked;
@@ -13156,25 +13608,25 @@ var isTransportWrapper = (className, collaborators, program) => {
13156
13608
  var fileInterfaceNames = (program) => {
13157
13609
  const names = [];
13158
13610
  for (const statement of program.body) {
13159
- const declaration = statement.type === AST_NODE_TYPES51.ExportNamedDeclaration ? statement.declaration : statement;
13160
- if (declaration?.type === AST_NODE_TYPES51.TSInterfaceDeclaration) names.push(declaration.id.name);
13611
+ const declaration = statement.type === AST_NODE_TYPES52.ExportNamedDeclaration ? statement.declaration : statement;
13612
+ if (declaration?.type === AST_NODE_TYPES52.TSInterfaceDeclaration) names.push(declaration.id.name);
13161
13613
  }
13162
13614
  return names;
13163
13615
  };
13164
13616
  var publicMethodNames = (body2, functionAliases) => {
13165
13617
  const names = [];
13166
13618
  for (const member of body2.body) {
13167
- if (member.type === AST_NODE_TYPES51.PropertyDefinition) {
13619
+ if (member.type === AST_NODE_TYPES52.PropertyDefinition) {
13168
13620
  if (member.static || member.accessibility === "private" || member.accessibility === "protected") continue;
13169
- if (member.value?.type !== AST_NODE_TYPES51.ArrowFunctionExpression && member.value?.type !== AST_NODE_TYPES51.FunctionExpression && member.typeAnnotation?.typeAnnotation.type !== AST_NODE_TYPES51.TSFunctionType && !(member.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES51.TSTypeReference && member.typeAnnotation.typeAnnotation.typeName.type === AST_NODE_TYPES51.Identifier && functionAliases.has(member.typeAnnotation.typeAnnotation.typeName.name))) continue;
13170
- names.push(member.key.type === AST_NODE_TYPES51.Identifier ? member.key.name : "\u2026");
13621
+ if (member.value?.type !== AST_NODE_TYPES52.ArrowFunctionExpression && member.value?.type !== AST_NODE_TYPES52.FunctionExpression && member.typeAnnotation?.typeAnnotation.type !== AST_NODE_TYPES52.TSFunctionType && !(member.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES52.TSTypeReference && member.typeAnnotation.typeAnnotation.typeName.type === AST_NODE_TYPES52.Identifier && functionAliases.has(member.typeAnnotation.typeAnnotation.typeName.name))) continue;
13622
+ names.push(member.key.type === AST_NODE_TYPES52.Identifier ? member.key.name : "\u2026");
13171
13623
  continue;
13172
13624
  }
13173
- if (member.type !== AST_NODE_TYPES51.MethodDefinition) continue;
13625
+ if (member.type !== AST_NODE_TYPES52.MethodDefinition) continue;
13174
13626
  if (member.kind !== "method" || member.static) continue;
13175
13627
  if (member.accessibility === "private" || member.accessibility === "protected") continue;
13176
- if (member.key.type === AST_NODE_TYPES51.PrivateIdentifier) continue;
13177
- if (member.key.type === AST_NODE_TYPES51.Identifier) names.push(member.key.name);
13628
+ if (member.key.type === AST_NODE_TYPES52.PrivateIdentifier) continue;
13629
+ if (member.key.type === AST_NODE_TYPES52.Identifier) names.push(member.key.name);
13178
13630
  else names.push("\u2026");
13179
13631
  }
13180
13632
  return names;
@@ -13182,13 +13634,13 @@ var publicMethodNames = (body2, functionAliases) => {
13182
13634
  var isFluentConstructionObject = (node, getText) => {
13183
13635
  if (node.id === null) return false;
13184
13636
  const methods = node.body.body.filter(
13185
- (member) => member.type === AST_NODE_TYPES51.MethodDefinition && member.kind === "method" && !member.static && member.accessibility !== "private" && member.accessibility !== "protected" && member.value.body !== null
13637
+ (member) => member.type === AST_NODE_TYPES52.MethodDefinition && member.kind === "method" && !member.static && member.accessibility !== "private" && member.accessibility !== "protected" && member.value.body !== null
13186
13638
  );
13187
13639
  if (methods.length === 0) return false;
13188
13640
  return methods.every((member) => {
13189
13641
  const result = member.value.returnType?.typeAnnotation;
13190
13642
  if (result === void 0) return false;
13191
- const returnsOwnType = result.type === AST_NODE_TYPES51.TSTypeReference && result.typeName.type === AST_NODE_TYPES51.Identifier && result.typeName.name === node.id?.name;
13643
+ const returnsOwnType = result.type === AST_NODE_TYPES52.TSTypeReference && result.typeName.type === AST_NODE_TYPES52.Identifier && result.typeName.name === node.id?.name;
13192
13644
  return returnsOwnType || FLUENT_BUILDER_NAME_RE.test(node.id?.name ?? "") && FLUENT_RESULT_TYPE_RE.test(getText(result));
13193
13645
  });
13194
13646
  };
@@ -13196,10 +13648,10 @@ function localClassAbstractness(program) {
13196
13648
  const classes = /* @__PURE__ */ new Map();
13197
13649
  const parents = /* @__PURE__ */ new Map();
13198
13650
  for (const statement of program.body) {
13199
- const declaration = statement.type === AST_NODE_TYPES51.ExportNamedDeclaration || statement.type === AST_NODE_TYPES51.ExportDefaultDeclaration ? statement.declaration : statement;
13200
- if (declaration?.type === AST_NODE_TYPES51.ClassDeclaration && declaration.id !== null) {
13651
+ const declaration = statement.type === AST_NODE_TYPES52.ExportNamedDeclaration || statement.type === AST_NODE_TYPES52.ExportDefaultDeclaration ? statement.declaration : statement;
13652
+ if (declaration?.type === AST_NODE_TYPES52.ClassDeclaration && declaration.id !== null) {
13201
13653
  classes.set(declaration.id.name, declaration.abstract === true);
13202
- if (declaration.superClass?.type === AST_NODE_TYPES51.Identifier) {
13654
+ if (declaration.superClass?.type === AST_NODE_TYPES52.Identifier) {
13203
13655
  parents.set(declaration.id.name, declaration.superClass.name);
13204
13656
  }
13205
13657
  }
@@ -13221,43 +13673,43 @@ function localInterfaceSurfaces(program) {
13221
13673
  const parents = /* @__PURE__ */ new Map();
13222
13674
  const functionAliases = /* @__PURE__ */ new Set();
13223
13675
  for (const statement of program.body) {
13224
- const declaration = statement.type === AST_NODE_TYPES51.ExportNamedDeclaration ? statement.declaration : statement;
13225
- if (declaration?.type === AST_NODE_TYPES51.TSTypeAliasDeclaration && (declaration.typeAnnotation.type === AST_NODE_TYPES51.TSFunctionType || declaration.typeAnnotation.type === AST_NODE_TYPES51.TSConstructorType)) functionAliases.add(declaration.id.name);
13676
+ const declaration = statement.type === AST_NODE_TYPES52.ExportNamedDeclaration ? statement.declaration : statement;
13677
+ if (declaration?.type === AST_NODE_TYPES52.TSTypeAliasDeclaration && (declaration.typeAnnotation.type === AST_NODE_TYPES52.TSFunctionType || declaration.typeAnnotation.type === AST_NODE_TYPES52.TSConstructorType)) functionAliases.add(declaration.id.name);
13226
13678
  }
13227
13679
  for (const statement of program.body) {
13228
- const declaration = statement.type === AST_NODE_TYPES51.ExportNamedDeclaration ? statement.declaration : statement;
13229
- if (declaration?.type === AST_NODE_TYPES51.TSTypeAliasDeclaration) {
13680
+ const declaration = statement.type === AST_NODE_TYPES52.ExportNamedDeclaration ? statement.declaration : statement;
13681
+ if (declaration?.type === AST_NODE_TYPES52.TSTypeAliasDeclaration) {
13230
13682
  const callables2 = interfaces.get(declaration.id.name) ?? /* @__PURE__ */ new Set();
13231
- const parts = declaration.typeAnnotation.type === AST_NODE_TYPES51.TSIntersectionType ? declaration.typeAnnotation.types : [declaration.typeAnnotation];
13683
+ const parts = declaration.typeAnnotation.type === AST_NODE_TYPES52.TSIntersectionType ? declaration.typeAnnotation.types : [declaration.typeAnnotation];
13232
13684
  const inherited = parents.get(declaration.id.name) ?? [];
13233
13685
  for (const part of parts) {
13234
- if (part.type === AST_NODE_TYPES51.TSTypeReference && part.typeName.type === AST_NODE_TYPES51.Identifier) {
13686
+ if (part.type === AST_NODE_TYPES52.TSTypeReference && part.typeName.type === AST_NODE_TYPES52.Identifier) {
13235
13687
  inherited.push(part.typeName.name);
13236
13688
  continue;
13237
13689
  }
13238
- if (part.type !== AST_NODE_TYPES51.TSTypeLiteral) continue;
13690
+ if (part.type !== AST_NODE_TYPES52.TSTypeLiteral) continue;
13239
13691
  for (const member of part.members) {
13240
- if (member.type !== AST_NODE_TYPES51.TSMethodSignature && member.type !== AST_NODE_TYPES51.TSPropertySignature) continue;
13241
- if (member.computed || member.key.type !== AST_NODE_TYPES51.Identifier) continue;
13242
- if (member.type === AST_NODE_TYPES51.TSMethodSignature) {
13692
+ if (member.type !== AST_NODE_TYPES52.TSMethodSignature && member.type !== AST_NODE_TYPES52.TSPropertySignature) continue;
13693
+ if (member.computed || member.key.type !== AST_NODE_TYPES52.Identifier) continue;
13694
+ if (member.type === AST_NODE_TYPES52.TSMethodSignature) {
13243
13695
  callables2.add(member.key.name);
13244
13696
  continue;
13245
13697
  }
13246
- if (member.type !== AST_NODE_TYPES51.TSPropertySignature) continue;
13698
+ if (member.type !== AST_NODE_TYPES52.TSPropertySignature) continue;
13247
13699
  const annotation = member.typeAnnotation?.typeAnnotation;
13248
- if (annotation?.type === AST_NODE_TYPES51.TSFunctionType || annotation?.type === AST_NODE_TYPES51.TSTypeReference && annotation.typeName.type === AST_NODE_TYPES51.Identifier && functionAliases.has(annotation.typeName.name)) callables2.add(member.key.name);
13700
+ if (annotation?.type === AST_NODE_TYPES52.TSFunctionType || annotation?.type === AST_NODE_TYPES52.TSTypeReference && annotation.typeName.type === AST_NODE_TYPES52.Identifier && functionAliases.has(annotation.typeName.name)) callables2.add(member.key.name);
13249
13701
  }
13250
13702
  }
13251
13703
  interfaces.set(declaration.id.name, callables2);
13252
13704
  parents.set(declaration.id.name, inherited);
13253
13705
  continue;
13254
13706
  }
13255
- if (declaration?.type !== AST_NODE_TYPES51.TSInterfaceDeclaration) continue;
13707
+ if (declaration?.type !== AST_NODE_TYPES52.TSInterfaceDeclaration) continue;
13256
13708
  const callables = interfaces.get(declaration.id.name) ?? /* @__PURE__ */ new Set();
13257
13709
  for (const member of declaration.body.body) {
13258
- if (member.type !== AST_NODE_TYPES51.TSMethodSignature && member.type !== AST_NODE_TYPES51.TSPropertySignature) continue;
13259
- if (member.computed || member.key.type !== AST_NODE_TYPES51.Identifier) continue;
13260
- if (member.type === AST_NODE_TYPES51.TSMethodSignature || member.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES51.TSFunctionType || member.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES51.TSTypeReference && member.typeAnnotation.typeAnnotation.typeName.type === AST_NODE_TYPES51.Identifier && functionAliases.has(member.typeAnnotation.typeAnnotation.typeName.name)) callables.add(member.key.name);
13710
+ if (member.type !== AST_NODE_TYPES52.TSMethodSignature && member.type !== AST_NODE_TYPES52.TSPropertySignature) continue;
13711
+ if (member.computed || member.key.type !== AST_NODE_TYPES52.Identifier) continue;
13712
+ if (member.type === AST_NODE_TYPES52.TSMethodSignature || member.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES52.TSFunctionType || member.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES52.TSTypeReference && member.typeAnnotation.typeAnnotation.typeName.type === AST_NODE_TYPES52.Identifier && functionAliases.has(member.typeAnnotation.typeAnnotation.typeName.name)) callables.add(member.key.name);
13261
13713
  }
13262
13714
  interfaces.set(declaration.id.name, callables);
13263
13715
  parents.set(
@@ -13265,7 +13717,7 @@ function localInterfaceSurfaces(program) {
13265
13717
  [
13266
13718
  ...parents.get(declaration.id.name) ?? [],
13267
13719
  ...declaration.extends.flatMap(
13268
- (heritage) => heritage.expression.type === AST_NODE_TYPES51.Identifier ? [heritage.expression.name] : ["*"]
13720
+ (heritage) => heritage.expression.type === AST_NODE_TYPES52.Identifier ? [heritage.expression.name] : ["*"]
13269
13721
  )
13270
13722
  ]
13271
13723
  );
@@ -13292,7 +13744,7 @@ function localInterfaceSurfaces(program) {
13292
13744
  }
13293
13745
  function hasServicePort(node, methods, classes, interfaces) {
13294
13746
  if (node.superClass !== null) {
13295
- if (node.superClass.type !== AST_NODE_TYPES51.Identifier) return true;
13747
+ if (node.superClass.type !== AST_NODE_TYPES52.Identifier) return true;
13296
13748
  const localAbstract = classes.get(node.superClass.name);
13297
13749
  if (localAbstract === void 0 || localAbstract) return true;
13298
13750
  }
@@ -13304,7 +13756,7 @@ function hasServicePort(node, methods, classes, interfaces) {
13304
13756
  if (node.implements.length === 0) return false;
13305
13757
  const combined = /* @__PURE__ */ new Set();
13306
13758
  for (const implementation of node.implements) {
13307
- if (implementation.expression.type !== AST_NODE_TYPES51.Identifier) return true;
13759
+ if (implementation.expression.type !== AST_NODE_TYPES52.Identifier) return true;
13308
13760
  const name = implementation.expression.name;
13309
13761
  const localAbstract = classes.get(name);
13310
13762
  if (localAbstract === true) return true;
@@ -13347,7 +13799,7 @@ var require_port_for_service_default = createRule({
13347
13799
  if (node.abstract === true) return;
13348
13800
  if (node.decorators.length > 0) return;
13349
13801
  const ctor = node.body.body.find(
13350
- (member) => member.type === AST_NODE_TYPES51.MethodDefinition && member.kind === "constructor" && member.value.body !== null && member.value.body !== void 0
13802
+ (member) => member.type === AST_NODE_TYPES52.MethodDefinition && member.kind === "constructor" && member.value.body !== null && member.value.body !== void 0
13351
13803
  );
13352
13804
  if (ctor === void 0) return;
13353
13805
  const constructorFacts = readConstructor(
@@ -13382,7 +13834,7 @@ var require_port_for_service_default = createRule({
13382
13834
  });
13383
13835
 
13384
13836
  // src/rules/require-static-next-matcher.ts
13385
- import { AST_NODE_TYPES as AST_NODE_TYPES52 } from "@typescript-eslint/utils";
13837
+ import { AST_NODE_TYPES as AST_NODE_TYPES53 } from "@typescript-eslint/utils";
13386
13838
  var requireStaticNextMatcherDocumentation = {
13387
13839
  summary: "Require Next.js middleware and proxy matcher configuration to contain only build-time literals.",
13388
13840
  rationale: "Next.js must statically analyze matcher values at build time; computed values are ignored.",
@@ -13395,34 +13847,34 @@ var requireStaticNextMatcherDocumentation = {
13395
13847
  };
13396
13848
  var NEXT_ENTRY_FILE = /(?:^|[/\\])(?:middleware|proxy)\.[cm]?[jt]sx?$/u;
13397
13849
  function unwrapExpression3(node) {
13398
- if (node.type === AST_NODE_TYPES52.TSAsExpression || node.type === AST_NODE_TYPES52.TSSatisfiesExpression || node.type === AST_NODE_TYPES52.TSNonNullExpression || node.type === AST_NODE_TYPES52.TSTypeAssertion) {
13850
+ if (node.type === AST_NODE_TYPES53.TSAsExpression || node.type === AST_NODE_TYPES53.TSSatisfiesExpression || node.type === AST_NODE_TYPES53.TSNonNullExpression || node.type === AST_NODE_TYPES53.TSTypeAssertion) {
13399
13851
  return unwrapExpression3(node.expression);
13400
13852
  }
13401
13853
  return node;
13402
13854
  }
13403
13855
  function isStaticValue(node) {
13404
13856
  const value = unwrapExpression3(node);
13405
- if (value.type === AST_NODE_TYPES52.Literal) {
13857
+ if (value.type === AST_NODE_TYPES53.Literal) {
13406
13858
  return true;
13407
13859
  }
13408
- if (value.type === AST_NODE_TYPES52.TemplateLiteral) {
13860
+ if (value.type === AST_NODE_TYPES53.TemplateLiteral) {
13409
13861
  return value.expressions.length === 0;
13410
13862
  }
13411
- if (value.type === AST_NODE_TYPES52.ArrayExpression) {
13863
+ if (value.type === AST_NODE_TYPES53.ArrayExpression) {
13412
13864
  return value.elements.every(
13413
- (element) => element !== null && element.type !== AST_NODE_TYPES52.SpreadElement && isStaticValue(element)
13865
+ (element) => element !== null && element.type !== AST_NODE_TYPES53.SpreadElement && isStaticValue(element)
13414
13866
  );
13415
13867
  }
13416
- if (value.type === AST_NODE_TYPES52.ObjectExpression) {
13868
+ if (value.type === AST_NODE_TYPES53.ObjectExpression) {
13417
13869
  return value.properties.every(
13418
- (property) => property.type === AST_NODE_TYPES52.Property && property.kind === "init" && !property.computed && property.value.type !== AST_NODE_TYPES52.AssignmentPattern && isStaticValue(property.value)
13870
+ (property) => property.type === AST_NODE_TYPES53.Property && property.kind === "init" && !property.computed && property.value.type !== AST_NODE_TYPES53.AssignmentPattern && isStaticValue(property.value)
13419
13871
  );
13420
13872
  }
13421
13873
  return false;
13422
13874
  }
13423
13875
  function propertyName2(property) {
13424
13876
  if (property.computed) return null;
13425
- if (property.key.type === AST_NODE_TYPES52.Identifier) return property.key.name;
13877
+ if (property.key.type === AST_NODE_TYPES53.Identifier) return property.key.name;
13426
13878
  return typeof property.key.value === "string" ? property.key.value : null;
13427
13879
  }
13428
13880
  var require_static_next_matcher_default = createRule({
@@ -13445,19 +13897,19 @@ var require_static_next_matcher_default = createRule({
13445
13897
  }
13446
13898
  return {
13447
13899
  ExportNamedDeclaration(node) {
13448
- if (node.declaration?.type !== AST_NODE_TYPES52.VariableDeclaration) {
13900
+ if (node.declaration?.type !== AST_NODE_TYPES53.VariableDeclaration) {
13449
13901
  return;
13450
13902
  }
13451
13903
  for (const declaration of node.declaration.declarations) {
13452
- if (declaration.id.type !== AST_NODE_TYPES52.Identifier || declaration.id.name !== "config" || declaration.init === null) {
13904
+ if (declaration.id.type !== AST_NODE_TYPES53.Identifier || declaration.id.name !== "config" || declaration.init === null) {
13453
13905
  continue;
13454
13906
  }
13455
13907
  const config = unwrapExpression3(declaration.init);
13456
- if (config.type !== AST_NODE_TYPES52.ObjectExpression) {
13908
+ if (config.type !== AST_NODE_TYPES53.ObjectExpression) {
13457
13909
  continue;
13458
13910
  }
13459
13911
  for (const property of config.properties) {
13460
- if (property.type !== AST_NODE_TYPES52.Property || propertyName2(property) !== "matcher" || property.value.type === AST_NODE_TYPES52.AssignmentPattern) {
13912
+ if (property.type !== AST_NODE_TYPES53.Property || propertyName2(property) !== "matcher" || property.value.type === AST_NODE_TYPES53.AssignmentPattern) {
13461
13913
  continue;
13462
13914
  }
13463
13915
  if (!isStaticValue(property.value)) {
@@ -13472,7 +13924,7 @@ var require_static_next_matcher_default = createRule({
13472
13924
 
13473
13925
  // src/rules/require-zod-form-validation.ts
13474
13926
  import {
13475
- AST_NODE_TYPES as AST_NODE_TYPES53,
13927
+ AST_NODE_TYPES as AST_NODE_TYPES54,
13476
13928
  ASTUtils as ASTUtils14
13477
13929
  } from "@typescript-eslint/utils";
13478
13930
  var requireZodFormValidationDocumentation = {
@@ -13499,14 +13951,14 @@ var FORM_VALUE_METHODS = /* @__PURE__ */ new Set(["get", "getAll"]);
13499
13951
  var zodReceiverRoot = (node) => {
13500
13952
  let current = node;
13501
13953
  while (true) {
13502
- if (current.type === AST_NODE_TYPES53.Identifier) {
13954
+ if (current.type === AST_NODE_TYPES54.Identifier) {
13503
13955
  return current;
13504
13956
  }
13505
- if (current.type === AST_NODE_TYPES53.CallExpression) {
13957
+ if (current.type === AST_NODE_TYPES54.CallExpression) {
13506
13958
  current = current.callee;
13507
13959
  continue;
13508
13960
  }
13509
- if (current.type === AST_NODE_TYPES53.MemberExpression) {
13961
+ if (current.type === AST_NODE_TYPES54.MemberExpression) {
13510
13962
  current = current.object;
13511
13963
  continue;
13512
13964
  }
@@ -13515,12 +13967,12 @@ var zodReceiverRoot = (node) => {
13515
13967
  };
13516
13968
  var isFormDataMethodCall = (node) => {
13517
13969
  let current = node;
13518
- if (current.type === AST_NODE_TYPES53.AwaitExpression) {
13970
+ if (current.type === AST_NODE_TYPES54.AwaitExpression) {
13519
13971
  current = current.argument;
13520
13972
  }
13521
- if (current.type !== AST_NODE_TYPES53.CallExpression) return false;
13973
+ if (current.type !== AST_NODE_TYPES54.CallExpression) return false;
13522
13974
  const callee = current.callee;
13523
- return callee.type === AST_NODE_TYPES53.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES53.Identifier && callee.property.name === "formData";
13975
+ return callee.type === AST_NODE_TYPES54.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES54.Identifier && callee.property.name === "formData";
13524
13976
  };
13525
13977
  var require_zod_form_validation_default = createRule({
13526
13978
  name: "require-zod-form-validation",
@@ -13551,16 +14003,16 @@ var require_zod_form_validation_default = createRule({
13551
14003
  return false;
13552
14004
  }
13553
14005
  const definition = binding.defs[0];
13554
- if (definition?.type !== "Variable" || definition.node.type !== AST_NODE_TYPES53.VariableDeclarator) {
14006
+ if (definition?.type !== "Variable" || definition.node.type !== AST_NODE_TYPES54.VariableDeclarator) {
13555
14007
  return false;
13556
14008
  }
13557
14009
  const init = definition.node.init;
13558
- return init?.type === AST_NODE_TYPES53.ObjectExpression || init?.type === AST_NODE_TYPES53.ArrayExpression || init?.type === AST_NODE_TYPES53.Literal || init?.type === AST_NODE_TYPES53.ArrowFunctionExpression || init?.type === AST_NODE_TYPES53.FunctionExpression;
14010
+ return init?.type === AST_NODE_TYPES54.ObjectExpression || init?.type === AST_NODE_TYPES54.ArrayExpression || init?.type === AST_NODE_TYPES54.Literal || init?.type === AST_NODE_TYPES54.ArrowFunctionExpression || init?.type === AST_NODE_TYPES54.FunctionExpression;
13559
14011
  };
13560
14012
  const isZodParseCall = (node) => {
13561
- if (node.type !== AST_NODE_TYPES53.CallExpression) return false;
14013
+ if (node.type !== AST_NODE_TYPES54.CallExpression) return false;
13562
14014
  const callee = node.callee;
13563
- if (callee.type !== AST_NODE_TYPES53.MemberExpression || callee.computed || callee.property.type !== AST_NODE_TYPES53.Identifier || !ZOD_PARSE_METHODS.has(callee.property.name)) {
14015
+ if (callee.type !== AST_NODE_TYPES54.MemberExpression || callee.computed || callee.property.type !== AST_NODE_TYPES54.Identifier || !ZOD_PARSE_METHODS.has(callee.property.name)) {
13564
14016
  return false;
13565
14017
  }
13566
14018
  const root = zodReceiverRoot(callee.object);
@@ -13569,14 +14021,14 @@ var require_zod_form_validation_default = createRule({
13569
14021
  return binding !== null && zodBindings.has(binding) || (root.name === "z" || ZOD_SCHEMA_NAME_RE.test(root.name)) && !isProvablyNonZodLocal(root);
13570
14022
  };
13571
14023
  const isFormSourceIdentifier = (node) => {
13572
- if (node.type !== AST_NODE_TYPES53.Identifier) return false;
14024
+ if (node.type !== AST_NODE_TYPES54.Identifier) return false;
13573
14025
  const conventionalName = /formdata/i.test(node.name);
13574
14026
  let scope = context.sourceCode.getScope(node);
13575
14027
  while (scope !== null) {
13576
14028
  const variable = scope.set.get(node.name);
13577
14029
  if (variable !== void 0 && variable.defs.length === 1) {
13578
14030
  const def = variable.defs[0];
13579
- if (def !== void 0 && def.type === "Variable" && def.node.type === AST_NODE_TYPES53.VariableDeclarator && def.node.init !== null) {
14031
+ if (def !== void 0 && def.type === "Variable" && def.node.type === AST_NODE_TYPES54.VariableDeclarator && def.node.init !== null) {
13580
14032
  return isFormDataMethodCall(def.node.init);
13581
14033
  }
13582
14034
  return def?.type === "Parameter" && conventionalName;
@@ -13587,8 +14039,8 @@ var require_zod_form_validation_default = createRule({
13587
14039
  };
13588
14040
  const isFormDataGetCall = (node) => {
13589
14041
  const callee = node.callee;
13590
- if (callee.type !== AST_NODE_TYPES53.MemberExpression) return false;
13591
- if (callee.property.type !== AST_NODE_TYPES53.Identifier || !FORM_VALUE_METHODS.has(callee.property.name)) {
14042
+ if (callee.type !== AST_NODE_TYPES54.MemberExpression) return false;
14043
+ if (callee.property.type !== AST_NODE_TYPES54.Identifier || !FORM_VALUE_METHODS.has(callee.property.name)) {
13592
14044
  return false;
13593
14045
  }
13594
14046
  return isFormSourceIdentifier(callee.object);
@@ -13604,16 +14056,16 @@ var require_zod_form_validation_default = createRule({
13604
14056
  const hasZodParseAncestor = (node) => zodParseAncestor(node) !== null;
13605
14057
  const isInstanceofNarrowing = (node) => {
13606
14058
  const parent = node.parent;
13607
- return parent !== null && parent !== void 0 && parent.type === AST_NODE_TYPES53.BinaryExpression && parent.operator === "instanceof" && parent.left === node && parent.right.type === AST_NODE_TYPES53.Identifier && (parent.right.name === "File" || parent.right.name === "Blob");
14059
+ return parent !== null && parent !== void 0 && parent.type === AST_NODE_TYPES54.BinaryExpression && parent.operator === "instanceof" && parent.left === node && parent.right.type === AST_NODE_TYPES54.Identifier && (parent.right.name === "File" || parent.right.name === "Blob");
13608
14060
  };
13609
14061
  const boundDeclarator = (node) => {
13610
14062
  let current = node;
13611
14063
  let parent = current.parent;
13612
- while ((parent.type === AST_NODE_TYPES53.TSAsExpression || parent.type === AST_NODE_TYPES53.TSSatisfiesExpression || parent.type === AST_NODE_TYPES53.TSNonNullExpression || parent.type === AST_NODE_TYPES53.ChainExpression) && parent.expression === current) {
14064
+ while ((parent.type === AST_NODE_TYPES54.TSAsExpression || parent.type === AST_NODE_TYPES54.TSSatisfiesExpression || parent.type === AST_NODE_TYPES54.TSNonNullExpression || parent.type === AST_NODE_TYPES54.ChainExpression) && parent.expression === current) {
13613
14065
  current = parent;
13614
14066
  parent = current.parent;
13615
14067
  }
13616
- if (parent.type === AST_NODE_TYPES53.VariableDeclarator && parent.init === current && parent.id.type === AST_NODE_TYPES53.Identifier) {
14068
+ if (parent.type === AST_NODE_TYPES54.VariableDeclarator && parent.init === current && parent.id.type === AST_NODE_TYPES54.Identifier) {
13617
14069
  return parent;
13618
14070
  }
13619
14071
  return null;
@@ -13622,7 +14074,7 @@ var require_zod_form_validation_default = createRule({
13622
14074
  let current = node;
13623
14075
  while (current.parent !== void 0) {
13624
14076
  const parent = current.parent;
13625
- if (parent.type === AST_NODE_TYPES53.BlockStatement || parent.type === AST_NODE_TYPES53.Program) {
14077
+ if (parent.type === AST_NODE_TYPES54.BlockStatement || parent.type === AST_NODE_TYPES54.Program) {
13626
14078
  return current;
13627
14079
  }
13628
14080
  current = parent;
@@ -13631,12 +14083,12 @@ var require_zod_form_validation_default = createRule({
13631
14083
  };
13632
14084
  const zodParseMethod = (call) => {
13633
14085
  const callee = call.callee;
13634
- return callee.type === AST_NODE_TYPES53.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES53.Identifier ? callee.property.name : null;
14086
+ return callee.type === AST_NODE_TYPES54.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES54.Identifier ? callee.property.name : null;
13635
14087
  };
13636
14088
  const hasConditionalAncestorBeforeStatement = (node, statement) => {
13637
14089
  let current = node.parent;
13638
14090
  while (current !== void 0 && current !== statement) {
13639
- if (current.type === AST_NODE_TYPES53.LogicalExpression || current.type === AST_NODE_TYPES53.ConditionalExpression) {
14091
+ if (current.type === AST_NODE_TYPES54.LogicalExpression || current.type === AST_NODE_TYPES54.ConditionalExpression) {
13640
14092
  return true;
13641
14093
  }
13642
14094
  current = current.parent;
@@ -13646,7 +14098,7 @@ var require_zod_form_validation_default = createRule({
13646
14098
  const isAwaitedBeforeStatement = (node, statement) => {
13647
14099
  let current = node.parent;
13648
14100
  while (current !== void 0 && current !== statement) {
13649
- if (current.type === AST_NODE_TYPES53.AwaitExpression) return true;
14101
+ if (current.type === AST_NODE_TYPES54.AwaitExpression) return true;
13650
14102
  current = current.parent;
13651
14103
  }
13652
14104
  return false;
@@ -13659,7 +14111,7 @@ var require_zod_form_validation_default = createRule({
13659
14111
  if (declarationStatement === null || validationStatement === null || declarationStatement.parent !== validationStatement.parent || validationStatement.range[0] <= declarationStatement.range[1] || hasConditionalAncestorBeforeStatement(parse2, validationStatement)) {
13660
14112
  return null;
13661
14113
  }
13662
- if (validationStatement.type !== AST_NODE_TYPES53.VariableDeclaration && validationStatement.type !== AST_NODE_TYPES53.ExpressionStatement) {
14114
+ if (validationStatement.type !== AST_NODE_TYPES54.VariableDeclaration && validationStatement.type !== AST_NODE_TYPES54.ExpressionStatement) {
13663
14115
  return null;
13664
14116
  }
13665
14117
  const method = zodParseMethod(parse2);
@@ -13671,16 +14123,16 @@ var require_zod_form_validation_default = createRule({
13671
14123
  };
13672
14124
  const isSafePrevalidationInspection = (identifier) => {
13673
14125
  const parent = identifier.parent;
13674
- if (parent.type === AST_NODE_TYPES53.UnaryExpression && parent.operator === "typeof") {
14126
+ if (parent.type === AST_NODE_TYPES54.UnaryExpression && parent.operator === "typeof") {
13675
14127
  return true;
13676
14128
  }
13677
- if (parent.type !== AST_NODE_TYPES53.BinaryExpression || parent.left !== identifier) {
14129
+ if (parent.type !== AST_NODE_TYPES54.BinaryExpression || parent.left !== identifier) {
13678
14130
  return false;
13679
14131
  }
13680
14132
  if (parent.operator === "instanceof") {
13681
- return parent.right.type === AST_NODE_TYPES53.Identifier && (parent.right.name === "File" || parent.right.name === "Blob");
14133
+ return parent.right.type === AST_NODE_TYPES54.Identifier && (parent.right.name === "File" || parent.right.name === "Blob");
13682
14134
  }
13683
- return ["===", "!==", "==", "!="].includes(parent.operator) && (parent.right.type === AST_NODE_TYPES53.Literal && parent.right.value === null || parent.right.type === AST_NODE_TYPES53.Identifier && parent.right.name === "undefined");
14135
+ return ["===", "!==", "==", "!="].includes(parent.operator) && (parent.right.type === AST_NODE_TYPES54.Literal && parent.right.value === null || parent.right.type === AST_NODE_TYPES54.Identifier && parent.right.name === "undefined");
13684
14136
  };
13685
14137
  const isDescendantOf = (node, ancestor) => {
13686
14138
  let current = node;
@@ -13691,23 +14143,23 @@ var require_zod_form_validation_default = createRule({
13691
14143
  return false;
13692
14144
  };
13693
14145
  const blockTerminates = (node) => {
13694
- if (node.type === AST_NODE_TYPES53.ReturnStatement || node.type === AST_NODE_TYPES53.ThrowStatement) {
14146
+ if (node.type === AST_NODE_TYPES54.ReturnStatement || node.type === AST_NODE_TYPES54.ThrowStatement) {
13695
14147
  return true;
13696
14148
  }
13697
- if (node.type !== AST_NODE_TYPES53.BlockStatement || node.body.length === 0) return false;
14149
+ if (node.type !== AST_NODE_TYPES54.BlockStatement || node.body.length === 0) return false;
13698
14150
  const last = node.body.at(-1);
13699
14151
  return last !== void 0 && blockTerminates(last);
13700
14152
  };
13701
14153
  const narrowingIf = (identifier) => {
13702
14154
  const comparison = identifier.parent;
13703
- if (comparison?.type !== AST_NODE_TYPES53.BinaryExpression || comparison.operator !== "instanceof" || comparison.left !== identifier || comparison.right.type !== AST_NODE_TYPES53.Identifier || comparison.right.name !== "File" && comparison.right.name !== "Blob") {
14155
+ if (comparison?.type !== AST_NODE_TYPES54.BinaryExpression || comparison.operator !== "instanceof" || comparison.left !== identifier || comparison.right.type !== AST_NODE_TYPES54.Identifier || comparison.right.name !== "File" && comparison.right.name !== "Blob") {
13704
14156
  return null;
13705
14157
  }
13706
14158
  const maybeNegation = comparison.parent;
13707
- const negated = maybeNegation?.type === AST_NODE_TYPES53.UnaryExpression && maybeNegation.operator === "!";
14159
+ const negated = maybeNegation?.type === AST_NODE_TYPES54.UnaryExpression && maybeNegation.operator === "!";
13708
14160
  const test = negated ? maybeNegation : comparison;
13709
14161
  const branch = test.parent;
13710
- return branch?.type === AST_NODE_TYPES53.IfStatement && branch.test === test ? { branch, positive: !negated } : null;
14162
+ return branch?.type === AST_NODE_TYPES54.IfStatement && branch.test === test ? { branch, positive: !negated } : null;
13711
14163
  };
13712
14164
  const useDominatedByNarrowing = (use, narrowings) => narrowings.some(({ branch, positive }) => {
13713
14165
  if (positive) return isDescendantOf(use, branch.consequent);
@@ -13727,7 +14179,7 @@ var require_zod_form_validation_default = createRule({
13727
14179
  const variable = context.sourceCode.getDeclaredVariables(declarator)[0];
13728
14180
  if (variable === void 0) return false;
13729
14181
  const references = variable.references.filter((reference) => !reference.isWriteOnly()).map((reference) => reference.identifier).filter(
13730
- (identifier) => identifier.type === AST_NODE_TYPES53.Identifier
14182
+ (identifier) => identifier.type === AST_NODE_TYPES54.Identifier
13731
14183
  );
13732
14184
  if (references.length === 0) return false;
13733
14185
  const narrowings = references.map(narrowingIf).filter(
@@ -13753,7 +14205,7 @@ var require_zod_form_validation_default = createRule({
13753
14205
  ImportDeclaration(node) {
13754
14206
  if (!isZodModule(node.source.value)) return;
13755
14207
  for (const specifier of node.specifiers) {
13756
- if (specifier.type === AST_NODE_TYPES53.ImportNamespaceSpecifier || specifier.type === AST_NODE_TYPES53.ImportDefaultSpecifier || specifier.type === AST_NODE_TYPES53.ImportSpecifier && (specifier.imported.type === AST_NODE_TYPES53.Identifier ? specifier.imported.name === "z" : specifier.imported.value === "z")) {
14208
+ if (specifier.type === AST_NODE_TYPES54.ImportNamespaceSpecifier || specifier.type === AST_NODE_TYPES54.ImportDefaultSpecifier || specifier.type === AST_NODE_TYPES54.ImportSpecifier && (specifier.imported.type === AST_NODE_TYPES54.Identifier ? specifier.imported.name === "z" : specifier.imported.value === "z")) {
13757
14209
  const binding = resolvedBinding(specifier.local);
13758
14210
  if (binding !== null) zodBindings.add(binding);
13759
14211
  }
@@ -13838,7 +14290,7 @@ var store_insert_requires_on_conflict_default = createRule({
13838
14290
  });
13839
14291
 
13840
14292
  // src/rules/stepdown.ts
13841
- import { AST_NODE_TYPES as AST_NODE_TYPES54, ASTUtils as ASTUtils15 } from "@typescript-eslint/utils";
14293
+ import { AST_NODE_TYPES as AST_NODE_TYPES55, ASTUtils as ASTUtils15 } from "@typescript-eslint/utils";
13842
14294
  var stepdownDocumentation = {
13843
14295
  summary: "Place a private helper below its sole direct same-scope caller.",
13844
14296
  rationale: "Caller-first ordering lets a reader follow the main flow before descending into implementation details.",
@@ -13855,7 +14307,7 @@ var stepdownDocumentation = {
13855
14307
  ]
13856
14308
  };
13857
14309
  function isFunction(node) {
13858
- return node.type === AST_NODE_TYPES54.ArrowFunctionExpression || node.type === AST_NODE_TYPES54.FunctionDeclaration || node.type === AST_NODE_TYPES54.FunctionExpression;
14310
+ return node.type === AST_NODE_TYPES55.ArrowFunctionExpression || node.type === AST_NODE_TYPES55.FunctionDeclaration || node.type === AST_NODE_TYPES55.FunctionExpression;
13859
14311
  }
13860
14312
  function reportMisordered(context, candidates, scopeDefinitions, calls, pinned, canMove = () => true) {
13861
14313
  const byName = new Map(scopeDefinitions.map((definition) => [definition.name, definition]));
@@ -13950,8 +14402,8 @@ function moduleScope(context, program) {
13950
14402
  for (const node of declarations) counts.set(node.name, (counts.get(node.name) ?? 0) + 1);
13951
14403
  const overloadNames = new Set(
13952
14404
  program.body.flatMap((statement) => {
13953
- const node = statement.type === AST_NODE_TYPES54.ExportNamedDeclaration ? statement.declaration : statement;
13954
- return node?.type === AST_NODE_TYPES54.TSDeclareFunction && node.id !== null ? [node.id.name] : [];
14405
+ const node = statement.type === AST_NODE_TYPES55.ExportNamedDeclaration ? statement.declaration : statement;
14406
+ return node?.type === AST_NODE_TYPES55.TSDeclareFunction && node.id !== null ? [node.id.name] : [];
13955
14407
  })
13956
14408
  );
13957
14409
  const exported = exportedNames(program);
@@ -13975,7 +14427,7 @@ function moduleScope(context, program) {
13975
14427
  const nearestFunction = [...ancestors].reverse().find(isFunction);
13976
14428
  const parent = identifier.parent;
13977
14429
  const callerDefinition = nearestFunction === void 0 ? void 0 : byFunction.get(nearestFunction);
13978
- if (callerDefinition === void 0 || parent.type !== AST_NODE_TYPES54.CallExpression || parent.callee !== identifier) {
14430
+ if (callerDefinition === void 0 || parent.type !== AST_NODE_TYPES55.CallExpression || parent.callee !== identifier) {
13979
14431
  pinned.add(definition.name);
13980
14432
  continue;
13981
14433
  }
@@ -13990,38 +14442,38 @@ function moduleScope(context, program) {
13990
14442
  function exportedNames(program) {
13991
14443
  const names = /* @__PURE__ */ new Set();
13992
14444
  for (const statement of program.body) {
13993
- if (statement.type !== AST_NODE_TYPES54.ExportNamedDeclaration || statement.exportKind === "type" || statement.source !== null) continue;
13994
- if (statement.declaration?.type === AST_NODE_TYPES54.FunctionDeclaration && statement.declaration.id !== null) {
14445
+ if (statement.type !== AST_NODE_TYPES55.ExportNamedDeclaration || statement.exportKind === "type" || statement.source !== null) continue;
14446
+ if (statement.declaration?.type === AST_NODE_TYPES55.FunctionDeclaration && statement.declaration.id !== null) {
13995
14447
  names.add(statement.declaration.id.name);
13996
14448
  }
13997
- if (statement.declaration?.type === AST_NODE_TYPES54.VariableDeclaration) {
14449
+ if (statement.declaration?.type === AST_NODE_TYPES55.VariableDeclaration) {
13998
14450
  for (const declarator of statement.declaration.declarations) {
13999
- if (declarator.id.type === AST_NODE_TYPES54.Identifier) names.add(declarator.id.name);
14451
+ if (declarator.id.type === AST_NODE_TYPES55.Identifier) names.add(declarator.id.name);
14000
14452
  }
14001
14453
  }
14002
14454
  for (const specifier of statement.specifiers) {
14003
- if (specifier.exportKind !== "type" && specifier.local.type === AST_NODE_TYPES54.Identifier) {
14455
+ if (specifier.exportKind !== "type" && specifier.local.type === AST_NODE_TYPES55.Identifier) {
14004
14456
  names.add(specifier.local.name);
14005
14457
  }
14006
14458
  }
14007
14459
  }
14008
14460
  for (const statement of program.body) {
14009
- if (statement.type === AST_NODE_TYPES54.ExportDefaultDeclaration && statement.declaration.type === AST_NODE_TYPES54.Identifier) names.add(statement.declaration.name);
14010
- if (statement.type === AST_NODE_TYPES54.ExportDefaultDeclaration && statement.declaration.type === AST_NODE_TYPES54.FunctionDeclaration && statement.declaration.id !== null) names.add(statement.declaration.id.name);
14461
+ if (statement.type === AST_NODE_TYPES55.ExportDefaultDeclaration && statement.declaration.type === AST_NODE_TYPES55.Identifier) names.add(statement.declaration.name);
14462
+ if (statement.type === AST_NODE_TYPES55.ExportDefaultDeclaration && statement.declaration.type === AST_NODE_TYPES55.FunctionDeclaration && statement.declaration.id !== null) names.add(statement.declaration.id.name);
14011
14463
  }
14012
14464
  return names;
14013
14465
  }
14014
14466
  function moduleDefinitions(program) {
14015
14467
  const definitions = [];
14016
14468
  for (const statement of program.body) {
14017
- const node = statement.type === AST_NODE_TYPES54.ExportNamedDeclaration || statement.type === AST_NODE_TYPES54.ExportDefaultDeclaration ? statement.declaration : statement;
14018
- if (node?.type === AST_NODE_TYPES54.FunctionDeclaration && node.id !== null && node.body !== null) {
14469
+ const node = statement.type === AST_NODE_TYPES55.ExportNamedDeclaration || statement.type === AST_NODE_TYPES55.ExportDefaultDeclaration ? statement.declaration : statement;
14470
+ if (node?.type === AST_NODE_TYPES55.FunctionDeclaration && node.id !== null && node.body !== null) {
14019
14471
  definitions.push({ name: node.id.name, node, functionNode: node, bindingNode: node });
14020
14472
  continue;
14021
14473
  }
14022
- if (node?.type !== AST_NODE_TYPES54.VariableDeclaration || node.kind !== "const") continue;
14474
+ if (node?.type !== AST_NODE_TYPES55.VariableDeclaration || node.kind !== "const") continue;
14023
14475
  for (const declarator of node.declarations) {
14024
- if (declarator.id.type === AST_NODE_TYPES54.Identifier && declarator.init !== null && isFunction(declarator.init)) {
14476
+ if (declarator.id.type === AST_NODE_TYPES55.Identifier && declarator.init !== null && isFunction(declarator.init)) {
14025
14477
  definitions.push({
14026
14478
  name: declarator.id.name,
14027
14479
  node: declarator,
@@ -14034,21 +14486,21 @@ function moduleDefinitions(program) {
14034
14486
  return definitions;
14035
14487
  }
14036
14488
  function methodName(node) {
14037
- if (node.key.type === AST_NODE_TYPES54.PrivateIdentifier) return `#${node.key.name}`;
14038
- return !node.computed && node.key.type === AST_NODE_TYPES54.Identifier ? node.key.name : null;
14489
+ if (node.key.type === AST_NODE_TYPES55.PrivateIdentifier) return `#${node.key.name}`;
14490
+ return !node.computed && node.key.type === AST_NODE_TYPES55.Identifier ? node.key.name : null;
14039
14491
  }
14040
14492
  function referencedMethod(context, node, classVariables) {
14041
- const objectVariable = node.object.type === AST_NODE_TYPES54.Identifier ? ASTUtils15.findVariable(context.sourceCode.getScope(node.object), node.object.name) : null;
14493
+ const objectVariable = node.object.type === AST_NODE_TYPES55.Identifier ? ASTUtils15.findVariable(context.sourceCode.getScope(node.object), node.object.name) : null;
14042
14494
  const isClassReference = objectVariable !== null && classVariables.has(objectVariable);
14043
- if (node.object.type !== AST_NODE_TYPES54.ThisExpression && !isClassReference) return null;
14044
- if (node.property.type === AST_NODE_TYPES54.PrivateIdentifier) return `#${node.property.name}`;
14045
- if (!node.computed && node.property.type === AST_NODE_TYPES54.Identifier) return node.property.name;
14046
- return node.computed && node.property.type === AST_NODE_TYPES54.Literal && typeof node.property.value === "string" ? node.property.value : null;
14495
+ if (node.object.type !== AST_NODE_TYPES55.ThisExpression && !isClassReference) return null;
14496
+ if (node.property.type === AST_NODE_TYPES55.PrivateIdentifier) return `#${node.property.name}`;
14497
+ if (!node.computed && node.property.type === AST_NODE_TYPES55.Identifier) return node.property.name;
14498
+ return node.computed && node.property.type === AST_NODE_TYPES55.Literal && typeof node.property.value === "string" ? node.property.value : null;
14047
14499
  }
14048
14500
  function referencedPropertyName(node) {
14049
- if (node.property.type === AST_NODE_TYPES54.PrivateIdentifier) return `#${node.property.name}`;
14050
- if (!node.computed && node.property.type === AST_NODE_TYPES54.Identifier) return node.property.name;
14051
- return node.computed && node.property.type === AST_NODE_TYPES54.Literal && typeof node.property.value === "string" ? node.property.value : null;
14501
+ if (node.property.type === AST_NODE_TYPES55.PrivateIdentifier) return `#${node.property.name}`;
14502
+ if (!node.computed && node.property.type === AST_NODE_TYPES55.Identifier) return node.property.name;
14503
+ return node.computed && node.property.type === AST_NODE_TYPES55.Literal && typeof node.property.value === "string" ? node.property.value : null;
14052
14504
  }
14053
14505
  function walk(node, visitorKeys, visit, nestedFunction = false) {
14054
14506
  visit(node, nestedFunction);
@@ -14064,7 +14516,7 @@ function walk(node, visitorKeys, visit, nestedFunction = false) {
14064
14516
  }
14065
14517
  function classScope(context, node, computedReferenceNames) {
14066
14518
  const methods = node.body.body.filter(
14067
- (member) => member.type === AST_NODE_TYPES54.MethodDefinition
14519
+ (member) => member.type === AST_NODE_TYPES55.MethodDefinition
14068
14520
  );
14069
14521
  const counts = /* @__PURE__ */ new Map();
14070
14522
  for (const method of methods) {
@@ -14072,8 +14524,8 @@ function classScope(context, node, computedReferenceNames) {
14072
14524
  if (name !== null) counts.set(name, (counts.get(name) ?? 0) + 1);
14073
14525
  }
14074
14526
  for (const member of node.body.body) {
14075
- if (member.type !== AST_NODE_TYPES54.TSAbstractMethodDefinition) continue;
14076
- const name = !member.computed && member.key.type === AST_NODE_TYPES54.Identifier ? member.key.name : null;
14527
+ if (member.type !== AST_NODE_TYPES55.TSAbstractMethodDefinition) continue;
14528
+ const name = !member.computed && member.key.type === AST_NODE_TYPES55.Identifier ? member.key.name : null;
14077
14529
  if (name !== null) counts.set(name, (counts.get(name) ?? 0) + 1);
14078
14530
  }
14079
14531
  const scopeDefinitions = methods.flatMap((method) => {
@@ -14082,7 +14534,7 @@ function classScope(context, node, computedReferenceNames) {
14082
14534
  });
14083
14535
  const definitions = methods.flatMap((method) => {
14084
14536
  const name = methodName(method);
14085
- const isPrivate = method.accessibility === "private" || method.key.type === AST_NODE_TYPES54.PrivateIdentifier;
14537
+ const isPrivate = method.accessibility === "private" || method.key.type === AST_NODE_TYPES55.PrivateIdentifier;
14086
14538
  return name !== null && isPrivate && counts.get(name) === 1 && method.decorators.length === 0 ? [{ name, node: method }] : [];
14087
14539
  });
14088
14540
  if (definitions.length === 0) return;
@@ -14094,7 +14546,7 @@ function classScope(context, node, computedReferenceNames) {
14094
14546
  const internal = ASTUtils15.findVariable(context.sourceCode.getScope(node), node.id.name);
14095
14547
  if (internal !== null) classVariables.add(internal);
14096
14548
  }
14097
- if (node.type === AST_NODE_TYPES54.ClassExpression && node.parent.type === AST_NODE_TYPES54.VariableDeclarator && node.parent.id.type === AST_NODE_TYPES54.Identifier) {
14549
+ if (node.type === AST_NODE_TYPES55.ClassExpression && node.parent.type === AST_NODE_TYPES55.VariableDeclarator && node.parent.id.type === AST_NODE_TYPES55.Identifier) {
14098
14550
  const outer = ASTUtils15.findVariable(context.sourceCode.getScope(node.parent), node.parent.id.name);
14099
14551
  if (outer !== null) classVariables.add(outer);
14100
14552
  }
@@ -14111,26 +14563,26 @@ function classScope(context, node, computedReferenceNames) {
14111
14563
  }
14112
14564
  const thisValue = (value) => {
14113
14565
  let current = value;
14114
- while (current?.type === AST_NODE_TYPES54.TSAsExpression || current?.type === AST_NODE_TYPES54.TSSatisfiesExpression || current?.type === AST_NODE_TYPES54.TSNonNullExpression) current = current.expression;
14115
- return current?.type === AST_NODE_TYPES54.ThisExpression;
14566
+ while (current?.type === AST_NODE_TYPES55.TSAsExpression || current?.type === AST_NODE_TYPES55.TSSatisfiesExpression || current?.type === AST_NODE_TYPES55.TSNonNullExpression) current = current.expression;
14567
+ return current?.type === AST_NODE_TYPES55.ThisExpression;
14116
14568
  };
14117
14569
  const collectAlias = (current, nestedFunction) => {
14118
- if (nestedFunction || current.type !== AST_NODE_TYPES54.VariableDeclarator && current.type !== AST_NODE_TYPES54.AssignmentPattern) return;
14119
- if (current.type === AST_NODE_TYPES54.VariableDeclarator && (current.parent.type !== AST_NODE_TYPES54.VariableDeclaration || current.parent.kind !== "const")) return;
14120
- const binding = current.type === AST_NODE_TYPES54.VariableDeclarator ? current.id : current.left;
14121
- const value = current.type === AST_NODE_TYPES54.VariableDeclarator ? current.init : current.right;
14570
+ if (nestedFunction || current.type !== AST_NODE_TYPES55.VariableDeclarator && current.type !== AST_NODE_TYPES55.AssignmentPattern) return;
14571
+ if (current.type === AST_NODE_TYPES55.VariableDeclarator && (current.parent.type !== AST_NODE_TYPES55.VariableDeclaration || current.parent.kind !== "const")) return;
14572
+ const binding = current.type === AST_NODE_TYPES55.VariableDeclarator ? current.id : current.left;
14573
+ const value = current.type === AST_NODE_TYPES55.VariableDeclarator ? current.init : current.right;
14122
14574
  if (!thisValue(value)) return;
14123
- if (binding.type === AST_NODE_TYPES54.ObjectPattern) {
14575
+ if (binding.type === AST_NODE_TYPES55.ObjectPattern) {
14124
14576
  for (const property of binding.properties) {
14125
- if (property.type === AST_NODE_TYPES54.RestElement) {
14577
+ if (property.type === AST_NODE_TYPES55.RestElement) {
14126
14578
  for (const name of privateNames) pinned.add(name);
14127
- } else if (property.key.type === AST_NODE_TYPES54.Identifier && privateNames.has(property.key.name)) {
14579
+ } else if (property.key.type === AST_NODE_TYPES55.Identifier && privateNames.has(property.key.name)) {
14128
14580
  pinned.add(property.key.name);
14129
14581
  }
14130
14582
  }
14131
14583
  return;
14132
14584
  }
14133
- if (binding.type !== AST_NODE_TYPES54.Identifier) return;
14585
+ if (binding.type !== AST_NODE_TYPES55.Identifier) return;
14134
14586
  const variable = ASTUtils15.findVariable(context.sourceCode.getScope(binding), binding.name);
14135
14587
  if (variable !== null) {
14136
14588
  methodClassVariables.add(variable);
@@ -14144,16 +14596,16 @@ function classScope(context, node, computedReferenceNames) {
14144
14596
  walk(statement, context.sourceCode.visitorKeys, collectAlias);
14145
14597
  }
14146
14598
  const visitCall = (current, nestedFunction) => {
14147
- if (current.type === AST_NODE_TYPES54.VariableDeclarator && current.id.type === AST_NODE_TYPES54.ObjectPattern && thisValue(current.init)) {
14599
+ if (current.type === AST_NODE_TYPES55.VariableDeclarator && current.id.type === AST_NODE_TYPES55.ObjectPattern && thisValue(current.init)) {
14148
14600
  for (const property of current.id.properties) {
14149
- if (property.type === AST_NODE_TYPES54.RestElement) {
14601
+ if (property.type === AST_NODE_TYPES55.RestElement) {
14150
14602
  for (const name of privateNames) pinned.add(name);
14151
14603
  continue;
14152
14604
  }
14153
- if (property.type === AST_NODE_TYPES54.Property && property.key.type === AST_NODE_TYPES54.Identifier && privateNames.has(property.key.name)) pinned.add(property.key.name);
14605
+ if (property.type === AST_NODE_TYPES55.Property && property.key.type === AST_NODE_TYPES55.Identifier && privateNames.has(property.key.name)) pinned.add(property.key.name);
14154
14606
  }
14155
14607
  }
14156
- if (current.type !== AST_NODE_TYPES54.MemberExpression) return;
14608
+ if (current.type !== AST_NODE_TYPES55.MemberExpression) return;
14157
14609
  const target = referencedMethod(context, current, methodClassVariables);
14158
14610
  if (target === null) {
14159
14611
  const possibleTarget = referencedPropertyName(current);
@@ -14161,12 +14613,12 @@ function classScope(context, node, computedReferenceNames) {
14161
14613
  return;
14162
14614
  }
14163
14615
  if (!privateNames.has(target)) return;
14164
- const objectVariable = current.object.type === AST_NODE_TYPES54.Identifier ? ASTUtils15.findVariable(context.sourceCode.getScope(current.object), current.object.name) : null;
14616
+ const objectVariable = current.object.type === AST_NODE_TYPES55.Identifier ? ASTUtils15.findVariable(context.sourceCode.getScope(current.object), current.object.name) : null;
14165
14617
  if (objectVariable !== null && methodAliases.has(objectVariable)) {
14166
14618
  pinned.add(target);
14167
14619
  return;
14168
14620
  }
14169
- if (current.computed || nestedFunction || parameterDecoratorNodes.has(current) || current.parent.type !== AST_NODE_TYPES54.CallExpression || current.parent.callee !== current) {
14621
+ if (current.computed || nestedFunction || parameterDecoratorNodes.has(current) || current.parent.type !== AST_NODE_TYPES55.CallExpression || current.parent.callee !== current) {
14170
14622
  pinned.add(target);
14171
14623
  return;
14172
14624
  }
@@ -14186,9 +14638,9 @@ function classScope(context, node, computedReferenceNames) {
14186
14638
  }
14187
14639
  }
14188
14640
  for (const member of node.body.body) {
14189
- if (member.type === AST_NODE_TYPES54.MethodDefinition || member.type === AST_NODE_TYPES54.TSAbstractMethodDefinition) continue;
14641
+ if (member.type === AST_NODE_TYPES55.MethodDefinition || member.type === AST_NODE_TYPES55.TSAbstractMethodDefinition) continue;
14190
14642
  walk(member, context.sourceCode.visitorKeys, (current) => {
14191
- if (current.type !== AST_NODE_TYPES54.MemberExpression) return;
14643
+ if (current.type !== AST_NODE_TYPES55.MemberExpression) return;
14192
14644
  const target = referencedMethod(context, current, classVariables);
14193
14645
  const possibleTarget = target ?? referencedPropertyName(current);
14194
14646
  if (possibleTarget !== null && privateNames.has(possibleTarget)) pinned.add(possibleTarget);
@@ -14198,14 +14650,14 @@ function classScope(context, node, computedReferenceNames) {
14198
14650
  const accessibility = new Map(
14199
14651
  scopeDefinitions.map((definition) => {
14200
14652
  const method = definition.node;
14201
- const accessibility2 = method.key.type === AST_NODE_TYPES54.PrivateIdentifier ? "private" : method.accessibility ?? "public";
14653
+ const accessibility2 = method.key.type === AST_NODE_TYPES55.PrivateIdentifier ? "private" : method.accessibility ?? "public";
14202
14654
  return [definition.name, accessibility2];
14203
14655
  })
14204
14656
  );
14205
14657
  const methodByName = new Map(scopeDefinitions.map((definition) => [definition.name, definition.node]));
14206
14658
  for (const [caller, callees] of calls) {
14207
14659
  const callerMethod = methodByName.get(caller);
14208
- if (accessibility.get(caller) === "private" && callerMethod?.type === AST_NODE_TYPES54.MethodDefinition && callerMethod.decorators.length === 0) continue;
14660
+ if (accessibility.get(caller) === "private" && callerMethod?.type === AST_NODE_TYPES55.MethodDefinition && callerMethod.decorators.length === 0) continue;
14209
14661
  for (const callee of callees) pinned.add(callee);
14210
14662
  }
14211
14663
  const memberIndexes = new Map(node.body.body.map((member, index) => [member, index]));
@@ -14222,12 +14674,12 @@ function classScope(context, node, computedReferenceNames) {
14222
14674
  }
14223
14675
  function isClassRuntimeBarrier(member) {
14224
14676
  switch (member.type) {
14225
- case AST_NODE_TYPES54.StaticBlock:
14677
+ case AST_NODE_TYPES55.StaticBlock:
14226
14678
  return true;
14227
- case AST_NODE_TYPES54.PropertyDefinition:
14228
- case AST_NODE_TYPES54.AccessorProperty:
14679
+ case AST_NODE_TYPES55.PropertyDefinition:
14680
+ case AST_NODE_TYPES55.AccessorProperty:
14229
14681
  return member.static || member.computed || member.decorators.length > 0 || member.value !== null;
14230
- case AST_NODE_TYPES54.MethodDefinition:
14682
+ case AST_NODE_TYPES55.MethodDefinition:
14231
14683
  return member.computed || member.decorators.length > 0;
14232
14684
  default:
14233
14685
  return false;
@@ -14259,7 +14711,7 @@ var stepdown_default = createRule({
14259
14711
  moduleScope(context, program);
14260
14712
  const computedReferenceNames = /* @__PURE__ */ new Set();
14261
14713
  walk(program, context.sourceCode.visitorKeys, (node) => {
14262
- if (node.type === AST_NODE_TYPES54.MemberExpression && node.computed && node.property.type === AST_NODE_TYPES54.Literal && typeof node.property.value === "string") computedReferenceNames.add(node.property.value);
14714
+ if (node.type === AST_NODE_TYPES55.MemberExpression && node.computed && node.property.type === AST_NODE_TYPES55.Literal && typeof node.property.value === "string") computedReferenceNames.add(node.property.value);
14263
14715
  });
14264
14716
  for (const node of classes) classScope(context, node, computedReferenceNames);
14265
14717
  }
@@ -14269,7 +14721,7 @@ var stepdown_default = createRule({
14269
14721
 
14270
14722
  // src/rules/zod-naming-convention.ts
14271
14723
  import {
14272
- AST_NODE_TYPES as AST_NODE_TYPES55,
14724
+ AST_NODE_TYPES as AST_NODE_TYPES56,
14273
14725
  ASTUtils as ASTUtils16
14274
14726
  } from "@typescript-eslint/utils";
14275
14727
  var zodNamingConventionDocumentation = {
@@ -14312,18 +14764,18 @@ var NON_SCHEMA_TERMINALS = /* @__PURE__ */ new Set([
14312
14764
  "prettifyError",
14313
14765
  "treeifyError"
14314
14766
  ]);
14315
- var terminalMethodName = (callee) => !callee.computed && callee.property.type === AST_NODE_TYPES55.Identifier ? callee.property.name : null;
14767
+ var terminalMethodName = (callee) => !callee.computed && callee.property.type === AST_NODE_TYPES56.Identifier ? callee.property.name : null;
14316
14768
  var calleeChainRoot = (node) => {
14317
14769
  let current = node;
14318
14770
  for (; ; ) {
14319
- if (current.type === AST_NODE_TYPES55.Identifier) {
14771
+ if (current.type === AST_NODE_TYPES56.Identifier) {
14320
14772
  return current;
14321
14773
  }
14322
- if (current.type === AST_NODE_TYPES55.MemberExpression) {
14774
+ if (current.type === AST_NODE_TYPES56.MemberExpression) {
14323
14775
  current = current.object;
14324
14776
  continue;
14325
14777
  }
14326
- if (current.type === AST_NODE_TYPES55.CallExpression) {
14778
+ if (current.type === AST_NODE_TYPES56.CallExpression) {
14327
14779
  current = current.callee;
14328
14780
  continue;
14329
14781
  }
@@ -14385,7 +14837,7 @@ var zod_naming_convention_default = createRule({
14385
14837
  ImportDeclaration(node) {
14386
14838
  if (!isZodModule(node.source.value)) return;
14387
14839
  for (const specifier of node.specifiers) {
14388
- if (specifier.type === AST_NODE_TYPES55.ImportNamespaceSpecifier || specifier.type === AST_NODE_TYPES55.ImportDefaultSpecifier || specifier.type === AST_NODE_TYPES55.ImportSpecifier && (specifier.imported.type === AST_NODE_TYPES55.Identifier ? specifier.imported.name === "z" : specifier.imported.value === "z")) {
14840
+ if (specifier.type === AST_NODE_TYPES56.ImportNamespaceSpecifier || specifier.type === AST_NODE_TYPES56.ImportDefaultSpecifier || specifier.type === AST_NODE_TYPES56.ImportSpecifier && (specifier.imported.type === AST_NODE_TYPES56.Identifier ? specifier.imported.name === "z" : specifier.imported.value === "z")) {
14389
14841
  recordZodBinding(specifier.local);
14390
14842
  }
14391
14843
  }
@@ -14393,13 +14845,13 @@ var zod_naming_convention_default = createRule({
14393
14845
  VariableDeclarator(node) {
14394
14846
  const init = node.init;
14395
14847
  if (init === null || init === void 0) return;
14396
- if (init.type !== AST_NODE_TYPES55.CallExpression) return;
14848
+ if (init.type !== AST_NODE_TYPES56.CallExpression) return;
14397
14849
  const callee = init.callee;
14398
- if (callee.type !== AST_NODE_TYPES55.MemberExpression) return;
14850
+ if (callee.type !== AST_NODE_TYPES56.MemberExpression) return;
14399
14851
  if (!isZodChain(callee)) return;
14400
14852
  const terminal = terminalMethodName(callee);
14401
14853
  if (terminal !== null && NON_SCHEMA_TERMINALS.has(terminal)) return;
14402
- if (node.id.type !== AST_NODE_TYPES55.Identifier) return;
14854
+ if (node.id.type !== AST_NODE_TYPES56.Identifier) return;
14403
14855
  if (test.test(node.id.name)) return;
14404
14856
  if (acceptsSchemaWord && CONTAINS_SCHEMA_RE.test(node.id.name)) return;
14405
14857
  context.report({
@@ -14543,6 +14995,7 @@ var rules = {
14543
14995
  "prefer-module-level-schema": prefer_module_level_schema_default,
14544
14996
  "prefer-native-random-uuid": prefer_native_random_uuid_default,
14545
14997
  "prefer-non-nullable-collection": prefer_non_nullable_collection_default,
14998
+ "prefer-await-in-async-return": prefer_await_in_async_return_default,
14546
14999
  "prefer-schema-for-api-payload": prefer_schema_for_api_payload_default,
14547
15000
  "prefer-semantic-colors": prefer_semantic_colors_default,
14548
15001
  "prefer-server-actions": prefer_server_actions_default,
@@ -14559,7 +15012,7 @@ var rules = {
14559
15012
  };
14560
15013
  var meta = {
14561
15014
  name: "@sarj/eslint-plugin",
14562
- version: "15.6.1"
15015
+ version: "15.6.3"
14563
15016
  };
14564
15017
  var applicationOnlyRules = [
14565
15018
  "no-restricted-library-load",
@@ -14610,6 +15063,7 @@ var recommendedRules = {
14610
15063
  "@sarj/prefer-module-level-constant": "error",
14611
15064
  "@sarj/prefer-module-level-schema": "error",
14612
15065
  "@sarj/prefer-non-nullable-collection": "error",
15066
+ "@sarj/prefer-await-in-async-return": "error",
14613
15067
  "@sarj/prefer-schema-for-api-payload": "error",
14614
15068
  "@sarj/prefer-semantic-colors": ["error", { requireSemanticTokens: true }],
14615
15069
  "@sarj/prefer-server-actions": "error",
@@ -14672,6 +15126,7 @@ var strictRules = {
14672
15126
  "@sarj/prefer-module-level-constant": "error",
14673
15127
  "@sarj/prefer-module-level-schema": "error",
14674
15128
  "@sarj/prefer-non-nullable-collection": "error",
15129
+ "@sarj/prefer-await-in-async-return": "error",
14675
15130
  "@sarj/prefer-schema-for-api-payload": "error",
14676
15131
  "@sarj/prefer-semantic-colors": ["error", { requireSemanticTokens: true }],
14677
15132
  "@sarj/prefer-server-actions": "error",