@pobammer-ts/eslint-cease-nonsense-rules 1.13.0 → 1.14.1

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
@@ -9071,7 +9071,7 @@ function ConstructorOptions(type) {
9071
9071
  }
9072
9072
 
9073
9073
  // node_modules/typebox/build/type/types/function.mjs
9074
- function Function2(parameters, returnType, options = {}) {
9074
+ function _Function_(parameters, returnType, options = {}) {
9075
9075
  return exports_memory.Create({ ["~kind"]: "Function" }, { type: "function", parameters, returnType }, options);
9076
9076
  }
9077
9077
  function IsFunction3(value) {
@@ -9603,7 +9603,6 @@ function _Object_(properties, options = {}) {
9603
9603
  const required = requiredKeys.length > 0 ? { required: requiredKeys } : {};
9604
9604
  return exports_memory.Create({ "~kind": "Object" }, { type: "object", ...required, properties }, options);
9605
9605
  }
9606
- var Object2 = _Object_;
9607
9606
  function IsObject3(value) {
9608
9607
  return IsKind(value, "Object");
9609
9608
  }
@@ -9641,6 +9640,87 @@ function IsString4(value) {
9641
9640
  return IsKind(value, "String");
9642
9641
  }
9643
9642
 
9643
+ // node_modules/typebox/build/type/types/union.mjs
9644
+ function Union(anyOf, options = {}) {
9645
+ return exports_memory.Create({ "~kind": "Union" }, { anyOf }, options);
9646
+ }
9647
+ function IsUnion(value) {
9648
+ return IsKind(value, "Union");
9649
+ }
9650
+ function UnionOptions(type) {
9651
+ return exports_memory.Discard(type, ["~kind", "anyOf"]);
9652
+ }
9653
+
9654
+ // node_modules/typebox/build/type/engine/patterns/pattern.mjs
9655
+ function ParsePatternIntoTypes(pattern) {
9656
+ const parsed = Pattern(pattern);
9657
+ const result = exports_guard.IsEqual(parsed.length, 2) ? parsed[0] : [];
9658
+ return result;
9659
+ }
9660
+
9661
+ // node_modules/typebox/build/type/engine/template-literal/finite.mjs
9662
+ function FromLiteral(value) {
9663
+ return true;
9664
+ }
9665
+ function FromTypesReduce(types) {
9666
+ const [left, ...right] = types;
9667
+ return IsSchema(left) ? FromType2(left) ? FromTypesReduce(right) : false : true;
9668
+ }
9669
+ function FromTypes(types) {
9670
+ const result = exports_guard.IsEqual(types.length, 0) ? false : FromTypesReduce(types);
9671
+ return result;
9672
+ }
9673
+ function FromType2(type) {
9674
+ return IsUnion(type) ? FromTypes(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : false;
9675
+ }
9676
+ function TemplateLiteralFinite(types) {
9677
+ const result = FromTypes(types);
9678
+ return result;
9679
+ }
9680
+
9681
+ // node_modules/typebox/build/type/engine/template-literal/create.mjs
9682
+ function TemplateLiteralCreate(pattern) {
9683
+ return exports_memory.Create({ ["~kind"]: "TemplateLiteral" }, { type: "string", pattern }, {});
9684
+ }
9685
+
9686
+ // node_modules/typebox/build/type/engine/template-literal/decode.mjs
9687
+ function FromLiteralPush(variants, value, result = []) {
9688
+ const [left, ...right] = variants;
9689
+ return exports_guard.IsString(left) ? FromLiteralPush(right, value, [...result, `${left}${value}`]) : result;
9690
+ }
9691
+ function FromLiteral2(variants, value) {
9692
+ return exports_guard.IsEqual(variants.length, 0) ? [`${value}`] : FromLiteralPush(variants, value);
9693
+ }
9694
+ function FromUnion(variants, types, result = []) {
9695
+ const [left, ...right] = types;
9696
+ return IsSchema(left) ? FromUnion(variants, right, [...result, ...FromType3(variants, left)]) : result;
9697
+ }
9698
+ function FromType3(variants, type) {
9699
+ const result = IsUnion(type) ? FromUnion(variants, type.anyOf) : IsLiteral(type) ? FromLiteral2(variants, type.const) : Unreachable();
9700
+ return result;
9701
+ }
9702
+ function DecodeFromSpan(variants, types) {
9703
+ const [left, ...right] = types;
9704
+ return IsSchema(left) ? DecodeFromSpan(FromType3(variants, left), right) : variants;
9705
+ }
9706
+ function VariantsToLiterals(variants) {
9707
+ return variants.map((variant) => Literal(variant));
9708
+ }
9709
+ function DecodeTypesAsUnion(types) {
9710
+ const variants = DecodeFromSpan([], types);
9711
+ const literals = VariantsToLiterals(variants);
9712
+ const result = Union(literals);
9713
+ return result;
9714
+ }
9715
+ function DecodeTypes(types) {
9716
+ return exports_guard.IsEqual(types.length, 0) ? Unreachable() : exports_guard.IsEqual(types.length, 1) && IsLiteral(types[0]) ? types[0] : DecodeTypesAsUnion(types);
9717
+ }
9718
+ function TemplateLiteralDecode(pattern) {
9719
+ const types = ParsePatternIntoTypes(pattern);
9720
+ const result = exports_guard.IsEqual(types.length, 0) ? String2() : TemplateLiteralFinite(types) ? DecodeTypes(types) : TemplateLiteralCreate(pattern);
9721
+ return result;
9722
+ }
9723
+
9644
9724
  // node_modules/typebox/build/type/engine/record/record-create.mjs
9645
9725
  function CreateRecord(key, value) {
9646
9726
  const type = "object";
@@ -9669,7 +9749,7 @@ function RecordPattern(type) {
9669
9749
  }
9670
9750
  function RecordKey(type) {
9671
9751
  const pattern = RecordPattern(type);
9672
- const result = exports_guard.IsEqual(pattern, IntegerKey) ? Integer() : exports_guard.IsEqual(pattern, NumberKey) ? Number2() : String2();
9752
+ const result = exports_guard.IsEqual(pattern, StringKey) ? String2() : exports_guard.IsEqual(pattern, IntegerKey) ? Integer() : exports_guard.IsEqual(pattern, NumberKey) ? Number2() : TemplateLiteralDecode(pattern);
9673
9753
  return result;
9674
9754
  }
9675
9755
  function RecordValue(type) {
@@ -9710,16 +9790,6 @@ function Undefined(options) {
9710
9790
  function IsUndefined3(value) {
9711
9791
  return IsKind(value, "Undefined");
9712
9792
  }
9713
- // node_modules/typebox/build/type/types/union.mjs
9714
- function Union(anyOf, options = {}) {
9715
- return exports_memory.Create({ "~kind": "Union" }, { anyOf }, options);
9716
- }
9717
- function IsUnion(value) {
9718
- return IsKind(value, "Union");
9719
- }
9720
- function UnionOptions(type) {
9721
- return exports_memory.Discard(type, ["~kind", "anyOf"]);
9722
- }
9723
9793
  // node_modules/typebox/build/type/types/unsafe.mjs
9724
9794
  function Unsafe(schema) {
9725
9795
  return exports_memory.Create({ ["~kind"]: "Unsafe" }, {}, schema);
@@ -9811,7 +9881,7 @@ function KeywordAnyMapping(input) {
9811
9881
  return Any();
9812
9882
  }
9813
9883
  function KeywordObjectMapping(input) {
9814
- return Object2({});
9884
+ return _Object_({});
9815
9885
  }
9816
9886
  function KeywordNeverMapping(input) {
9817
9887
  return Never();
@@ -9972,7 +10042,7 @@ function PropertiesMapping(input) {
9972
10042
  function _Object_Mapping(input) {
9973
10043
  const [properties2, patternProperties] = input;
9974
10044
  const options = exports_guard.IsEqual(exports_guard.Keys(patternProperties).length, 0) ? {} : { patternProperties };
9975
- return Object2(properties2, options);
10045
+ return _Object_(properties2, options);
9976
10046
  }
9977
10047
  function ElementNamedMapping(input) {
9978
10048
  return exports_guard.IsEqual(input.length, 5) ? ReadonlyAdd(OptionalAdd(input[4])) : exports_guard.IsEqual(input.length, 3) ? input[2] : exports_guard.IsEqual(input.length, 4) ? exports_guard.IsEqual(input[2], "readonly") ? ReadonlyAdd(input[3]) : OptionalAdd(input[3]) : Unreachable2();
@@ -10020,7 +10090,7 @@ function ParameterListMapping(input) {
10020
10090
  return Delimited(input);
10021
10091
  }
10022
10092
  function _Function_Mapping(input) {
10023
- return Function2(input[1], input[4]);
10093
+ return _Function_(input[1], input[4]);
10024
10094
  }
10025
10095
  function ConstructorMapping(input) {
10026
10096
  return Constructor(input[2], input[5]);
@@ -10439,7 +10509,7 @@ var KeyOf = (input) => If2(If2(If2(Const("keyof", input), ([_0, input2]) => [[_0
10439
10509
  var IndexArray_0 = (input, result = []) => If2(If2(If2(Const("[", input), ([_0, input2]) => If2(Type(input2), ([_1, input3]) => If2(Const("]", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If2(If2(Const("[", input), ([_0, input2]) => If2(Const("]", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => IndexArray_0(input2, [...result, _0]), () => [result, input]);
10440
10510
  var IndexArray = (input) => If2(IndexArray_0(input), ([_0, input2]) => [IndexArrayMapping(_0), input2]);
10441
10511
  var Extends = (input) => If2(If2(If2(Const("extends", input), ([_0, input2]) => If2(Type(input2), ([_1, input3]) => If2(Const("?", input3), ([_2, input4]) => If2(Type(input4), ([_3, input5]) => If2(Const(":", input5), ([_4, input6]) => If2(Type(input6), ([_5, input7]) => [[_0, _1, _2, _3, _4, _5], input7])))))), ([_0, input2]) => [_0, input2], () => If2([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ExtendsMapping(_0), input2]);
10442
- var Base2 = (input) => If2(If2(If2(Const("(", input), ([_0, input2]) => If2(Type(input2), ([_1, input3]) => If2(Const(")", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If2(Keyword(input), ([_0, input2]) => [_0, input2], () => If2(_Object_2(input), ([_0, input2]) => [_0, input2], () => If2(Tuple2(input), ([_0, input2]) => [_0, input2], () => If2(TemplateLiteral(input), ([_0, input2]) => [_0, input2], () => If2(Literal2(input), ([_0, input2]) => [_0, input2], () => If2(Constructor2(input), ([_0, input2]) => [_0, input2], () => If2(_Function_(input), ([_0, input2]) => [_0, input2], () => If2(Mapped(input), ([_0, input2]) => [_0, input2], () => If2(Options(input), ([_0, input2]) => [_0, input2], () => If2(GenericCall(input), ([_0, input2]) => [_0, input2], () => If2(Reference(input), ([_0, input2]) => [_0, input2], () => [])))))))))))), ([_0, input2]) => [BaseMapping(_0), input2]);
10512
+ var Base2 = (input) => If2(If2(If2(Const("(", input), ([_0, input2]) => If2(Type(input2), ([_1, input3]) => If2(Const(")", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If2(Keyword(input), ([_0, input2]) => [_0, input2], () => If2(_Object_2(input), ([_0, input2]) => [_0, input2], () => If2(Tuple2(input), ([_0, input2]) => [_0, input2], () => If2(TemplateLiteral(input), ([_0, input2]) => [_0, input2], () => If2(Literal2(input), ([_0, input2]) => [_0, input2], () => If2(Constructor2(input), ([_0, input2]) => [_0, input2], () => If2(_Function_2(input), ([_0, input2]) => [_0, input2], () => If2(Mapped(input), ([_0, input2]) => [_0, input2], () => If2(Options(input), ([_0, input2]) => [_0, input2], () => If2(GenericCall(input), ([_0, input2]) => [_0, input2], () => If2(Reference(input), ([_0, input2]) => [_0, input2], () => [])))))))))))), ([_0, input2]) => [BaseMapping(_0), input2]);
10443
10513
  var Factor = (input) => If2(If2(KeyOf(input), ([_0, input2]) => If2(Base2(input2), ([_1, input3]) => If2(IndexArray(input3), ([_2, input4]) => If2(Extends(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [FactorMapping(_0), input2]);
10444
10514
  var ExprTermTail = (input) => If2(If2(If2(Const("&", input), ([_0, input2]) => If2(Factor(input2), ([_1, input3]) => If2(ExprTermTail(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If2([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ExprTermTailMapping(_0), input2]);
10445
10515
  var ExprTerm = (input) => If2(If2(Factor(input), ([_0, input2]) => If2(ExprTermTail(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ExprTermMapping(_0), input2]);
@@ -10483,7 +10553,7 @@ var ParameterBase = (input) => If2(If2(ParameterReadonlyOptional(input), ([_0, i
10483
10553
  var Parameter2 = (input) => If2(If2(If2(Const("...", input), ([_0, input2]) => If2(ParameterBase(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If2(If2(ParameterBase(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ParameterMapping(_0), input2]);
10484
10554
  var ParameterList_0 = (input, result = []) => If2(If2(Parameter2(input), ([_0, input2]) => If2(Const(",", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => ParameterList_0(input2, [...result, _0]), () => [result, input]);
10485
10555
  var ParameterList = (input) => If2(If2(ParameterList_0(input), ([_0, input2]) => If2(If2(If2(Parameter2(input2), ([_02, input3]) => [[_02], input3]), ([_02, input3]) => [_02, input3], () => If2([[], input2], ([_02, input3]) => [_02, input3], () => [])), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ParameterListMapping(_0), input2]);
10486
- var _Function_ = (input) => If2(If2(Const("(", input), ([_0, input2]) => If2(ParameterList(input2), ([_1, input3]) => If2(Const(")", input3), ([_2, input4]) => If2(Const("=>", input4), ([_3, input5]) => If2(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [_Function_Mapping(_0), input2]);
10556
+ var _Function_2 = (input) => If2(If2(Const("(", input), ([_0, input2]) => If2(ParameterList(input2), ([_1, input3]) => If2(Const(")", input3), ([_2, input4]) => If2(Const("=>", input4), ([_3, input5]) => If2(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [_Function_Mapping(_0), input2]);
10487
10557
  var Constructor2 = (input) => If2(If2(Const("new", input), ([_0, input2]) => If2(Const("(", input2), ([_1, input3]) => If2(ParameterList(input3), ([_2, input4]) => If2(Const(")", input4), ([_3, input5]) => If2(Const("=>", input5), ([_4, input6]) => If2(Type(input6), ([_5, input7]) => [[_0, _1, _2, _3, _4, _5], input7])))))), ([_0, input2]) => [ConstructorMapping(_0), input2]);
10488
10558
  var MappedReadonly = (input) => If2(If2(If2(Const("+", input), ([_0, input2]) => If2(Const("readonly", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If2(If2(Const("-", input), ([_0, input2]) => If2(Const("readonly", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If2(If2(Const("readonly", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If2([[], input], ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [MappedReadonlyMapping(_0), input2]);
10489
10559
  var MappedOptional = (input) => If2(If2(If2(Const("+", input), ([_0, input2]) => If2(Const("?", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If2(If2(Const("-", input), ([_0, input2]) => If2(Const("?", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If2(If2(Const("?", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If2([[], input], ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [MappedOptionalMapping(_0), input2]);
@@ -10591,72 +10661,6 @@ function IsExtendsTrueLike(value) {
10591
10661
  return IsExtendsUnion(value) || IsExtendsTrue(value);
10592
10662
  }
10593
10663
 
10594
- // node_modules/typebox/build/type/engine/patterns/pattern.mjs
10595
- function ParsePatternIntoTypes(pattern) {
10596
- const parsed = Pattern(pattern);
10597
- const result = exports_guard.IsEqual(parsed.length, 2) ? parsed[0] : Unreachable();
10598
- return result;
10599
- }
10600
-
10601
- // node_modules/typebox/build/type/engine/template-literal/finite.mjs
10602
- function FromLiteral(value) {
10603
- return true;
10604
- }
10605
- function FromTypesReduce(types) {
10606
- const [left, ...right] = types;
10607
- return IsSchema(left) ? FromType2(left) ? FromTypesReduce(right) : false : true;
10608
- }
10609
- function FromTypes(types) {
10610
- const result = exports_guard.IsEqual(types.length, 0) ? false : FromTypesReduce(types);
10611
- return result;
10612
- }
10613
- function FromType2(type) {
10614
- return IsUnion(type) ? FromTypes(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : false;
10615
- }
10616
- function TemplateLiteralFinite(types) {
10617
- const result = FromTypes(types);
10618
- return result;
10619
- }
10620
-
10621
- // node_modules/typebox/build/type/engine/template-literal/decode.mjs
10622
- function FromLiteralPush(variants, value, result = []) {
10623
- const [left, ...right] = variants;
10624
- return exports_guard.IsString(left) ? FromLiteralPush(right, value, [...result, `${left}${value}`]) : result;
10625
- }
10626
- function FromLiteral2(variants, value) {
10627
- return exports_guard.IsEqual(variants.length, 0) ? [`${value}`] : FromLiteralPush(variants, value);
10628
- }
10629
- function FromUnion(variants, types, result = []) {
10630
- const [left, ...right] = types;
10631
- return IsSchema(left) ? FromUnion(variants, right, [...result, ...FromType3(variants, left)]) : result;
10632
- }
10633
- function FromType3(variants, type) {
10634
- const result = IsUnion(type) ? FromUnion(variants, type.anyOf) : IsLiteral(type) ? FromLiteral2(variants, type.const) : Unreachable();
10635
- return result;
10636
- }
10637
- function DecodeFromSpan(variants, types) {
10638
- const [left, ...right] = types;
10639
- return IsSchema(left) ? DecodeFromSpan(FromType3(variants, left), right) : variants;
10640
- }
10641
- function VariantsToLiterals(variants) {
10642
- return variants.map((variant) => Literal(variant));
10643
- }
10644
- function DecodeTypesAsUnion(types) {
10645
- const variants = DecodeFromSpan([], types);
10646
- const literals = VariantsToLiterals(variants);
10647
- const result = Union(literals);
10648
- return result;
10649
- }
10650
- function DecodeTypes(types) {
10651
- return exports_guard.IsEqual(types.length, 0) ? Unreachable() : exports_guard.IsEqual(types.length, 1) && IsLiteral(types[0]) ? types[0] : DecodeTypesAsUnion(types);
10652
- }
10653
- function TemplateLiteralDecode(pattern) {
10654
- const types = ParsePatternIntoTypes(pattern);
10655
- const finite = TemplateLiteralFinite(types);
10656
- const result = finite ? DecodeTypes(types) : String2();
10657
- return result;
10658
- }
10659
-
10660
10664
  // node_modules/typebox/build/type/engine/enum/enum-to-union.mjs
10661
10665
  function FromEnumValue(value) {
10662
10666
  return exports_guard.IsString(value) || exports_guard.IsNumber(value) ? Literal(value) : exports_guard.IsNull(value) ? Null() : Never();
@@ -10823,7 +10827,7 @@ function TupleElementsToProperties(types) {
10823
10827
  }
10824
10828
  function TupleToObject(type) {
10825
10829
  const properties2 = TupleElementsToProperties(type.items);
10826
- const result = Object2(properties2);
10830
+ const result = _Object_(properties2);
10827
10831
  return result;
10828
10832
  }
10829
10833
 
@@ -10858,7 +10862,7 @@ function Composite(left, right) {
10858
10862
  const leftProperties = GetProperties(left);
10859
10863
  const rightProperties = GetProperties(right);
10860
10864
  const properties2 = CompositeProperties(leftProperties, rightProperties);
10861
- return Object2(properties2);
10865
+ return _Object_(properties2);
10862
10866
  }
10863
10867
 
10864
10868
  // node_modules/typebox/build/type/engine/evaluate/narrow.mjs
@@ -10868,18 +10872,22 @@ function Narrow(left, right) {
10868
10872
  }
10869
10873
 
10870
10874
  // node_modules/typebox/build/type/engine/evaluate/distribute.mjs
10871
- function CanDistribute(type) {
10875
+ function IsObjectLike(type) {
10872
10876
  return IsObject3(type) || IsTuple(type);
10873
10877
  }
10874
- function DistributeNormalize(type) {
10875
- return IsIntersect(type) ? EvaluateIntersect(type.allOf) : type;
10878
+ function IsUnionOperand(left, right) {
10879
+ const isUnionLeft = IsUnion(left);
10880
+ const isUnionRight = IsUnion(right);
10881
+ const result = isUnionLeft || isUnionRight;
10882
+ return result;
10876
10883
  }
10877
10884
  function DistributeOperation(left, right) {
10878
- const normalLeft = DistributeNormalize(left);
10879
- const normalRight = DistributeNormalize(right);
10880
- const isObjectLeft = CanDistribute(normalLeft);
10881
- const IsObjectRight = CanDistribute(normalRight);
10882
- const result = isObjectLeft && IsObjectRight ? Composite(EvaluateType(normalLeft), normalRight) : isObjectLeft && !IsObjectRight ? EvaluateType(normalLeft) : !isObjectLeft && IsObjectRight ? normalRight : Narrow(EvaluateType(normalLeft), normalRight);
10885
+ const evaluatedLeft = EvaluateType(left);
10886
+ const evaluatedRight = EvaluateType(right);
10887
+ const isUnionOperand = IsUnionOperand(evaluatedLeft, evaluatedRight);
10888
+ const isObjectLeft = IsObjectLike(evaluatedLeft);
10889
+ const IsObjectRight = IsObjectLike(evaluatedRight);
10890
+ const result = isUnionOperand ? EvaluateIntersect([evaluatedLeft, evaluatedRight]) : isObjectLeft && IsObjectRight ? Composite(evaluatedLeft, evaluatedRight) : isObjectLeft && !IsObjectRight ? evaluatedLeft : !isObjectLeft && IsObjectRight ? evaluatedRight : Narrow(evaluatedLeft, evaluatedRight);
10883
10891
  return result;
10884
10892
  }
10885
10893
  function DistributeType(type, types, result = []) {
@@ -11026,7 +11034,7 @@ function ExtendsObjectToObject(inferred, left, right) {
11026
11034
  return ExtendsProperties(inferred, left, right);
11027
11035
  }
11028
11036
  function ExtendsObject(inferred, left, right) {
11029
- return IsObject3(right) ? ExtendsObjectToObject(inferred, left, right.properties) : ExtendsRight(inferred, Object2(left), right);
11037
+ return IsObject3(right) ? ExtendsObjectToObject(inferred, left, right.properties) : ExtendsRight(inferred, _Object_(left), right);
11030
11038
  }
11031
11039
 
11032
11040
  // node_modules/typebox/build/type/extends/promise.mjs
@@ -11246,7 +11254,7 @@ function FromTypes4(types) {
11246
11254
  }, []);
11247
11255
  }
11248
11256
  function FromType6(type) {
11249
- return IsRef(type) ? FromRef4(type.$ref) : IsArray3(type) ? Array2(FromType6(type.items), ArrayOptions(type)) : IsAsyncIterator3(type) ? AsyncIterator(FromType6(type.iteratorItems)) : IsConstructor3(type) ? Constructor(FromTypes4(type.parameters), FromType6(type.instanceType)) : IsFunction3(type) ? Function2(FromTypes4(type.parameters), FromType6(type.returnType)) : IsIntersect(type) ? Intersect(FromTypes4(type.allOf)) : IsIterator3(type) ? Iterator(FromType6(type.iteratorItems)) : IsObject3(type) ? Object2(FromProperties3(type.properties)) : IsPromise(type) ? Promise2(FromType6(type.item)) : IsRecord(type) ? Record(RecordKey(type), FromType6(RecordValue(type))) : IsUnion(type) ? Union(FromTypes4(type.anyOf)) : IsTuple(type) ? Tuple(FromTypes4(type.items)) : type;
11257
+ return IsRef(type) ? FromRef4(type.$ref) : IsArray3(type) ? Array2(FromType6(type.items), ArrayOptions(type)) : IsAsyncIterator3(type) ? AsyncIterator(FromType6(type.iteratorItems)) : IsConstructor3(type) ? Constructor(FromTypes4(type.parameters), FromType6(type.instanceType)) : IsFunction3(type) ? _Function_(FromTypes4(type.parameters), FromType6(type.returnType)) : IsIntersect(type) ? Intersect(FromTypes4(type.allOf)) : IsIterator3(type) ? Iterator(FromType6(type.iteratorItems)) : IsObject3(type) ? _Object_(FromProperties3(type.properties)) : IsPromise(type) ? Promise2(FromType6(type.item)) : IsRecord(type) ? Record(RecordKey(type), FromType6(RecordValue(type))) : IsUnion(type) ? Union(FromTypes4(type.anyOf)) : IsTuple(type) ? Tuple(FromTypes4(type.items)) : type;
11250
11258
  }
11251
11259
  function CyclicAnyFromParameters(defs, ref2) {
11252
11260
  return ref2 in defs ? FromType6(defs[ref2]) : Unknown();
@@ -11258,7 +11266,7 @@ function CyclicExtends(type) {
11258
11266
  function CyclicInterface(context, heritage, properties2) {
11259
11267
  const instantiatedHeritage = InstantiateTypes(context, { callstack: [] }, heritage);
11260
11268
  const instantiatedProperties = InstantiateProperties({}, { callstack: [] }, properties2);
11261
- const evaluatedInterface = EvaluateIntersect([...instantiatedHeritage, Object2(instantiatedProperties)]);
11269
+ const evaluatedInterface = EvaluateIntersect([...instantiatedHeritage, _Object_(instantiatedProperties)]);
11262
11270
  return evaluatedInterface;
11263
11271
  }
11264
11272
  function CyclicDefinitions(context, dependencies) {
@@ -11769,7 +11777,7 @@ function FromType9(type) {
11769
11777
  // node_modules/typebox/build/type/engine/object/collapse.mjs
11770
11778
  function CollapseToObject(type) {
11771
11779
  const properties2 = FromType9(type);
11772
- const result = Object2(properties2);
11780
+ const result = _Object_(properties2);
11773
11781
  return result;
11774
11782
  }
11775
11783
  // node_modules/typebox/build/type/engine/indexed/instantiate.mjs
@@ -11814,7 +11822,7 @@ function InstanceTypeInstantiate(context, state, type, options = {}) {
11814
11822
  function InterfaceImmediate(context, state, heritage, properties2, options) {
11815
11823
  const instantiatedHeritage = InstantiateTypes(context, { callstack: [] }, heritage);
11816
11824
  const instantiatedProperties = InstantiateProperties(context, { callstack: [] }, properties2);
11817
- const evaluatedInterface = EvaluateIntersect([...instantiatedHeritage, Object2(instantiatedProperties)]);
11825
+ const evaluatedInterface = EvaluateIntersect([...instantiatedHeritage, _Object_(instantiatedProperties)]);
11818
11826
  return exports_memory.Update(evaluatedInterface, {}, options);
11819
11827
  }
11820
11828
  function InterfaceInstantiate(context, state, heritage, properties2, options) {
@@ -11934,7 +11942,7 @@ function MappedProperties(context, state, identifier2, keys, as, type) {
11934
11942
  function MappedAction(context, state, identifier2, key, as, type) {
11935
11943
  const keys = MappedKeys(key);
11936
11944
  const mapped = MappedProperties(context, state, identifier2, keys, as, type);
11937
- const result = Object2(mapped);
11945
+ const result = _Object_(mapped);
11938
11946
  return result;
11939
11947
  }
11940
11948
  function MappedImmediate(context, state, identifier2, key, as, property, options) {
@@ -12019,7 +12027,7 @@ function OmitAction(type, indexer) {
12019
12027
  const indexable = ToIndexable(type);
12020
12028
  const indexableKeys = ToIndexableKeys(indexer);
12021
12029
  const omitted = FromKeys(indexable, indexableKeys);
12022
- const result = Object2(omitted);
12030
+ const result = _Object_(omitted);
12023
12031
  return result;
12024
12032
  }
12025
12033
  function OmitImmediate(context, state, type, indexer, options) {
@@ -12101,13 +12109,13 @@ function FromObject6(properties2) {
12101
12109
  const mapped = exports_guard.Keys(properties2).reduce((result2, left) => {
12102
12110
  return { ...result2, [left]: Optional(properties2[left]) };
12103
12111
  }, {});
12104
- const result = Object2(mapped);
12112
+ const result = _Object_(mapped);
12105
12113
  return result;
12106
12114
  }
12107
12115
 
12108
12116
  // node_modules/typebox/build/type/engine/partial/from-type.mjs
12109
12117
  function FromType11(type) {
12110
- return IsCyclic(type) ? FromCyclic3(type.$defs, type.$ref) : IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion6(type.anyOf) : IsObject3(type) ? FromObject6(type.properties) : Object2({});
12118
+ return IsCyclic(type) ? FromCyclic3(type.$defs, type.$ref) : IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion6(type.anyOf) : IsObject3(type) ? FromObject6(type.properties) : _Object_({});
12111
12119
  }
12112
12120
 
12113
12121
  // node_modules/typebox/build/type/engine/partial/instantiate.mjs
@@ -12139,7 +12147,7 @@ function PickAction(type, indexer) {
12139
12147
  const indexable = ToIndexable(type);
12140
12148
  const keys = ToIndexableKeys(indexer);
12141
12149
  const applied = FromKeys2(indexable, keys);
12142
- const result = Object2(applied);
12150
+ const result = _Object_(applied);
12143
12151
  return result;
12144
12152
  }
12145
12153
  function PickImmediate(context, state, type, indexer, options) {
@@ -12184,7 +12192,7 @@ function FromObject7(properties2) {
12184
12192
  const mapped = exports_guard.Keys(properties2).reduce((result2, left) => {
12185
12193
  return { ...result2, [left]: Readonly(properties2[left]) };
12186
12194
  }, {});
12187
- const result = Object2(mapped);
12195
+ const result = _Object_(mapped);
12188
12196
  return result;
12189
12197
  }
12190
12198
 
@@ -12221,7 +12229,7 @@ function FromAnyKey(value) {
12221
12229
 
12222
12230
  // node_modules/typebox/build/type/engine/record/from-key-boolean.mjs
12223
12231
  function FromBooleanKey(value) {
12224
- return Object2({ true: value, false: value });
12232
+ return _Object_({ true: value, false: value });
12225
12233
  }
12226
12234
 
12227
12235
  // node_modules/typebox/build/type/engine/record/from-key-enum.mjs
@@ -12246,7 +12254,7 @@ function FromIntersectKey(types, value) {
12246
12254
 
12247
12255
  // node_modules/typebox/build/type/engine/record/from-key-literal.mjs
12248
12256
  function FromLiteralKey(key, value) {
12249
- return exports_guard.IsString(key) || exports_guard.IsNumber(key) ? Object2({ [key]: value }) : exports_guard.IsEqual(key, false) ? Object2({ false: value }) : exports_guard.IsEqual(key, true) ? Object2({ true: value }) : Object2({});
12257
+ return exports_guard.IsString(key) || exports_guard.IsNumber(key) ? _Object_({ [key]: value }) : exports_guard.IsEqual(key, false) ? _Object_({ false: value }) : exports_guard.IsEqual(key, true) ? _Object_({ true: value }) : _Object_({});
12250
12258
  }
12251
12259
 
12252
12260
  // node_modules/typebox/build/type/engine/record/from-key-number.mjs
@@ -12282,7 +12290,7 @@ function CreateProperties(types, value) {
12282
12290
  }
12283
12291
  function CreateObject(types, value) {
12284
12292
  const properties2 = CreateProperties(types, value);
12285
- const result = Object2(properties2);
12293
+ const result = _Object_(properties2);
12286
12294
  return result;
12287
12295
  }
12288
12296
  function FromUnionKey(types, value) {
@@ -12293,7 +12301,7 @@ function FromUnionKey(types, value) {
12293
12301
 
12294
12302
  // node_modules/typebox/build/type/engine/record/from-key.mjs
12295
12303
  function FromKey(key, value) {
12296
- const result = IsAny(key) ? FromAnyKey(value) : IsBoolean4(key) ? FromBooleanKey(value) : IsEnum(key) ? FromEnumKey(key.enum, value) : IsInteger3(key) ? FromIntegerKey(key, value) : IsIntersect(key) ? FromIntersectKey(key.allOf, value) : IsLiteral(key) ? FromLiteralKey(key.const, value) : IsNumber4(key) ? FromNumberKey(key, value) : IsUnion(key) ? FromUnionKey(key.anyOf, value) : IsString4(key) ? FromStringKey(key, value) : IsTemplateLiteral(key) ? FromTemplateKey(key.pattern, value) : Object2({});
12304
+ const result = IsAny(key) ? FromAnyKey(value) : IsBoolean4(key) ? FromBooleanKey(value) : IsEnum(key) ? FromEnumKey(key.enum, value) : IsInteger3(key) ? FromIntegerKey(key, value) : IsIntersect(key) ? FromIntersectKey(key.allOf, value) : IsLiteral(key) ? FromLiteralKey(key.const, value) : IsNumber4(key) ? FromNumberKey(key, value) : IsUnion(key) ? FromUnionKey(key.anyOf, value) : IsString4(key) ? FromStringKey(key, value) : IsTemplateLiteral(key) ? FromTemplateKey(key.pattern, value) : _Object_({});
12297
12305
  return result;
12298
12306
  }
12299
12307
 
@@ -12337,13 +12345,13 @@ function FromObject8(properties2) {
12337
12345
  const mapped = exports_guard.Keys(properties2).reduce((result2, left) => {
12338
12346
  return { ...result2, [left]: OptionalRemove(properties2[left]) };
12339
12347
  }, {});
12340
- const result = Object2(mapped);
12348
+ const result = _Object_(mapped);
12341
12349
  return result;
12342
12350
  }
12343
12351
 
12344
12352
  // node_modules/typebox/build/type/engine/required/from-type.mjs
12345
12353
  function FromType13(type) {
12346
- return IsCyclic(type) ? FromCyclic5(type.$defs, type.$ref) : IsIntersect(type) ? FromIntersect5(type.allOf) : IsUnion(type) ? FromUnion8(type.anyOf) : IsObject3(type) ? FromObject8(type.properties) : Object2({});
12354
+ return IsCyclic(type) ? FromCyclic5(type.$defs, type.$ref) : IsIntersect(type) ? FromIntersect5(type.allOf) : IsUnion(type) ? FromUnion8(type.anyOf) : IsObject3(type) ? FromObject8(type.properties) : _Object_({});
12347
12355
  }
12348
12356
 
12349
12357
  // node_modules/typebox/build/type/action/required.mjs
@@ -12383,11 +12391,6 @@ function ReturnTypeInstantiate(context, state, type, options) {
12383
12391
  return CanInstantiate(context, [type]) ? ReturnTypeImmediate(context, state, type, options) : ReturnTypeDeferred(type, options);
12384
12392
  }
12385
12393
 
12386
- // node_modules/typebox/build/type/engine/template-literal/create.mjs
12387
- function TemplateLiteralCreate(pattern) {
12388
- return exports_memory.Create({ ["~kind"]: "TemplateLiteral" }, { type: "string", pattern }, {});
12389
- }
12390
-
12391
12394
  // node_modules/typebox/build/type/engine/template-literal/encode.mjs
12392
12395
  function JoinString(input) {
12393
12396
  return input.join("|");
@@ -12502,7 +12505,7 @@ function InstantiateType(context, state, input) {
12502
12505
  const immutable = IsImmutable(input);
12503
12506
  const modifiers = ModifierActions(input, IsReadonly(input) ? "add" : "none", IsOptional(input) ? "add" : "none");
12504
12507
  const type = IsBase(modifiers[0]) ? modifiers[0].Clone() : modifiers[0];
12505
- const instantiated = IsRef(type) ? RefInstantiate(context, state, type.$ref) : IsArray3(type) ? Array2(InstantiateType(context, state, type.items), ArrayOptions(type)) : IsAsyncIterator3(type) ? AsyncIterator(InstantiateType(context, state, type.iteratorItems), AsyncIteratorOptions(type)) : IsCall(type) ? CallInstantiate(context, state, type.target, type.arguments) : IsConstructor3(type) ? Constructor(InstantiateTypes(context, state, type.parameters), InstantiateType(context, state, type.instanceType), ConstructorOptions(type)) : IsDeferred(type) ? InstantiateDeferred(context, state, type.action, type.parameters, type.options) : IsFunction3(type) ? Function2(InstantiateTypes(context, state, type.parameters), InstantiateType(context, state, type.returnType), FunctionOptions(type)) : IsIntersect(type) ? Intersect(InstantiateTypes(context, state, type.allOf), IntersectOptions(type)) : IsIterator3(type) ? Iterator(InstantiateType(context, state, type.iteratorItems), IteratorOptions(type)) : IsObject3(type) ? Object2(InstantiateProperties(context, state, type.properties), ObjectOptions(type)) : IsPromise(type) ? Promise2(InstantiateType(context, state, type.item), PromiseOptions(type)) : IsRecord(type) ? RecordFromPattern(RecordPattern(type), InstantiateType(context, state, RecordValue(type))) : IsRest(type) ? Rest(InstantiateType(context, state, type.items)) : IsTuple(type) ? Tuple(InstantiateElements(context, state, type.items), TupleOptions(type)) : IsUnion(type) ? Union(InstantiateTypes(context, state, type.anyOf), UnionOptions(type)) : type;
12508
+ const instantiated = IsRef(type) ? RefInstantiate(context, state, type.$ref) : IsArray3(type) ? Array2(InstantiateType(context, state, type.items), ArrayOptions(type)) : IsAsyncIterator3(type) ? AsyncIterator(InstantiateType(context, state, type.iteratorItems), AsyncIteratorOptions(type)) : IsCall(type) ? CallInstantiate(context, state, type.target, type.arguments) : IsConstructor3(type) ? Constructor(InstantiateTypes(context, state, type.parameters), InstantiateType(context, state, type.instanceType), ConstructorOptions(type)) : IsDeferred(type) ? InstantiateDeferred(context, state, type.action, type.parameters, type.options) : IsFunction3(type) ? _Function_(InstantiateTypes(context, state, type.parameters), InstantiateType(context, state, type.returnType), FunctionOptions(type)) : IsIntersect(type) ? Intersect(InstantiateTypes(context, state, type.allOf), IntersectOptions(type)) : IsIterator3(type) ? Iterator(InstantiateType(context, state, type.iteratorItems), IteratorOptions(type)) : IsObject3(type) ? _Object_(InstantiateProperties(context, state, type.properties), ObjectOptions(type)) : IsPromise(type) ? Promise2(InstantiateType(context, state, type.item), PromiseOptions(type)) : IsRecord(type) ? RecordFromPattern(RecordPattern(type), InstantiateType(context, state, RecordValue(type))) : IsRest(type) ? Rest(InstantiateType(context, state, type.items)) : IsTuple(type) ? Tuple(InstantiateElements(context, state, type.items), TupleOptions(type)) : IsUnion(type) ? Union(InstantiateTypes(context, state, type.anyOf), UnionOptions(type)) : type;
12506
12509
  const withImmutable = immutable ? Immutable(instantiated) : instantiated;
12507
12510
  const withModifiers = ApplyReadonly2(modifiers[1], ApplyOptional2(modifiers[2], withImmutable));
12508
12511
  return withModifiers;
@@ -12578,7 +12581,7 @@ __export(exports_typebox, {
12578
12581
  Options: () => Options2,
12579
12582
  Optional: () => Optional,
12580
12583
  Omit: () => Omit,
12581
- Object: () => Object2,
12584
+ Object: () => _Object_,
12582
12585
  Number: () => Number2,
12583
12586
  Null: () => Null,
12584
12587
  NonNullable: () => NonNullable,
@@ -12643,7 +12646,7 @@ __export(exports_typebox, {
12643
12646
  Immutable: () => Immutable,
12644
12647
  Identifier: () => Identifier,
12645
12648
  Generic: () => Generic,
12646
- Function: () => Function2,
12649
+ Function: () => _Function_,
12647
12650
  Extract: () => Extract,
12648
12651
  ExtendsResult: () => exports_result,
12649
12652
  Extends: () => Extends2,
@@ -16164,7 +16167,7 @@ var Parser = Pipeline([
16164
16167
  (context, type3, value) => Assert3(context, type3, value)
16165
16168
  ]);
16166
16169
  // node_modules/typebox/build/value/delta/edit.mjs
16167
- var Insert = Object2({
16170
+ var Insert = _Object_({
16168
16171
  type: Literal("insert"),
16169
16172
  path: String2(),
16170
16173
  value: Unknown()
@@ -16174,7 +16177,7 @@ var Update2 = Object({
16174
16177
  path: String2(),
16175
16178
  value: Unknown()
16176
16179
  });
16177
- var Delete2 = Object2({
16180
+ var Delete2 = _Object_({
16178
16181
  type: Literal("delete"),
16179
16182
  path: String2()
16180
16183
  });
@@ -19398,6 +19401,18 @@ function isStaticArrayExpression(context, arrayExpr, seen, options3) {
19398
19401
  function isStaticExpressionInner(node, seen, options3) {
19399
19402
  return isStaticExpression(undefined, node, seen, options3);
19400
19403
  }
19404
+ function checkStaticBinaryOrLogical(context, expression, seen, options3) {
19405
+ if (!(isNonPrivateExpression(expression.left) && isNonPrivateExpression(expression.right)))
19406
+ return false;
19407
+ return isStaticExpression(context, expression.left, seen, options3) && isStaticExpression(context, expression.right, seen, options3);
19408
+ }
19409
+ function checkStaticCallOrNewExpression(context, args, callee, seen, options3) {
19410
+ if (context === undefined)
19411
+ return false;
19412
+ if (!isStaticCallCallee(context, callee, seen, options3))
19413
+ return false;
19414
+ return (args ?? []).every((argument) => argument.type !== AST_NODE_TYPES4.SpreadElement && isStaticExpression(context, argument, seen, options3));
19415
+ }
19401
19416
  function isStaticExpression(context, expression, seen, options3) {
19402
19417
  const unwrapped = unwrapExpression(expression);
19403
19418
  if (seen.has(unwrapped))
@@ -19412,9 +19427,7 @@ function isStaticExpression(context, expression, seen, options3) {
19412
19427
  return STATIC_UNARY_OPERATORS.has(unwrapped.operator) && isStaticExpression(context, unwrapped.argument, seen, options3);
19413
19428
  case AST_NODE_TYPES4.BinaryExpression:
19414
19429
  case AST_NODE_TYPES4.LogicalExpression:
19415
- if (!(isNonPrivateExpression(unwrapped.left) && isNonPrivateExpression(unwrapped.right)))
19416
- return false;
19417
- return isStaticExpression(context, unwrapped.left, seen, options3) && isStaticExpression(context, unwrapped.right, seen, options3);
19430
+ return checkStaticBinaryOrLogical(context, unwrapped, seen, options3);
19418
19431
  case AST_NODE_TYPES4.ConditionalExpression:
19419
19432
  return isStaticExpression(context, unwrapped.test, seen, options3) && isStaticExpression(context, unwrapped.consequent, seen, options3) && isStaticExpression(context, unwrapped.alternate, seen, options3);
19420
19433
  case AST_NODE_TYPES4.ArrayExpression:
@@ -19428,11 +19441,11 @@ function isStaticExpression(context, expression, seen, options3) {
19428
19441
  case AST_NODE_TYPES4.ChainExpression:
19429
19442
  return isStaticExpression(context, unwrapped.expression, seen, options3);
19430
19443
  case AST_NODE_TYPES4.CallExpression:
19431
- return context !== undefined && isStaticCallCallee(context, unwrapped.callee, seen, options3) && unwrapped.arguments.every((argument) => argument.type !== AST_NODE_TYPES4.SpreadElement && isStaticExpression(context, argument, seen, options3));
19444
+ return checkStaticCallOrNewExpression(context, unwrapped.arguments, unwrapped.callee, seen, options3);
19432
19445
  case AST_NODE_TYPES4.NewExpression:
19433
- return context !== undefined && isStaticCallCallee(context, unwrapped.callee, seen, options3) && (unwrapped.arguments ?? []).every((argument) => argument.type !== AST_NODE_TYPES4.SpreadElement && isStaticExpression(context, argument, seen, options3));
19446
+ return checkStaticCallOrNewExpression(context, unwrapped.arguments, unwrapped.callee, seen, options3);
19434
19447
  case AST_NODE_TYPES4.SequenceExpression:
19435
- return unwrapped.expressions.length > 0 && unwrapped.expressions.every((expression2) => isStaticExpression(context, expression2, seen, options3));
19448
+ return unwrapped.expressions.length > 0 && unwrapped.expressions.every((expr) => isStaticExpression(context, expr, seen, options3));
19436
19449
  case AST_NODE_TYPES4.AssignmentExpression:
19437
19450
  return isStaticExpression(context, unwrapped.right, seen, options3);
19438
19451
  default:
@@ -19738,53 +19751,1126 @@ var prefer_early_return_default = createRule({
19738
19751
  name: "prefer-early-return"
19739
19752
  });
19740
19753
 
19741
- // src/rules/prefer-module-scope-constants.ts
19742
- var import_scope_manager3 = __toESM(require_dist2(), 1);
19743
- import { AST_NODE_TYPES as AST_NODE_TYPES7 } from "@typescript-eslint/utils";
19744
- var SCREAMING_SNAKE_CASE = /^[A-Z][A-Z0-9_]*$/;
19745
- function isTopScope(scope) {
19746
- const { type: type3 } = scope;
19747
- if (type3 === import_scope_manager3.ScopeType.module || type3 === import_scope_manager3.ScopeType.global)
19748
- return true;
19749
- if (scope.upper?.type === import_scope_manager3.ScopeType.global) {
19750
- const { block } = scope.upper;
19751
- if (block.type === AST_NODE_TYPES7.Program && block.sourceType === "script")
19754
+ // src/rules/prefer-enum-item.ts
19755
+ import { AST_NODE_TYPES as AST_NODE_TYPES7, ESLintUtils as ESLintUtils3 } from "@typescript-eslint/utils";
19756
+
19757
+ // node_modules/ts-api-utils/lib/index.js
19758
+ import ts9 from "typescript";
19759
+ function isFlagSet(allFlags, flag) {
19760
+ return (allFlags & flag) !== 0;
19761
+ }
19762
+ function isFlagSetOnObject(obj, flag) {
19763
+ return isFlagSet(obj.flags, flag);
19764
+ }
19765
+ var isTypeFlagSet = isFlagSetOnObject;
19766
+ function includesModifier(modifiers, ...kinds) {
19767
+ if (modifiers === undefined) {
19768
+ return false;
19769
+ }
19770
+ for (const modifier of modifiers) {
19771
+ if (kinds.includes(modifier.kind)) {
19752
19772
  return true;
19773
+ }
19753
19774
  }
19754
19775
  return false;
19755
19776
  }
19756
- var prefer_module_scope_constants_default = createRule({
19757
- create(context) {
19758
- let inConstDeclaration = false;
19759
- return {
19760
- VariableDeclaration(node) {
19761
- inConstDeclaration = node.kind === "const";
19762
- },
19763
- "VariableDeclaration:exit"() {
19764
- inConstDeclaration = false;
19765
- },
19766
- VariableDeclarator(node) {
19767
- const { id: id2 } = node;
19768
- if (id2.type !== AST_NODE_TYPES7.Identifier || !SCREAMING_SNAKE_CASE.test(id2.name))
19769
- return;
19770
- if (!inConstDeclaration) {
19771
- context.report({
19772
- messageId: "mustUseConst",
19773
- node
19774
- });
19777
+ var [tsMajor, tsMinor] = ts9.versionMajorMinor.split(".").map((raw) => Number.parseInt(raw, 10));
19778
+ function isNumericOrStringLikeLiteral(node) {
19779
+ switch (node.kind) {
19780
+ case ts9.SyntaxKind.NoSubstitutionTemplateLiteral:
19781
+ case ts9.SyntaxKind.NumericLiteral:
19782
+ case ts9.SyntaxKind.StringLiteral:
19783
+ return true;
19784
+ default:
19785
+ return false;
19786
+ }
19787
+ }
19788
+ function isFunctionScopeBoundary(node) {
19789
+ switch (node.kind) {
19790
+ case ts9.SyntaxKind.ArrowFunction:
19791
+ case ts9.SyntaxKind.CallSignature:
19792
+ case ts9.SyntaxKind.ClassDeclaration:
19793
+ case ts9.SyntaxKind.ClassExpression:
19794
+ case ts9.SyntaxKind.Constructor:
19795
+ case ts9.SyntaxKind.ConstructorType:
19796
+ case ts9.SyntaxKind.ConstructSignature:
19797
+ case ts9.SyntaxKind.EnumDeclaration:
19798
+ case ts9.SyntaxKind.FunctionDeclaration:
19799
+ case ts9.SyntaxKind.FunctionExpression:
19800
+ case ts9.SyntaxKind.FunctionType:
19801
+ case ts9.SyntaxKind.GetAccessor:
19802
+ case ts9.SyntaxKind.MethodDeclaration:
19803
+ case ts9.SyntaxKind.MethodSignature:
19804
+ case ts9.SyntaxKind.ModuleDeclaration:
19805
+ case ts9.SyntaxKind.SetAccessor:
19806
+ return true;
19807
+ case ts9.SyntaxKind.SourceFile:
19808
+ return ts9.isExternalModule(node);
19809
+ default:
19810
+ return false;
19811
+ }
19812
+ }
19813
+ var IntrinsicTypeFlags = ts9.TypeFlags.Intrinsic ?? ts9.TypeFlags.Any | ts9.TypeFlags.Unknown | ts9.TypeFlags.String | ts9.TypeFlags.Number | ts9.TypeFlags.BigInt | ts9.TypeFlags.Boolean | ts9.TypeFlags.BooleanLiteral | ts9.TypeFlags.ESSymbol | ts9.TypeFlags.Void | ts9.TypeFlags.Undefined | ts9.TypeFlags.Null | ts9.TypeFlags.Never | ts9.TypeFlags.NonPrimitive;
19814
+ function isUnionType(type3) {
19815
+ return isTypeFlagSet(type3, ts9.TypeFlags.Union);
19816
+ }
19817
+ function unionConstituents(type3) {
19818
+ return isUnionType(type3) ? type3.types : [type3];
19819
+ }
19820
+ function identifierToKeywordKind(node) {
19821
+ return "originalKeywordKind" in node ? node.originalKeywordKind : ts9.identifierToKeywordKind(node);
19822
+ }
19823
+ function getDeclarationDomain(node) {
19824
+ switch (node.parent.kind) {
19825
+ case ts9.SyntaxKind.ClassDeclaration:
19826
+ case ts9.SyntaxKind.ClassExpression:
19827
+ return 2 | 4;
19828
+ case ts9.SyntaxKind.EnumDeclaration:
19829
+ return 7;
19830
+ case ts9.SyntaxKind.FunctionDeclaration:
19831
+ case ts9.SyntaxKind.FunctionExpression:
19832
+ return 4;
19833
+ case ts9.SyntaxKind.ImportClause:
19834
+ case ts9.SyntaxKind.NamespaceImport:
19835
+ return 7 | 8;
19836
+ case ts9.SyntaxKind.ImportEqualsDeclaration:
19837
+ case ts9.SyntaxKind.ImportSpecifier:
19838
+ return node.parent.name === node ? 7 | 8 : undefined;
19839
+ case ts9.SyntaxKind.InterfaceDeclaration:
19840
+ case ts9.SyntaxKind.TypeAliasDeclaration:
19841
+ case ts9.SyntaxKind.TypeParameter:
19842
+ return 2;
19843
+ case ts9.SyntaxKind.ModuleDeclaration:
19844
+ return 1;
19845
+ case ts9.SyntaxKind.Parameter:
19846
+ if (node.parent.parent.kind === ts9.SyntaxKind.IndexSignature || identifierToKeywordKind(node) === ts9.SyntaxKind.ThisKeyword) {
19847
+ return;
19848
+ }
19849
+ case ts9.SyntaxKind.BindingElement:
19850
+ case ts9.SyntaxKind.VariableDeclaration:
19851
+ return node.parent.name === node ? 4 : undefined;
19852
+ }
19853
+ }
19854
+ function getPropertyName(propertyName) {
19855
+ if (propertyName.kind === ts9.SyntaxKind.ComputedPropertyName) {
19856
+ const expression = unwrapParentheses(propertyName.expression);
19857
+ if (ts9.isPrefixUnaryExpression(expression)) {
19858
+ let negate = false;
19859
+ switch (expression.operator) {
19860
+ case ts9.SyntaxKind.MinusToken:
19861
+ negate = true;
19862
+ case ts9.SyntaxKind.PlusToken:
19863
+ return ts9.isNumericLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text}` : ts9.isBigIntLiteral(expression.operand) ? `${negate ? "-" : ""}${expression.operand.text.slice(0, -1)}` : undefined;
19864
+ default:
19775
19865
  return;
19866
+ }
19867
+ }
19868
+ if (ts9.isBigIntLiteral(expression)) {
19869
+ return expression.text.slice(0, -1);
19870
+ }
19871
+ if (isNumericOrStringLikeLiteral(expression)) {
19872
+ return expression.text;
19873
+ }
19874
+ return;
19875
+ }
19876
+ return propertyName.kind === ts9.SyntaxKind.PrivateIdentifier ? undefined : propertyName.text;
19877
+ }
19878
+ function unwrapParentheses(node) {
19879
+ while (node.kind === ts9.SyntaxKind.ParenthesizedExpression) {
19880
+ node = node.expression;
19881
+ }
19882
+ return node;
19883
+ }
19884
+ function getUsageDomain(node) {
19885
+ const parent = node.parent;
19886
+ switch (parent.kind) {
19887
+ case ts9.SyntaxKind.BindingElement:
19888
+ if (parent.initializer === node) {
19889
+ return 5;
19890
+ }
19891
+ break;
19892
+ case ts9.SyntaxKind.BreakStatement:
19893
+ case ts9.SyntaxKind.ClassDeclaration:
19894
+ case ts9.SyntaxKind.ClassExpression:
19895
+ case ts9.SyntaxKind.ContinueStatement:
19896
+ case ts9.SyntaxKind.EnumDeclaration:
19897
+ case ts9.SyntaxKind.FunctionDeclaration:
19898
+ case ts9.SyntaxKind.FunctionExpression:
19899
+ case ts9.SyntaxKind.GetAccessor:
19900
+ case ts9.SyntaxKind.ImportClause:
19901
+ case ts9.SyntaxKind.ImportSpecifier:
19902
+ case ts9.SyntaxKind.InterfaceDeclaration:
19903
+ case ts9.SyntaxKind.JsxAttribute:
19904
+ case ts9.SyntaxKind.LabeledStatement:
19905
+ case ts9.SyntaxKind.MethodDeclaration:
19906
+ case ts9.SyntaxKind.MethodSignature:
19907
+ case ts9.SyntaxKind.ModuleDeclaration:
19908
+ case ts9.SyntaxKind.NamedTupleMember:
19909
+ case ts9.SyntaxKind.NamespaceExport:
19910
+ case ts9.SyntaxKind.NamespaceExportDeclaration:
19911
+ case ts9.SyntaxKind.NamespaceImport:
19912
+ case ts9.SyntaxKind.PropertySignature:
19913
+ case ts9.SyntaxKind.SetAccessor:
19914
+ case ts9.SyntaxKind.TypeAliasDeclaration:
19915
+ case ts9.SyntaxKind.TypeParameter:
19916
+ case ts9.SyntaxKind.TypePredicate:
19917
+ break;
19918
+ case ts9.SyntaxKind.EnumMember:
19919
+ case ts9.SyntaxKind.ImportEqualsDeclaration:
19920
+ case ts9.SyntaxKind.Parameter:
19921
+ case ts9.SyntaxKind.PropertyAccessExpression:
19922
+ case ts9.SyntaxKind.PropertyAssignment:
19923
+ case ts9.SyntaxKind.PropertyDeclaration:
19924
+ case ts9.SyntaxKind.VariableDeclaration:
19925
+ if (parent.name !== node) {
19926
+ return 5;
19927
+ }
19928
+ break;
19929
+ case ts9.SyntaxKind.ExportAssignment:
19930
+ return 7;
19931
+ case ts9.SyntaxKind.ExportSpecifier:
19932
+ if (parent.propertyName === undefined || parent.propertyName === node) {
19933
+ return 7;
19934
+ }
19935
+ break;
19936
+ case ts9.SyntaxKind.ExpressionWithTypeArguments:
19937
+ return parent.parent.token === ts9.SyntaxKind.ImplementsKeyword || parent.parent.parent.kind === ts9.SyntaxKind.InterfaceDeclaration ? 2 : 4;
19938
+ case ts9.SyntaxKind.QualifiedName:
19939
+ if (parent.left === node) {
19940
+ if (getEntityNameParent(parent).kind === ts9.SyntaxKind.TypeQuery) {
19941
+ return 1 | 8;
19776
19942
  }
19777
- const scope = context.sourceCode.getScope(node);
19778
- if (isTopScope(scope))
19779
- return;
19780
- context.report({
19781
- messageId: "mustBeModuleScope",
19782
- node
19783
- });
19943
+ return 1;
19784
19944
  }
19945
+ break;
19946
+ case ts9.SyntaxKind.TypeQuery:
19947
+ return 5 | 8;
19948
+ case ts9.SyntaxKind.TypeReference:
19949
+ return identifierToKeywordKind(node) !== ts9.SyntaxKind.ConstKeyword ? 2 : undefined;
19950
+ default:
19951
+ return 5;
19952
+ }
19953
+ }
19954
+ function getEntityNameParent(name) {
19955
+ let parent = name.parent;
19956
+ while (parent.kind === ts9.SyntaxKind.QualifiedName) {
19957
+ parent = parent.parent;
19958
+ }
19959
+ return parent;
19960
+ }
19961
+ function isBlockScopeBoundary(node) {
19962
+ switch (node.kind) {
19963
+ case ts9.SyntaxKind.Block: {
19964
+ const parent = node.parent;
19965
+ return parent.kind !== ts9.SyntaxKind.CatchClause && (parent.kind === ts9.SyntaxKind.SourceFile || !isFunctionScopeBoundary(parent)) ? 2 : 0;
19966
+ }
19967
+ case ts9.SyntaxKind.CaseBlock:
19968
+ case ts9.SyntaxKind.CatchClause:
19969
+ case ts9.SyntaxKind.ForInStatement:
19970
+ case ts9.SyntaxKind.ForOfStatement:
19971
+ case ts9.SyntaxKind.ForStatement:
19972
+ case ts9.SyntaxKind.WithStatement:
19973
+ return 2;
19974
+ default:
19975
+ return 0;
19976
+ }
19977
+ }
19978
+ var AbstractScope = class {
19979
+ constructor(global) {
19980
+ this.global = global;
19981
+ }
19982
+ namespaceScopes = undefined;
19983
+ uses = [];
19984
+ variables = /* @__PURE__ */ new Map;
19985
+ #enumScopes = undefined;
19986
+ addUse(use) {
19987
+ this.uses.push(use);
19988
+ }
19989
+ addVariable(identifier3, name, selector, exported, domain) {
19990
+ const variables = this.getDestinationScope(selector).getVariables();
19991
+ const declaration = {
19992
+ declaration: name,
19993
+ domain,
19994
+ exported
19785
19995
  };
19786
- },
19787
- defaultOptions: [],
19996
+ const variable = variables.get(identifier3);
19997
+ if (variable === undefined) {
19998
+ variables.set(identifier3, {
19999
+ declarations: [declaration],
20000
+ domain,
20001
+ uses: []
20002
+ });
20003
+ } else {
20004
+ variable.domain |= domain;
20005
+ variable.declarations.push(declaration);
20006
+ }
20007
+ }
20008
+ createOrReuseEnumScope(name, _exported) {
20009
+ let scope;
20010
+ if (this.#enumScopes === undefined) {
20011
+ this.#enumScopes = /* @__PURE__ */ new Map;
20012
+ } else {
20013
+ scope = this.#enumScopes.get(name);
20014
+ }
20015
+ if (scope === undefined) {
20016
+ scope = new EnumScope(this);
20017
+ this.#enumScopes.set(name, scope);
20018
+ }
20019
+ return scope;
20020
+ }
20021
+ createOrReuseNamespaceScope(name, _exported, ambient, hasExportStatement) {
20022
+ let scope;
20023
+ if (this.namespaceScopes === undefined) {
20024
+ this.namespaceScopes = /* @__PURE__ */ new Map;
20025
+ } else {
20026
+ scope = this.namespaceScopes.get(name);
20027
+ }
20028
+ if (scope === undefined) {
20029
+ scope = new NamespaceScope(ambient, hasExportStatement, this);
20030
+ this.namespaceScopes.set(name, scope);
20031
+ } else {
20032
+ scope.refresh(ambient, hasExportStatement);
20033
+ }
20034
+ return scope;
20035
+ }
20036
+ end(cb) {
20037
+ if (this.namespaceScopes !== undefined) {
20038
+ this.namespaceScopes.forEach((value) => value.finish(cb));
20039
+ }
20040
+ this.namespaceScopes = this.#enumScopes = undefined;
20041
+ this.applyUses();
20042
+ this.variables.forEach((variable) => {
20043
+ for (const declaration of variable.declarations) {
20044
+ const result = {
20045
+ declarations: [],
20046
+ domain: declaration.domain,
20047
+ exported: declaration.exported,
20048
+ inGlobalScope: this.global,
20049
+ uses: []
20050
+ };
20051
+ for (const other of variable.declarations) {
20052
+ if (other.domain & declaration.domain) {
20053
+ result.declarations.push(other.declaration);
20054
+ }
20055
+ }
20056
+ for (const use of variable.uses) {
20057
+ if (use.domain & declaration.domain) {
20058
+ result.uses.push(use);
20059
+ }
20060
+ }
20061
+ cb(result, declaration.declaration, this);
20062
+ }
20063
+ });
20064
+ }
20065
+ getFunctionScope() {
20066
+ return this;
20067
+ }
20068
+ getVariables() {
20069
+ return this.variables;
20070
+ }
20071
+ markExported(_name) {}
20072
+ addUseToParent(_use) {}
20073
+ applyUse(use, variables = this.variables) {
20074
+ const variable = variables.get(use.location.text);
20075
+ if (variable === undefined || (variable.domain & use.domain) === 0) {
20076
+ return false;
20077
+ }
20078
+ variable.uses.push(use);
20079
+ return true;
20080
+ }
20081
+ applyUses() {
20082
+ for (const use of this.uses) {
20083
+ if (!this.applyUse(use)) {
20084
+ this.addUseToParent(use);
20085
+ }
20086
+ }
20087
+ this.uses = [];
20088
+ }
20089
+ };
20090
+ var NonRootScope = class extends AbstractScope {
20091
+ constructor(parent, boundary) {
20092
+ super(false);
20093
+ this.parent = parent;
20094
+ this.boundary = boundary;
20095
+ }
20096
+ getDestinationScope(selector) {
20097
+ return this.boundary & selector ? this : this.parent.getDestinationScope(selector);
20098
+ }
20099
+ addUseToParent(use) {
20100
+ return this.parent.addUse(use, this);
20101
+ }
20102
+ };
20103
+ var AbstractNamedExpressionScope = class extends NonRootScope {
20104
+ #domain;
20105
+ #name;
20106
+ constructor(name, domain, parent) {
20107
+ super(parent, 1);
20108
+ this.#name = name;
20109
+ this.#domain = domain;
20110
+ }
20111
+ addUse(use, source) {
20112
+ if (source !== this.innerScope) {
20113
+ return this.innerScope.addUse(use);
20114
+ }
20115
+ if (use.domain & this.#domain && use.location.text === this.#name.text) {
20116
+ this.uses.push(use);
20117
+ } else {
20118
+ return this.parent.addUse(use, this);
20119
+ }
20120
+ }
20121
+ end(cb) {
20122
+ this.innerScope.end(cb);
20123
+ return cb({
20124
+ declarations: [this.#name],
20125
+ domain: this.#domain,
20126
+ exported: false,
20127
+ inGlobalScope: false,
20128
+ uses: this.uses
20129
+ }, this.#name, this);
20130
+ }
20131
+ getDestinationScope() {
20132
+ return this.innerScope;
20133
+ }
20134
+ getFunctionScope() {
20135
+ return this.innerScope;
20136
+ }
20137
+ };
20138
+ var BlockScope = class extends NonRootScope {
20139
+ #functionScope;
20140
+ constructor(functionScope, parent) {
20141
+ super(parent, 2);
20142
+ this.#functionScope = functionScope;
20143
+ }
20144
+ getFunctionScope() {
20145
+ return this.#functionScope;
20146
+ }
20147
+ };
20148
+ var ClassExpressionScope = class extends AbstractNamedExpressionScope {
20149
+ innerScope = new NonRootScope(this, 1);
20150
+ constructor(name, parent) {
20151
+ super(name, 4 | 2, parent);
20152
+ }
20153
+ };
20154
+ var ConditionalTypeScope = class extends NonRootScope {
20155
+ #state = 0;
20156
+ constructor(parent) {
20157
+ super(parent, 8);
20158
+ }
20159
+ addUse(use) {
20160
+ if (this.#state === 2) {
20161
+ return void this.uses.push(use);
20162
+ }
20163
+ return this.parent.addUse(use, this);
20164
+ }
20165
+ updateState(newState) {
20166
+ this.#state = newState;
20167
+ }
20168
+ };
20169
+ var EnumScope = class extends NonRootScope {
20170
+ constructor(parent) {
20171
+ super(parent, 1);
20172
+ }
20173
+ end() {
20174
+ this.applyUses();
20175
+ }
20176
+ };
20177
+ var FunctionScope = class extends NonRootScope {
20178
+ constructor(parent) {
20179
+ super(parent, 1);
20180
+ }
20181
+ beginBody() {
20182
+ this.applyUses();
20183
+ }
20184
+ };
20185
+ var FunctionExpressionScope = class extends AbstractNamedExpressionScope {
20186
+ innerScope = new FunctionScope(this);
20187
+ constructor(name, parent) {
20188
+ super(name, 4, parent);
20189
+ }
20190
+ beginBody() {
20191
+ return this.innerScope.beginBody();
20192
+ }
20193
+ };
20194
+ var NamespaceScope = class extends NonRootScope {
20195
+ #ambient;
20196
+ #exports = undefined;
20197
+ #hasExport;
20198
+ #innerScope = new NonRootScope(this, 1);
20199
+ constructor(ambient, hasExport, parent) {
20200
+ super(parent, 1);
20201
+ this.#ambient = ambient;
20202
+ this.#hasExport = hasExport;
20203
+ }
20204
+ addUse(use, source) {
20205
+ if (source !== this.#innerScope) {
20206
+ return this.#innerScope.addUse(use);
20207
+ }
20208
+ this.uses.push(use);
20209
+ }
20210
+ createOrReuseEnumScope(name, exported) {
20211
+ if (!exported && (!this.#ambient || this.#hasExport)) {
20212
+ return this.#innerScope.createOrReuseEnumScope(name, exported);
20213
+ }
20214
+ return super.createOrReuseEnumScope(name, exported);
20215
+ }
20216
+ createOrReuseNamespaceScope(name, exported, ambient, hasExportStatement) {
20217
+ if (!exported && (!this.#ambient || this.#hasExport)) {
20218
+ return this.#innerScope.createOrReuseNamespaceScope(name, exported, ambient || this.#ambient, hasExportStatement);
20219
+ }
20220
+ return super.createOrReuseNamespaceScope(name, exported, ambient || this.#ambient, hasExportStatement);
20221
+ }
20222
+ end(cb) {
20223
+ this.#innerScope.end((variable, key, scope) => {
20224
+ if (scope !== this.#innerScope || !variable.exported && (!this.#ambient || this.#exports !== undefined && !this.#exports.has(key.text))) {
20225
+ return cb(variable, key, scope);
20226
+ }
20227
+ const namespaceVar = this.variables.get(key.text);
20228
+ if (namespaceVar === undefined) {
20229
+ this.variables.set(key.text, {
20230
+ declarations: variable.declarations.map(mapDeclaration),
20231
+ domain: variable.domain,
20232
+ uses: [...variable.uses]
20233
+ });
20234
+ } else {
20235
+ outer:
20236
+ for (const declaration of variable.declarations) {
20237
+ for (const existing of namespaceVar.declarations) {
20238
+ if (existing.declaration === declaration) {
20239
+ continue outer;
20240
+ }
20241
+ namespaceVar.declarations.push(mapDeclaration(declaration));
20242
+ }
20243
+ }
20244
+ namespaceVar.domain |= variable.domain;
20245
+ for (const use of variable.uses) {
20246
+ if (namespaceVar.uses.includes(use)) {
20247
+ continue;
20248
+ }
20249
+ namespaceVar.uses.push(use);
20250
+ }
20251
+ }
20252
+ });
20253
+ this.applyUses();
20254
+ this.#innerScope = new NonRootScope(this, 1);
20255
+ }
20256
+ finish(cb) {
20257
+ return super.end(cb);
20258
+ }
20259
+ getDestinationScope() {
20260
+ return this.#innerScope;
20261
+ }
20262
+ markExported(name) {
20263
+ if (this.#exports === undefined) {
20264
+ this.#exports = /* @__PURE__ */ new Set;
20265
+ }
20266
+ this.#exports.add(name.text);
20267
+ }
20268
+ refresh(ambient, hasExport) {
20269
+ this.#ambient = ambient;
20270
+ this.#hasExport = hasExport;
20271
+ }
20272
+ };
20273
+ var RootScope = class extends AbstractScope {
20274
+ #exportAll;
20275
+ #exports = undefined;
20276
+ #innerScope = new NonRootScope(this, 1);
20277
+ constructor(exportAll, global) {
20278
+ super(global);
20279
+ this.#exportAll = exportAll;
20280
+ }
20281
+ addUse(use, origin) {
20282
+ if (origin === this.#innerScope) {
20283
+ return super.addUse(use);
20284
+ }
20285
+ return this.#innerScope.addUse(use);
20286
+ }
20287
+ addVariable(identifier3, name, selector, exported, domain) {
20288
+ if (domain & 8) {
20289
+ return super.addVariable(identifier3, name, selector, exported, domain);
20290
+ }
20291
+ return this.#innerScope.addVariable(identifier3, name, selector, exported, domain);
20292
+ }
20293
+ end(cb) {
20294
+ this.#innerScope.end((value, key) => {
20295
+ value.exported ||= this.#exportAll || this.#exports !== undefined && this.#exports.includes(key.text);
20296
+ value.inGlobalScope = this.global;
20297
+ return cb(value, key, this);
20298
+ });
20299
+ return super.end((value, key, scope) => {
20300
+ value.exported ||= scope === this && this.#exports !== undefined && this.#exports.includes(key.text);
20301
+ return cb(value, key, scope);
20302
+ });
20303
+ }
20304
+ getDestinationScope() {
20305
+ return this;
20306
+ }
20307
+ markExported(id2) {
20308
+ if (this.#exports === undefined) {
20309
+ this.#exports = [id2.text];
20310
+ } else {
20311
+ this.#exports.push(id2.text);
20312
+ }
20313
+ }
20314
+ };
20315
+ function mapDeclaration(declaration) {
20316
+ return {
20317
+ declaration,
20318
+ domain: getDeclarationDomain(declaration),
20319
+ exported: true
20320
+ };
20321
+ }
20322
+ var UsageWalker = class {
20323
+ #result = /* @__PURE__ */ new Map;
20324
+ #scope;
20325
+ getUsage(sourceFile) {
20326
+ const variableCallback = (variable, key) => {
20327
+ this.#result.set(key, variable);
20328
+ };
20329
+ const isModule = ts9.isExternalModule(sourceFile);
20330
+ this.#scope = new RootScope(sourceFile.isDeclarationFile && isModule && !containsExportStatement(sourceFile), !isModule);
20331
+ const cb = (node) => {
20332
+ if (isBlockScopeBoundary(node)) {
20333
+ return continueWithScope(node, new BlockScope(this.#scope.getFunctionScope(), this.#scope), handleBlockScope);
20334
+ }
20335
+ switch (node.kind) {
20336
+ case ts9.SyntaxKind.ArrowFunction:
20337
+ case ts9.SyntaxKind.CallSignature:
20338
+ case ts9.SyntaxKind.Constructor:
20339
+ case ts9.SyntaxKind.ConstructorType:
20340
+ case ts9.SyntaxKind.ConstructSignature:
20341
+ case ts9.SyntaxKind.FunctionDeclaration:
20342
+ case ts9.SyntaxKind.FunctionExpression:
20343
+ case ts9.SyntaxKind.FunctionType:
20344
+ case ts9.SyntaxKind.GetAccessor:
20345
+ case ts9.SyntaxKind.MethodDeclaration:
20346
+ case ts9.SyntaxKind.MethodSignature:
20347
+ case ts9.SyntaxKind.SetAccessor:
20348
+ return this.#handleFunctionLikeDeclaration(node, cb, variableCallback);
20349
+ case ts9.SyntaxKind.ClassDeclaration:
20350
+ this.#handleDeclaration(node, true, 4 | 2);
20351
+ return continueWithScope(node, new NonRootScope(this.#scope, 1));
20352
+ case ts9.SyntaxKind.ClassExpression:
20353
+ return continueWithScope(node, node.name !== undefined ? new ClassExpressionScope(node.name, this.#scope) : new NonRootScope(this.#scope, 1));
20354
+ case ts9.SyntaxKind.ConditionalType:
20355
+ return this.#handleConditionalType(node, cb, variableCallback);
20356
+ case ts9.SyntaxKind.EnumDeclaration:
20357
+ this.#handleDeclaration(node, true, 7);
20358
+ return continueWithScope(node, this.#scope.createOrReuseEnumScope(node.name.text, includesModifier(node.modifiers, ts9.SyntaxKind.ExportKeyword)));
20359
+ case ts9.SyntaxKind.EnumMember:
20360
+ this.#scope.addVariable(getPropertyName(node.name), node.name, 1, true, 4);
20361
+ break;
20362
+ case ts9.SyntaxKind.ExportAssignment:
20363
+ if (node.expression.kind === ts9.SyntaxKind.Identifier) {
20364
+ return this.#scope.markExported(node.expression);
20365
+ }
20366
+ break;
20367
+ case ts9.SyntaxKind.ExportSpecifier:
20368
+ if (node.propertyName !== undefined) {
20369
+ return this.#scope.markExported(node.propertyName, node.name);
20370
+ }
20371
+ return this.#scope.markExported(node.name);
20372
+ case ts9.SyntaxKind.Identifier: {
20373
+ const domain = getUsageDomain(node);
20374
+ if (domain !== undefined) {
20375
+ this.#scope.addUse({ domain, location: node });
20376
+ }
20377
+ return;
20378
+ }
20379
+ case ts9.SyntaxKind.ImportClause:
20380
+ case ts9.SyntaxKind.ImportEqualsDeclaration:
20381
+ case ts9.SyntaxKind.ImportSpecifier:
20382
+ case ts9.SyntaxKind.NamespaceImport:
20383
+ this.#handleDeclaration(node, false, 7 | 8);
20384
+ break;
20385
+ case ts9.SyntaxKind.InterfaceDeclaration:
20386
+ case ts9.SyntaxKind.TypeAliasDeclaration:
20387
+ this.#handleDeclaration(node, true, 2);
20388
+ return continueWithScope(node, new NonRootScope(this.#scope, 4));
20389
+ case ts9.SyntaxKind.MappedType:
20390
+ return continueWithScope(node, new NonRootScope(this.#scope, 4));
20391
+ case ts9.SyntaxKind.ModuleDeclaration:
20392
+ return this.#handleModule(node, continueWithScope);
20393
+ case ts9.SyntaxKind.Parameter:
20394
+ if (node.parent.kind !== ts9.SyntaxKind.IndexSignature && (node.name.kind !== ts9.SyntaxKind.Identifier || identifierToKeywordKind(node.name) !== ts9.SyntaxKind.ThisKeyword)) {
20395
+ this.#handleBindingName(node.name, false, false);
20396
+ }
20397
+ break;
20398
+ case ts9.SyntaxKind.TypeParameter:
20399
+ this.#scope.addVariable(node.name.text, node.name, node.parent.kind === ts9.SyntaxKind.InferType ? 8 : 7, false, 2);
20400
+ break;
20401
+ case ts9.SyntaxKind.VariableDeclarationList:
20402
+ this.#handleVariableDeclaration(node);
20403
+ break;
20404
+ }
20405
+ return ts9.forEachChild(node, cb);
20406
+ };
20407
+ const continueWithScope = (node, scope, next = forEachChild) => {
20408
+ const savedScope = this.#scope;
20409
+ this.#scope = scope;
20410
+ next(node);
20411
+ this.#scope.end(variableCallback);
20412
+ this.#scope = savedScope;
20413
+ };
20414
+ const handleBlockScope = (node) => {
20415
+ if (node.kind === ts9.SyntaxKind.CatchClause && node.variableDeclaration !== undefined) {
20416
+ this.#handleBindingName(node.variableDeclaration.name, true, false);
20417
+ }
20418
+ return ts9.forEachChild(node, cb);
20419
+ };
20420
+ ts9.forEachChild(sourceFile, cb);
20421
+ this.#scope.end(variableCallback);
20422
+ return this.#result;
20423
+ function forEachChild(node) {
20424
+ return ts9.forEachChild(node, cb);
20425
+ }
20426
+ }
20427
+ #handleBindingName(name, blockScoped, exported) {
20428
+ if (name.kind === ts9.SyntaxKind.Identifier) {
20429
+ return this.#scope.addVariable(name.text, name, blockScoped ? 3 : 1, exported, 4);
20430
+ }
20431
+ forEachDestructuringIdentifier(name, (declaration) => {
20432
+ this.#scope.addVariable(declaration.name.text, declaration.name, blockScoped ? 3 : 1, exported, 4);
20433
+ });
20434
+ }
20435
+ #handleConditionalType(node, cb, varCb) {
20436
+ const savedScope = this.#scope;
20437
+ const scope = this.#scope = new ConditionalTypeScope(savedScope);
20438
+ cb(node.checkType);
20439
+ scope.updateState(1);
20440
+ cb(node.extendsType);
20441
+ scope.updateState(2);
20442
+ cb(node.trueType);
20443
+ scope.updateState(3);
20444
+ cb(node.falseType);
20445
+ scope.end(varCb);
20446
+ this.#scope = savedScope;
20447
+ }
20448
+ #handleDeclaration(node, blockScoped, domain) {
20449
+ if (node.name !== undefined) {
20450
+ this.#scope.addVariable(node.name.text, node.name, blockScoped ? 3 : 1, includesModifier(node.modifiers, ts9.SyntaxKind.ExportKeyword), domain);
20451
+ }
20452
+ }
20453
+ #handleFunctionLikeDeclaration(node, cb, varCb) {
20454
+ if (ts9.canHaveDecorators(node)) {
20455
+ ts9.getDecorators(node)?.forEach(cb);
20456
+ }
20457
+ const savedScope = this.#scope;
20458
+ if (node.kind === ts9.SyntaxKind.FunctionDeclaration) {
20459
+ this.#handleDeclaration(node, false, 4);
20460
+ }
20461
+ const scope = this.#scope = node.kind === ts9.SyntaxKind.FunctionExpression && node.name !== undefined ? new FunctionExpressionScope(node.name, savedScope) : new FunctionScope(savedScope);
20462
+ if (node.name !== undefined) {
20463
+ cb(node.name);
20464
+ }
20465
+ if (node.typeParameters !== undefined) {
20466
+ node.typeParameters.forEach(cb);
20467
+ }
20468
+ node.parameters.forEach(cb);
20469
+ if (node.type !== undefined) {
20470
+ cb(node.type);
20471
+ }
20472
+ if (node.body !== undefined) {
20473
+ scope.beginBody();
20474
+ cb(node.body);
20475
+ }
20476
+ scope.end(varCb);
20477
+ this.#scope = savedScope;
20478
+ }
20479
+ #handleModule(node, next) {
20480
+ if (node.flags & ts9.NodeFlags.GlobalAugmentation) {
20481
+ return next(node, this.#scope.createOrReuseNamespaceScope("-global", false, true, false));
20482
+ }
20483
+ if (node.name.kind === ts9.SyntaxKind.Identifier) {
20484
+ const exported = isNamespaceExported(node);
20485
+ this.#scope.addVariable(node.name.text, node.name, 1, exported, 1 | 4);
20486
+ const ambient = includesModifier(node.modifiers, ts9.SyntaxKind.DeclareKeyword);
20487
+ return next(node, this.#scope.createOrReuseNamespaceScope(node.name.text, exported, ambient, ambient && namespaceHasExportStatement(node)));
20488
+ }
20489
+ return next(node, this.#scope.createOrReuseNamespaceScope(`"${node.name.text}"`, false, true, namespaceHasExportStatement(node)));
20490
+ }
20491
+ #handleVariableDeclaration(declarationList) {
20492
+ const blockScoped = isBlockScopedVariableDeclarationList(declarationList);
20493
+ const exported = declarationList.parent.kind === ts9.SyntaxKind.VariableStatement && includesModifier(declarationList.parent.modifiers, ts9.SyntaxKind.ExportKeyword);
20494
+ for (const declaration of declarationList.declarations) {
20495
+ this.#handleBindingName(declaration.name, blockScoped, exported);
20496
+ }
20497
+ }
20498
+ };
20499
+ function containsExportStatement(block) {
20500
+ for (const statement of block.statements) {
20501
+ if (statement.kind === ts9.SyntaxKind.ExportDeclaration || statement.kind === ts9.SyntaxKind.ExportAssignment) {
20502
+ return true;
20503
+ }
20504
+ }
20505
+ return false;
20506
+ }
20507
+ function forEachDestructuringIdentifier(pattern4, fn) {
20508
+ for (const element of pattern4.elements) {
20509
+ if (element.kind !== ts9.SyntaxKind.BindingElement) {
20510
+ continue;
20511
+ }
20512
+ let result;
20513
+ if (element.name.kind === ts9.SyntaxKind.Identifier) {
20514
+ result = fn(element);
20515
+ } else {
20516
+ result = forEachDestructuringIdentifier(element.name, fn);
20517
+ }
20518
+ if (result) {
20519
+ return result;
20520
+ }
20521
+ }
20522
+ }
20523
+ function isBlockScopedVariableDeclarationList(declarationList) {
20524
+ return (declarationList.flags & ts9.NodeFlags.BlockScoped) !== 0;
20525
+ }
20526
+ function isNamespaceExported(node) {
20527
+ return node.parent.kind === ts9.SyntaxKind.ModuleDeclaration || includesModifier(node.modifiers, ts9.SyntaxKind.ExportKeyword);
20528
+ }
20529
+ function namespaceHasExportStatement(ns) {
20530
+ if (ns.body === undefined || ns.body.kind !== ts9.SyntaxKind.ModuleBlock) {
20531
+ return false;
20532
+ }
20533
+ return containsExportStatement(ns.body);
20534
+ }
20535
+
20536
+ // src/rules/prefer-enum-item.ts
20537
+ import { SymbolFlags } from "typescript";
20538
+ function isJSXAttributeValue(node) {
20539
+ const { parent } = node;
20540
+ return parent !== undefined && parent.type === AST_NODE_TYPES7.JSXAttribute && parent.value === node;
20541
+ }
20542
+ function canHaveContextualEnumType(node) {
20543
+ const { parent } = node;
20544
+ if (parent === undefined)
20545
+ return false;
20546
+ switch (parent.type) {
20547
+ case AST_NODE_TYPES7.CallExpression:
20548
+ case AST_NODE_TYPES7.NewExpression:
20549
+ return parent.arguments.includes(node);
20550
+ case AST_NODE_TYPES7.Property:
20551
+ return parent.value === node;
20552
+ case AST_NODE_TYPES7.JSXAttribute:
20553
+ return parent.value === node;
20554
+ case AST_NODE_TYPES7.VariableDeclarator: {
20555
+ if (parent.init !== node)
20556
+ return false;
20557
+ const { id: id2 } = parent;
20558
+ return id2.type === AST_NODE_TYPES7.Identifier && id2.typeAnnotation !== undefined;
20559
+ }
20560
+ default:
20561
+ return false;
20562
+ }
20563
+ }
20564
+ var ENUM_PREFIX = "Enum.";
20565
+ var enumLiteralIndexCache = new WeakMap;
20566
+ function getFullEnumPath(checker, type3) {
20567
+ const symbol3 = type3.getSymbol();
20568
+ if (symbol3 === undefined)
20569
+ return;
20570
+ const fullName = checker.getFullyQualifiedName(symbol3);
20571
+ if (!fullName.startsWith(ENUM_PREFIX))
20572
+ return;
20573
+ return fullName;
20574
+ }
20575
+ function getPropertyLiteralType(checker, type3, propertyName) {
20576
+ const property = type3.getProperty(propertyName);
20577
+ if (property === undefined)
20578
+ return;
20579
+ const propertyType = checker.getTypeOfSymbol(property);
20580
+ if (propertyType.isStringLiteral())
20581
+ return propertyType.value;
20582
+ if (propertyType.isNumberLiteral())
20583
+ return propertyType.value;
20584
+ return;
20585
+ }
20586
+ function getUnionTypes(type3) {
20587
+ if (isUnionType(type3))
20588
+ return unionConstituents(type3);
20589
+ return [type3];
20590
+ }
20591
+ function createEnumMatch(enumPath) {
20592
+ return { enumPath };
20593
+ }
20594
+ var prefer_enum_item_default = createRule({
20595
+ create(context) {
20596
+ const [{ fixNumericToValue = false, performanceMode = false } = {}] = context.options;
20597
+ const services = ESLintUtils3.getParserServices(context);
20598
+ const checker = services.program.getTypeChecker();
20599
+ const unionTypesCache = new WeakMap;
20600
+ const enumPathCache = new WeakMap;
20601
+ const enumItemInfoCache = new WeakMap;
20602
+ const enumLookupCache = new WeakMap;
20603
+ function getUnionTypesCached(type3) {
20604
+ const cached = unionTypesCache.get(type3);
20605
+ if (cached !== undefined)
20606
+ return cached;
20607
+ const resolved = isUnionType(type3) ? unionConstituents(type3) : [type3];
20608
+ unionTypesCache.set(type3, resolved);
20609
+ return resolved;
20610
+ }
20611
+ function getFullEnumPathCached(type3) {
20612
+ const cached = enumPathCache.get(type3);
20613
+ if (cached !== undefined)
20614
+ return cached === false ? undefined : cached;
20615
+ const resolved = getFullEnumPath(checker, type3);
20616
+ enumPathCache.set(type3, resolved ?? false);
20617
+ return resolved;
20618
+ }
20619
+ function getEnumItemInfo(type3) {
20620
+ const cached = enumItemInfoCache.get(type3);
20621
+ if (cached !== undefined)
20622
+ return cached === false ? undefined : cached;
20623
+ const enumPath = getFullEnumPathCached(type3);
20624
+ if (enumPath === undefined) {
20625
+ enumItemInfoCache.set(type3, false);
20626
+ return;
20627
+ }
20628
+ const nameLiteral = getPropertyLiteralType(checker, type3, "Name");
20629
+ const valueLiteral = getPropertyLiteralType(checker, type3, "Value");
20630
+ const info = {
20631
+ enumPath,
20632
+ ...typeof nameLiteral === "string" ? { nameLiteral } : {},
20633
+ ...typeof valueLiteral === "number" ? { valueLiteral } : {}
20634
+ };
20635
+ enumItemInfoCache.set(type3, info);
20636
+ return info;
20637
+ }
20638
+ function getEnumLookup(type3) {
20639
+ const cached = enumLookupCache.get(type3);
20640
+ if (cached !== undefined)
20641
+ return cached === false ? undefined : cached;
20642
+ const unionTypes = getUnionTypesCached(type3);
20643
+ const stringMap = new Map;
20644
+ const numberMap = new Map;
20645
+ let hasAny = false;
20646
+ for (const memberType of unionTypes) {
20647
+ const info = getEnumItemInfo(memberType);
20648
+ if (info === undefined)
20649
+ continue;
20650
+ hasAny = true;
20651
+ if (info.nameLiteral !== undefined && !stringMap.has(info.nameLiteral)) {
20652
+ stringMap.set(info.nameLiteral, info.enumPath);
20653
+ }
20654
+ if (info.valueLiteral !== undefined && !numberMap.has(info.valueLiteral)) {
20655
+ numberMap.set(info.valueLiteral, info.enumPath);
20656
+ }
20657
+ }
20658
+ if (!hasAny) {
20659
+ enumLookupCache.set(type3, false);
20660
+ return;
20661
+ }
20662
+ const lookup = { numberMap, stringMap };
20663
+ enumLookupCache.set(type3, lookup);
20664
+ return lookup;
20665
+ }
20666
+ function resolveAliasSymbol(symbol3) {
20667
+ if ((symbol3.flags & SymbolFlags.Alias) !== 0)
20668
+ return checker.getAliasedSymbol(symbol3);
20669
+ return symbol3;
20670
+ }
20671
+ function buildEnumLiteralIndex(anchorNode) {
20672
+ const resolved = checker.resolveName("Enum", anchorNode, SymbolFlags.Namespace, false);
20673
+ if (resolved === undefined)
20674
+ return;
20675
+ const enumSymbol = resolveAliasSymbol(resolved);
20676
+ if ((enumSymbol.flags & SymbolFlags.Namespace) === 0)
20677
+ return;
20678
+ const stringSet = new Set;
20679
+ const numberSet = new Set;
20680
+ const stack = [enumSymbol];
20681
+ const visited2 = new Set;
20682
+ while (stack.length > 0) {
20683
+ const current = stack.pop();
20684
+ if (current === undefined)
20685
+ continue;
20686
+ if (visited2.has(current))
20687
+ continue;
20688
+ visited2.add(current);
20689
+ const exports = checker.getExportsOfModule(current);
20690
+ for (const exportSymbol of exports) {
20691
+ const unaliased = resolveAliasSymbol(exportSymbol);
20692
+ if ((unaliased.flags & SymbolFlags.Namespace) !== 0) {
20693
+ stack.push(unaliased);
20694
+ continue;
20695
+ }
20696
+ const type3 = checker.getTypeOfSymbol(unaliased);
20697
+ const info = getEnumItemInfo(type3);
20698
+ if (info === undefined)
20699
+ continue;
20700
+ if (info.nameLiteral !== undefined)
20701
+ stringSet.add(info.nameLiteral);
20702
+ if (info.valueLiteral !== undefined)
20703
+ numberSet.add(info.valueLiteral);
20704
+ }
20705
+ }
20706
+ if (stringSet.size === 0 && numberSet.size === 0)
20707
+ return;
20708
+ return { numberSet, stringSet };
20709
+ }
20710
+ function getEnumLiteralIndex(anchorNode) {
20711
+ const cached = enumLiteralIndexCache.get(checker);
20712
+ if (cached !== undefined)
20713
+ return cached === false ? undefined : cached;
20714
+ const built = buildEnumLiteralIndex(anchorNode);
20715
+ enumLiteralIndexCache.set(checker, built ?? false);
20716
+ return built;
20717
+ }
20718
+ function getContextualType(node) {
20719
+ const tsNode = services.esTreeNodeToTSNodeMap.get(node);
20720
+ return checker.getContextualType(tsNode);
20721
+ }
20722
+ function shouldSkipLiteral(node, value) {
20723
+ if (!performanceMode)
20724
+ return false;
20725
+ const tsNode = services.esTreeNodeToTSNodeMap.get(node);
20726
+ if (tsNode === undefined)
20727
+ return false;
20728
+ const index2 = getEnumLiteralIndex(tsNode);
20729
+ if (index2 === undefined)
20730
+ return false;
20731
+ if (typeof value === "string")
20732
+ return !index2.stringSet.has(value);
20733
+ return !index2.numberSet.has(value);
20734
+ }
20735
+ function findEnumMatch(contextualType, literalValue) {
20736
+ if (performanceMode) {
20737
+ const lookup = getEnumLookup(contextualType);
20738
+ if (lookup === undefined)
20739
+ return;
20740
+ const enumPath = typeof literalValue === "string" ? lookup.stringMap.get(literalValue) : lookup.numberMap.get(literalValue);
20741
+ return enumPath === undefined ? undefined : createEnumMatch(enumPath);
20742
+ }
20743
+ const unionTypes = getUnionTypes(contextualType);
20744
+ for (const memberType of unionTypes) {
20745
+ const enumPath = getFullEnumPath(checker, memberType);
20746
+ if (enumPath === undefined)
20747
+ continue;
20748
+ if (typeof literalValue === "string") {
20749
+ const nameProperty = getPropertyLiteralType(checker, memberType, "Name");
20750
+ if (nameProperty === literalValue)
20751
+ return createEnumMatch(enumPath);
20752
+ } else {
20753
+ const valueProperty = getPropertyLiteralType(checker, memberType, "Value");
20754
+ if (valueProperty === literalValue)
20755
+ return createEnumMatch(enumPath);
20756
+ }
20757
+ }
20758
+ return;
20759
+ }
20760
+ return {
20761
+ Literal(node) {
20762
+ const { value } = node;
20763
+ if (typeof value !== "string" && typeof value !== "number")
20764
+ return;
20765
+ if (!canHaveContextualEnumType(node))
20766
+ return;
20767
+ if (shouldSkipLiteral(node, value))
20768
+ return;
20769
+ const contextualType = getContextualType(node);
20770
+ if (contextualType === undefined)
20771
+ return;
20772
+ const match = findEnumMatch(contextualType, value);
20773
+ if (match === undefined)
20774
+ return;
20775
+ const isString = typeof value === "string";
20776
+ const displayValue = isString ? `"${value}"` : String(value);
20777
+ const fixPath = fixNumericToValue && !isString ? `${match.enumPath}.Value` : match.enumPath;
20778
+ const needsJSXBraces = isJSXAttributeValue(node);
20779
+ const fixText = needsJSXBraces ? `{${fixPath}}` : fixPath;
20780
+ context.report({
20781
+ data: {
20782
+ enumType: match.enumPath.split(".").slice(0, -1).join("."),
20783
+ expected: fixPath,
20784
+ value: displayValue
20785
+ },
20786
+ fix(fixer) {
20787
+ return fixer.replaceText(node, fixText);
20788
+ },
20789
+ messageId: "preferEnumItem",
20790
+ node
20791
+ });
20792
+ }
20793
+ };
20794
+ },
20795
+ defaultOptions: [{ fixNumericToValue: false, performanceMode: false }],
20796
+ meta: {
20797
+ docs: {
20798
+ description: "Enforce using EnumItem values instead of string or number literals."
20799
+ },
20800
+ fixable: "code",
20801
+ messages: {
20802
+ preferEnumItem: "Use `{{ expected }}` instead of `{{ value }}`. EnumItems provide type safety and avoid magic values."
20803
+ },
20804
+ schema: [
20805
+ {
20806
+ additionalProperties: false,
20807
+ properties: {
20808
+ fixNumericToValue: {
20809
+ default: false,
20810
+ description: "When true, numeric literals fix to Enum.X.Y.Value instead of Enum.X.Y",
20811
+ type: "boolean"
20812
+ },
20813
+ performanceMode: {
20814
+ default: false,
20815
+ description: "When true, uses caching to speed up enum lookups without changing behavior",
20816
+ type: "boolean"
20817
+ }
20818
+ },
20819
+ type: "object"
20820
+ }
20821
+ ],
20822
+ type: "suggestion"
20823
+ },
20824
+ name: "prefer-enum-item"
20825
+ });
20826
+
20827
+ // src/rules/prefer-module-scope-constants.ts
20828
+ var import_scope_manager3 = __toESM(require_dist2(), 1);
20829
+ import { AST_NODE_TYPES as AST_NODE_TYPES8 } from "@typescript-eslint/utils";
20830
+ var SCREAMING_SNAKE_CASE = /^[A-Z][A-Z0-9_]*$/;
20831
+ function isTopScope(scope) {
20832
+ const { type: type3 } = scope;
20833
+ if (type3 === import_scope_manager3.ScopeType.module || type3 === import_scope_manager3.ScopeType.global)
20834
+ return true;
20835
+ if (scope.upper?.type === import_scope_manager3.ScopeType.global) {
20836
+ const { block } = scope.upper;
20837
+ if (block.type === AST_NODE_TYPES8.Program && block.sourceType === "script")
20838
+ return true;
20839
+ }
20840
+ return false;
20841
+ }
20842
+ var prefer_module_scope_constants_default = createRule({
20843
+ create(context) {
20844
+ let inConstDeclaration = false;
20845
+ return {
20846
+ VariableDeclaration(node) {
20847
+ inConstDeclaration = node.kind === "const";
20848
+ },
20849
+ "VariableDeclaration:exit"() {
20850
+ inConstDeclaration = false;
20851
+ },
20852
+ VariableDeclarator(node) {
20853
+ const { id: id2 } = node;
20854
+ if (id2.type !== AST_NODE_TYPES8.Identifier || !SCREAMING_SNAKE_CASE.test(id2.name))
20855
+ return;
20856
+ if (!inConstDeclaration) {
20857
+ context.report({
20858
+ messageId: "mustUseConst",
20859
+ node
20860
+ });
20861
+ return;
20862
+ }
20863
+ const scope = context.sourceCode.getScope(node);
20864
+ if (isTopScope(scope))
20865
+ return;
20866
+ context.report({
20867
+ messageId: "mustBeModuleScope",
20868
+ node
20869
+ });
20870
+ }
20871
+ };
20872
+ },
20873
+ defaultOptions: [],
19788
20874
  meta: {
19789
20875
  docs: {
19790
20876
  description: "Prefer that screaming snake case variables always be defined using `const`, and always appear at module scope."
@@ -19800,7 +20886,7 @@ var prefer_module_scope_constants_default = createRule({
19800
20886
  });
19801
20887
 
19802
20888
  // src/rules/prefer-pascal-case-enums.ts
19803
- import { AST_NODE_TYPES as AST_NODE_TYPES8 } from "@typescript-eslint/utils";
20889
+ import { AST_NODE_TYPES as AST_NODE_TYPES9 } from "@typescript-eslint/utils";
19804
20890
 
19805
20891
  // src/utilities/casing-utilities.ts
19806
20892
  var SPLIT_LOWER_TO_UPPER = regex2("([\\p{Ll}\\d])(\\p{Lu})", "gu");
@@ -19840,9 +20926,9 @@ function toPascalCase(value) {
19840
20926
  // src/rules/prefer-pascal-case-enums.ts
19841
20927
  var STARTS_WITH_DIGIT = regex2("^\\d");
19842
20928
  function getIdentifierName(node) {
19843
- if (node.type === AST_NODE_TYPES8.Identifier)
20929
+ if (node.type === AST_NODE_TYPES9.Identifier)
19844
20930
  return node.name;
19845
- if (node.type !== AST_NODE_TYPES8.Literal || typeof node.value !== "string")
20931
+ if (node.type !== AST_NODE_TYPES9.Literal || typeof node.value !== "string")
19846
20932
  return;
19847
20933
  return STARTS_WITH_DIGIT.test(node.value) ? undefined : node.value;
19848
20934
  }
@@ -19885,17 +20971,17 @@ var prefer_pascal_case_enums_default = createRule({
19885
20971
  });
19886
20972
 
19887
20973
  // src/utilities/pattern-replacement/pattern-matcher.ts
19888
- import { AST_NODE_TYPES as AST_NODE_TYPES10 } from "@typescript-eslint/types";
20974
+ import { AST_NODE_TYPES as AST_NODE_TYPES11 } from "@typescript-eslint/types";
19889
20975
 
19890
20976
  // src/utilities/pattern-replacement/constant-folder.ts
19891
- import { AST_NODE_TYPES as AST_NODE_TYPES9 } from "@typescript-eslint/types";
20977
+ import { AST_NODE_TYPES as AST_NODE_TYPES10 } from "@typescript-eslint/types";
19892
20978
  function normalizeZero(num) {
19893
20979
  return Object.is(num, -0) ? 0 : num;
19894
20980
  }
19895
20981
  function unwrap(node) {
19896
20982
  switch (node.type) {
19897
- case AST_NODE_TYPES9.TSAsExpression:
19898
- case AST_NODE_TYPES9.TSNonNullExpression:
20983
+ case AST_NODE_TYPES10.TSAsExpression:
20984
+ case AST_NODE_TYPES10.TSNonNullExpression:
19899
20985
  return unwrap(node.expression);
19900
20986
  default:
19901
20987
  return node;
@@ -19903,10 +20989,10 @@ function unwrap(node) {
19903
20989
  }
19904
20990
  function evaluateConstant(node) {
19905
20991
  const expression = unwrap(node);
19906
- if (expression.type === AST_NODE_TYPES9.Literal && typeof expression.value === "number") {
20992
+ if (expression.type === AST_NODE_TYPES10.Literal && typeof expression.value === "number") {
19907
20993
  return normalizeZero(expression.value);
19908
20994
  }
19909
- if (expression.type === AST_NODE_TYPES9.UnaryExpression) {
20995
+ if (expression.type === AST_NODE_TYPES10.UnaryExpression) {
19910
20996
  const argument = evaluateConstant(expression.argument);
19911
20997
  if (argument === undefined)
19912
20998
  return;
@@ -19919,8 +21005,8 @@ function evaluateConstant(node) {
19919
21005
  return;
19920
21006
  }
19921
21007
  }
19922
- if (expression.type === AST_NODE_TYPES9.BinaryExpression) {
19923
- if (expression.left.type === AST_NODE_TYPES9.PrivateIdentifier)
21008
+ if (expression.type === AST_NODE_TYPES10.BinaryExpression) {
21009
+ if (expression.left.type === AST_NODE_TYPES10.PrivateIdentifier)
19924
21010
  return;
19925
21011
  const left = evaluateConstant(expression.left);
19926
21012
  const right = evaluateConstant(expression.right);
@@ -19963,14 +21049,14 @@ function buildPatternIndex(patterns2) {
19963
21049
  }
19964
21050
  function resolveCallee(node) {
19965
21051
  const callee = unwrap(node.callee);
19966
- if (node.type === AST_NODE_TYPES10.NewExpression && callee.type === AST_NODE_TYPES10.Identifier) {
21052
+ if (node.type === AST_NODE_TYPES11.NewExpression && callee.type === AST_NODE_TYPES11.Identifier) {
19967
21053
  return { kind: "constructor", typeName: callee.name };
19968
21054
  }
19969
- if (node.type === AST_NODE_TYPES10.CallExpression) {
19970
- const member = callee.type === AST_NODE_TYPES10.ChainExpression ? unwrap(callee.expression) : callee;
19971
- if (member.type === AST_NODE_TYPES10.MemberExpression && !member.computed) {
21055
+ if (node.type === AST_NODE_TYPES11.CallExpression) {
21056
+ const member = callee.type === AST_NODE_TYPES11.ChainExpression ? unwrap(callee.expression) : callee;
21057
+ if (member.type === AST_NODE_TYPES11.MemberExpression && !member.computed) {
19972
21058
  const object3 = unwrap(member.object);
19973
- if (object3.type === AST_NODE_TYPES10.Identifier && member.property.type === AST_NODE_TYPES10.Identifier) {
21059
+ if (object3.type === AST_NODE_TYPES11.Identifier && member.property.type === AST_NODE_TYPES11.Identifier) {
19974
21060
  return {
19975
21061
  kind: "staticMethod",
19976
21062
  methodName: member.property.name,
@@ -19987,9 +21073,9 @@ function captureParameter(node, sourceCode) {
19987
21073
  const constValue = evaluateConstant(expression);
19988
21074
  let expressionKey;
19989
21075
  let isComplex = false;
19990
- if (expression.type === AST_NODE_TYPES10.Literal && typeof expression.value === "number") {
21076
+ if (expression.type === AST_NODE_TYPES11.Literal && typeof expression.value === "number") {
19991
21077
  expressionKey = `literal:${normalizeZero(expression.value)}`;
19992
- } else if (expression.type === AST_NODE_TYPES10.Identifier) {
21078
+ } else if (expression.type === AST_NODE_TYPES11.Identifier) {
19993
21079
  if (expression.name === "undefined")
19994
21080
  expressionKey = "undefined";
19995
21081
  else
@@ -20015,7 +21101,7 @@ function matchParameters(patterns2, parameters3, sourceCode) {
20015
21101
  continue;
20016
21102
  const parameter2 = parameters3[index2];
20017
21103
  const unwrappedParameter = parameter2 === undefined ? undefined : unwrap(parameter2);
20018
- const isMissing = parameter2 === undefined || unwrappedParameter?.type === AST_NODE_TYPES10.Identifier && unwrappedParameter.name === "undefined";
21104
+ const isMissing = parameter2 === undefined || unwrappedParameter?.type === AST_NODE_TYPES11.Identifier && unwrappedParameter.name === "undefined";
20019
21105
  if (pattern4.kind === "literal") {
20020
21106
  if (isMissing)
20021
21107
  return;
@@ -20305,13 +21391,13 @@ var prefer_pattern_replacements_default = createRule({
20305
21391
  });
20306
21392
 
20307
21393
  // src/rules/prefer-sequence-overloads.ts
20308
- import { AST_NODE_TYPES as AST_NODE_TYPES11 } from "@typescript-eslint/types";
21394
+ import { AST_NODE_TYPES as AST_NODE_TYPES12 } from "@typescript-eslint/types";
20309
21395
  var sequenceDescriptors = [
20310
21396
  { keypointName: "ColorSequenceKeypoint", sequenceName: "ColorSequence" },
20311
21397
  { keypointName: "NumberSequenceKeypoint", sequenceName: "NumberSequence" }
20312
21398
  ];
20313
21399
  function isSequenceIdentifier(node) {
20314
- if (node.type !== AST_NODE_TYPES11.Identifier)
21400
+ if (node.type !== AST_NODE_TYPES12.Identifier)
20315
21401
  return false;
20316
21402
  for (const { sequenceName } of sequenceDescriptors)
20317
21403
  if (sequenceName === node.name)
@@ -20325,16 +21411,16 @@ function findDescriptor(sequenceName) {
20325
21411
  return;
20326
21412
  }
20327
21413
  var isNumericLiteral = Compile(build_default.Object({
20328
- type: build_default.Literal(AST_NODE_TYPES11.Literal),
21414
+ type: build_default.Literal(AST_NODE_TYPES12.Literal),
20329
21415
  value: build_default.Number()
20330
21416
  }));
20331
21417
  function isExpressionArgument(argument) {
20332
- return argument !== undefined && argument.type !== AST_NODE_TYPES11.SpreadElement;
21418
+ return argument !== undefined && argument.type !== AST_NODE_TYPES12.SpreadElement;
20333
21419
  }
20334
21420
  function extractKeypoint(element, descriptor) {
20335
- if (element === undefined || element.type !== AST_NODE_TYPES11.NewExpression)
21421
+ if (element === undefined || element.type !== AST_NODE_TYPES12.NewExpression)
20336
21422
  return;
20337
- if (element.callee.type !== AST_NODE_TYPES11.Identifier || element.callee.name !== descriptor.keypointName)
21423
+ if (element.callee.type !== AST_NODE_TYPES12.Identifier || element.callee.name !== descriptor.keypointName)
20338
21424
  return;
20339
21425
  if (element.arguments.length !== 2)
20340
21426
  return;
@@ -20360,7 +21446,7 @@ var prefer_sequence_overloads_default = createRule({
20360
21446
  if (descriptor === undefined || node.arguments.length !== 1)
20361
21447
  return;
20362
21448
  const [argument] = node.arguments;
20363
- if (argument === undefined || argument.type !== AST_NODE_TYPES11.ArrayExpression || argument.elements.length !== 2)
21449
+ if (argument === undefined || argument.type !== AST_NODE_TYPES12.ArrayExpression || argument.elements.length !== 2)
20364
21450
  return;
20365
21451
  const firstElement = argument.elements[0] ?? undefined;
20366
21452
  const secondElement = argument.elements[1] ?? undefined;
@@ -20597,51 +21683,70 @@ function reconstructText(node) {
20597
21683
  }
20598
21684
  return text;
20599
21685
  }
21686
+ function evaluateLiteral(node) {
21687
+ const { value } = node;
21688
+ return isNumber(value) ? value : undefined;
21689
+ }
21690
+ function evaluateUnary(node) {
21691
+ const { argument, operator } = node;
21692
+ if (!isRecord3(argument))
21693
+ return;
21694
+ const argumentValue = evaluateExpression(argument);
21695
+ if (argumentValue === undefined)
21696
+ return;
21697
+ if (operator === "-")
21698
+ return -argumentValue;
21699
+ if (operator === "+")
21700
+ return argumentValue;
21701
+ return;
21702
+ }
21703
+ function evaluateBinaryOperation(operator, left, right) {
21704
+ switch (operator) {
21705
+ case "+":
21706
+ return left + right;
21707
+ case "-":
21708
+ return left - right;
21709
+ case "*":
21710
+ return left * right;
21711
+ case "/":
21712
+ return right === 0 ? undefined : left / right;
21713
+ case "%":
21714
+ return right === 0 ? undefined : left % right;
21715
+ default:
21716
+ return;
21717
+ }
21718
+ }
21719
+ function evaluateBinary(node) {
21720
+ const { right, left, operator } = node;
21721
+ if (!(isRecord3(left) && isRecord3(right)))
21722
+ return;
21723
+ if (typeof operator !== "string" || !OPERATORS2.has(operator))
21724
+ return;
21725
+ const leftValue = evaluateExpression(left);
21726
+ const rightValue = evaluateExpression(right);
21727
+ if (leftValue === undefined || rightValue === undefined)
21728
+ return;
21729
+ return evaluateBinaryOperation(operator, leftValue, rightValue);
21730
+ }
20600
21731
  function evaluateExpression(node) {
20601
21732
  if (!isRecord3(node))
20602
21733
  return;
20603
- const nodeType = node.type;
20604
- let value;
20605
- if (nodeType === TSESTree7.AST_NODE_TYPES.Literal) {
20606
- const { value: literalValue } = node;
20607
- value = isNumber(literalValue) ? literalValue : undefined;
20608
- }
20609
- if (nodeType === TSESTree7.AST_NODE_TYPES.UnaryExpression) {
20610
- const { argument, operator } = node;
20611
- if (isRecord3(argument)) {
20612
- const argumentValue = evaluateExpression(argument);
20613
- if (operator === "-" && argumentValue !== undefined)
20614
- value = -argumentValue;
20615
- if (operator === "+" && argumentValue !== undefined)
20616
- value = argumentValue;
20617
- }
20618
- }
20619
- if (nodeType === TSESTree7.AST_NODE_TYPES.BinaryExpression) {
20620
- const { right, left, operator } = node;
20621
- if (isRecord3(left) && isRecord3(right) && typeof operator === "string" && OPERATORS2.has(operator)) {
20622
- const leftValue = evaluateExpression(left);
20623
- const rightValue = evaluateExpression(right);
20624
- if (leftValue !== undefined && rightValue !== undefined) {
20625
- if (operator === "+")
20626
- value = leftValue + rightValue;
20627
- if (operator === "-")
20628
- value = leftValue - rightValue;
20629
- if (operator === "*")
20630
- value = leftValue * rightValue;
20631
- if (operator === "/")
20632
- value = rightValue === 0 ? undefined : leftValue / rightValue;
20633
- if (operator === "%")
20634
- value = rightValue === 0 ? undefined : leftValue % rightValue;
20635
- }
20636
- }
21734
+ switch (node.type) {
21735
+ case TSESTree7.AST_NODE_TYPES.Literal:
21736
+ return evaluateLiteral(node);
21737
+ case TSESTree7.AST_NODE_TYPES.UnaryExpression:
21738
+ return evaluateUnary(node);
21739
+ case TSESTree7.AST_NODE_TYPES.BinaryExpression:
21740
+ return evaluateBinary(node);
21741
+ default:
21742
+ return;
20637
21743
  }
20638
- return value;
20639
21744
  }
20640
21745
  function collectArguments(_context2, parameters3) {
20641
21746
  if (parameters3.length !== 4)
20642
21747
  return;
20643
- const texts = [undefined, undefined, undefined, undefined];
20644
- for (let index2 = 0;index2 < 4; index2++) {
21748
+ const texts = new Array(4);
21749
+ for (let index2 = 0;index2 < 4; index2 += 1) {
20645
21750
  const parameter2 = parameters3[index2];
20646
21751
  if (!(isRecord3(parameter2) && hasTypeProperty(parameter2)))
20647
21752
  return;
@@ -20653,8 +21758,9 @@ function collectArguments(_context2, parameters3) {
20653
21758
  texts[index2] = text;
20654
21759
  }
20655
21760
  const [scaleXText, offsetXText, scaleYText, offsetYText] = texts;
20656
- if (scaleXText === undefined || offsetXText === undefined || scaleYText === undefined || offsetYText === undefined)
21761
+ if (scaleXText === undefined || offsetXText === undefined || scaleYText === undefined || offsetYText === undefined) {
20657
21762
  return;
21763
+ }
20658
21764
  return { offsetXText, offsetYText, scaleXText, scaleYText };
20659
21765
  }
20660
21766
  var preferUDim2Shorthand = {
@@ -20708,16 +21814,16 @@ var preferUDim2Shorthand = {
20708
21814
  var prefer_udim2_shorthand_default = preferUDim2Shorthand;
20709
21815
 
20710
21816
  // src/rules/react-hooks-strict-return.ts
20711
- import { AST_NODE_TYPES as AST_NODE_TYPES12 } from "@typescript-eslint/utils";
21817
+ import { AST_NODE_TYPES as AST_NODE_TYPES13 } from "@typescript-eslint/utils";
20712
21818
  var MAX_RETURN_ELEMENTS = 2;
20713
21819
  var HOOK_PATTERN = /^use[A-Z0-9].*$/;
20714
21820
  function isHookNode(node) {
20715
21821
  let name;
20716
- if (node.type === AST_NODE_TYPES12.VariableDeclarator && node.id.type === AST_NODE_TYPES12.Identifier) {
21822
+ if (node.type === AST_NODE_TYPES13.VariableDeclarator && node.id.type === AST_NODE_TYPES13.Identifier) {
20717
21823
  ({ name } = node.id);
20718
- } else if (node.type === AST_NODE_TYPES12.FunctionDeclaration && node.id)
21824
+ } else if (node.type === AST_NODE_TYPES13.FunctionDeclaration && node.id)
20719
21825
  ({ name } = node.id);
20720
- else if (node.type === AST_NODE_TYPES12.FunctionExpression && node.id)
21826
+ else if (node.type === AST_NODE_TYPES13.FunctionExpression && node.id)
20721
21827
  ({ name } = node.id);
20722
21828
  return name !== undefined && HOOK_PATTERN.test(name);
20723
21829
  }
@@ -20741,27 +21847,27 @@ function getArrayElementsFromVariable(scope, name) {
20741
21847
  if (!identifier3.parent)
20742
21848
  continue;
20743
21849
  const { parent } = identifier3;
20744
- if (parent.type !== AST_NODE_TYPES12.VariableDeclarator)
21850
+ if (parent.type !== AST_NODE_TYPES13.VariableDeclarator)
20745
21851
  continue;
20746
- if (!parent.init || parent.init.type !== AST_NODE_TYPES12.ArrayExpression)
21852
+ if (!parent.init || parent.init.type !== AST_NODE_TYPES13.ArrayExpression)
20747
21853
  continue;
20748
21854
  elements.push(...parent.init.elements);
20749
21855
  }
20750
21856
  return elements;
20751
21857
  }
20752
21858
  function countReturnElements(argument, scope) {
20753
- if (argument.type === AST_NODE_TYPES12.Identifier)
21859
+ if (argument.type === AST_NODE_TYPES13.Identifier)
20754
21860
  return getArrayElementsFromVariable(scope, argument.name).length;
20755
- if (argument.type !== AST_NODE_TYPES12.ArrayExpression)
21861
+ if (argument.type !== AST_NODE_TYPES13.ArrayExpression)
20756
21862
  return 0;
20757
21863
  let count = 0;
20758
21864
  for (const element of argument.elements) {
20759
21865
  if (element === null)
20760
21866
  count += 1;
20761
- else if (element.type === AST_NODE_TYPES12.SpreadElement) {
20762
- if (element.argument.type === AST_NODE_TYPES12.Identifier) {
21867
+ else if (element.type === AST_NODE_TYPES13.SpreadElement) {
21868
+ if (element.argument.type === AST_NODE_TYPES13.Identifier) {
20763
21869
  count += getArrayElementsFromVariable(scope, element.argument.name).length;
20764
- } else if (element.argument.type === AST_NODE_TYPES12.ArrayExpression) {
21870
+ } else if (element.argument.type === AST_NODE_TYPES13.ArrayExpression) {
20765
21871
  count += element.argument.elements.length;
20766
21872
  } else
20767
21873
  count += 1;
@@ -20774,14 +21880,14 @@ function exceedsMaxReturnProperties(node, scope) {
20774
21880
  const { argument } = node;
20775
21881
  if (argument === null)
20776
21882
  return false;
20777
- if (argument.type === AST_NODE_TYPES12.ObjectExpression)
21883
+ if (argument.type === AST_NODE_TYPES13.ObjectExpression)
20778
21884
  return false;
20779
- if (argument.type === AST_NODE_TYPES12.Identifier) {
21885
+ if (argument.type === AST_NODE_TYPES13.Identifier) {
20780
21886
  const variable = getVariableByName(scope, argument.name);
20781
21887
  if (variable) {
20782
21888
  for (const { identifier: identifier3 } of variable.references) {
20783
21889
  const { parent } = identifier3;
20784
- if (parent?.type === AST_NODE_TYPES12.VariableDeclarator && parent.init?.type === AST_NODE_TYPES12.ObjectExpression) {
21890
+ if (parent?.type === AST_NODE_TYPES13.VariableDeclarator && parent.init?.type === AST_NODE_TYPES13.ObjectExpression) {
20785
21891
  return false;
20786
21892
  }
20787
21893
  }
@@ -20803,13 +21909,13 @@ var react_hooks_strict_return_default = createRule({
20803
21909
  return {
20804
21910
  ArrowFunctionExpression(node) {
20805
21911
  const { parent } = node;
20806
- if (parent?.type === AST_NODE_TYPES12.VariableDeclarator && parent.id.type === AST_NODE_TYPES12.Identifier && HOOK_PATTERN.test(parent.id.name)) {
21912
+ if (parent?.type === AST_NODE_TYPES13.VariableDeclarator && parent.id.type === AST_NODE_TYPES13.Identifier && HOOK_PATTERN.test(parent.id.name)) {
20807
21913
  hookDepth += 1;
20808
21914
  }
20809
21915
  },
20810
21916
  "ArrowFunctionExpression:exit"(node) {
20811
21917
  const { parent } = node;
20812
- if (parent?.type === AST_NODE_TYPES12.VariableDeclarator && parent.id.type === AST_NODE_TYPES12.Identifier && HOOK_PATTERN.test(parent.id.name)) {
21918
+ if (parent?.type === AST_NODE_TYPES13.VariableDeclarator && parent.id.type === AST_NODE_TYPES13.Identifier && HOOK_PATTERN.test(parent.id.name)) {
20813
21919
  hookDepth -= 1;
20814
21920
  }
20815
21921
  },
@@ -20890,6 +21996,67 @@ function getHookName3(callExpression) {
20890
21996
  }
20891
21997
  return;
20892
21998
  }
21999
+ function findVariableInScope(identifier3, scope) {
22000
+ let variable;
22001
+ let currentScope = scope;
22002
+ while (typeof currentScope === "object" && currentScope !== null) {
22003
+ const current = currentScope;
22004
+ variable = current.set.get(identifier3.name);
22005
+ if (typeof variable === "object" && variable !== null)
22006
+ break;
22007
+ currentScope = current.upper;
22008
+ }
22009
+ return variable;
22010
+ }
22011
+ function processFunctionDeclaration(node) {
22012
+ const castNode = node;
22013
+ return {
22014
+ isAsync: Boolean(castNode.async),
22015
+ node,
22016
+ type: "function-declaration"
22017
+ };
22018
+ }
22019
+ function processArrowFunction(init) {
22020
+ const arrowNode = init;
22021
+ return {
22022
+ isAsync: Boolean(init.async),
22023
+ node: arrowNode,
22024
+ type: "arrow"
22025
+ };
22026
+ }
22027
+ function processFunctionExpression(init) {
22028
+ const exprNode = init;
22029
+ return {
22030
+ isAsync: Boolean(init.async),
22031
+ node: exprNode,
22032
+ type: "function-expression"
22033
+ };
22034
+ }
22035
+ function checkVariableDeclaratorDef(node) {
22036
+ const castNode = node;
22037
+ if (castNode.type !== TSESTree8.AST_NODE_TYPES.VariableDeclarator)
22038
+ return;
22039
+ if (typeof castNode.init !== "object" || castNode.init === null)
22040
+ return;
22041
+ const castInit = castNode.init;
22042
+ if (castInit.type === TSESTree8.AST_NODE_TYPES.ArrowFunctionExpression)
22043
+ return processArrowFunction(castNode.init);
22044
+ if (castInit.type === TSESTree8.AST_NODE_TYPES.FunctionExpression)
22045
+ return processFunctionExpression(castNode.init);
22046
+ return;
22047
+ }
22048
+ function processSingleDefinition(definition) {
22049
+ if (typeof definition !== "object" || definition === null)
22050
+ return;
22051
+ const castDef = definition;
22052
+ const { node } = castDef;
22053
+ if (typeof node !== "object" || node === null)
22054
+ return;
22055
+ const castNode = node;
22056
+ if (castNode.type === TSESTree8.AST_NODE_TYPES.FunctionDeclaration)
22057
+ return processFunctionDeclaration(node);
22058
+ return checkVariableDeclaratorDef(node);
22059
+ }
20893
22060
  function resolveIdentifierToFunction(identifier3, context) {
20894
22061
  try {
20895
22062
  const scope = context.sourceCode.getScope?.(identifier3);
@@ -20899,54 +22066,16 @@ function resolveIdentifierToFunction(identifier3, context) {
20899
22066
  const setVal = scopeObj.set;
20900
22067
  if (!(setVal instanceof Map))
20901
22068
  return;
20902
- let variable;
20903
- let currentScope = scope;
20904
- while (typeof currentScope === "object" && currentScope !== null) {
20905
- const current = currentScope;
20906
- variable = current.set.get(identifier3.name);
20907
- if (typeof variable === "object" && variable !== null)
20908
- break;
20909
- currentScope = current.upper;
20910
- }
22069
+ const variable = findVariableInScope(identifier3, scope);
20911
22070
  if (typeof variable !== "object" || variable === null)
20912
22071
  return;
20913
22072
  const castVariable = variable;
20914
22073
  if (!Array.isArray(castVariable.defs) || castVariable.defs.length === 0)
20915
22074
  return;
20916
22075
  for (const definition of castVariable.defs) {
20917
- if (typeof definition !== "object" || definition === null)
20918
- continue;
20919
- const castDefinition = definition;
20920
- const { node } = castDefinition;
20921
- if (typeof node !== "object" || node === null)
20922
- continue;
20923
- const castNode = node;
20924
- if (castNode.type === TSESTree8.AST_NODE_TYPES.FunctionDeclaration) {
20925
- return {
20926
- isAsync: Boolean(castNode.async),
20927
- node,
20928
- type: "function-declaration"
20929
- };
20930
- }
20931
- if (castNode.type === TSESTree8.AST_NODE_TYPES.VariableDeclarator && typeof castNode.init === "object" && castNode.init !== null) {
20932
- const castInit = castNode.init;
20933
- if (castInit.type === TSESTree8.AST_NODE_TYPES.ArrowFunctionExpression) {
20934
- const arrowNode = castNode.init;
20935
- return {
20936
- isAsync: Boolean(arrowNode.async),
20937
- node: arrowNode,
20938
- type: "arrow"
20939
- };
20940
- }
20941
- if (castInit.type === TSESTree8.AST_NODE_TYPES.FunctionExpression) {
20942
- const castInitNode = castNode.init;
20943
- return {
20944
- isAsync: Boolean(castInitNode.async),
20945
- node: castInitNode,
20946
- type: "function-expression"
20947
- };
20948
- }
20949
- }
22076
+ const result = processSingleDefinition(definition);
22077
+ if (result !== undefined)
22078
+ return result;
20950
22079
  }
20951
22080
  return;
20952
22081
  } catch {
@@ -21178,7 +22307,7 @@ var requireNamedEffectFunctions = {
21178
22307
  var require_named_effect_functions_default = requireNamedEffectFunctions;
21179
22308
 
21180
22309
  // src/rules/require-paired-calls.ts
21181
- import { AST_NODE_TYPES as AST_NODE_TYPES13 } from "@typescript-eslint/types";
22310
+ import { AST_NODE_TYPES as AST_NODE_TYPES14 } from "@typescript-eslint/types";
21182
22311
  var isStringArray = Compile(build_default.Readonly(build_default.Array(build_default.String())));
21183
22312
  var isPairConfiguration = Compile(build_default.Readonly(build_default.Object({
21184
22313
  alternatives: build_default.Optional(isStringArray),
@@ -21196,20 +22325,20 @@ var isRuleOptions4 = Compile(build_default.Partial(build_default.Readonly(build_
21196
22325
  pairs: build_default.Readonly(build_default.Array(isPairConfiguration))
21197
22326
  }))));
21198
22327
  var LOOP_NODE_TYPES = new Set([
21199
- AST_NODE_TYPES13.DoWhileStatement,
21200
- AST_NODE_TYPES13.ForInStatement,
21201
- AST_NODE_TYPES13.ForOfStatement,
21202
- AST_NODE_TYPES13.ForStatement,
21203
- AST_NODE_TYPES13.WhileStatement
22328
+ AST_NODE_TYPES14.DoWhileStatement,
22329
+ AST_NODE_TYPES14.ForInStatement,
22330
+ AST_NODE_TYPES14.ForOfStatement,
22331
+ AST_NODE_TYPES14.ForStatement,
22332
+ AST_NODE_TYPES14.WhileStatement
21204
22333
  ]);
21205
22334
  var DEFAULT_ROBLOX_YIELDING_FUNCTIONS = ["task.wait", "wait", "*.WaitForChild", "*.*Async"];
21206
22335
  function getCallName(node) {
21207
22336
  const { callee } = node;
21208
- if (callee.type === AST_NODE_TYPES13.Identifier)
22337
+ if (callee.type === AST_NODE_TYPES14.Identifier)
21209
22338
  return callee.name;
21210
- if (callee.type === AST_NODE_TYPES13.MemberExpression) {
21211
- const object3 = callee.object.type === AST_NODE_TYPES13.Identifier ? callee.object.name : undefined;
21212
- const property = callee.property.type === AST_NODE_TYPES13.Identifier ? callee.property.name : undefined;
22339
+ if (callee.type === AST_NODE_TYPES14.MemberExpression) {
22340
+ const object3 = callee.object.type === AST_NODE_TYPES14.Identifier ? callee.object.name : undefined;
22341
+ const property = callee.property.type === AST_NODE_TYPES14.Identifier ? callee.property.name : undefined;
21213
22342
  if (object3 !== undefined && property !== undefined)
21214
22343
  return `${object3}.${property}`;
21215
22344
  }
@@ -21245,12 +22374,12 @@ function isLoopLikeStatement(node) {
21245
22374
  return LOOP_NODE_TYPES.has(node.type);
21246
22375
  }
21247
22376
  function isSwitchStatement(node) {
21248
- return node?.type === AST_NODE_TYPES13.SwitchStatement;
22377
+ return node?.type === AST_NODE_TYPES14.SwitchStatement;
21249
22378
  }
21250
22379
  function findLabeledStatementBody(label, startingNode) {
21251
22380
  let current = startingNode;
21252
22381
  while (current) {
21253
- if (current.type === AST_NODE_TYPES13.LabeledStatement && current.label.name === label.name)
22382
+ if (current.type === AST_NODE_TYPES14.LabeledStatement && current.label.name === label.name)
21254
22383
  return current.body;
21255
22384
  current = current.parent ?? undefined;
21256
22385
  }
@@ -21512,7 +22641,7 @@ var rule = {
21512
22641
  function onIfConsequentExit(node) {
21513
22642
  const consequentNode = node;
21514
22643
  const { parent } = consequentNode;
21515
- if (parent?.type === AST_NODE_TYPES13.IfStatement) {
22644
+ if (parent?.type === AST_NODE_TYPES14.IfStatement) {
21516
22645
  const branches = branchStacks.get(parent) ?? [];
21517
22646
  branches.push(cloneStack());
21518
22647
  branchStacks.set(parent, branches);
@@ -21527,7 +22656,7 @@ var rule = {
21527
22656
  function onIfAlternateExit(node) {
21528
22657
  const alternateNode = node;
21529
22658
  const { parent } = alternateNode;
21530
- if (parent?.type === AST_NODE_TYPES13.IfStatement) {
22659
+ if (parent?.type === AST_NODE_TYPES14.IfStatement) {
21531
22660
  const branches = branchStacks.get(parent) ?? [];
21532
22661
  branches.push(cloneStack());
21533
22662
  branchStacks.set(parent, branches);
@@ -21576,7 +22705,7 @@ var rule = {
21576
22705
  function onTryBlockExit(node) {
21577
22706
  const blockNode = node;
21578
22707
  const { parent } = blockNode;
21579
- if (parent?.type === AST_NODE_TYPES13.TryStatement) {
22708
+ if (parent?.type === AST_NODE_TYPES14.TryStatement) {
21580
22709
  const branches = branchStacks.get(parent) ?? [];
21581
22710
  branches.push(cloneStack());
21582
22711
  branchStacks.set(parent, branches);
@@ -21595,7 +22724,7 @@ var rule = {
21595
22724
  function onCatchClauseExit(node) {
21596
22725
  const catchNode = node;
21597
22726
  const { parent } = catchNode;
21598
- if (parent?.type === AST_NODE_TYPES13.TryStatement) {
22727
+ if (parent?.type === AST_NODE_TYPES14.TryStatement) {
21599
22728
  const branches = branchStacks.get(parent) ?? [];
21600
22729
  branches.push(cloneStack());
21601
22730
  branchStacks.set(parent, branches);
@@ -21658,7 +22787,7 @@ var rule = {
21658
22787
  function onSwitchCaseExit(node) {
21659
22788
  const caseNode = node;
21660
22789
  const { parent } = caseNode;
21661
- if (parent?.type === AST_NODE_TYPES13.SwitchStatement) {
22790
+ if (parent?.type === AST_NODE_TYPES14.SwitchStatement) {
21662
22791
  const branches = branchStacks.get(parent) ?? [];
21663
22792
  branches.push(cloneStack());
21664
22793
  branchStacks.set(parent, branches);
@@ -21689,7 +22818,7 @@ var rule = {
21689
22818
  for (const { opener, config, node: node2 } of openerStack) {
21690
22819
  const validClosers = getValidClosers(config);
21691
22820
  const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
21692
- const statementType = statementNode.type === AST_NODE_TYPES13.ReturnStatement ? "return" : "throw";
22821
+ const statementType = statementNode.type === AST_NODE_TYPES14.ReturnStatement ? "return" : "throw";
21693
22822
  const lineNumber = statementNode.loc?.start.line ?? 0;
21694
22823
  context.report({
21695
22824
  data: {
@@ -21706,7 +22835,7 @@ var rule = {
21706
22835
  const statementNode = node;
21707
22836
  if (openerStack.length === 0)
21708
22837
  return;
21709
- const targetLoop = statementNode.type === AST_NODE_TYPES13.ContinueStatement ? resolveContinueTargetLoop(statementNode) : resolveBreakTargetLoop(statementNode);
22838
+ const targetLoop = statementNode.type === AST_NODE_TYPES14.ContinueStatement ? resolveContinueTargetLoop(statementNode) : resolveBreakTargetLoop(statementNode);
21710
22839
  if (!targetLoop)
21711
22840
  return;
21712
22841
  for (const { node: openerNode, config, opener, loopAncestors } of openerStack) {
@@ -21714,7 +22843,7 @@ var rule = {
21714
22843
  continue;
21715
22844
  const validClosers = getValidClosers(config);
21716
22845
  const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
21717
- const statementType = statementNode.type === AST_NODE_TYPES13.BreakStatement ? "break" : "continue";
22846
+ const statementType = statementNode.type === AST_NODE_TYPES14.BreakStatement ? "break" : "continue";
21718
22847
  const lineNumber = statementNode.loc?.start.line ?? 0;
21719
22848
  context.report({
21720
22849
  data: {
@@ -21852,7 +22981,7 @@ var rule = {
21852
22981
  continue;
21853
22982
  const validClosers = getValidClosers(config);
21854
22983
  const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
21855
- const asyncType = asyncNode.type === AST_NODE_TYPES13.AwaitExpression ? "await" : "yield";
22984
+ const asyncType = asyncNode.type === AST_NODE_TYPES14.AwaitExpression ? "await" : "yield";
21856
22985
  context.report({
21857
22986
  data: { asyncType, closer, opener },
21858
22987
  messageId: "asyncViolation",
@@ -23880,6 +25009,7 @@ var rules = {
23880
25009
  "no-warn": no_warn_default,
23881
25010
  "prefer-class-properties": prefer_class_properties_default,
23882
25011
  "prefer-early-return": prefer_early_return_default,
25012
+ "prefer-enum-item": prefer_enum_item_default,
23883
25013
  "prefer-module-scope-constants": prefer_module_scope_constants_default,
23884
25014
  "prefer-pascal-case-enums": prefer_pascal_case_enums_default,
23885
25015
  "prefer-pattern-replacements": prefer_pattern_replacements_default,
@@ -23946,4 +25076,4 @@ export {
23946
25076
  createBanInstancesOptions
23947
25077
  };
23948
25078
 
23949
- //# debugId=2B2944174D0F631464756E2164756E21
25079
+ //# debugId=A96F64DDBF4FBDA864756E2164756E21