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

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,6 +19751,120 @@ var prefer_early_return_default = createRule({
19738
19751
  name: "prefer-early-return"
19739
19752
  });
19740
19753
 
19754
+ // src/rules/prefer-enum-item.ts
19755
+ import { ESLintUtils as ESLintUtils3 } from "@typescript-eslint/utils";
19756
+ var ENUM_PREFIX = "Enum.";
19757
+ function getFullEnumPath(checker, type3) {
19758
+ const symbol3 = type3.getSymbol();
19759
+ if (symbol3 === undefined)
19760
+ return;
19761
+ const fullName = checker.getFullyQualifiedName(symbol3);
19762
+ if (!fullName.startsWith(ENUM_PREFIX))
19763
+ return;
19764
+ return fullName;
19765
+ }
19766
+ function getPropertyLiteralType(checker, type3, propertyName) {
19767
+ const property = type3.getProperty(propertyName);
19768
+ if (property === undefined)
19769
+ return;
19770
+ const propertyType = checker.getTypeOfSymbol(property);
19771
+ if (propertyType.isStringLiteral())
19772
+ return propertyType.value;
19773
+ if (propertyType.isNumberLiteral())
19774
+ return propertyType.value;
19775
+ return;
19776
+ }
19777
+ function getUnionTypes(type3) {
19778
+ if (type3.isUnion())
19779
+ return type3.types;
19780
+ return [type3];
19781
+ }
19782
+ function createEnumMatch(enumPath) {
19783
+ return { enumPath };
19784
+ }
19785
+ var prefer_enum_item_default = createRule({
19786
+ create(context) {
19787
+ const [{ fixNumericToValue = false } = {}] = context.options;
19788
+ const services = ESLintUtils3.getParserServices(context);
19789
+ const checker = services.program.getTypeChecker();
19790
+ function getContextualType(node) {
19791
+ const tsNode = services.esTreeNodeToTSNodeMap.get(node);
19792
+ return checker.getContextualType(tsNode);
19793
+ }
19794
+ function findEnumMatch(contextualType, literalValue) {
19795
+ const unionTypes = getUnionTypes(contextualType);
19796
+ for (const memberType of unionTypes) {
19797
+ const enumPath = getFullEnumPath(checker, memberType);
19798
+ if (enumPath === undefined)
19799
+ continue;
19800
+ if (typeof literalValue === "string") {
19801
+ const nameProperty = getPropertyLiteralType(checker, memberType, "Name");
19802
+ if (nameProperty === literalValue)
19803
+ return createEnumMatch(enumPath);
19804
+ } else {
19805
+ const valueProperty = getPropertyLiteralType(checker, memberType, "Value");
19806
+ if (valueProperty === literalValue)
19807
+ return createEnumMatch(enumPath);
19808
+ }
19809
+ }
19810
+ return;
19811
+ }
19812
+ return {
19813
+ Literal(node) {
19814
+ const { value } = node;
19815
+ if (typeof value !== "string" && typeof value !== "number")
19816
+ return;
19817
+ const contextualType = getContextualType(node);
19818
+ if (contextualType === undefined)
19819
+ return;
19820
+ const match = findEnumMatch(contextualType, value);
19821
+ if (match === undefined)
19822
+ return;
19823
+ const isString = typeof value === "string";
19824
+ const displayValue = isString ? `"${value}"` : String(value);
19825
+ const fixPath = fixNumericToValue && !isString ? `${match.enumPath}.Value` : match.enumPath;
19826
+ context.report({
19827
+ data: {
19828
+ enumType: match.enumPath.split(".").slice(0, -1).join("."),
19829
+ expected: fixPath,
19830
+ value: displayValue
19831
+ },
19832
+ fix(fixer) {
19833
+ return fixer.replaceText(node, fixPath);
19834
+ },
19835
+ messageId: "preferEnumItem",
19836
+ node
19837
+ });
19838
+ }
19839
+ };
19840
+ },
19841
+ defaultOptions: [{}],
19842
+ meta: {
19843
+ docs: {
19844
+ description: "Enforce using EnumItem values instead of string or number literals."
19845
+ },
19846
+ fixable: "code",
19847
+ messages: {
19848
+ preferEnumItem: "Use `{{ expected }}` instead of `{{ value }}`. EnumItems provide type safety and avoid magic values."
19849
+ },
19850
+ schema: [
19851
+ {
19852
+ additionalProperties: false,
19853
+ properties: {
19854
+ fixNumericToValue: {
19855
+ default: false,
19856
+ description: "When true, numeric literals fix to Enum.X.Y.Value instead of Enum.X.Y",
19857
+ type: "boolean"
19858
+ }
19859
+ },
19860
+ type: "object"
19861
+ }
19862
+ ],
19863
+ type: "suggestion"
19864
+ },
19865
+ name: "prefer-enum-item"
19866
+ });
19867
+
19741
19868
  // src/rules/prefer-module-scope-constants.ts
19742
19869
  var import_scope_manager3 = __toESM(require_dist2(), 1);
19743
19870
  import { AST_NODE_TYPES as AST_NODE_TYPES7 } from "@typescript-eslint/utils";
@@ -20597,51 +20724,70 @@ function reconstructText(node) {
20597
20724
  }
20598
20725
  return text;
20599
20726
  }
20727
+ function evaluateLiteral(node) {
20728
+ const { value } = node;
20729
+ return isNumber(value) ? value : undefined;
20730
+ }
20731
+ function evaluateUnary(node) {
20732
+ const { argument, operator } = node;
20733
+ if (!isRecord3(argument))
20734
+ return;
20735
+ const argumentValue = evaluateExpression(argument);
20736
+ if (argumentValue === undefined)
20737
+ return;
20738
+ if (operator === "-")
20739
+ return -argumentValue;
20740
+ if (operator === "+")
20741
+ return argumentValue;
20742
+ return;
20743
+ }
20744
+ function evaluateBinaryOperation(operator, left, right) {
20745
+ switch (operator) {
20746
+ case "+":
20747
+ return left + right;
20748
+ case "-":
20749
+ return left - right;
20750
+ case "*":
20751
+ return left * right;
20752
+ case "/":
20753
+ return right === 0 ? undefined : left / right;
20754
+ case "%":
20755
+ return right === 0 ? undefined : left % right;
20756
+ default:
20757
+ return;
20758
+ }
20759
+ }
20760
+ function evaluateBinary(node) {
20761
+ const { right, left, operator } = node;
20762
+ if (!(isRecord3(left) && isRecord3(right)))
20763
+ return;
20764
+ if (typeof operator !== "string" || !OPERATORS2.has(operator))
20765
+ return;
20766
+ const leftValue = evaluateExpression(left);
20767
+ const rightValue = evaluateExpression(right);
20768
+ if (leftValue === undefined || rightValue === undefined)
20769
+ return;
20770
+ return evaluateBinaryOperation(operator, leftValue, rightValue);
20771
+ }
20600
20772
  function evaluateExpression(node) {
20601
20773
  if (!isRecord3(node))
20602
20774
  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
- }
20775
+ switch (node.type) {
20776
+ case TSESTree7.AST_NODE_TYPES.Literal:
20777
+ return evaluateLiteral(node);
20778
+ case TSESTree7.AST_NODE_TYPES.UnaryExpression:
20779
+ return evaluateUnary(node);
20780
+ case TSESTree7.AST_NODE_TYPES.BinaryExpression:
20781
+ return evaluateBinary(node);
20782
+ default:
20783
+ return;
20637
20784
  }
20638
- return value;
20639
20785
  }
20640
20786
  function collectArguments(_context2, parameters3) {
20641
20787
  if (parameters3.length !== 4)
20642
20788
  return;
20643
- const texts = [undefined, undefined, undefined, undefined];
20644
- for (let index2 = 0;index2 < 4; index2++) {
20789
+ const texts = new Array(4);
20790
+ for (let index2 = 0;index2 < 4; index2 += 1) {
20645
20791
  const parameter2 = parameters3[index2];
20646
20792
  if (!(isRecord3(parameter2) && hasTypeProperty(parameter2)))
20647
20793
  return;
@@ -20653,8 +20799,9 @@ function collectArguments(_context2, parameters3) {
20653
20799
  texts[index2] = text;
20654
20800
  }
20655
20801
  const [scaleXText, offsetXText, scaleYText, offsetYText] = texts;
20656
- if (scaleXText === undefined || offsetXText === undefined || scaleYText === undefined || offsetYText === undefined)
20802
+ if (scaleXText === undefined || offsetXText === undefined || scaleYText === undefined || offsetYText === undefined) {
20657
20803
  return;
20804
+ }
20658
20805
  return { offsetXText, offsetYText, scaleXText, scaleYText };
20659
20806
  }
20660
20807
  var preferUDim2Shorthand = {
@@ -20890,6 +21037,67 @@ function getHookName3(callExpression) {
20890
21037
  }
20891
21038
  return;
20892
21039
  }
21040
+ function findVariableInScope(identifier3, scope) {
21041
+ let variable;
21042
+ let currentScope = scope;
21043
+ while (typeof currentScope === "object" && currentScope !== null) {
21044
+ const current = currentScope;
21045
+ variable = current.set.get(identifier3.name);
21046
+ if (typeof variable === "object" && variable !== null)
21047
+ break;
21048
+ currentScope = current.upper;
21049
+ }
21050
+ return variable;
21051
+ }
21052
+ function processFunctionDeclaration(node) {
21053
+ const castNode = node;
21054
+ return {
21055
+ isAsync: Boolean(castNode.async),
21056
+ node,
21057
+ type: "function-declaration"
21058
+ };
21059
+ }
21060
+ function processArrowFunction(init) {
21061
+ const arrowNode = init;
21062
+ return {
21063
+ isAsync: Boolean(init.async),
21064
+ node: arrowNode,
21065
+ type: "arrow"
21066
+ };
21067
+ }
21068
+ function processFunctionExpression(init) {
21069
+ const exprNode = init;
21070
+ return {
21071
+ isAsync: Boolean(init.async),
21072
+ node: exprNode,
21073
+ type: "function-expression"
21074
+ };
21075
+ }
21076
+ function checkVariableDeclaratorDef(node) {
21077
+ const castNode = node;
21078
+ if (castNode.type !== TSESTree8.AST_NODE_TYPES.VariableDeclarator)
21079
+ return;
21080
+ if (typeof castNode.init !== "object" || castNode.init === null)
21081
+ return;
21082
+ const castInit = castNode.init;
21083
+ if (castInit.type === TSESTree8.AST_NODE_TYPES.ArrowFunctionExpression)
21084
+ return processArrowFunction(castNode.init);
21085
+ if (castInit.type === TSESTree8.AST_NODE_TYPES.FunctionExpression)
21086
+ return processFunctionExpression(castNode.init);
21087
+ return;
21088
+ }
21089
+ function processSingleDefinition(definition) {
21090
+ if (typeof definition !== "object" || definition === null)
21091
+ return;
21092
+ const castDef = definition;
21093
+ const { node } = castDef;
21094
+ if (typeof node !== "object" || node === null)
21095
+ return;
21096
+ const castNode = node;
21097
+ if (castNode.type === TSESTree8.AST_NODE_TYPES.FunctionDeclaration)
21098
+ return processFunctionDeclaration(node);
21099
+ return checkVariableDeclaratorDef(node);
21100
+ }
20893
21101
  function resolveIdentifierToFunction(identifier3, context) {
20894
21102
  try {
20895
21103
  const scope = context.sourceCode.getScope?.(identifier3);
@@ -20899,54 +21107,16 @@ function resolveIdentifierToFunction(identifier3, context) {
20899
21107
  const setVal = scopeObj.set;
20900
21108
  if (!(setVal instanceof Map))
20901
21109
  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
- }
21110
+ const variable = findVariableInScope(identifier3, scope);
20911
21111
  if (typeof variable !== "object" || variable === null)
20912
21112
  return;
20913
21113
  const castVariable = variable;
20914
21114
  if (!Array.isArray(castVariable.defs) || castVariable.defs.length === 0)
20915
21115
  return;
20916
21116
  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
- }
21117
+ const result = processSingleDefinition(definition);
21118
+ if (result !== undefined)
21119
+ return result;
20950
21120
  }
20951
21121
  return;
20952
21122
  } catch {
@@ -23880,6 +24050,7 @@ var rules = {
23880
24050
  "no-warn": no_warn_default,
23881
24051
  "prefer-class-properties": prefer_class_properties_default,
23882
24052
  "prefer-early-return": prefer_early_return_default,
24053
+ "prefer-enum-item": prefer_enum_item_default,
23883
24054
  "prefer-module-scope-constants": prefer_module_scope_constants_default,
23884
24055
  "prefer-pascal-case-enums": prefer_pascal_case_enums_default,
23885
24056
  "prefer-pattern-replacements": prefer_pattern_replacements_default,
@@ -23946,4 +24117,4 @@ export {
23946
24117
  createBanInstancesOptions
23947
24118
  };
23948
24119
 
23949
- //# debugId=2B2944174D0F631464756E2164756E21
24120
+ //# debugId=82B8719F042D688964756E2164756E21