@dereekb/util 13.23.0 → 13.24.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.
@@ -1,3 +1,5 @@
1
+ import * as ts from 'typescript';
2
+
1
3
  /**
2
4
  * The bundler hint string that marks a function call as side-effect-free.
3
5
  */ var NO_SIDE_EFFECTS_TAG = '@__NO_SIDE_EFFECTS__';
@@ -268,7 +270,7 @@
268
270
  return result;
269
271
  }
270
272
 
271
- function _array_like_to_array$c(arr, len) {
273
+ function _array_like_to_array$d(arr, len) {
272
274
  if (len == null || len > arr.length) len = arr.length;
273
275
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
274
276
  return arr2;
@@ -276,10 +278,10 @@ function _array_like_to_array$c(arr, len) {
276
278
  function _array_with_holes$a(arr) {
277
279
  if (Array.isArray(arr)) return arr;
278
280
  }
279
- function _array_without_holes$4(arr) {
280
- if (Array.isArray(arr)) return _array_like_to_array$c(arr);
281
+ function _array_without_holes$5(arr) {
282
+ if (Array.isArray(arr)) return _array_like_to_array$d(arr);
281
283
  }
282
- function _iterable_to_array$4(iter) {
284
+ function _iterable_to_array$5(iter) {
283
285
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
284
286
  }
285
287
  function _iterable_to_array_limit$a(arr, i) {
@@ -309,22 +311,22 @@ function _iterable_to_array_limit$a(arr, i) {
309
311
  function _non_iterable_rest$a() {
310
312
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
311
313
  }
312
- function _non_iterable_spread$4() {
314
+ function _non_iterable_spread$5() {
313
315
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
314
316
  }
315
317
  function _sliced_to_array$a(arr, i) {
316
- return _array_with_holes$a(arr) || _iterable_to_array_limit$a(arr, i) || _unsupported_iterable_to_array$c(arr, i) || _non_iterable_rest$a();
318
+ return _array_with_holes$a(arr) || _iterable_to_array_limit$a(arr, i) || _unsupported_iterable_to_array$d(arr, i) || _non_iterable_rest$a();
317
319
  }
318
- function _to_consumable_array$4(arr) {
319
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$4();
320
+ function _to_consumable_array$5(arr) {
321
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$5();
320
322
  }
321
- function _unsupported_iterable_to_array$c(o, minLen) {
323
+ function _unsupported_iterable_to_array$d(o, minLen) {
322
324
  if (!o) return;
323
- if (typeof o === "string") return _array_like_to_array$c(o, minLen);
325
+ if (typeof o === "string") return _array_like_to_array$d(o, minLen);
324
326
  var n = Object.prototype.toString.call(o).slice(8, -1);
325
327
  if (n === "Object" && o.constructor) n = o.constructor.name;
326
328
  if (n === "Map" || n === "Set") return Array.from(n);
327
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
329
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
328
330
  }
329
331
  /**
330
332
  * The JSDoc tag identifying a function as a factory in the @dereekb conventions.
@@ -364,7 +366,7 @@ function pickMessageId(hasOverloads, jsdoc) {
364
366
  var additional = ((_options_additionalNamePatterns = options.additionalNamePatterns) !== null && _options_additionalNamePatterns !== void 0 ? _options_additionalNamePatterns : []).map(function(source) {
365
367
  return new RegExp(source);
366
368
  });
367
- result = _to_consumable_array$4(DEFAULT_NAME_PATTERNS).concat(_to_consumable_array$4(additional));
369
+ result = _to_consumable_array$5(DEFAULT_NAME_PATTERNS).concat(_to_consumable_array$5(additional));
368
370
  } else {
369
371
  result = [];
370
372
  }
@@ -472,7 +474,7 @@ function pickMessageId(hasOverloads, jsdoc) {
472
474
  var _fixes;
473
475
  var jsdoc = ctx.jsdoc, redundantLineComments = ctx.orphanLineComments, hasOverloads = ctx.hasOverloads, implLineComment = ctx.implLineComment, chainStartStatement = ctx.chainStartStatement;
474
476
  var fixes = [];
475
- if (jsdoc && !jsdoc.hasNoSideEffects) (_fixes = fixes).push.apply(_fixes, _to_consumable_array$4(buildJsdocTagFixes(fixer, jsdoc)));
477
+ if (jsdoc && !jsdoc.hasNoSideEffects) (_fixes = fixes).push.apply(_fixes, _to_consumable_array$5(buildJsdocTagFixes(fixer, jsdoc)));
476
478
  else if (!jsdoc) fixes.push(buildCreateJsdocFix(fixer, chainStartStatement));
477
479
  if (hasOverloads && !implLineComment) fixes.push(buildImplLineCommentFix(fixer, node));
478
480
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -525,7 +527,7 @@ function pickMessageId(hasOverloads, jsdoc) {
525
527
  }
526
528
  };
527
529
 
528
- function _array_like_to_array$b(arr, len) {
530
+ function _array_like_to_array$c(arr, len) {
529
531
  if (len == null || len > arr.length) len = arr.length;
530
532
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
531
533
  return arr2;
@@ -561,15 +563,15 @@ function _non_iterable_rest$9() {
561
563
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
562
564
  }
563
565
  function _sliced_to_array$9(arr, i) {
564
- return _array_with_holes$9(arr) || _iterable_to_array_limit$9(arr, i) || _unsupported_iterable_to_array$b(arr, i) || _non_iterable_rest$9();
566
+ return _array_with_holes$9(arr) || _iterable_to_array_limit$9(arr, i) || _unsupported_iterable_to_array$c(arr, i) || _non_iterable_rest$9();
565
567
  }
566
- function _unsupported_iterable_to_array$b(o, minLen) {
568
+ function _unsupported_iterable_to_array$c(o, minLen) {
567
569
  if (!o) return;
568
- if (typeof o === "string") return _array_like_to_array$b(o, minLen);
570
+ if (typeof o === "string") return _array_like_to_array$c(o, minLen);
569
571
  var n = Object.prototype.toString.call(o).slice(8, -1);
570
572
  if (n === "Object" && o.constructor) n = o.constructor.name;
571
573
  if (n === "Map" || n === "Set") return Array.from(n);
572
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
574
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
573
575
  }
574
576
  var UTIL_PREFER_NO_SIDE_EFFECTS_IN_JSDOC_RULE = {
575
577
  meta: {
@@ -869,7 +871,7 @@ function _templateObject() {
869
871
  }
870
872
  };
871
873
 
872
- function _array_like_to_array$a(arr, len) {
874
+ function _array_like_to_array$b(arr, len) {
873
875
  if (len == null || len > arr.length) len = arr.length;
874
876
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
875
877
  return arr2;
@@ -905,19 +907,19 @@ function _non_iterable_rest$8() {
905
907
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
906
908
  }
907
909
  function _sliced_to_array$8(arr, i) {
908
- return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$8();
910
+ return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$b(arr, i) || _non_iterable_rest$8();
909
911
  }
910
912
  function _type_of$1(obj) {
911
913
  "@swc/helpers - typeof";
912
914
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
913
915
  }
914
- function _unsupported_iterable_to_array$a(o, minLen) {
916
+ function _unsupported_iterable_to_array$b(o, minLen) {
915
917
  if (!o) return;
916
- if (typeof o === "string") return _array_like_to_array$a(o, minLen);
918
+ if (typeof o === "string") return _array_like_to_array$b(o, minLen);
917
919
  var n = Object.prototype.toString.call(o).slice(8, -1);
918
920
  if (n === "Object" && o.constructor) n = o.constructor.name;
919
921
  if (n === "Map" || n === "Set") return Array.from(n);
920
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
922
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
921
923
  }
922
924
  /**
923
925
  * AST node types whose bodies represent a *new* function scope and must be skipped during return-counting.
@@ -1114,30 +1116,30 @@ function walkChildren(node, out) {
1114
1116
  }
1115
1117
  };
1116
1118
 
1117
- function _array_like_to_array$9(arr, len) {
1119
+ function _array_like_to_array$a(arr, len) {
1118
1120
  if (len == null || len > arr.length) len = arr.length;
1119
1121
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1120
1122
  return arr2;
1121
1123
  }
1122
- function _array_without_holes$3(arr) {
1123
- if (Array.isArray(arr)) return _array_like_to_array$9(arr);
1124
+ function _array_without_holes$4(arr) {
1125
+ if (Array.isArray(arr)) return _array_like_to_array$a(arr);
1124
1126
  }
1125
- function _iterable_to_array$3(iter) {
1127
+ function _iterable_to_array$4(iter) {
1126
1128
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1127
1129
  }
1128
- function _non_iterable_spread$3() {
1130
+ function _non_iterable_spread$4() {
1129
1131
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1130
1132
  }
1131
- function _to_consumable_array$3(arr) {
1132
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$3();
1133
+ function _to_consumable_array$4(arr) {
1134
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$4();
1133
1135
  }
1134
- function _unsupported_iterable_to_array$9(o, minLen) {
1136
+ function _unsupported_iterable_to_array$a(o, minLen) {
1135
1137
  if (!o) return;
1136
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
1138
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
1137
1139
  var n = Object.prototype.toString.call(o).slice(8, -1);
1138
1140
  if (n === "Object" && o.constructor) n = o.constructor.name;
1139
1141
  if (n === "Map" || n === "Set") return Array.from(n);
1140
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
1142
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
1141
1143
  }
1142
1144
  /**
1143
1145
  * Default name suffixes that mark an interface as config-shaped (its properties should be readonly).
@@ -1242,7 +1244,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
1242
1244
  create: function create(context) {
1243
1245
  var _context_options_, _options_additionalSuffixes, _options_exemptJsdocTag;
1244
1246
  var options = (_context_options_ = context.options[0]) !== null && _context_options_ !== void 0 ? _context_options_ : {};
1245
- var suffixes = _to_consumable_array$3(DEFAULT_SUFFIXES).concat(_to_consumable_array$3((_options_additionalSuffixes = options.additionalSuffixes) !== null && _options_additionalSuffixes !== void 0 ? _options_additionalSuffixes : []));
1247
+ var suffixes = _to_consumable_array$4(DEFAULT_SUFFIXES).concat(_to_consumable_array$4((_options_additionalSuffixes = options.additionalSuffixes) !== null && _options_additionalSuffixes !== void 0 ? _options_additionalSuffixes : []));
1246
1248
  var exemptTag = (_options_exemptJsdocTag = options.exemptJsdocTag) !== null && _options_exemptJsdocTag !== void 0 ? _options_exemptJsdocTag : DEFAULT_EXEMPT_JSDOC_TAG$3;
1247
1249
  var sourceCode = context.sourceCode;
1248
1250
  function interfaceNameMatches(name) {
@@ -1858,34 +1860,34 @@ function statementBringsMaybeIntoScope(stmt) {
1858
1860
  }
1859
1861
  };
1860
1862
 
1861
- function _array_like_to_array$8(arr, len) {
1863
+ function _array_like_to_array$9(arr, len) {
1862
1864
  if (len == null || len > arr.length) len = arr.length;
1863
1865
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1864
1866
  return arr2;
1865
1867
  }
1866
- function _array_without_holes$2(arr) {
1867
- if (Array.isArray(arr)) return _array_like_to_array$8(arr);
1868
+ function _array_without_holes$3(arr) {
1869
+ if (Array.isArray(arr)) return _array_like_to_array$9(arr);
1868
1870
  }
1869
- function _iterable_to_array$2(iter) {
1871
+ function _iterable_to_array$3(iter) {
1870
1872
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1871
1873
  }
1872
- function _non_iterable_spread$2() {
1874
+ function _non_iterable_spread$3() {
1873
1875
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1874
1876
  }
1875
- function _to_consumable_array$2(arr) {
1876
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$2();
1877
+ function _to_consumable_array$3(arr) {
1878
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$3();
1877
1879
  }
1878
1880
  function _type_of(obj) {
1879
1881
  "@swc/helpers - typeof";
1880
1882
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1881
1883
  }
1882
- function _unsupported_iterable_to_array$8(o, minLen) {
1884
+ function _unsupported_iterable_to_array$9(o, minLen) {
1883
1885
  if (!o) return;
1884
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
1886
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
1885
1887
  var n = Object.prototype.toString.call(o).slice(8, -1);
1886
1888
  if (n === "Object" && o.constructor) n = o.constructor.name;
1887
1889
  if (n === "Map" || n === "Set") return Array.from(n);
1888
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
1890
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
1889
1891
  }
1890
1892
  /**
1891
1893
  * The required marker line comment that opens the deprecated-aliases section at the bottom of a file.
@@ -2108,7 +2110,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2108
2110
  for(var _iterator = ((_node_properties = node.properties) !== null && _node_properties !== void 0 ? _node_properties : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2109
2111
  var property = _step.value;
2110
2112
  var _names;
2111
- (_names = names).push.apply(_names, _to_consumable_array$2(collectPatternNames(property.type === 'RestElement' ? property.argument : property.value)));
2113
+ (_names = names).push.apply(_names, _to_consumable_array$3(collectPatternNames(property.type === 'RestElement' ? property.argument : property.value)));
2112
2114
  }
2113
2115
  } catch (err) {
2114
2116
  _didIteratorError = true;
@@ -2131,7 +2133,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2131
2133
  for(var _iterator1 = ((_node_elements = node.elements) !== null && _node_elements !== void 0 ? _node_elements : [])[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2132
2134
  var element = _step1.value;
2133
2135
  var _names1;
2134
- (_names1 = names).push.apply(_names1, _to_consumable_array$2(collectPatternNames((element === null || element === void 0 ? void 0 : element.type) === 'RestElement' ? element.argument : element)));
2136
+ (_names1 = names).push.apply(_names1, _to_consumable_array$3(collectPatternNames((element === null || element === void 0 ? void 0 : element.type) === 'RestElement' ? element.argument : element)));
2135
2137
  }
2136
2138
  } catch (err) {
2137
2139
  _didIteratorError1 = true;
@@ -2149,10 +2151,10 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2149
2151
  }
2150
2152
  } else if (node.type === 'AssignmentPattern') {
2151
2153
  var _names2;
2152
- (_names2 = names).push.apply(_names2, _to_consumable_array$2(collectPatternNames(node.left)));
2154
+ (_names2 = names).push.apply(_names2, _to_consumable_array$3(collectPatternNames(node.left)));
2153
2155
  } else if (node.type === 'RestElement') {
2154
2156
  var _names3;
2155
- (_names3 = names).push.apply(_names3, _to_consumable_array$2(collectPatternNames(node.argument)));
2157
+ (_names3 = names).push.apply(_names3, _to_consumable_array$3(collectPatternNames(node.argument)));
2156
2158
  }
2157
2159
  }
2158
2160
  return names;
@@ -2174,7 +2176,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2174
2176
  for(var _iterator = ((_declaration_declarations = declaration.declarations) !== null && _declaration_declarations !== void 0 ? _declaration_declarations : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2175
2177
  var declarator = _step.value;
2176
2178
  var _names;
2177
- (_names = names).push.apply(_names, _to_consumable_array$2(collectPatternNames(declarator.id)));
2179
+ (_names = names).push.apply(_names, _to_consumable_array$3(collectPatternNames(declarator.id)));
2178
2180
  }
2179
2181
  } catch (err) {
2180
2182
  _didIteratorError = true;
@@ -2666,7 +2668,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2666
2668
  }).join('\n\n');
2667
2669
  var appendText = "".concat(trailingNewline, "\n").concat(COMPAT_MARKER_LINE, "\n").concat(joinedBlocks, "\n");
2668
2670
  return function(fixer) {
2669
- return _to_consumable_array$2(blockRanges.map(function(r) {
2671
+ return _to_consumable_array$3(blockRanges.map(function(r) {
2670
2672
  return fixer.removeRange(r);
2671
2673
  })).concat([
2672
2674
  fixer.insertTextAfterRange([
@@ -2884,7 +2886,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2884
2886
  }
2885
2887
  };
2886
2888
 
2887
- function _array_like_to_array$7(arr, len) {
2889
+ function _array_like_to_array$8(arr, len) {
2888
2890
  if (len == null || len > arr.length) len = arr.length;
2889
2891
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2890
2892
  return arr2;
@@ -2920,15 +2922,15 @@ function _non_iterable_rest$7() {
2920
2922
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2921
2923
  }
2922
2924
  function _sliced_to_array$7(arr, i) {
2923
- return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$7();
2925
+ return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$7();
2924
2926
  }
2925
- function _unsupported_iterable_to_array$7(o, minLen) {
2927
+ function _unsupported_iterable_to_array$8(o, minLen) {
2926
2928
  if (!o) return;
2927
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
2929
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
2928
2930
  var n = Object.prototype.toString.call(o).slice(8, -1);
2929
2931
  if (n === "Object" && o.constructor) n = o.constructor.name;
2930
2932
  if (n === "Map" || n === "Set") return Array.from(n);
2931
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
2933
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
2932
2934
  }
2933
2935
  var TAG_LINE_REGEX$1 = /^@([A-Za-z_]\w*)\s*(.*)$/;
2934
2936
  var TYPE_ANNOTATION_REGEX = /^\{([^}]*)\}\s*(.*)$/;
@@ -3268,7 +3270,7 @@ var LINE_PREFIX_REGEX = /^(\s*\*?\s?)(.*)$/;
3268
3270
  };
3269
3271
  }
3270
3272
 
3271
- function _array_like_to_array$6(arr, len) {
3273
+ function _array_like_to_array$7(arr, len) {
3272
3274
  if (len == null || len > arr.length) len = arr.length;
3273
3275
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3274
3276
  return arr2;
@@ -3276,10 +3278,10 @@ function _array_like_to_array$6(arr, len) {
3276
3278
  function _array_with_holes$6(arr) {
3277
3279
  if (Array.isArray(arr)) return arr;
3278
3280
  }
3279
- function _array_without_holes$1(arr) {
3280
- if (Array.isArray(arr)) return _array_like_to_array$6(arr);
3281
+ function _array_without_holes$2(arr) {
3282
+ if (Array.isArray(arr)) return _array_like_to_array$7(arr);
3281
3283
  }
3282
- function _iterable_to_array$1(iter) {
3284
+ function _iterable_to_array$2(iter) {
3283
3285
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3284
3286
  }
3285
3287
  function _iterable_to_array_limit$6(arr, i) {
@@ -3309,22 +3311,22 @@ function _iterable_to_array_limit$6(arr, i) {
3309
3311
  function _non_iterable_rest$6() {
3310
3312
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3311
3313
  }
3312
- function _non_iterable_spread$1() {
3314
+ function _non_iterable_spread$2() {
3313
3315
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3314
3316
  }
3315
3317
  function _sliced_to_array$6(arr, i) {
3316
- return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
3318
+ return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$6();
3317
3319
  }
3318
- function _to_consumable_array$1(arr) {
3319
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$1();
3320
+ function _to_consumable_array$2(arr) {
3321
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$2();
3320
3322
  }
3321
- function _unsupported_iterable_to_array$6(o, minLen) {
3323
+ function _unsupported_iterable_to_array$7(o, minLen) {
3322
3324
  if (!o) return;
3323
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
3325
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
3324
3326
  var n = Object.prototype.toString.call(o).slice(8, -1);
3325
3327
  if (n === "Object" && o.constructor) n = o.constructor.name;
3326
3328
  if (n === "Map" || n === "Set") return Array.from(n);
3327
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
3329
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
3328
3330
  }
3329
3331
  var TAG_LINE_REGEX = /^@([A-Za-z_]\w*)\s*(.*)$/;
3330
3332
  var DEFAULT_WORKSPACE_TAG_PREFIXES = [
@@ -3643,7 +3645,7 @@ var TYPE_RESTATING_PATTERNS = [
3643
3645
  }
3644
3646
  return [
3645
3647
  header
3646
- ].concat(_to_consumable_array$1(tag.continuationLines));
3648
+ ].concat(_to_consumable_array$2(tag.continuationLines));
3647
3649
  }
3648
3650
  /**
3649
3651
  * Groups the canonical tags into bucketed sections, inserting a new section when the bucket changes.
@@ -3668,7 +3670,7 @@ var TYPE_RESTATING_PATTERNS = [
3668
3670
  currentBucket = b;
3669
3671
  hasCurrentSection = true;
3670
3672
  }
3671
- (_currentSection = currentSection).push.apply(_currentSection, _to_consumable_array$1(serializeTag(tag)));
3673
+ (_currentSection = currentSection).push.apply(_currentSection, _to_consumable_array$2(serializeTag(tag)));
3672
3674
  }
3673
3675
  } catch (err) {
3674
3676
  _didIteratorError = true;
@@ -3699,7 +3701,7 @@ var TYPE_RESTATING_PATTERNS = [
3699
3701
  var _step_value = _sliced_to_array$6(_step.value, 2), i = _step_value[0], section = _step_value[1];
3700
3702
  var _allLines;
3701
3703
  if (i > 0) allLines.push('');
3702
- (_allLines = allLines).push.apply(_allLines, _to_consumable_array$1(section));
3704
+ (_allLines = allLines).push.apply(_allLines, _to_consumable_array$2(section));
3703
3705
  }
3704
3706
  } catch (err) {
3705
3707
  _didIteratorError = true;
@@ -3770,10 +3772,10 @@ var TYPE_RESTATING_PATTERNS = [
3770
3772
  result = '* ' + descText + ' ';
3771
3773
  } else {
3772
3774
  var descriptionSections = model.descriptionParagraphs.map(function(paragraph) {
3773
- return _to_consumable_array$1(paragraph);
3775
+ return _to_consumable_array$2(paragraph);
3774
3776
  });
3775
3777
  var tagSections = groupTagsIntoSections(model.tags, workspacePrefixes);
3776
- var allLines = flattenSections(_to_consumable_array$1(descriptionSections).concat(_to_consumable_array$1(tagSections)));
3778
+ var allLines = flattenSections(_to_consumable_array$2(descriptionSections).concat(_to_consumable_array$2(tagSections)));
3777
3779
  result = renderMultilineValue(allLines, indent);
3778
3780
  }
3779
3781
  return result;
@@ -3940,7 +3942,7 @@ var LOWER_LETTER_PATTERN = /[a-z]/;
3940
3942
  if (tag.tag !== 'example') return;
3941
3943
  var bodyLines = [];
3942
3944
  if (tag.headerText.length > 0) bodyLines.push(tag.headerText);
3943
- (_bodyLines = bodyLines).push.apply(_bodyLines, _to_consumable_array$1(tag.continuationLines));
3945
+ (_bodyLines = bodyLines).push.apply(_bodyLines, _to_consumable_array$2(tag.continuationLines));
3944
3946
  var firstNonBlank = findFirstNonBlankLine(bodyLines);
3945
3947
  if (firstNonBlank == null) return;
3946
3948
  if (firstNonBlank.trimStart().startsWith('```')) return;
@@ -3950,7 +3952,7 @@ var LOWER_LETTER_PATTERN = /[a-z]/;
3950
3952
  tag.headerText = '';
3951
3953
  tag.continuationLines = [
3952
3954
  '```ts'
3953
- ].concat(_to_consumable_array$1(content), [
3955
+ ].concat(_to_consumable_array$2(content), [
3954
3956
  '```'
3955
3957
  ]);
3956
3958
  }
@@ -4816,7 +4818,7 @@ var LOWER_LETTER_PATTERN = /[a-z]/;
4816
4818
  return name;
4817
4819
  }
4818
4820
 
4819
- function _array_like_to_array$5(arr, len) {
4821
+ function _array_like_to_array$6(arr, len) {
4820
4822
  if (len == null || len > arr.length) len = arr.length;
4821
4823
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4822
4824
  return arr2;
@@ -4852,15 +4854,15 @@ function _non_iterable_rest$5() {
4852
4854
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4853
4855
  }
4854
4856
  function _sliced_to_array$5(arr, i) {
4855
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
4857
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$5();
4856
4858
  }
4857
- function _unsupported_iterable_to_array$5(o, minLen) {
4859
+ function _unsupported_iterable_to_array$6(o, minLen) {
4858
4860
  if (!o) return;
4859
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
4861
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
4860
4862
  var n = Object.prototype.toString.call(o).slice(8, -1);
4861
4863
  if (n === "Object" && o.constructor) n = o.constructor.name;
4862
4864
  if (n === "Map" || n === "Set") return Array.from(n);
4863
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
4865
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
4864
4866
  }
4865
4867
  /**
4866
4868
  * Shared helpers for the `@dbx<Family>` companion-tag ESLint rules. Mirrors the
@@ -6938,7 +6940,7 @@ var DEFAULT_KNOWN_COMPANIONS$4 = [
6938
6940
  }
6939
6941
  };
6940
6942
 
6941
- function _array_like_to_array$4(arr, len) {
6943
+ function _array_like_to_array$5(arr, len) {
6942
6944
  if (len == null || len > arr.length) len = arr.length;
6943
6945
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6944
6946
  return arr2;
@@ -6946,10 +6948,10 @@ function _array_like_to_array$4(arr, len) {
6946
6948
  function _array_with_holes$4(arr) {
6947
6949
  if (Array.isArray(arr)) return arr;
6948
6950
  }
6949
- function _array_without_holes(arr) {
6950
- if (Array.isArray(arr)) return _array_like_to_array$4(arr);
6951
+ function _array_without_holes$1(arr) {
6952
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
6951
6953
  }
6952
- function _iterable_to_array(iter) {
6954
+ function _iterable_to_array$1(iter) {
6953
6955
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6954
6956
  }
6955
6957
  function _iterable_to_array_limit$4(arr, i) {
@@ -6979,22 +6981,22 @@ function _iterable_to_array_limit$4(arr, i) {
6979
6981
  function _non_iterable_rest$4() {
6980
6982
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6981
6983
  }
6982
- function _non_iterable_spread() {
6984
+ function _non_iterable_spread$1() {
6983
6985
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6984
6986
  }
6985
6987
  function _sliced_to_array$4(arr, i) {
6986
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
6988
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$4();
6987
6989
  }
6988
- function _to_consumable_array(arr) {
6989
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread();
6990
+ function _to_consumable_array$1(arr) {
6991
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$1();
6990
6992
  }
6991
- function _unsupported_iterable_to_array$4(o, minLen) {
6993
+ function _unsupported_iterable_to_array$5(o, minLen) {
6992
6994
  if (!o) return;
6993
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
6995
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
6994
6996
  var n = Object.prototype.toString.call(o).slice(8, -1);
6995
6997
  if (n === "Object" && o.constructor) n = o.constructor.name;
6996
6998
  if (n === "Map" || n === "Set") return Array.from(n);
6997
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
6999
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
6998
7000
  }
6999
7001
  var DEFAULT_ALLOWED_ROLES = [
7000
7002
  'directive',
@@ -7458,7 +7460,7 @@ function reportClassSkillRefs(ctx, skillRefsTags) {
7458
7460
  });
7459
7461
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7460
7462
  try {
7461
- for(var _iterator = _to_consumable_array(fromTags).concat(_to_consumable_array(toTags))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7463
+ for(var _iterator = _to_consumable_array$1(fromTags).concat(_to_consumable_array$1(toTags))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7462
7464
  var tag = _step.value;
7463
7465
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7464
7466
  try {
@@ -7523,7 +7525,7 @@ function reportClassSkillRefs(ctx, skillRefsTags) {
7523
7525
  }
7524
7526
  };
7525
7527
 
7526
- function _array_like_to_array$3(arr, len) {
7528
+ function _array_like_to_array$4(arr, len) {
7527
7529
  if (len == null || len > arr.length) len = arr.length;
7528
7530
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7529
7531
  return arr2;
@@ -7559,15 +7561,15 @@ function _non_iterable_rest$3() {
7559
7561
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7560
7562
  }
7561
7563
  function _sliced_to_array$3(arr, i) {
7562
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
7564
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$3();
7563
7565
  }
7564
- function _unsupported_iterable_to_array$3(o, minLen) {
7566
+ function _unsupported_iterable_to_array$4(o, minLen) {
7565
7567
  if (!o) return;
7566
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
7568
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
7567
7569
  var n = Object.prototype.toString.call(o).slice(8, -1);
7568
7570
  if (n === "Object" && o.constructor) n = o.constructor.name;
7569
7571
  if (n === "Map" || n === "Set") return Array.from(n);
7570
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
7572
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
7571
7573
  }
7572
7574
  var FORM_MARKERS = new Set([
7573
7575
  'dbxFormField',
@@ -8265,7 +8267,7 @@ function reportFormComposesFromKebab(ctx, composesFromTags, markers) {
8265
8267
  }
8266
8268
  };
8267
8269
 
8268
- function _array_like_to_array$2(arr, len) {
8270
+ function _array_like_to_array$3(arr, len) {
8269
8271
  if (len == null || len > arr.length) len = arr.length;
8270
8272
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8271
8273
  return arr2;
@@ -8301,15 +8303,15 @@ function _non_iterable_rest$2() {
8301
8303
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8302
8304
  }
8303
8305
  function _sliced_to_array$2(arr, i) {
8304
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
8306
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$2();
8305
8307
  }
8306
- function _unsupported_iterable_to_array$2(o, minLen) {
8308
+ function _unsupported_iterable_to_array$3(o, minLen) {
8307
8309
  if (!o) return;
8308
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
8310
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
8309
8311
  var n = Object.prototype.toString.call(o).slice(8, -1);
8310
8312
  if (n === "Object" && o.constructor) n = o.constructor.name;
8311
8313
  if (n === "Map" || n === "Set") return Array.from(n);
8312
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
8314
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
8313
8315
  }
8314
8316
  var DEFAULT_KNOWN_COMPANIONS$1 = [
8315
8317
  'ClaimsApp',
@@ -8649,7 +8651,7 @@ var DEFAULT_KNOWN_COMPANIONS$1 = [
8649
8651
  }
8650
8652
  };
8651
8653
 
8652
- function _array_like_to_array$1(arr, len) {
8654
+ function _array_like_to_array$2(arr, len) {
8653
8655
  if (len == null || len > arr.length) len = arr.length;
8654
8656
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8655
8657
  return arr2;
@@ -8685,15 +8687,15 @@ function _non_iterable_rest$1() {
8685
8687
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8686
8688
  }
8687
8689
  function _sliced_to_array$1(arr, i) {
8688
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
8690
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$1();
8689
8691
  }
8690
- function _unsupported_iterable_to_array$1(o, minLen) {
8692
+ function _unsupported_iterable_to_array$2(o, minLen) {
8691
8693
  if (!o) return;
8692
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
8694
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
8693
8695
  var n = Object.prototype.toString.call(o).slice(8, -1);
8694
8696
  if (n === "Object" && o.constructor) n = o.constructor.name;
8695
8697
  if (n === "Map" || n === "Set") return Array.from(n);
8696
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
8698
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
8697
8699
  }
8698
8700
  var DEFAULT_ALLOWED_SEVERITIES = [
8699
8701
  'error',
@@ -9659,6 +9661,310 @@ function collectRuleCompanions(parsed) {
9659
9661
  }
9660
9662
  };
9661
9663
 
9664
+ function _array_like_to_array$1(arr, len) {
9665
+ if (len == null || len > arr.length) len = arr.length;
9666
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
9667
+ return arr2;
9668
+ }
9669
+ function _array_without_holes(arr) {
9670
+ if (Array.isArray(arr)) return _array_like_to_array$1(arr);
9671
+ }
9672
+ function _iterable_to_array(iter) {
9673
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
9674
+ }
9675
+ function _non_iterable_spread() {
9676
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9677
+ }
9678
+ function _to_consumable_array(arr) {
9679
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread();
9680
+ }
9681
+ function _unsupported_iterable_to_array$1(o, minLen) {
9682
+ if (!o) return;
9683
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
9684
+ var n = Object.prototype.toString.call(o).slice(8, -1);
9685
+ if (n === "Object" && o.constructor) n = o.constructor.name;
9686
+ if (n === "Map" || n === "Set") return Array.from(n);
9687
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
9688
+ }
9689
+ /**
9690
+ * Reads a numeric/string literal value from an assertion's asserted expression. Handles a bare
9691
+ * `Literal` (e.g. `0`, `'foo'`) and a unary-signed numeric literal (e.g. `-1`, `+2`) so negative
9692
+ * enum values round-trip. Returns `null` for anything else (member access, call, template, etc.) —
9693
+ * those are not the "magic literal stamped onto an enum type" smell this rule targets.
9694
+ *
9695
+ * @param node - The asserted expression AST node.
9696
+ * @returns The literal value + source text, or `null` when the expression is not a literal.
9697
+ */ function readLiteral(node) {
9698
+ var result = null;
9699
+ if (node) {
9700
+ var _node_argument;
9701
+ if (node.type === 'Literal' && (typeof node.value === 'number' || typeof node.value === 'string')) {
9702
+ var _node_raw;
9703
+ result = {
9704
+ value: node.value,
9705
+ text: String((_node_raw = node.raw) !== null && _node_raw !== void 0 ? _node_raw : node.value)
9706
+ };
9707
+ } else if (node.type === 'UnaryExpression' && (node.operator === '-' || node.operator === '+') && ((_node_argument = node.argument) === null || _node_argument === void 0 ? void 0 : _node_argument.type) === 'Literal' && typeof node.argument.value === 'number') {
9708
+ var _node_argument_raw;
9709
+ var numeric = node.operator === '-' ? -node.argument.value : node.argument.value;
9710
+ result = {
9711
+ value: numeric,
9712
+ text: "".concat(node.operator).concat((_node_argument_raw = node.argument.raw) !== null && _node_argument_raw !== void 0 ? _node_argument_raw : node.argument.value)
9713
+ };
9714
+ }
9715
+ }
9716
+ return result;
9717
+ }
9718
+ /**
9719
+ * Resolves the enum symbol behind a TS type node, following an `import type` / import alias to the
9720
+ * real declaration. Returns `null` when the type is not an enum (a branded number/string alias like
9721
+ * `EntityId`, a class, an interface, a primitive, etc. — none of which have named members to prefer).
9722
+ *
9723
+ * @param checker - The TS type checker.
9724
+ * @param typeRefNode - The TS node mapped from the assertion's `typeAnnotation`.
9725
+ * @returns The enum's symbol, or `null` when the target type is not an enum.
9726
+ */ function resolveEnumSymbol(checker, typeRefNode) {
9727
+ var result = null;
9728
+ if (typeRefNode && ts.isTypeReferenceNode(typeRefNode) && ts.isIdentifier(typeRefNode.typeName)) {
9729
+ var symbol = checker.getSymbolAtLocation(typeRefNode.typeName);
9730
+ if (symbol && symbol.flags & ts.SymbolFlags.Alias) {
9731
+ symbol = checker.getAliasedSymbol(symbol);
9732
+ }
9733
+ // `SymbolFlags.Enum` === `RegularEnum | ConstEnum`, so this matches both `enum` and `const enum`.
9734
+ if (symbol && symbol.flags & ts.SymbolFlags.Enum) {
9735
+ result = symbol;
9736
+ }
9737
+ }
9738
+ return result;
9739
+ }
9740
+ /**
9741
+ * Finds the name of the enum member whose constant value equals `value`. Iterates the enum symbol's
9742
+ * member table and compares each member's computed constant value (works for `enum` and `const enum`,
9743
+ * numeric and string members). Returns `null` when no member matches — i.e. the literal is outside
9744
+ * the enum's domain, which is an unsafe cast the type system would otherwise have caught.
9745
+ *
9746
+ * @param checker - The TS type checker.
9747
+ * @param enumSymbol - The resolved enum symbol.
9748
+ * @param value - The literal value the cast stamps onto the enum type.
9749
+ * @returns The matching member name, or `null` when the value matches no member.
9750
+ */ function findEnumMemberName(checker, enumSymbol, value) {
9751
+ var result = null;
9752
+ var members = enumSymbol.exports;
9753
+ if (members) {
9754
+ members.forEach(function(memberSymbol) {
9755
+ var declaration = memberSymbol.valueDeclaration;
9756
+ if (result == null && declaration && ts.isEnumMember(declaration) && checker.getConstantValue(declaration) === value) {
9757
+ result = memberSymbol.getName();
9758
+ }
9759
+ });
9760
+ }
9761
+ return result;
9762
+ }
9763
+ /**
9764
+ * Locates the import that binds `localName` and classifies how the enum must be made value-usable.
9765
+ * When the binding is not a type-only import (already a value import, or a local enum declaration),
9766
+ * returns a `value` plan that needs no import edit.
9767
+ *
9768
+ * @param program - The `Program` AST node.
9769
+ * @param localName - The local identifier used in the cast (the enum's in-scope name).
9770
+ * @returns The import-fix plan for the binding.
9771
+ */ function planImportFix(program, localName) {
9772
+ var _ref;
9773
+ var plan = {
9774
+ kind: 'value'
9775
+ };
9776
+ var body = (_ref = program === null || program === void 0 ? void 0 : program.body) !== null && _ref !== void 0 ? _ref : [];
9777
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
9778
+ try {
9779
+ for(var _iterator = body[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
9780
+ var statement = _step.value;
9781
+ if (plan.kind === 'value' && statement.type === 'ImportDeclaration') {
9782
+ var _statement_specifiers;
9783
+ var specifiers = (_statement_specifiers = statement.specifiers) !== null && _statement_specifiers !== void 0 ? _statement_specifiers : [];
9784
+ var specifier = specifiers.find(function(spec) {
9785
+ var _spec_local;
9786
+ return spec.type === 'ImportSpecifier' && ((_spec_local = spec.local) === null || _spec_local === void 0 ? void 0 : _spec_local.name) === localName;
9787
+ });
9788
+ if (specifier) {
9789
+ if (specifier.importKind === 'type') {
9790
+ plan = {
9791
+ kind: 'inline-type',
9792
+ declaration: statement,
9793
+ specifier: specifier
9794
+ };
9795
+ } else if (statement.importKind === 'type') {
9796
+ plan = specifiers.length === 1 ? {
9797
+ kind: 'decl-type-single',
9798
+ declaration: statement,
9799
+ specifier: specifier
9800
+ } : {
9801
+ kind: 'decl-type-multi',
9802
+ declaration: statement,
9803
+ specifier: specifier
9804
+ };
9805
+ }
9806
+ }
9807
+ }
9808
+ }
9809
+ } catch (err) {
9810
+ _didIteratorError = true;
9811
+ _iteratorError = err;
9812
+ } finally{
9813
+ try {
9814
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
9815
+ _iterator.return();
9816
+ }
9817
+ } finally{
9818
+ if (_didIteratorError) {
9819
+ throw _iteratorError;
9820
+ }
9821
+ }
9822
+ }
9823
+ return plan;
9824
+ }
9825
+ /**
9826
+ * Builds the fixer edits that convert the enum's binding into a value import per the resolved plan.
9827
+ * Returns an empty array for the `value` plan (nothing to change).
9828
+ *
9829
+ * @param fixer - The ESLint fixer.
9830
+ * @param sourceCode - The ESLint `SourceCode` instance.
9831
+ * @param plan - The import-fix plan from {@link planImportFix}.
9832
+ * @returns The list of fixer edits (possibly empty).
9833
+ */ function buildImportFixes(fixer, sourceCode, plan) {
9834
+ var fixes = [];
9835
+ if (plan.kind === 'inline-type' && plan.specifier) {
9836
+ // `type Foo` -> `Foo`: drop the leading `type` keyword + following whitespace.
9837
+ var typeToken = sourceCode.getFirstToken(plan.specifier);
9838
+ var nameToken = sourceCode.getTokenAfter(typeToken);
9839
+ fixes.push(fixer.removeRange([
9840
+ typeToken.range[0],
9841
+ nameToken.range[0]
9842
+ ]));
9843
+ } else if (plan.kind === 'decl-type-single' && plan.declaration) {
9844
+ // `import type { Foo }` -> `import { Foo }`: drop the declaration-level `type` keyword.
9845
+ var importToken = sourceCode.getFirstToken(plan.declaration);
9846
+ var typeToken1 = sourceCode.getTokenAfter(importToken);
9847
+ var afterTypeToken = sourceCode.getTokenAfter(typeToken1);
9848
+ fixes.push(fixer.removeRange([
9849
+ typeToken1.range[0],
9850
+ afterTypeToken.range[0]
9851
+ ]));
9852
+ } else if (plan.kind === 'decl-type-multi' && plan.declaration && plan.specifier) {
9853
+ var _plan_declaration_specifiers;
9854
+ // `import type { A, Foo }` -> `import type { A };\nimport { Foo } from '…';`
9855
+ var specifiers = (_plan_declaration_specifiers = plan.declaration.specifiers) !== null && _plan_declaration_specifiers !== void 0 ? _plan_declaration_specifiers : [];
9856
+ var index = specifiers.indexOf(plan.specifier);
9857
+ if (index === specifiers.length - 1) {
9858
+ // last specifier: also remove the preceding comma (sits after the previous specifier).
9859
+ var previous = specifiers[index - 1];
9860
+ fixes.push(fixer.removeRange([
9861
+ previous.range[1],
9862
+ plan.specifier.range[1]
9863
+ ]));
9864
+ } else {
9865
+ // not last: remove the specifier and the comma/space up to the next specifier.
9866
+ fixes.push(fixer.removeRange([
9867
+ plan.specifier.range[0],
9868
+ specifiers[index + 1].range[0]
9869
+ ]));
9870
+ }
9871
+ fixes.push(fixer.insertTextAfter(plan.declaration, "\nimport { ".concat(sourceCode.getText(plan.specifier), " } from ").concat(plan.declaration.source.raw, ";")));
9872
+ }
9873
+ return fixes;
9874
+ }
9875
+ /**
9876
+ * ESLint rule that flags a numeric/string literal asserted onto an enum type — e.g.
9877
+ * `layer: 0 as PromptLayer` — and steers it to the named member (`PromptLayer.REPLY_PROTOCOL`).
9878
+ *
9879
+ * The cast is doubly harmful: it bypasses type-checking (any in-range *or* out-of-range number
9880
+ * satisfies `n as SomeEnum`, so `99 as PromptLayer` compiles silently) and it hides intent behind a
9881
+ * magic number. The rule is type-aware: it fires ONLY when the assertion target resolves to a real
9882
+ * `enum` / `const enum`, so legitimate branded-primitive aliases (`30 as EntityId`,
9883
+ * `7001 as ConceptId`) — which have no named members and for which the cast is the sanctioned form —
9884
+ * are never touched.
9885
+ *
9886
+ * When the literal matches a member, the fix rewrites the assertion to `Enum.MEMBER` and, when the
9887
+ * enum is bound via `import type` / `import { type … }`, converts that binding to a value import so
9888
+ * the rewritten value reference compiles. When the literal matches NO member, the rule reports the
9889
+ * unsafe cast without a fix (there is no correct member to substitute).
9890
+ *
9891
+ * Requires type information — it no-ops in lint passes without it (no `projectService` / `project`).
9892
+ */ var UTIL_NO_ENUM_LITERAL_CAST_RULE = {
9893
+ meta: {
9894
+ type: 'problem',
9895
+ fixable: 'code',
9896
+ docs: {
9897
+ description: 'Disallow asserting a literal onto an enum type (e.g. `0 as PromptLayer`); use the named enum member instead.',
9898
+ recommended: true
9899
+ },
9900
+ messages: {
9901
+ useEnumMember: 'Avoid `{{literal}} as {{enumName}}`; use the named member `{{enumName}}.{{member}}`. The literal cast bypasses type-checking (any number satisfies it) and hides intent.',
9902
+ unsafeEnumCast: '`{{literal}} as {{enumName}}` casts a literal onto enum `{{enumName}}`, but no `{{enumName}}` member has that value. The cast bypasses type-checking — use a real `{{enumName}}` member.'
9903
+ },
9904
+ schema: []
9905
+ },
9906
+ create: function create(context) {
9907
+ var sourceCode = context.sourceCode;
9908
+ var services = sourceCode === null || sourceCode === void 0 ? void 0 : sourceCode.parserServices;
9909
+ // The rule is only meaningful with type information. Without it (`program`/node-map absent) it
9910
+ // cannot tell an enum target from a branded-primitive alias, so it stays silent rather than guess.
9911
+ if (!(services === null || services === void 0 ? void 0 : services.program) || !(services === null || services === void 0 ? void 0 : services.esTreeNodeToTSNodeMap)) {
9912
+ return {};
9913
+ }
9914
+ var checker = services.program.getTypeChecker();
9915
+ var programNode = null;
9916
+ function check(node) {
9917
+ var _node_typeAnnotation, _node_typeAnnotation_typeName;
9918
+ var literal = readLiteral(node.expression);
9919
+ if (literal && ((_node_typeAnnotation = node.typeAnnotation) === null || _node_typeAnnotation === void 0 ? void 0 : _node_typeAnnotation.type) === 'TSTypeReference' && ((_node_typeAnnotation_typeName = node.typeAnnotation.typeName) === null || _node_typeAnnotation_typeName === void 0 ? void 0 : _node_typeAnnotation_typeName.type) === 'Identifier') {
9920
+ var typeRefNode = services.esTreeNodeToTSNodeMap.get(node.typeAnnotation);
9921
+ var enumSymbol = resolveEnumSymbol(checker, typeRefNode);
9922
+ if (enumSymbol) {
9923
+ var enumName = node.typeAnnotation.typeName.name;
9924
+ var member = findEnumMemberName(checker, enumSymbol, literal.value);
9925
+ if (member == null) {
9926
+ // No member carries this literal value (e.g. `99 as Color`): an unsafe cast the type
9927
+ // system would otherwise catch. Report it, but there is no correct member to fix to.
9928
+ context.report({
9929
+ node: node,
9930
+ messageId: 'unsafeEnumCast',
9931
+ data: {
9932
+ literal: literal.text,
9933
+ enumName: enumName
9934
+ }
9935
+ });
9936
+ } else {
9937
+ var plan = programNode ? planImportFix(programNode, enumName) : {
9938
+ kind: 'value'
9939
+ };
9940
+ context.report({
9941
+ node: node,
9942
+ messageId: 'useEnumMember',
9943
+ data: {
9944
+ literal: literal.text,
9945
+ enumName: enumName,
9946
+ member: member
9947
+ },
9948
+ fix: function fix(fixer) {
9949
+ return [
9950
+ fixer.replaceText(node, "".concat(enumName, ".").concat(member))
9951
+ ].concat(_to_consumable_array(buildImportFixes(fixer, sourceCode, plan)));
9952
+ }
9953
+ });
9954
+ }
9955
+ }
9956
+ }
9957
+ }
9958
+ return {
9959
+ Program: function Program(node) {
9960
+ programNode = node;
9961
+ },
9962
+ TSAsExpression: check,
9963
+ TSTypeAssertion: check
9964
+ };
9965
+ }
9966
+ };
9967
+
9662
9968
  function _array_like_to_array(arr, len) {
9663
9969
  if (len == null || len > arr.length) len = arr.length;
9664
9970
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -9917,7 +10223,8 @@ function _unsupported_iterable_to_array(o, minLen) {
9917
10223
  'require-default-prefix-naming': UTIL_REQUIRE_DEFAULT_PREFIX_NAMING_RULE,
9918
10224
  'require-exported-jsdoc-example': UTIL_REQUIRE_EXPORTED_JSDOC_EXAMPLE_RULE,
9919
10225
  'no-inline-string-empty-object-intersection': UTIL_NO_INLINE_STRING_EMPTY_OBJECT_INTERSECTION_RULE,
9920
- 'prefer-suggested-string': UTIL_PREFER_SUGGESTED_STRING_RULE
10226
+ 'prefer-suggested-string': UTIL_PREFER_SUGGESTED_STRING_RULE,
10227
+ 'no-enum-literal-cast': UTIL_NO_ENUM_LITERAL_CAST_RULE
9921
10228
  }
9922
10229
  };
9923
10230
  /**
@@ -9926,4 +10233,4 @@ function _unsupported_iterable_to_array(o, minLen) {
9926
10233
  * @dbxAllowConstantName
9927
10234
  */ var utilESLintPlugin = UTIL_ESLINT_PLUGIN;
9928
10235
 
9929
- export { UTIL_ESLINT_PLUGIN, UTIL_NO_INLINE_TYPE_IMPORT_RULE, UTIL_NO_SISTER_RE_EXPORT_RULE, UTIL_PREFER_CANONICAL_JSDOC_RULE, UTIL_PREFER_CONFIG_OBJECT_HARD_RULE, UTIL_PREFER_CONFIG_OBJECT_RULE, UTIL_PREFER_MAYBE_TYPE_RULE, UTIL_PREFER_NO_SIDE_EFFECTS_IN_JSDOC_RULE, UTIL_REQUIRE_CONSTANT_NAMING_RULE, UTIL_REQUIRE_DBX_ACTION_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_AUTH_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_DOCS_UI_EXAMPLE_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_FILTER_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_FORM_FIELD_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_MODEL_SNAPSHOT_FIELD_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_PIPE_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_RULE_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_UTIL_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_WEB_COMPANION_TAGS_RULE, UTIL_REQUIRE_DEFAULT_PREFIX_NAMING_RULE, UTIL_REQUIRE_DEPRECATED_ALIAS_PLACEMENT_RULE, UTIL_REQUIRE_EXPORTED_JSDOC_EXAMPLE_RULE, UTIL_REQUIRE_NO_SIDE_EFFECTS_RULE, UTIL_REQUIRE_READONLY_CONFIG_PARAMS_RULE, UTIL_REQUIRE_SINGLE_RETURN_RULE, buildLowercaseTagsFix, checkDbxTagFamily, findFamilyTags, getStatementAnchor, leadingJsdocFor, parseBooleanTagValue, parseJsdocComment, reportOnJsdocLine, utilESLintPlugin };
10236
+ export { UTIL_ESLINT_PLUGIN, UTIL_NO_ENUM_LITERAL_CAST_RULE, UTIL_NO_INLINE_TYPE_IMPORT_RULE, UTIL_NO_SISTER_RE_EXPORT_RULE, UTIL_PREFER_CANONICAL_JSDOC_RULE, UTIL_PREFER_CONFIG_OBJECT_HARD_RULE, UTIL_PREFER_CONFIG_OBJECT_RULE, UTIL_PREFER_MAYBE_TYPE_RULE, UTIL_PREFER_NO_SIDE_EFFECTS_IN_JSDOC_RULE, UTIL_REQUIRE_CONSTANT_NAMING_RULE, UTIL_REQUIRE_DBX_ACTION_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_AUTH_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_DOCS_UI_EXAMPLE_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_FILTER_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_FORM_FIELD_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_MODEL_SNAPSHOT_FIELD_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_PIPE_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_RULE_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_UTIL_COMPANION_TAGS_RULE, UTIL_REQUIRE_DBX_WEB_COMPANION_TAGS_RULE, UTIL_REQUIRE_DEFAULT_PREFIX_NAMING_RULE, UTIL_REQUIRE_DEPRECATED_ALIAS_PLACEMENT_RULE, UTIL_REQUIRE_EXPORTED_JSDOC_EXAMPLE_RULE, UTIL_REQUIRE_NO_SIDE_EFFECTS_RULE, UTIL_REQUIRE_READONLY_CONFIG_PARAMS_RULE, UTIL_REQUIRE_SINGLE_RETURN_RULE, buildLowercaseTagsFix, checkDbxTagFamily, findFamilyTags, getStatementAnchor, leadingJsdocFor, parseBooleanTagValue, parseJsdocComment, reportOnJsdocLine, utilESLintPlugin };