@dereekb/util 13.11.18 → 13.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -268,21 +268,21 @@
268
268
  return result;
269
269
  }
270
270
 
271
- function _array_like_to_array$d(arr, len) {
271
+ function _array_like_to_array$c(arr, len) {
272
272
  if (len == null || len > arr.length) len = arr.length;
273
273
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
274
274
  return arr2;
275
275
  }
276
- function _array_with_holes$b(arr) {
276
+ function _array_with_holes$a(arr) {
277
277
  if (Array.isArray(arr)) return arr;
278
278
  }
279
279
  function _array_without_holes$4(arr) {
280
- if (Array.isArray(arr)) return _array_like_to_array$d(arr);
280
+ if (Array.isArray(arr)) return _array_like_to_array$c(arr);
281
281
  }
282
282
  function _iterable_to_array$4(iter) {
283
283
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
284
284
  }
285
- function _iterable_to_array_limit$b(arr, i) {
285
+ function _iterable_to_array_limit$a(arr, i) {
286
286
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
287
287
  if (_i == null) return;
288
288
  var _arr = [];
@@ -306,25 +306,25 @@ function _iterable_to_array_limit$b(arr, i) {
306
306
  }
307
307
  return _arr;
308
308
  }
309
- function _non_iterable_rest$b() {
309
+ function _non_iterable_rest$a() {
310
310
  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
311
  }
312
312
  function _non_iterable_spread$4() {
313
313
  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
314
  }
315
- function _sliced_to_array$b(arr, i) {
316
- return _array_with_holes$b(arr) || _iterable_to_array_limit$b(arr, i) || _unsupported_iterable_to_array$d(arr, i) || _non_iterable_rest$b();
315
+ 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();
317
317
  }
318
318
  function _to_consumable_array$4(arr) {
319
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$4();
319
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$4();
320
320
  }
321
- function _unsupported_iterable_to_array$d(o, minLen) {
321
+ function _unsupported_iterable_to_array$c(o, minLen) {
322
322
  if (!o) return;
323
- if (typeof o === "string") return _array_like_to_array$d(o, minLen);
323
+ if (typeof o === "string") return _array_like_to_array$c(o, minLen);
324
324
  var n = Object.prototype.toString.call(o).slice(8, -1);
325
325
  if (n === "Object" && o.constructor) n = o.constructor.name;
326
326
  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$d(o, minLen);
327
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
328
328
  }
329
329
  /**
330
330
  * The JSDoc tag identifying a function as a factory in the @dereekb conventions.
@@ -457,7 +457,7 @@ function pickMessageId(hasOverloads, jsdoc) {
457
457
  ], "// ".concat(NO_SIDE_EFFECTS_TAG, "\n").concat(indent));
458
458
  }
459
459
  function buildRedundantRemovalFix(fixer, redundant) {
460
- var _redundant_range = _sliced_to_array$b(redundant.range, 2), start = _redundant_range[0], end = _redundant_range[1];
460
+ var _redundant_range = _sliced_to_array$a(redundant.range, 2), start = _redundant_range[0], end = _redundant_range[1];
461
461
  var removeEnd = end;
462
462
  while(removeEnd < sourceText.length && (sourceText.charAt(removeEnd) === ' ' || sourceText.charAt(removeEnd) === '\t'))removeEnd += 1;
463
463
  if (sourceText.charAt(removeEnd) === '\n') removeEnd += 1;
@@ -525,15 +525,15 @@ function pickMessageId(hasOverloads, jsdoc) {
525
525
  }
526
526
  };
527
527
 
528
- function _array_like_to_array$c(arr, len) {
528
+ function _array_like_to_array$b(arr, len) {
529
529
  if (len == null || len > arr.length) len = arr.length;
530
530
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
531
531
  return arr2;
532
532
  }
533
- function _array_with_holes$a(arr) {
533
+ function _array_with_holes$9(arr) {
534
534
  if (Array.isArray(arr)) return arr;
535
535
  }
536
- function _iterable_to_array_limit$a(arr, i) {
536
+ function _iterable_to_array_limit$9(arr, i) {
537
537
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
538
538
  if (_i == null) return;
539
539
  var _arr = [];
@@ -557,19 +557,19 @@ function _iterable_to_array_limit$a(arr, i) {
557
557
  }
558
558
  return _arr;
559
559
  }
560
- function _non_iterable_rest$a() {
560
+ function _non_iterable_rest$9() {
561
561
  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
562
  }
563
- function _sliced_to_array$a(arr, i) {
564
- return _array_with_holes$a(arr) || _iterable_to_array_limit$a(arr, i) || _unsupported_iterable_to_array$c(arr, i) || _non_iterable_rest$a();
563
+ 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();
565
565
  }
566
- function _unsupported_iterable_to_array$c(o, minLen) {
566
+ function _unsupported_iterable_to_array$b(o, minLen) {
567
567
  if (!o) return;
568
- if (typeof o === "string") return _array_like_to_array$c(o, minLen);
568
+ if (typeof o === "string") return _array_like_to_array$b(o, minLen);
569
569
  var n = Object.prototype.toString.call(o).slice(8, -1);
570
570
  if (n === "Object" && o.constructor) n = o.constructor.name;
571
571
  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$c(o, minLen);
572
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
573
573
  }
574
574
  var UTIL_PREFER_NO_SIDE_EFFECTS_IN_JSDOC_RULE = {
575
575
  meta: {
@@ -663,7 +663,7 @@ function _unsupported_iterable_to_array$c(o, minLen) {
663
663
  // Remove the orphan line/block comment annotations.
664
664
  for(var _iterator = orphanLineComments[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
665
665
  var orphan = _step.value;
666
- var _orphan_range = _sliced_to_array$a(orphan.range, 2), start = _orphan_range[0], end = _orphan_range[1];
666
+ var _orphan_range = _sliced_to_array$9(orphan.range, 2), start = _orphan_range[0], end = _orphan_range[1];
667
667
  var removeEnd = end;
668
668
  while(removeEnd < sourceText.length && (sourceText.charAt(removeEnd) === ' ' || sourceText.charAt(removeEnd) === '\t')){
669
669
  removeEnd += 1;
@@ -869,15 +869,15 @@ function _templateObject() {
869
869
  }
870
870
  };
871
871
 
872
- function _array_like_to_array$b(arr, len) {
872
+ function _array_like_to_array$a(arr, len) {
873
873
  if (len == null || len > arr.length) len = arr.length;
874
874
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
875
875
  return arr2;
876
876
  }
877
- function _array_with_holes$9(arr) {
877
+ function _array_with_holes$8(arr) {
878
878
  if (Array.isArray(arr)) return arr;
879
879
  }
880
- function _iterable_to_array_limit$9(arr, i) {
880
+ function _iterable_to_array_limit$8(arr, i) {
881
881
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
882
882
  if (_i == null) return;
883
883
  var _arr = [];
@@ -901,23 +901,23 @@ function _iterable_to_array_limit$9(arr, i) {
901
901
  }
902
902
  return _arr;
903
903
  }
904
- function _non_iterable_rest$9() {
904
+ function _non_iterable_rest$8() {
905
905
  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
906
  }
907
- function _sliced_to_array$9(arr, i) {
908
- return _array_with_holes$9(arr) || _iterable_to_array_limit$9(arr, i) || _unsupported_iterable_to_array$b(arr, i) || _non_iterable_rest$9();
907
+ 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();
909
909
  }
910
- function _type_of(obj) {
910
+ function _type_of$1(obj) {
911
911
  "@swc/helpers - typeof";
912
912
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
913
913
  }
914
- function _unsupported_iterable_to_array$b(o, minLen) {
914
+ function _unsupported_iterable_to_array$a(o, minLen) {
915
915
  if (!o) return;
916
- if (typeof o === "string") return _array_like_to_array$b(o, minLen);
916
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
917
917
  var n = Object.prototype.toString.call(o).slice(8, -1);
918
918
  if (n === "Object" && o.constructor) n = o.constructor.name;
919
919
  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$b(o, minLen);
920
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
921
921
  }
922
922
  /**
923
923
  * AST node types whose bodies represent a *new* function scope and must be skipped during return-counting.
@@ -967,7 +967,7 @@ function collectFromGuardConsequent(consequent, out) {
967
967
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
968
968
  try {
969
969
  for(var _iterator = body.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
970
- var _step_value = _sliced_to_array$9(_step.value, 2), i = _step_value[0], stmt = _step_value[1];
970
+ var _step_value = _sliced_to_array$8(_step.value, 2), i = _step_value[0], stmt = _step_value[1];
971
971
  var isLastReturn = i === lastIndex && (stmt === null || stmt === void 0 ? void 0 : stmt.type) === 'ReturnStatement';
972
972
  if (!isLastReturn) collectCountedReturns(stmt, out);
973
973
  }
@@ -1024,7 +1024,7 @@ function walkChildren(node, out) {
1024
1024
  * @param node - The AST node to traverse.
1025
1025
  * @param out - The accumulator array that receives counted `ReturnStatement` nodes.
1026
1026
  */ function collectCountedReturns(node, out) {
1027
- if (node === null || (typeof node === "undefined" ? "undefined" : _type_of(node)) !== 'object') return;
1027
+ if (node === null || (typeof node === "undefined" ? "undefined" : _type_of$1(node)) !== 'object') return;
1028
1028
  if (Array.isArray(node)) {
1029
1029
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1030
1030
  try {
@@ -1114,13 +1114,13 @@ function walkChildren(node, out) {
1114
1114
  }
1115
1115
  };
1116
1116
 
1117
- function _array_like_to_array$a(arr, len) {
1117
+ function _array_like_to_array$9(arr, len) {
1118
1118
  if (len == null || len > arr.length) len = arr.length;
1119
1119
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1120
1120
  return arr2;
1121
1121
  }
1122
1122
  function _array_without_holes$3(arr) {
1123
- if (Array.isArray(arr)) return _array_like_to_array$a(arr);
1123
+ if (Array.isArray(arr)) return _array_like_to_array$9(arr);
1124
1124
  }
1125
1125
  function _iterable_to_array$3(iter) {
1126
1126
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
@@ -1129,15 +1129,15 @@ function _non_iterable_spread$3() {
1129
1129
  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
1130
  }
1131
1131
  function _to_consumable_array$3(arr) {
1132
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$3();
1132
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$3();
1133
1133
  }
1134
- function _unsupported_iterable_to_array$a(o, minLen) {
1134
+ function _unsupported_iterable_to_array$9(o, minLen) {
1135
1135
  if (!o) return;
1136
- if (typeof o === "string") return _array_like_to_array$a(o, minLen);
1136
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
1137
1137
  var n = Object.prototype.toString.call(o).slice(8, -1);
1138
1138
  if (n === "Object" && o.constructor) n = o.constructor.name;
1139
1139
  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$a(o, minLen);
1140
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
1141
1141
  }
1142
1142
  /**
1143
1143
  * Default name suffixes that mark an interface as config-shaped (its properties should be readonly).
@@ -1858,13 +1858,13 @@ function statementBringsMaybeIntoScope(stmt) {
1858
1858
  }
1859
1859
  };
1860
1860
 
1861
- function _array_like_to_array$9(arr, len) {
1861
+ function _array_like_to_array$8(arr, len) {
1862
1862
  if (len == null || len > arr.length) len = arr.length;
1863
1863
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1864
1864
  return arr2;
1865
1865
  }
1866
1866
  function _array_without_holes$2(arr) {
1867
- if (Array.isArray(arr)) return _array_like_to_array$9(arr);
1867
+ if (Array.isArray(arr)) return _array_like_to_array$8(arr);
1868
1868
  }
1869
1869
  function _iterable_to_array$2(iter) {
1870
1870
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
@@ -1873,15 +1873,19 @@ function _non_iterable_spread$2() {
1873
1873
  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
1874
  }
1875
1875
  function _to_consumable_array$2(arr) {
1876
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$2();
1876
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$2();
1877
1877
  }
1878
- function _unsupported_iterable_to_array$9(o, minLen) {
1878
+ function _type_of(obj) {
1879
+ "@swc/helpers - typeof";
1880
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1881
+ }
1882
+ function _unsupported_iterable_to_array$8(o, minLen) {
1879
1883
  if (!o) return;
1880
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
1884
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
1881
1885
  var n = Object.prototype.toString.call(o).slice(8, -1);
1882
1886
  if (n === "Object" && o.constructor) n = o.constructor.name;
1883
1887
  if (n === "Map" || n === "Set") return Array.from(n);
1884
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
1888
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
1885
1889
  }
1886
1890
  /**
1887
1891
  * The required marker line comment that opens the deprecated-aliases section at the bottom of a file.
@@ -2074,30 +2078,104 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2074
2078
  return sourceCode.text.slice(range[0], range[1]);
2075
2079
  }
2076
2080
  /**
2077
- * Returns true when every deprecated statement in `deprecated` appears AFTER every non-deprecated
2078
- * analyzable statement in `analyzable` (i.e., the deprecated section is already at the bottom of
2079
- * the file). This is the condition under which the autofix can simply insert the marker without
2080
- * reordering statements.
2081
+ * Unwraps an `export` statement to the underlying declaration. Returns the node itself when it is
2082
+ * not an export wrapper.
2081
2083
  *
2082
- * @param analyzable - All analyzable top-level statements in source order.
2083
- * @param deprecated - The subset that carry `@deprecated`.
2084
- * @returns True when no non-deprecated statement appears after the first deprecated one.
2085
- */ function allDeprecatedAtBottom(analyzable, deprecated) {
2086
- var atBottom = true;
2087
- if (deprecated.length !== 0) {
2088
- var firstDeprecatedStart = deprecated[0].range[0];
2089
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2090
- try {
2091
- for(var _iterator = analyzable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2092
- var stmt = _step.value;
2093
- if (stmt.range[0] > firstDeprecatedStart) {
2094
- // Statement appears after the first deprecated one. It must itself be deprecated.
2095
- var isDeprecated = deprecated.includes(stmt);
2096
- if (!isDeprecated) {
2097
- atBottom = false;
2084
+ * @param statement - The top-level statement node.
2085
+ * @returns The inner declaration for export wrappers, otherwise the statement itself.
2086
+ */ function unwrapDeclaration(statement) {
2087
+ var declaration = statement;
2088
+ if ((statement.type === 'ExportNamedDeclaration' || statement.type === 'ExportDefaultDeclaration') && statement.declaration != null) {
2089
+ declaration = statement.declaration;
2090
+ }
2091
+ return declaration;
2092
+ }
2093
+ /**
2094
+ * Recursively collects the binding names introduced by a binding pattern (`Identifier`,
2095
+ * `ObjectPattern`, `ArrayPattern`, including defaults and rest elements).
2096
+ *
2097
+ * @param node - A binding pattern to walk; missing array-pattern holes contribute no names.
2098
+ * @returns The flat list of bound identifier names.
2099
+ */ function collectPatternNames(node) {
2100
+ var names = [];
2101
+ if (node != null) {
2102
+ if (node.type === 'Identifier') {
2103
+ names.push(node.name);
2104
+ } else if (node.type === 'ObjectPattern') {
2105
+ var _node_properties;
2106
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2107
+ try {
2108
+ 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
+ var property = _step.value;
2110
+ var _names;
2111
+ (_names = names).push.apply(_names, _to_consumable_array$2(collectPatternNames(property.type === 'RestElement' ? property.argument : property.value)));
2112
+ }
2113
+ } catch (err) {
2114
+ _didIteratorError = true;
2115
+ _iteratorError = err;
2116
+ } finally{
2117
+ try {
2118
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2119
+ _iterator.return();
2120
+ }
2121
+ } finally{
2122
+ if (_didIteratorError) {
2123
+ throw _iteratorError;
2124
+ }
2125
+ }
2126
+ }
2127
+ } else if (node.type === 'ArrayPattern') {
2128
+ var _node_elements;
2129
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
2130
+ try {
2131
+ 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
+ var element = _step1.value;
2133
+ 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)));
2135
+ }
2136
+ } catch (err) {
2137
+ _didIteratorError1 = true;
2138
+ _iteratorError1 = err;
2139
+ } finally{
2140
+ try {
2141
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
2142
+ _iterator1.return();
2143
+ }
2144
+ } finally{
2145
+ if (_didIteratorError1) {
2146
+ throw _iteratorError1;
2098
2147
  }
2099
2148
  }
2100
2149
  }
2150
+ } else if (node.type === 'AssignmentPattern') {
2151
+ var _names2;
2152
+ (_names2 = names).push.apply(_names2, _to_consumable_array$2(collectPatternNames(node.left)));
2153
+ } else if (node.type === 'RestElement') {
2154
+ var _names3;
2155
+ (_names3 = names).push.apply(_names3, _to_consumable_array$2(collectPatternNames(node.argument)));
2156
+ }
2157
+ }
2158
+ return names;
2159
+ }
2160
+ /**
2161
+ * Returns the binding names a top-level statement introduces: variable declarator ids, an
2162
+ * import's local specifier names, or a function/class/interface/type/enum declaration id.
2163
+ *
2164
+ * @param statement - The top-level statement node.
2165
+ * @returns The names bound by the statement.
2166
+ */ function getDeclaredBindingNames(statement) {
2167
+ var _declaration_id;
2168
+ var names = [];
2169
+ var declaration = unwrapDeclaration(statement);
2170
+ if (declaration.type === 'VariableDeclaration') {
2171
+ var _declaration_declarations;
2172
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2173
+ try {
2174
+ 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
+ var declarator = _step.value;
2176
+ var _names;
2177
+ (_names = names).push.apply(_names, _to_consumable_array$2(collectPatternNames(declarator.id)));
2178
+ }
2101
2179
  } catch (err) {
2102
2180
  _didIteratorError = true;
2103
2181
  _iteratorError = err;
@@ -2112,43 +2190,82 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2112
2190
  }
2113
2191
  }
2114
2192
  }
2193
+ } else if (declaration.type === 'ImportDeclaration') {
2194
+ var _declaration_specifiers;
2195
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
2196
+ try {
2197
+ for(var _iterator1 = ((_declaration_specifiers = declaration.specifiers) !== null && _declaration_specifiers !== void 0 ? _declaration_specifiers : [])[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2198
+ var specifier = _step1.value;
2199
+ var _specifier_local;
2200
+ if (typeof ((_specifier_local = specifier.local) === null || _specifier_local === void 0 ? void 0 : _specifier_local.name) === 'string') {
2201
+ names.push(specifier.local.name);
2202
+ }
2203
+ }
2204
+ } catch (err) {
2205
+ _didIteratorError1 = true;
2206
+ _iteratorError1 = err;
2207
+ } finally{
2208
+ try {
2209
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
2210
+ _iterator1.return();
2211
+ }
2212
+ } finally{
2213
+ if (_didIteratorError1) {
2214
+ throw _iteratorError1;
2215
+ }
2216
+ }
2217
+ }
2218
+ } else if (((_declaration_id = declaration.id) === null || _declaration_id === void 0 ? void 0 : _declaration_id.type) === 'Identifier') {
2219
+ names.push(declaration.id.name);
2115
2220
  }
2116
- return atBottom;
2221
+ return names;
2117
2222
  }
2118
2223
  /**
2119
- * Builds the fix for the marker-only case where every deprecated statement already sits at the
2120
- * bottom of the file: insert the marker line immediately above the first deprecated block.
2224
+ * Returns true for AST-walk keys that must not be descended into: the `parent` back-reference
2225
+ * (which would escape the subtree) and the `loc`/`range` position metadata.
2121
2226
  *
2122
- * @param sourceCode - The ESLint `SourceCode` instance.
2123
- * @param firstDeprecated - The first deprecated statement (the insertion anchor).
2124
- * @returns A fix function that inserts the marker comment.
2125
- */ function buildMarkerOnlyFix(sourceCode, firstDeprecated) {
2126
- var blockRange = getStatementBlockRange(sourceCode, firstDeprecated);
2127
- var insertionPoint = blockRange[0];
2128
- return function(fixer) {
2129
- return fixer.replaceTextRange([
2130
- insertionPoint,
2131
- insertionPoint
2132
- ], "".concat(COMPAT_MARKER_LINE, "\n"));
2133
- };
2227
+ * @param key - The property key being considered for traversal.
2228
+ * @returns True when the key should be skipped.
2229
+ */ function isIdentifierWalkSkipKey(key) {
2230
+ return key === 'parent' || key === 'loc' || key === 'range';
2134
2231
  }
2135
2232
  /**
2136
- * Builds the fix for the interleaved case: cut every deprecated block out of the file and re-emit
2137
- * them in source order at EOF, preceded by the marker.
2233
+ * Collects every `Identifier` name reachable from an AST record (a node with a string `type`),
2234
+ * recursing into its child nodes while skipping the keys flagged by {@link isIdentifierWalkSkipKey}.
2138
2235
  *
2139
- * @param sourceCode - The ESLint `SourceCode` instance.
2140
- * @param deprecatedStatements - Deprecated statements in source order.
2141
- * @returns A fix function that removes and re-appends each deprecated block.
2142
- */ function buildInterleavedFix(sourceCode, deprecatedStatements) {
2143
- var blockRanges = [];
2144
- var blockTexts = [];
2236
+ * @param record - An AST node, keyed by its properties.
2237
+ * @returns The set of identifier names found within the node.
2238
+ */ function collectIdentifierNamesFromRecord(record) {
2239
+ var names = new Set();
2240
+ if (record.type === 'Identifier' && typeof record.name === 'string') {
2241
+ names.add(record.name);
2242
+ }
2145
2243
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2146
2244
  try {
2147
- for(var _iterator = deprecatedStatements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2148
- var stmt = _step.value;
2149
- var range = getStatementBlockRange(sourceCode, stmt);
2150
- blockRanges.push(range);
2151
- blockTexts.push(readRange(sourceCode, range));
2245
+ for(var _iterator = Object.keys(record)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2246
+ var key = _step.value;
2247
+ if (!isIdentifierWalkSkipKey(key)) {
2248
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
2249
+ try {
2250
+ for(var _iterator1 = collectIdentifierNames(record[key])[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2251
+ var name = _step1.value;
2252
+ names.add(name);
2253
+ }
2254
+ } catch (err) {
2255
+ _didIteratorError1 = true;
2256
+ _iteratorError1 = err;
2257
+ } finally{
2258
+ try {
2259
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
2260
+ _iterator1.return();
2261
+ }
2262
+ } finally{
2263
+ if (_didIteratorError1) {
2264
+ throw _iteratorError1;
2265
+ }
2266
+ }
2267
+ }
2268
+ }
2152
2269
  }
2153
2270
  } catch (err) {
2154
2271
  _didIteratorError = true;
@@ -2164,132 +2281,271 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2164
2281
  }
2165
2282
  }
2166
2283
  }
2167
- var sourceText = sourceCode.text;
2168
- var eof = sourceText.length;
2169
- var trailingNewline = sourceText.endsWith('\n') ? '' : '\n';
2170
- // Strip trailing newline from each block to control spacing precisely, then re-add a single
2171
- // newline between blocks. Final block lands without a trailing newline; an explicit `\n` at
2172
- // the end keeps EOF tidy.
2173
- var joinedBlocks = blockTexts.map(function(t) {
2174
- return t.replace(/\n+$/, '');
2175
- }).join('\n\n');
2176
- var appendText = "".concat(trailingNewline, "\n").concat(COMPAT_MARKER_LINE, "\n").concat(joinedBlocks, "\n");
2177
- return function(fixer) {
2178
- return _to_consumable_array$2(blockRanges.map(function(r) {
2179
- return fixer.removeRange(r);
2180
- })).concat([
2181
- fixer.insertTextAfterRange([
2182
- eof,
2183
- eof
2184
- ], appendText)
2185
- ]);
2186
- };
2284
+ return names;
2187
2285
  }
2188
2286
  /**
2189
- * Reports the `missingCompatMarker` violation, choosing between the marker-only and interleaved
2190
- * fix strategies based on whether the deprecated tail is already at the bottom of the file.
2287
+ * Recursively collects every `Identifier` name reachable from a value, staying within the subtree.
2191
2288
  *
2192
- * @param args - Inputs grouped as a single config object.
2193
- * @param args.context - The ESLint rule context.
2194
- * @param args.sourceCode - The ESLint `SourceCode` instance.
2195
- * @param args.analyzable - All analyzable top-level statements in source order.
2196
- * @param args.deprecatedStatements - The subset that carry `@deprecated`.
2197
- */ function reportMissingMarker(args) {
2198
- var context = args.context, sourceCode = args.sourceCode, analyzable = args.analyzable, deprecatedStatements = args.deprecatedStatements;
2199
- var firstDeprecated = deprecatedStatements[0];
2200
- var fixFn = allDeprecatedAtBottom(analyzable, deprecatedStatements) ? buildMarkerOnlyFix(sourceCode, firstDeprecated) : buildInterleavedFix(sourceCode, deprecatedStatements);
2201
- context.report({
2202
- node: firstDeprecated,
2203
- messageId: 'missingCompatMarker',
2204
- fix: fixFn
2205
- });
2289
+ * Used both for the value-alias check (over a declarator `init`) and the reverse-reference safety
2290
+ * net (over a whole statement). Over-collection is acceptable for both callers: it only makes the
2291
+ * safety net more conservative and the alias check more permissive toward genuine aliases.
2292
+ *
2293
+ * @param node - The subtree root to scan (an AST node, an array of nodes, or a leaf value).
2294
+ * @returns The set of identifier names found in the subtree.
2295
+ */ function collectIdentifierNames(node) {
2296
+ var names = new Set();
2297
+ if (Array.isArray(node)) {
2298
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2299
+ try {
2300
+ for(var _iterator = node[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2301
+ var item = _step.value;
2302
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
2303
+ try {
2304
+ for(var _iterator1 = collectIdentifierNames(item)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2305
+ var name = _step1.value;
2306
+ names.add(name);
2307
+ }
2308
+ } catch (err) {
2309
+ _didIteratorError1 = true;
2310
+ _iteratorError1 = err;
2311
+ } finally{
2312
+ try {
2313
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
2314
+ _iterator1.return();
2315
+ }
2316
+ } finally{
2317
+ if (_didIteratorError1) {
2318
+ throw _iteratorError1;
2319
+ }
2320
+ }
2321
+ }
2322
+ }
2323
+ } catch (err) {
2324
+ _didIteratorError = true;
2325
+ _iteratorError = err;
2326
+ } finally{
2327
+ try {
2328
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2329
+ _iterator.return();
2330
+ }
2331
+ } finally{
2332
+ if (_didIteratorError) {
2333
+ throw _iteratorError;
2334
+ }
2335
+ }
2336
+ }
2337
+ } else if (node != null && (typeof node === "undefined" ? "undefined" : _type_of(node)) === 'object' && typeof node.type === 'string') {
2338
+ names = collectIdentifierNamesFromRecord(node);
2339
+ }
2340
+ return names;
2206
2341
  }
2207
2342
  /**
2208
- * Builds the fix that moves a deprecated block sitting above the marker to immediately after the
2209
- * marker comment.
2343
+ * Builds a map of every top-level binding name in the file to whether its declaration carries an
2344
+ * `@deprecated` tag. A name declared more than once is considered non-deprecated when any of its
2345
+ * declarations is non-deprecated.
2210
2346
  *
2211
2347
  * @param sourceCode - The ESLint `SourceCode` instance.
2212
- * @param stmt - The misplaced deprecated statement.
2213
- * @param marker - Marker comment node (when available) plus its start offset (fallback).
2214
- * @returns A fix function that relocates the block below the marker.
2215
- */ function buildMoveDeprecatedFix(sourceCode, stmt, marker) {
2216
- var blockRange = getStatementBlockRange(sourceCode, stmt);
2217
- var blockText = readRange(sourceCode, blockRange);
2218
- var markerEnd = marker.comment === undefined ? marker.offset : marker.comment.range[1];
2219
- return function(fixer) {
2220
- return [
2221
- // Remove from current location.
2222
- fixer.removeRange(blockRange),
2223
- // Insert after the marker comment, preceded by a newline so it lands on a new line.
2224
- fixer.insertTextAfterRange([
2225
- markerEnd,
2226
- markerEnd
2227
- ], "\n".concat(blockText.replace(/\n$/, '')))
2228
- ];
2229
- };
2348
+ * @param body - All top-level program-body statements.
2349
+ * @returns Whether each top-level binding name is declared as `@deprecated`, keyed by that name.
2350
+ */ function buildBindingDeprecationMap(sourceCode, body) {
2351
+ var bindingDeprecation = new Map();
2352
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2353
+ try {
2354
+ for(var _iterator = body[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2355
+ var statement = _step.value;
2356
+ var deprecated = statementIsDeprecated(sourceCode, statement);
2357
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
2358
+ try {
2359
+ for(var _iterator1 = getDeclaredBindingNames(statement)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2360
+ var name = _step1.value;
2361
+ var existing = bindingDeprecation.get(name);
2362
+ bindingDeprecation.set(name, existing === undefined ? deprecated : existing && deprecated);
2363
+ }
2364
+ } catch (err) {
2365
+ _didIteratorError1 = true;
2366
+ _iteratorError1 = err;
2367
+ } finally{
2368
+ try {
2369
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
2370
+ _iterator1.return();
2371
+ }
2372
+ } finally{
2373
+ if (_didIteratorError1) {
2374
+ throw _iteratorError1;
2375
+ }
2376
+ }
2377
+ }
2378
+ }
2379
+ } catch (err) {
2380
+ _didIteratorError = true;
2381
+ _iteratorError = err;
2382
+ } finally{
2383
+ try {
2384
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2385
+ _iterator.return();
2386
+ }
2387
+ } finally{
2388
+ if (_didIteratorError) {
2389
+ throw _iteratorError;
2390
+ }
2391
+ }
2392
+ }
2393
+ return bindingDeprecation;
2230
2394
  }
2231
2395
  /**
2232
- * Builds the fix that moves a non-deprecated block sitting below the marker to immediately before
2233
- * the marker comment.
2396
+ * Returns true when a `@deprecated` statement is a runtime *value alias* a `VariableDeclaration`
2397
+ * whose initializer references a non-deprecated binding declared elsewhere in the file (or an
2398
+ * imported name). Literal-only initializers (`= 'SPED'`, `= 5`, object/array literals with no
2399
+ * variable references) are primary definitions, not aliases, and return false.
2234
2400
  *
2235
2401
  * @param sourceCode - The ESLint `SourceCode` instance.
2236
- * @param stmt - The misplaced non-deprecated statement.
2237
- * @param marker - Marker comment node (when available) plus its start offset (fallback).
2238
- * @returns A fix function that relocates the block above the marker.
2239
- */ function buildMoveNonDeprecatedFix(sourceCode, stmt, marker) {
2240
- var blockRange = getStatementBlockRange(sourceCode, stmt);
2241
- var blockText = readRange(sourceCode, blockRange);
2242
- var markerStart = marker.comment === undefined ? marker.offset : marker.comment.range[0];
2243
- return function(fixer) {
2244
- return [
2245
- fixer.removeRange(blockRange),
2246
- // Insert just before the marker; keep the block's trailing newline and add one more so a
2247
- // blank line separates the moved block from the marker.
2248
- fixer.replaceTextRange([
2249
- markerStart,
2250
- markerStart
2251
- ], "".concat(blockText, "\n"))
2252
- ];
2253
- };
2402
+ * @param statement - The top-level statement node.
2403
+ * @param bindingDeprecation - Map of top-level binding name to deprecation flag.
2404
+ * @returns True when the statement is a deprecated value alias.
2405
+ */ function statementIsValueAlias(sourceCode, statement, bindingDeprecation) {
2406
+ var isAlias = false;
2407
+ var declaration = unwrapDeclaration(statement);
2408
+ if (statementIsDeprecated(sourceCode, statement) && declaration.type === 'VariableDeclaration') {
2409
+ var _declaration_declarations;
2410
+ var ownNames = new Set(getDeclaredBindingNames(statement));
2411
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2412
+ try {
2413
+ for(var _iterator = ((_declaration_declarations = declaration.declarations) !== null && _declaration_declarations !== void 0 ? _declaration_declarations : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2414
+ var declarator = _step.value;
2415
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
2416
+ try {
2417
+ for(var _iterator1 = collectIdentifierNames(declarator.init)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2418
+ var name = _step1.value;
2419
+ if (!ownNames.has(name) && bindingDeprecation.get(name) === false) {
2420
+ isAlias = true;
2421
+ }
2422
+ }
2423
+ } catch (err) {
2424
+ _didIteratorError1 = true;
2425
+ _iteratorError1 = err;
2426
+ } finally{
2427
+ try {
2428
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
2429
+ _iterator1.return();
2430
+ }
2431
+ } finally{
2432
+ if (_didIteratorError1) {
2433
+ throw _iteratorError1;
2434
+ }
2435
+ }
2436
+ }
2437
+ }
2438
+ } catch (err) {
2439
+ _didIteratorError = true;
2440
+ _iteratorError = err;
2441
+ } finally{
2442
+ try {
2443
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2444
+ _iterator.return();
2445
+ }
2446
+ } finally{
2447
+ if (_didIteratorError) {
2448
+ throw _iteratorError;
2449
+ }
2450
+ }
2451
+ }
2452
+ }
2453
+ return isAlias;
2254
2454
  }
2255
2455
  /**
2256
- * Reports the first misplaced deprecated block (above the marker) and the first misplaced
2257
- * non-deprecated block (below the marker). At most one of each is reported per pass; ESLint's
2258
- * autofix loop converges across multiple violations.
2456
+ * Safety net for runtime value aliases: returns true when any name bound by `statement` is
2457
+ * referenced by some *other* top-level statement in the file. Relocating such a value below those
2458
+ * references would introduce a use-before-declaration / temporal-dead-zone error, so a referenced
2459
+ * alias must stay in place.
2259
2460
  *
2260
- * @param args - Inputs grouped as a single config object.
2261
- * @param args.context - The ESLint rule context.
2262
- * @param args.sourceCode - The ESLint `SourceCode` instance.
2263
- * @param args.analyzable - All analyzable top-level statements in source order.
2264
- * @param args.markerOffset - The marker comment's start offset.
2265
- */ function reportMisplacedStatements(args) {
2266
- var context = args.context, sourceCode = args.sourceCode, analyzable = args.analyzable, markerOffset = args.markerOffset;
2267
- var marker = {
2268
- comment: findCompatMarkerComment(sourceCode),
2269
- offset: markerOffset
2270
- };
2271
- var reportedAliasAboveMarker = false;
2272
- var reportedNonDeprecatedBelowMarker = false;
2461
+ * @param names - The names bound by the candidate statement.
2462
+ * @param statement - The candidate statement (excluded from the scan).
2463
+ * @param body - All top-level program-body statements.
2464
+ * @returns True when another statement references one of `names`.
2465
+ */ function isReferencedByOtherStatements(names, statement, body) {
2466
+ var referenced = false;
2467
+ if (names.length !== 0) {
2468
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2469
+ try {
2470
+ for(var _iterator = body[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2471
+ var other = _step.value;
2472
+ if (other !== statement) {
2473
+ var otherNames = collectIdentifierNames(other);
2474
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
2475
+ try {
2476
+ for(var _iterator1 = names[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2477
+ var name = _step1.value;
2478
+ if (otherNames.has(name)) {
2479
+ referenced = true;
2480
+ }
2481
+ }
2482
+ } catch (err) {
2483
+ _didIteratorError1 = true;
2484
+ _iteratorError1 = err;
2485
+ } finally{
2486
+ try {
2487
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
2488
+ _iterator1.return();
2489
+ }
2490
+ } finally{
2491
+ if (_didIteratorError1) {
2492
+ throw _iteratorError1;
2493
+ }
2494
+ }
2495
+ }
2496
+ }
2497
+ }
2498
+ } catch (err) {
2499
+ _didIteratorError = true;
2500
+ _iteratorError = err;
2501
+ } finally{
2502
+ try {
2503
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2504
+ _iterator.return();
2505
+ }
2506
+ } finally{
2507
+ if (_didIteratorError) {
2508
+ throw _iteratorError;
2509
+ }
2510
+ }
2511
+ }
2512
+ }
2513
+ return referenced;
2514
+ }
2515
+ /**
2516
+ * Collects the analyzable statements the rule may relocate to the `// COMPAT: Deprecated aliases`
2517
+ * section.
2518
+ *
2519
+ * A `@deprecated` statement is movable when it is a type-only declaration (`TSTypeAliasDeclaration`
2520
+ * or `TSInterfaceDeclaration`), which is erased at runtime and can never cause a
2521
+ * use-before-declaration error, or a runtime value alias (see {@link statementIsValueAlias}) that
2522
+ * is not referenced by any other statement in the file (see {@link isReferencedByOtherStatements}).
2523
+ *
2524
+ * Primary runtime definitions — literal-valued consts, functions, classes, enums — are never
2525
+ * movable; they stay exactly where they are so the autofix cannot reorder a value below its uses.
2526
+ *
2527
+ * @param sourceCode - The ESLint `SourceCode` instance.
2528
+ * @param body - All top-level program-body statements.
2529
+ * @param analyzable - The analyzable subset of `body` in source order.
2530
+ * @returns The movable statements in source order.
2531
+ */ function computeMovableStatements(sourceCode, body, analyzable) {
2532
+ var bindingDeprecation = buildBindingDeprecationMap(sourceCode, body);
2533
+ var movable = [];
2273
2534
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2274
2535
  try {
2275
2536
  for(var _iterator = analyzable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2276
- var stmt = _step.value;
2277
- var isAfterMarker = stmt.range[0] > markerOffset;
2278
- var isDeprecated = statementIsDeprecated(sourceCode, stmt);
2279
- if (isDeprecated && !isAfterMarker && !reportedAliasAboveMarker) {
2280
- context.report({
2281
- node: stmt,
2282
- messageId: 'deprecatedAliasNotAtBottom',
2283
- fix: buildMoveDeprecatedFix(sourceCode, stmt, marker)
2284
- });
2285
- reportedAliasAboveMarker = true;
2286
- } else if (!isDeprecated && isAfterMarker && !reportedNonDeprecatedBelowMarker) {
2287
- context.report({
2288
- node: stmt,
2289
- messageId: 'nonDeprecatedAfterMarker',
2290
- fix: buildMoveNonDeprecatedFix(sourceCode, stmt, marker)
2291
- });
2292
- reportedNonDeprecatedBelowMarker = true;
2537
+ var statement = _step.value;
2538
+ if (statementIsDeprecated(sourceCode, statement)) {
2539
+ var declaration = unwrapDeclaration(statement);
2540
+ var isMovable = false;
2541
+ if (declaration.type === 'TSTypeAliasDeclaration' || declaration.type === 'TSInterfaceDeclaration') {
2542
+ isMovable = true;
2543
+ } else if (statementIsValueAlias(sourceCode, statement, bindingDeprecation)) {
2544
+ isMovable = !isReferencedByOtherStatements(getDeclaredBindingNames(statement), statement, body);
2545
+ }
2546
+ if (isMovable) {
2547
+ movable.push(statement);
2548
+ }
2293
2549
  }
2294
2550
  }
2295
2551
  } catch (err) {
@@ -2306,23 +2562,84 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2306
2562
  }
2307
2563
  }
2308
2564
  }
2565
+ return movable;
2309
2566
  }
2310
2567
  /**
2311
- * Collects all analyzable top-level statements that carry an `@deprecated` JSDoc tag, preserving
2312
- * source order.
2568
+ * Returns true when every movable statement in `movable` appears AFTER every non-movable analyzable
2569
+ * statement in `analyzable` (i.e., the deprecated-alias section is already at the bottom of the
2570
+ * file). This is the condition under which the autofix can simply insert the marker without
2571
+ * reordering statements.
2313
2572
  *
2314
- * @param sourceCode - The ESLint `SourceCode` instance.
2315
2573
  * @param analyzable - All analyzable top-level statements in source order.
2316
- * @returns The deprecated subset of `analyzable`.
2317
- */ function collectDeprecatedStatements(sourceCode, analyzable) {
2318
- var deprecatedStatements = [];
2574
+ * @param movable - The movable subset (relocatable deprecated aliases).
2575
+ * @returns True when no non-movable statement appears after the first movable one.
2576
+ */ function allMovableStatementsAtBottom(analyzable, movable) {
2577
+ var atBottom = true;
2578
+ if (movable.length !== 0) {
2579
+ var firstMovableStart = movable[0].range[0];
2580
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2581
+ try {
2582
+ for(var _iterator = analyzable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2583
+ var stmt = _step.value;
2584
+ if (stmt.range[0] > firstMovableStart) {
2585
+ // Statement appears after the first movable one. It must itself be movable.
2586
+ var isMovable = movable.includes(stmt);
2587
+ if (!isMovable) {
2588
+ atBottom = false;
2589
+ }
2590
+ }
2591
+ }
2592
+ } catch (err) {
2593
+ _didIteratorError = true;
2594
+ _iteratorError = err;
2595
+ } finally{
2596
+ try {
2597
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2598
+ _iterator.return();
2599
+ }
2600
+ } finally{
2601
+ if (_didIteratorError) {
2602
+ throw _iteratorError;
2603
+ }
2604
+ }
2605
+ }
2606
+ }
2607
+ return atBottom;
2608
+ }
2609
+ /**
2610
+ * Builds the fix for the marker-only case where every deprecated statement already sits at the
2611
+ * bottom of the file: insert the marker line immediately above the first deprecated block.
2612
+ *
2613
+ * @param sourceCode - The ESLint `SourceCode` instance.
2614
+ * @param firstDeprecated - The first deprecated statement (the insertion anchor).
2615
+ * @returns A fix function that inserts the marker comment.
2616
+ */ function buildMarkerOnlyFix(sourceCode, firstDeprecated) {
2617
+ var blockRange = getStatementBlockRange(sourceCode, firstDeprecated);
2618
+ var insertionPoint = blockRange[0];
2619
+ return function(fixer) {
2620
+ return fixer.replaceTextRange([
2621
+ insertionPoint,
2622
+ insertionPoint
2623
+ ], "".concat(COMPAT_MARKER_LINE, "\n"));
2624
+ };
2625
+ }
2626
+ /**
2627
+ * Builds the fix for the interleaved case: cut every movable block out of the file and re-emit
2628
+ * them in source order at EOF, preceded by the marker.
2629
+ *
2630
+ * @param sourceCode - The ESLint `SourceCode` instance.
2631
+ * @param movableStatements - Movable deprecated-alias statements in source order.
2632
+ * @returns A fix function that removes and re-appends each movable block.
2633
+ */ function buildInterleavedFix(sourceCode, movableStatements) {
2634
+ var blockRanges = [];
2635
+ var blockTexts = [];
2319
2636
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2320
2637
  try {
2321
- for(var _iterator = analyzable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2638
+ for(var _iterator = movableStatements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2322
2639
  var stmt = _step.value;
2323
- if (statementIsDeprecated(sourceCode, stmt)) {
2324
- deprecatedStatements.push(stmt);
2325
- }
2640
+ var range = getStatementBlockRange(sourceCode, stmt);
2641
+ blockRanges.push(range);
2642
+ blockTexts.push(readRange(sourceCode, range));
2326
2643
  }
2327
2644
  } catch (err) {
2328
2645
  _didIteratorError = true;
@@ -2338,30 +2655,184 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2338
2655
  }
2339
2656
  }
2340
2657
  }
2341
- return deprecatedStatements;
2658
+ var sourceText = sourceCode.text;
2659
+ var eof = sourceText.length;
2660
+ var trailingNewline = sourceText.endsWith('\n') ? '' : '\n';
2661
+ // Strip trailing newline from each block to control spacing precisely, then re-add a single
2662
+ // newline between blocks. Final block lands without a trailing newline; an explicit `\n` at
2663
+ // the end keeps EOF tidy.
2664
+ var joinedBlocks = blockTexts.map(function(t) {
2665
+ return t.replace(/\n+$/, '');
2666
+ }).join('\n\n');
2667
+ var appendText = "".concat(trailingNewline, "\n").concat(COMPAT_MARKER_LINE, "\n").concat(joinedBlocks, "\n");
2668
+ return function(fixer) {
2669
+ return _to_consumable_array$2(blockRanges.map(function(r) {
2670
+ return fixer.removeRange(r);
2671
+ })).concat([
2672
+ fixer.insertTextAfterRange([
2673
+ eof,
2674
+ eof
2675
+ ], appendText)
2676
+ ]);
2677
+ };
2342
2678
  }
2343
2679
  /**
2344
- * ESLint rule requiring that exports carrying a `@deprecated` JSDoc tag live at the bottom of the
2345
- * file under a `// COMPAT: Deprecated aliases` line comment, and that no non-deprecated exports
2346
- * follow the marker. The rule mirrors the workspace's "Deprecated Alias Placement" convention so
2347
- * that deprecated aliases stay segregated from current code and are easy to spot for removal.
2348
- *
2349
- * The rule reports at most one violation per concern (missing marker, alias above marker,
2350
- * non-deprecated below marker) to keep editor noise manageable; once the first violation in a
2351
- * category is fixed, re-linting will surface the next one.
2680
+ * Reports the `missingCompatMarker` violation, choosing between the marker-only and interleaved
2681
+ * fix strategies based on whether the movable tail is already at the bottom of the file.
2352
2682
  *
2353
- * Autofix coverage:
2354
- * - `missingCompatMarker` inserts `// COMPAT: Deprecated aliases` and consolidates all
2355
- * deprecated blocks at the bottom of the file. When the deprecated tail is already at the
2356
- * bottom of the file, only the marker line is inserted (no statements are moved). When
2357
- * deprecated exports are interleaved with non-deprecated ones, the autofix removes each
2358
- * deprecated block from its current location and re-emits them in source order at the bottom
2359
- * of the file under the marker.
2360
- * - `deprecatedAliasNotAtBottom` — moves the misplaced deprecated block from above the marker to
2361
- * just after the marker. One block per pass; ESLint's autofix loop converges across multiple
2362
- * violations.
2363
- * - `nonDeprecatedAfterMarker` — moves the misplaced non-deprecated block from below the marker
2364
- * to just before the marker. One block per pass.
2683
+ * @param args - Inputs grouped as a single config object.
2684
+ * @param args.context - The ESLint rule context.
2685
+ * @param args.sourceCode - The ESLint `SourceCode` instance.
2686
+ * @param args.analyzable - All analyzable top-level statements in source order.
2687
+ * @param args.movableStatements - The movable (relocatable deprecated-alias) subset.
2688
+ */ function reportMissingMarker(args) {
2689
+ var context = args.context, sourceCode = args.sourceCode, analyzable = args.analyzable, movableStatements = args.movableStatements;
2690
+ var firstMovable = movableStatements[0];
2691
+ var fixFn = allMovableStatementsAtBottom(analyzable, movableStatements) ? buildMarkerOnlyFix(sourceCode, firstMovable) : buildInterleavedFix(sourceCode, movableStatements);
2692
+ context.report({
2693
+ node: firstMovable,
2694
+ messageId: 'missingCompatMarker',
2695
+ fix: fixFn
2696
+ });
2697
+ }
2698
+ /**
2699
+ * Builds the fix that moves a deprecated block sitting above the marker to immediately after the
2700
+ * marker comment.
2701
+ *
2702
+ * @param sourceCode - The ESLint `SourceCode` instance.
2703
+ * @param stmt - The misplaced deprecated statement.
2704
+ * @param marker - Marker comment node (when available) plus its start offset (fallback).
2705
+ * @returns A fix function that relocates the block below the marker.
2706
+ */ function buildMoveDeprecatedFix(sourceCode, stmt, marker) {
2707
+ var blockRange = getStatementBlockRange(sourceCode, stmt);
2708
+ var blockText = readRange(sourceCode, blockRange);
2709
+ var markerEnd = marker.comment === undefined ? marker.offset : marker.comment.range[1];
2710
+ return function(fixer) {
2711
+ return [
2712
+ // Remove from current location.
2713
+ fixer.removeRange(blockRange),
2714
+ // Insert after the marker comment, preceded by a newline so it lands on a new line.
2715
+ fixer.insertTextAfterRange([
2716
+ markerEnd,
2717
+ markerEnd
2718
+ ], "\n".concat(blockText.replace(/\n$/, '')))
2719
+ ];
2720
+ };
2721
+ }
2722
+ /**
2723
+ * Builds the fix that moves a non-deprecated block sitting below the marker to immediately before
2724
+ * the marker comment.
2725
+ *
2726
+ * @param sourceCode - The ESLint `SourceCode` instance.
2727
+ * @param stmt - The misplaced non-deprecated statement.
2728
+ * @param marker - Marker comment node (when available) plus its start offset (fallback).
2729
+ * @returns A fix function that relocates the block above the marker.
2730
+ */ function buildMoveNonDeprecatedFix(sourceCode, stmt, marker) {
2731
+ var blockRange = getStatementBlockRange(sourceCode, stmt);
2732
+ var blockText = readRange(sourceCode, blockRange);
2733
+ var markerStart = marker.comment === undefined ? marker.offset : marker.comment.range[0];
2734
+ return function(fixer) {
2735
+ return [
2736
+ fixer.removeRange(blockRange),
2737
+ // Insert just before the marker; keep the block's trailing newline and add one more so a
2738
+ // blank line separates the moved block from the marker.
2739
+ fixer.replaceTextRange([
2740
+ markerStart,
2741
+ markerStart
2742
+ ], "".concat(blockText, "\n"))
2743
+ ];
2744
+ };
2745
+ }
2746
+ /**
2747
+ * Reports the first misplaced movable alias (above the marker) and the first misplaced
2748
+ * non-deprecated block (below the marker). At most one of each is reported per pass; ESLint's
2749
+ * autofix loop converges across multiple violations.
2750
+ *
2751
+ * Only movable statements are pulled down below the marker; only statements that are not
2752
+ * `@deprecated` at all are pushed up above it. A deprecated-but-not-movable statement (a primary
2753
+ * definition such as a literal-valued const) sitting below an existing marker is left in place, so
2754
+ * files that already carry a marker are not re-churned.
2755
+ *
2756
+ * @param args - Inputs grouped as a single config object.
2757
+ * @param args.context - The ESLint rule context.
2758
+ * @param args.sourceCode - The ESLint `SourceCode` instance.
2759
+ * @param args.analyzable - All analyzable top-level statements in source order.
2760
+ * @param args.markerOffset - The marker comment's start offset.
2761
+ * @param args.movableSet - The set of movable (relocatable deprecated-alias) statements.
2762
+ */ function reportMisplacedStatements(args) {
2763
+ var context = args.context, sourceCode = args.sourceCode, analyzable = args.analyzable, markerOffset = args.markerOffset, movableSet = args.movableSet;
2764
+ var marker = {
2765
+ comment: findCompatMarkerComment(sourceCode),
2766
+ offset: markerOffset
2767
+ };
2768
+ var reportedAliasAboveMarker = false;
2769
+ var reportedNonDeprecatedBelowMarker = false;
2770
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2771
+ try {
2772
+ for(var _iterator = analyzable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2773
+ var stmt = _step.value;
2774
+ var isAfterMarker = stmt.range[0] > markerOffset;
2775
+ var isMovable = movableSet.has(stmt);
2776
+ var isDeprecated = statementIsDeprecated(sourceCode, stmt);
2777
+ if (isMovable && !isAfterMarker && !reportedAliasAboveMarker) {
2778
+ context.report({
2779
+ node: stmt,
2780
+ messageId: 'deprecatedAliasNotAtBottom',
2781
+ fix: buildMoveDeprecatedFix(sourceCode, stmt, marker)
2782
+ });
2783
+ reportedAliasAboveMarker = true;
2784
+ } else if (!isDeprecated && isAfterMarker && !reportedNonDeprecatedBelowMarker) {
2785
+ context.report({
2786
+ node: stmt,
2787
+ messageId: 'nonDeprecatedAfterMarker',
2788
+ fix: buildMoveNonDeprecatedFix(sourceCode, stmt, marker)
2789
+ });
2790
+ reportedNonDeprecatedBelowMarker = true;
2791
+ }
2792
+ }
2793
+ } catch (err) {
2794
+ _didIteratorError = true;
2795
+ _iteratorError = err;
2796
+ } finally{
2797
+ try {
2798
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2799
+ _iterator.return();
2800
+ }
2801
+ } finally{
2802
+ if (_didIteratorError) {
2803
+ throw _iteratorError;
2804
+ }
2805
+ }
2806
+ }
2807
+ }
2808
+ /**
2809
+ * ESLint rule requiring that `@deprecated` *aliases* live at the bottom of the file under a
2810
+ * `// COMPAT: Deprecated aliases` line comment, and that no non-deprecated exports follow the
2811
+ * marker. The rule mirrors the workspace's "Deprecated Alias Placement" convention so that
2812
+ * deprecated aliases stay segregated from current code and are easy to spot for removal.
2813
+ *
2814
+ * Only *relocatable* deprecated statements participate (see {@link computeMovableStatements}):
2815
+ * type-only declarations (always runtime-safe to move) and runtime value aliases — a
2816
+ * `VariableDeclaration` whose initializer references a non-deprecated binding — that are not
2817
+ * referenced elsewhere in the file. Primary runtime definitions (literal-valued consts, functions,
2818
+ * classes, enums) and any value still referenced by other code are left exactly where they are, so
2819
+ * the autofix can never reorder a value below its uses (a use-before-declaration error).
2820
+ *
2821
+ * The rule reports at most one violation per concern (missing marker, alias above marker,
2822
+ * non-deprecated below marker) to keep editor noise manageable; once the first violation in a
2823
+ * category is fixed, re-linting will surface the next one.
2824
+ *
2825
+ * Autofix coverage:
2826
+ * - `missingCompatMarker` — inserts `// COMPAT: Deprecated aliases` and consolidates all movable
2827
+ * blocks at the bottom of the file. When the movable tail is already at the bottom of the file,
2828
+ * only the marker line is inserted (no statements are moved). When movable aliases are
2829
+ * interleaved with other statements, the autofix removes each movable block from its current
2830
+ * location and re-emits them in source order at the bottom of the file under the marker.
2831
+ * - `deprecatedAliasNotAtBottom` — moves the misplaced movable block from above the marker to
2832
+ * just after the marker. One block per pass; ESLint's autofix loop converges across multiple
2833
+ * violations.
2834
+ * - `nonDeprecatedAfterMarker` — moves the misplaced non-deprecated block from below the marker
2835
+ * to just before the marker. One block per pass.
2365
2836
  *
2366
2837
  * @see `dbx__note__typescript-programming` → Deprecated Alias Placement
2367
2838
  */ var UTIL_REQUIRE_DEPRECATED_ALIAS_PLACEMENT_RULE = {
@@ -2369,12 +2840,12 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2369
2840
  type: 'suggestion',
2370
2841
  fixable: 'code',
2371
2842
  docs: {
2372
- description: 'Require @deprecated exports to live at the bottom of the file under a // COMPAT: Deprecated aliases marker.',
2843
+ description: 'Require @deprecated aliases to live at the bottom of the file under a // COMPAT: Deprecated aliases marker.',
2373
2844
  recommended: true
2374
2845
  },
2375
2846
  messages: {
2376
- missingCompatMarker: "File contains @deprecated exports but is missing the '// COMPAT: Deprecated aliases' marker line comment. Add the marker and move all @deprecated exports below it.",
2377
- deprecatedAliasNotAtBottom: "This @deprecated export should live below the '// COMPAT: Deprecated aliases' marker at the bottom of the file.",
2847
+ missingCompatMarker: "File contains @deprecated aliases but is missing the '// COMPAT: Deprecated aliases' marker line comment. Add the marker and move the @deprecated aliases below it.",
2848
+ deprecatedAliasNotAtBottom: "This @deprecated alias should live below the '// COMPAT: Deprecated aliases' marker at the bottom of the file.",
2378
2849
  nonDeprecatedAfterMarker: "This export is not @deprecated but appears after the '// COMPAT: Deprecated aliases' marker. Move it above the marker."
2379
2850
  },
2380
2851
  schema: []
@@ -2385,8 +2856,8 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2385
2856
  var _programNode_body;
2386
2857
  var body = (_programNode_body = programNode.body) !== null && _programNode_body !== void 0 ? _programNode_body : [];
2387
2858
  var analyzable = body.filter(isAnalyzableExportLike);
2388
- var deprecatedStatements = collectDeprecatedStatements(sourceCode, analyzable);
2389
- if (deprecatedStatements.length === 0) {
2859
+ var movableStatements = computeMovableStatements(sourceCode, body, analyzable);
2860
+ if (movableStatements.length === 0) {
2390
2861
  return;
2391
2862
  }
2392
2863
  var markerOffset = findCompatMarkerOffset(sourceCode);
@@ -2395,7 +2866,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2395
2866
  context: context,
2396
2867
  sourceCode: sourceCode,
2397
2868
  analyzable: analyzable,
2398
- deprecatedStatements: deprecatedStatements
2869
+ movableStatements: movableStatements
2399
2870
  });
2400
2871
  return;
2401
2872
  }
@@ -2403,7 +2874,8 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2403
2874
  context: context,
2404
2875
  sourceCode: sourceCode,
2405
2876
  analyzable: analyzable,
2406
- markerOffset: markerOffset
2877
+ markerOffset: markerOffset,
2878
+ movableSet: new Set(movableStatements)
2407
2879
  });
2408
2880
  }
2409
2881
  return {
@@ -2412,15 +2884,15 @@ function _unsupported_iterable_to_array$9(o, minLen) {
2412
2884
  }
2413
2885
  };
2414
2886
 
2415
- function _array_like_to_array$8(arr, len) {
2887
+ function _array_like_to_array$7(arr, len) {
2416
2888
  if (len == null || len > arr.length) len = arr.length;
2417
2889
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2418
2890
  return arr2;
2419
2891
  }
2420
- function _array_with_holes$8(arr) {
2892
+ function _array_with_holes$7(arr) {
2421
2893
  if (Array.isArray(arr)) return arr;
2422
2894
  }
2423
- function _iterable_to_array_limit$8(arr, i) {
2895
+ function _iterable_to_array_limit$7(arr, i) {
2424
2896
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2425
2897
  if (_i == null) return;
2426
2898
  var _arr = [];
@@ -2444,19 +2916,19 @@ function _iterable_to_array_limit$8(arr, i) {
2444
2916
  }
2445
2917
  return _arr;
2446
2918
  }
2447
- function _non_iterable_rest$8() {
2919
+ function _non_iterable_rest$7() {
2448
2920
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2449
2921
  }
2450
- function _sliced_to_array$8(arr, i) {
2451
- return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$8();
2922
+ 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();
2452
2924
  }
2453
- function _unsupported_iterable_to_array$8(o, minLen) {
2925
+ function _unsupported_iterable_to_array$7(o, minLen) {
2454
2926
  if (!o) return;
2455
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
2927
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
2456
2928
  var n = Object.prototype.toString.call(o).slice(8, -1);
2457
2929
  if (n === "Object" && o.constructor) n = o.constructor.name;
2458
2930
  if (n === "Map" || n === "Set") return Array.from(n);
2459
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
2931
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
2460
2932
  }
2461
2933
  var TAG_LINE_REGEX$1 = /^@([A-Za-z_]\w*)\s*(.*)$/;
2462
2934
  var TYPE_ANNOTATION_REGEX = /^\{([^}]*)\}\s*(.*)$/;
@@ -2521,7 +2993,7 @@ var LINE_PREFIX_REGEX = /^(\s*\*?\s?)(.*)$/;
2521
2993
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2522
2994
  try {
2523
2995
  for(var _iterator = lines.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2524
- var _step_value = _sliced_to_array$8(_step.value, 2), i = _step_value[0], line = _step_value[1];
2996
+ var _step_value = _sliced_to_array$7(_step.value, 2), i = _step_value[0], line = _step_value[1];
2525
2997
  if (TAG_LINE_REGEX$1.test(line.text)) {
2526
2998
  firstTagIndex = i;
2527
2999
  break;
@@ -2757,21 +3229,21 @@ var LINE_PREFIX_REGEX = /^(\s*\*?\s?)(.*)$/;
2757
3229
  };
2758
3230
  }
2759
3231
 
2760
- function _array_like_to_array$7(arr, len) {
3232
+ function _array_like_to_array$6(arr, len) {
2761
3233
  if (len == null || len > arr.length) len = arr.length;
2762
3234
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2763
3235
  return arr2;
2764
3236
  }
2765
- function _array_with_holes$7(arr) {
3237
+ function _array_with_holes$6(arr) {
2766
3238
  if (Array.isArray(arr)) return arr;
2767
3239
  }
2768
3240
  function _array_without_holes$1(arr) {
2769
- if (Array.isArray(arr)) return _array_like_to_array$7(arr);
3241
+ if (Array.isArray(arr)) return _array_like_to_array$6(arr);
2770
3242
  }
2771
3243
  function _iterable_to_array$1(iter) {
2772
3244
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2773
3245
  }
2774
- function _iterable_to_array_limit$7(arr, i) {
3246
+ function _iterable_to_array_limit$6(arr, i) {
2775
3247
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2776
3248
  if (_i == null) return;
2777
3249
  var _arr = [];
@@ -2795,25 +3267,25 @@ function _iterable_to_array_limit$7(arr, i) {
2795
3267
  }
2796
3268
  return _arr;
2797
3269
  }
2798
- function _non_iterable_rest$7() {
3270
+ function _non_iterable_rest$6() {
2799
3271
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2800
3272
  }
2801
3273
  function _non_iterable_spread$1() {
2802
3274
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2803
3275
  }
2804
- function _sliced_to_array$7(arr, i) {
2805
- return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$7();
3276
+ function _sliced_to_array$6(arr, i) {
3277
+ return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
2806
3278
  }
2807
3279
  function _to_consumable_array$1(arr) {
2808
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$1();
3280
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$1();
2809
3281
  }
2810
- function _unsupported_iterable_to_array$7(o, minLen) {
3282
+ function _unsupported_iterable_to_array$6(o, minLen) {
2811
3283
  if (!o) return;
2812
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
3284
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
2813
3285
  var n = Object.prototype.toString.call(o).slice(8, -1);
2814
3286
  if (n === "Object" && o.constructor) n = o.constructor.name;
2815
3287
  if (n === "Map" || n === "Set") return Array.from(n);
2816
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
3288
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
2817
3289
  }
2818
3290
  var TAG_LINE_REGEX = /^@([A-Za-z_]\w*)\s*(.*)$/;
2819
3291
  var DEFAULT_WORKSPACE_TAG_PREFIXES = [
@@ -3185,7 +3657,7 @@ var TYPE_RESTATING_PATTERNS = [
3185
3657
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
3186
3658
  try {
3187
3659
  for(var _iterator = sections.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
3188
- var _step_value = _sliced_to_array$7(_step.value, 2), i = _step_value[0], section = _step_value[1];
3660
+ var _step_value = _sliced_to_array$6(_step.value, 2), i = _step_value[0], section = _step_value[1];
3189
3661
  var _allLines;
3190
3662
  if (i > 0) allLines.push('');
3191
3663
  (_allLines = allLines).push.apply(_allLines, _to_consumable_array$1(section));
@@ -3485,7 +3957,7 @@ var LOWER_LETTER_PATTERN = /[a-z]/;
3485
3957
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
3486
3958
  try {
3487
3959
  for(var _iterator = indexed.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
3488
- var _step_value = _sliced_to_array$7(_step.value, 2), i = _step_value[0], element = _step_value[1];
3960
+ var _step_value = _sliced_to_array$6(_step.value, 2), i = _step_value[0], element = _step_value[1];
3489
3961
  if (element.tag.tag === 'param') {
3490
3962
  paramSlots.push(i);
3491
3963
  paramEntries.push(element);
@@ -3515,7 +3987,7 @@ var LOWER_LETTER_PATTERN = /[a-z]/;
3515
3987
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
3516
3988
  try {
3517
3989
  for(var _iterator1 = paramSlots.entries()[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
3518
- var _step_value1 = _sliced_to_array$7(_step1.value, 2), i1 = _step_value1[0], paramSlot = _step_value1[1];
3990
+ var _step_value1 = _sliced_to_array$6(_step1.value, 2), i1 = _step_value1[0], paramSlot = _step_value1[1];
3519
3991
  indexed[paramSlot] = paramEntries[i1];
3520
3992
  }
3521
3993
  } catch (err) {
@@ -4305,15 +4777,15 @@ var LOWER_LETTER_PATTERN = /[a-z]/;
4305
4777
  return name;
4306
4778
  }
4307
4779
 
4308
- function _array_like_to_array$6(arr, len) {
4780
+ function _array_like_to_array$5(arr, len) {
4309
4781
  if (len == null || len > arr.length) len = arr.length;
4310
4782
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4311
4783
  return arr2;
4312
4784
  }
4313
- function _array_with_holes$6(arr) {
4785
+ function _array_with_holes$5(arr) {
4314
4786
  if (Array.isArray(arr)) return arr;
4315
4787
  }
4316
- function _iterable_to_array_limit$6(arr, i) {
4788
+ function _iterable_to_array_limit$5(arr, i) {
4317
4789
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
4318
4790
  if (_i == null) return;
4319
4791
  var _arr = [];
@@ -4337,23 +4809,23 @@ function _iterable_to_array_limit$6(arr, i) {
4337
4809
  }
4338
4810
  return _arr;
4339
4811
  }
4340
- function _non_iterable_rest$6() {
4812
+ function _non_iterable_rest$5() {
4341
4813
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4342
4814
  }
4343
- function _sliced_to_array$6(arr, i) {
4344
- return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
4815
+ function _sliced_to_array$5(arr, i) {
4816
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
4345
4817
  }
4346
- function _unsupported_iterable_to_array$6(o, minLen) {
4818
+ function _unsupported_iterable_to_array$5(o, minLen) {
4347
4819
  if (!o) return;
4348
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
4820
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
4349
4821
  var n = Object.prototype.toString.call(o).slice(8, -1);
4350
4822
  if (n === "Object" && o.constructor) n = o.constructor.name;
4351
4823
  if (n === "Map" || n === "Set") return Array.from(n);
4352
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
4824
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
4353
4825
  }
4354
4826
  /**
4355
4827
  * Shared helpers for the `@dbx<Family>` companion-tag ESLint rules. Mirrors the
4356
- * scanner schemas in `packages/dbx-components-mcp/src/scan/*-extract.ts` so
4828
+ * scanner schemas in `packages/dbx-cli/src/lib/mcp-scan/scan/*-extract.ts` so
4357
4829
  * violations surface at lint time instead of at manifest-regeneration time.
4358
4830
  *
4359
4831
  * Each per-family rule supplies a {@link DbxTagFamilySpec} describing which
@@ -4632,7 +5104,7 @@ function emitUnknownCompanions(groups, knownSuffixes, emit) {
4632
5104
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4633
5105
  try {
4634
5106
  for(var _iterator = groups.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4635
- var _step_value = _sliced_to_array$6(_step.value, 2), suffix = _step_value[0], instances = _step_value[1];
5107
+ var _step_value = _sliced_to_array$5(_step.value, 2), suffix = _step_value[0], instances = _step_value[1];
4636
5108
  if (knownSuffixes.has(suffix)) continue;
4637
5109
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
4638
5110
  try {
@@ -5010,7 +5482,7 @@ function reportUtilAllowedCategory(ctx, familyTags, allowedCategories) {
5010
5482
  ];
5011
5483
  /**
5012
5484
  * Allowed values for `@dbxUtilKind`. Mirrors the enum in
5013
- * `packages/dbx-components-mcp/src/scan/utils-extract.ts`.
5485
+ * `packages/dbx-cli/src/lib/mcp-scan/scan/utils-extract.ts`.
5014
5486
  */ var DEFAULT_ALLOWED_KINDS$2 = [
5015
5487
  'function',
5016
5488
  'class',
@@ -5020,7 +5492,7 @@ function reportUtilAllowedCategory(ctx, familyTags, allowedCategories) {
5020
5492
  /**
5021
5493
  * ESLint rule enforcing that exports tagged `@dbxUtil` carry the registry-required companion tags
5022
5494
  * with valid value formats. Mirrors the scanner schema at
5023
- * `packages/dbx-components-mcp/src/scan/utils-extract.ts` so violations surface at lint time
5495
+ * `packages/dbx-cli/src/lib/mcp-scan/scan/utils-extract.ts` so violations surface at lint time
5024
5496
  * instead of at manifest-regeneration time.
5025
5497
  *
5026
5498
  * Checks:
@@ -5201,7 +5673,7 @@ var DEFAULT_KNOWN_COMPANIONS$8 = [
5201
5673
  ];
5202
5674
  /**
5203
5675
  * ESLint rule enforcing `@dbxPipe` companion tags. Mirrors the scanner schema
5204
- * at `packages/dbx-components-mcp/src/scan/pipes-extract.ts` so violations
5676
+ * at `packages/dbx-cli/src/lib/mcp-scan/scan/pipes-extract.ts` so violations
5205
5677
  * surface at lint time instead of at manifest-regeneration time.
5206
5678
  */ var UTIL_REQUIRE_DBX_PIPE_COMPANION_TAGS_RULE = {
5207
5679
  meta: {
@@ -5429,7 +5901,7 @@ var DEFAULT_KNOWN_COMPANIONS$7 = [
5429
5901
  ];
5430
5902
  /**
5431
5903
  * ESLint rule enforcing `@dbxFilter` companion tags. Mirrors the scanner
5432
- * schema at `packages/dbx-components-mcp/src/scan/filters-extract.ts`.
5904
+ * schema at `packages/dbx-cli/src/lib/mcp-scan/scan/filters-extract.ts`.
5433
5905
  * Applies to classes (filter directives) and exported interfaces (filter
5434
5906
  * patterns); the scanner reads both as filter entries.
5435
5907
  */ var UTIL_REQUIRE_DBX_FILTER_COMPANION_TAGS_RULE = {
@@ -5635,7 +6107,7 @@ var DEFAULT_KNOWN_COMPANIONS$6 = [
5635
6107
  ];
5636
6108
  /**
5637
6109
  * ESLint rule enforcing `@dbxWebComponent` companion tags. Mirrors the scanner
5638
- * schema at `packages/dbx-components-mcp/src/scan/ui-components-extract.ts`.
6110
+ * schema at `packages/dbx-cli/src/lib/mcp-scan/scan/ui-components-extract.ts`.
5639
6111
  */ var UTIL_REQUIRE_DBX_WEB_COMPANION_TAGS_RULE = {
5640
6112
  meta: {
5641
6113
  type: 'suggestion',
@@ -5923,7 +6395,7 @@ var DEFAULT_KNOWN_COMPANIONS$5 = [
5923
6395
  ];
5924
6396
  /**
5925
6397
  * ESLint rule enforcing `@dbxDocsUiExample` companion tags. Mirrors the
5926
- * scanner schema at `packages/dbx-components-mcp/src/scan/dbx-docs-ui-examples-extract.ts`.
6398
+ * scanner schema at `packages/dbx-cli/src/lib/mcp-scan/scan/dbx-docs-ui-examples-extract.ts`.
5927
6399
  */ var UTIL_REQUIRE_DBX_DOCS_UI_EXAMPLE_COMPANION_TAGS_RULE = {
5928
6400
  meta: {
5929
6401
  type: 'suggestion',
@@ -6175,7 +6647,7 @@ var DEFAULT_KNOWN_COMPANIONS$4 = [
6175
6647
  ];
6176
6648
  /**
6177
6649
  * ESLint rule enforcing `@dbxModelSnapshotField` companion tags. Mirrors the
6178
- * scanner schema at `packages/dbx-components-mcp/src/scan/model-snapshot-fields-extract.ts`.
6650
+ * scanner schema at `packages/dbx-cli/src/lib/mcp-scan/scan/model-snapshot-fields-extract.ts`.
6179
6651
  */ var UTIL_REQUIRE_DBX_MODEL_SNAPSHOT_FIELD_COMPANION_TAGS_RULE = {
6180
6652
  meta: {
6181
6653
  type: 'suggestion',
@@ -6346,668 +6818,83 @@ var DEFAULT_KNOWN_COMPANIONS$4 = [
6346
6818
  lineIndex: v.lineIndex,
6347
6819
  messageId: 'skillRefsNotKebab',
6348
6820
  data: {
6349
- value: v.value
6350
- },
6351
- report: context.report
6352
- });
6353
- break;
6354
- case 'tags-not-lowercase':
6355
- {
6356
- if (v.suffix !== 'Tags') break;
6357
- var fix = buildLowercaseTagsFix({
6358
- commentNode: commentNode,
6359
- parsed: parsed,
6360
- sourceCode: sourceCode,
6361
- tag: v.raw
6362
- });
6363
- var fixer = fix ? function(fixer2) {
6364
- return fixer2.replaceTextRange([
6365
- fix.startOffset,
6366
- fix.endOffset
6367
- ], fix.replacement);
6368
- } : undefined;
6369
- reportOnJsdocLine({
6370
- commentNode: commentNode,
6371
- parsed: parsed,
6372
- sourceCode: sourceCode,
6373
- lineIndex: v.lineIndex,
6374
- messageId: 'tagsNotLowercase',
6375
- data: {
6376
- value: v.value
6377
- },
6378
- report: context.report,
6379
- fix: fixer
6380
- });
6381
- break;
6382
- }
6383
- case 'unknown':
6384
- reportOnJsdocLine({
6385
- commentNode: commentNode,
6386
- parsed: parsed,
6387
- sourceCode: sourceCode,
6388
- lineIndex: v.lineIndex,
6389
- messageId: 'unknownDbxModelSnapshotFieldTag',
6390
- data: {
6391
- name: v.suffix,
6392
- known: knownCompanions.join(', ')
6393
- },
6394
- report: context.report
6395
- });
6396
- break;
6397
- case 'duplicate':
6398
- reportOnJsdocLine({
6399
- commentNode: commentNode,
6400
- parsed: parsed,
6401
- sourceCode: sourceCode,
6402
- lineIndex: v.lineIndex,
6403
- messageId: 'duplicateCompanionTag',
6404
- data: {
6405
- name: v.suffix
6406
- },
6407
- report: context.report
6408
- });
6409
- break;
6410
- }
6411
- }
6412
- });
6413
- }
6414
- function visit(node) {
6415
- var anchor = node.parent && (node.parent.type === 'ExportNamedDeclaration' || node.parent.type === 'ExportDefaultDeclaration') ? node.parent : node;
6416
- var jsdoc = leadingJsdocFor(sourceCode, anchor);
6417
- if (jsdoc) checkJsdoc(jsdoc);
6418
- }
6419
- return {
6420
- FunctionDeclaration: function FunctionDeclaration(node) {
6421
- if (!node.body) return;
6422
- var jsdoc = leadingJsdocFor(sourceCode, getStatementAnchor(node));
6423
- if (jsdoc) checkJsdoc(jsdoc);
6424
- },
6425
- VariableDeclaration: visit
6426
- };
6427
- }
6428
- };
6429
-
6430
- function _array_like_to_array$5(arr, len) {
6431
- if (len == null || len > arr.length) len = arr.length;
6432
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6433
- return arr2;
6434
- }
6435
- function _array_with_holes$5(arr) {
6436
- if (Array.isArray(arr)) return arr;
6437
- }
6438
- function _array_without_holes(arr) {
6439
- if (Array.isArray(arr)) return _array_like_to_array$5(arr);
6440
- }
6441
- function _iterable_to_array(iter) {
6442
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6443
- }
6444
- function _iterable_to_array_limit$5(arr, i) {
6445
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
6446
- if (_i == null) return;
6447
- var _arr = [];
6448
- var _n = true;
6449
- var _d = false;
6450
- var _s, _e;
6451
- try {
6452
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
6453
- _arr.push(_s.value);
6454
- if (i && _arr.length === i) break;
6455
- }
6456
- } catch (err) {
6457
- _d = true;
6458
- _e = err;
6459
- } finally{
6460
- try {
6461
- if (!_n && _i["return"] != null) _i["return"]();
6462
- } finally{
6463
- if (_d) throw _e;
6464
- }
6465
- }
6466
- return _arr;
6467
- }
6468
- function _non_iterable_rest$5() {
6469
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6470
- }
6471
- function _non_iterable_spread() {
6472
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6473
- }
6474
- function _sliced_to_array$5(arr, i) {
6475
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
6476
- }
6477
- function _to_consumable_array(arr) {
6478
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread();
6479
- }
6480
- function _unsupported_iterable_to_array$5(o, minLen) {
6481
- if (!o) return;
6482
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
6483
- var n = Object.prototype.toString.call(o).slice(8, -1);
6484
- if (n === "Object" && o.constructor) n = o.constructor.name;
6485
- if (n === "Map" || n === "Set") return Array.from(n);
6486
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
6487
- }
6488
- var DEFAULT_ALLOWED_ROLES = [
6489
- 'directive',
6490
- 'store'
6491
- ];
6492
- var DEFAULT_ALLOWED_STATES = [
6493
- 'IDLE',
6494
- 'DISABLED',
6495
- 'TRIGGERED',
6496
- 'VALUE_READY',
6497
- 'WORKING',
6498
- 'RESOLVED',
6499
- 'REJECTED'
6500
- ];
6501
- var DEFAULT_KNOWN_COMPANIONS$3 = [
6502
- 'Slug',
6503
- 'Role',
6504
- 'StateInteraction',
6505
- 'ProducesContext',
6506
- 'ConsumesContext',
6507
- 'SkillRefs',
6508
- 'DisabledKey',
6509
- 'StateEnum',
6510
- 'StateTransitionsFrom',
6511
- 'StateTransitionsTo'
6512
- ];
6513
- var PROPERTY_ONLY_COMPANIONS = new Set([
6514
- 'StateTransitionsFrom',
6515
- 'StateTransitionsTo'
6516
- ]);
6517
- function reportClassUnknownAndMisplaced(ctx, companions, knownCompanions) {
6518
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6519
- try {
6520
- for(var _iterator = companions.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6521
- var _step_value = _sliced_to_array$5(_step.value, 2), suffix = _step_value[0], instances = _step_value[1];
6522
- if (!knownCompanions.includes(suffix)) {
6523
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6524
- try {
6525
- for(var _iterator1 = instances[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6526
- var tag = _step1.value;
6527
- reportOnJsdocLine({
6528
- commentNode: ctx.commentNode,
6529
- parsed: ctx.parsed,
6530
- sourceCode: ctx.sourceCode,
6531
- lineIndex: tag.startLineIndex,
6532
- messageId: 'unknownDbxActionTag',
6533
- data: {
6534
- name: suffix,
6535
- known: knownCompanions.join(', ')
6536
- },
6537
- report: ctx.report
6538
- });
6539
- }
6540
- } catch (err) {
6541
- _didIteratorError1 = true;
6542
- _iteratorError1 = err;
6543
- } finally{
6544
- try {
6545
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6546
- _iterator1.return();
6547
- }
6548
- } finally{
6549
- if (_didIteratorError1) {
6550
- throw _iteratorError1;
6551
- }
6552
- }
6553
- }
6554
- }
6555
- if (PROPERTY_ONLY_COMPANIONS.has(suffix)) {
6556
- var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
6557
- try {
6558
- for(var _iterator2 = instances[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
6559
- var tag1 = _step2.value;
6560
- reportOnJsdocLine({
6561
- commentNode: ctx.commentNode,
6562
- parsed: ctx.parsed,
6563
- sourceCode: ctx.sourceCode,
6564
- lineIndex: tag1.startLineIndex,
6565
- messageId: 'stateTagOutsideEnumMember',
6566
- data: {
6567
- name: suffix
6568
- },
6569
- report: ctx.report
6570
- });
6571
- }
6572
- } catch (err) {
6573
- _didIteratorError2 = true;
6574
- _iteratorError2 = err;
6575
- } finally{
6576
- try {
6577
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
6578
- _iterator2.return();
6579
- }
6580
- } finally{
6581
- if (_didIteratorError2) {
6582
- throw _iteratorError2;
6583
- }
6584
- }
6585
- }
6586
- }
6587
- }
6588
- } catch (err) {
6589
- _didIteratorError = true;
6590
- _iteratorError = err;
6591
- } finally{
6592
- try {
6593
- if (!_iteratorNormalCompletion && _iterator.return != null) {
6594
- _iterator.return();
6595
- }
6596
- } finally{
6597
- if (_didIteratorError) {
6598
- throw _iteratorError;
6599
- }
6600
- }
6601
- }
6602
- }
6603
- function reportClassDuplicates(ctx, companions) {
6604
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6605
- try {
6606
- for(var _iterator = companions.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6607
- var _step_value = _sliced_to_array$5(_step.value, 2), suffix = _step_value[0], instances = _step_value[1];
6608
- if (instances.length <= 1) continue;
6609
- for(var i = 1; i < instances.length; i += 1){
6610
- reportOnJsdocLine({
6611
- commentNode: ctx.commentNode,
6612
- parsed: ctx.parsed,
6613
- sourceCode: ctx.sourceCode,
6614
- lineIndex: instances[i].startLineIndex,
6615
- messageId: 'duplicateCompanionTag',
6616
- data: {
6617
- name: suffix
6618
- },
6619
- report: ctx.report
6620
- });
6621
- }
6622
- }
6623
- } catch (err) {
6624
- _didIteratorError = true;
6625
- _iteratorError = err;
6626
- } finally{
6627
- try {
6628
- if (!_iteratorNormalCompletion && _iterator.return != null) {
6629
- _iterator.return();
6630
- }
6631
- } finally{
6632
- if (_didIteratorError) {
6633
- throw _iteratorError;
6634
- }
6635
- }
6636
- }
6637
- }
6638
- function reportClassSlug(ctx, slugTags, triggerLine) {
6639
- if (slugTags.length === 0) {
6640
- reportOnJsdocLine({
6641
- commentNode: ctx.commentNode,
6642
- parsed: ctx.parsed,
6643
- sourceCode: ctx.sourceCode,
6644
- lineIndex: triggerLine,
6645
- messageId: 'missingSlug',
6646
- report: ctx.report
6647
- });
6648
- return;
6649
- }
6650
- var value = slugTags[0].description.trim();
6651
- if (value.length === 0) {
6652
- reportOnJsdocLine({
6653
- commentNode: ctx.commentNode,
6654
- parsed: ctx.parsed,
6655
- sourceCode: ctx.sourceCode,
6656
- lineIndex: slugTags[0].startLineIndex,
6657
- messageId: 'missingSlug',
6658
- report: ctx.report
6659
- });
6660
- } else if (!KEBAB_SLUG_PATTERN.test(value)) {
6661
- reportOnJsdocLine({
6662
- commentNode: ctx.commentNode,
6663
- parsed: ctx.parsed,
6664
- sourceCode: ctx.sourceCode,
6665
- lineIndex: slugTags[0].startLineIndex,
6666
- messageId: 'invalidSlugFormat',
6667
- data: {
6668
- value: value
6669
- },
6670
- report: ctx.report
6671
- });
6672
- }
6673
- }
6674
- function reportClassRoles(ctx, roleTags, allowedRoles) {
6675
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6676
- try {
6677
- for(var _iterator = roleTags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6678
- var tag = _step.value;
6679
- var value = tag.description.trim();
6680
- if (value.length > 0 && !allowedRoles.includes(value)) {
6681
- reportOnJsdocLine({
6682
- commentNode: ctx.commentNode,
6683
- parsed: ctx.parsed,
6684
- sourceCode: ctx.sourceCode,
6685
- lineIndex: tag.startLineIndex,
6686
- messageId: 'invalidRole',
6687
- data: {
6688
- value: value,
6689
- allowed: allowedRoles.join(', ')
6690
- },
6691
- report: ctx.report
6692
- });
6693
- }
6694
- }
6695
- } catch (err) {
6696
- _didIteratorError = true;
6697
- _iteratorError = err;
6698
- } finally{
6699
- try {
6700
- if (!_iteratorNormalCompletion && _iterator.return != null) {
6701
- _iterator.return();
6702
- }
6703
- } finally{
6704
- if (_didIteratorError) {
6705
- throw _iteratorError;
6706
- }
6707
- }
6708
- }
6709
- }
6710
- function reportClassStateInteractions(ctx, stateTags, allowedStates) {
6711
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6712
- try {
6713
- for(var _iterator = stateTags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6714
- var tag = _step.value;
6715
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6716
- try {
6717
- for(var _iterator1 = splitCommaSeparated(tag.description)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6718
- var item = _step1.value;
6719
- if (!allowedStates.includes(item)) {
6720
- reportOnJsdocLine({
6721
- commentNode: ctx.commentNode,
6722
- parsed: ctx.parsed,
6723
- sourceCode: ctx.sourceCode,
6724
- lineIndex: tag.startLineIndex,
6725
- messageId: 'invalidStateValue',
6726
- data: {
6727
- value: item,
6728
- allowed: allowedStates.join(', ')
6729
- },
6730
- report: ctx.report
6731
- });
6732
- }
6733
- }
6734
- } catch (err) {
6735
- _didIteratorError1 = true;
6736
- _iteratorError1 = err;
6737
- } finally{
6738
- try {
6739
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6740
- _iterator1.return();
6741
- }
6742
- } finally{
6743
- if (_didIteratorError1) {
6744
- throw _iteratorError1;
6745
- }
6746
- }
6747
- }
6748
- }
6749
- } catch (err) {
6750
- _didIteratorError = true;
6751
- _iteratorError = err;
6752
- } finally{
6753
- try {
6754
- if (!_iteratorNormalCompletion && _iterator.return != null) {
6755
- _iterator.return();
6756
- }
6757
- } finally{
6758
- if (_didIteratorError) {
6759
- throw _iteratorError;
6760
- }
6761
- }
6762
- }
6763
- }
6764
- function reportClassSkillRefs(ctx, skillRefsTags) {
6765
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6766
- try {
6767
- for(var _iterator = skillRefsTags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6768
- var tag = _step.value;
6769
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6770
- try {
6771
- for(var _iterator1 = splitCommaSeparated(tag.description)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6772
- var item = _step1.value;
6773
- if (!KEBAB_SLUG_PATTERN.test(item)) {
6774
- reportOnJsdocLine({
6775
- commentNode: ctx.commentNode,
6776
- parsed: ctx.parsed,
6777
- sourceCode: ctx.sourceCode,
6778
- lineIndex: tag.startLineIndex,
6779
- messageId: 'skillRefsNotKebab',
6780
- data: {
6781
- value: item
6782
- },
6783
- report: ctx.report
6784
- });
6785
- }
6786
- }
6787
- } catch (err) {
6788
- _didIteratorError1 = true;
6789
- _iteratorError1 = err;
6790
- } finally{
6791
- try {
6792
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6793
- _iterator1.return();
6794
- }
6795
- } finally{
6796
- if (_didIteratorError1) {
6797
- throw _iteratorError1;
6798
- }
6799
- }
6800
- }
6801
- }
6802
- } catch (err) {
6803
- _didIteratorError = true;
6804
- _iteratorError = err;
6805
- } finally{
6806
- try {
6807
- if (!_iteratorNormalCompletion && _iterator.return != null) {
6808
- _iterator.return();
6809
- }
6810
- } finally{
6811
- if (_didIteratorError) {
6812
- throw _iteratorError;
6813
- }
6814
- }
6815
- }
6816
- }
6817
- /**
6818
- * Splits an `@dbxAction`-family JSDoc into its marker tag and the map of
6819
- * companion tags keyed by their suffix (e.g. `Slug`, `Role`).
6820
- *
6821
- * @param parsed - The parsed JSDoc to inspect.
6822
- * @returns The marker tag (if any) and a map of companion suffix to tag instances.
6823
- */ function collectFamilyTags(parsed) {
6824
- var markerTag = parsed.tags.find(function(t) {
6825
- return t.tag === 'dbxAction';
6826
- });
6827
- var groups = new Map();
6828
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6829
- try {
6830
- for(var _iterator = parsed.tags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6831
- var tag = _step.value;
6832
- var _groups_get;
6833
- if (!tag.tag.startsWith('dbxAction') || tag.tag === 'dbxAction') continue;
6834
- var suffix = tag.tag.slice('dbxAction'.length);
6835
- var list = (_groups_get = groups.get(suffix)) !== null && _groups_get !== void 0 ? _groups_get : [];
6836
- list.push(tag);
6837
- groups.set(suffix, list);
6838
- }
6839
- } catch (err) {
6840
- _didIteratorError = true;
6841
- _iteratorError = err;
6842
- } finally{
6843
- try {
6844
- if (!_iteratorNormalCompletion && _iterator.return != null) {
6845
- _iterator.return();
6846
- }
6847
- } finally{
6848
- if (_didIteratorError) {
6849
- throw _iteratorError;
6850
- }
6851
- }
6852
- }
6853
- return {
6854
- markerTag: markerTag,
6855
- companions: groups
6856
- };
6857
- }
6858
- /**
6859
- * ESLint rule enforcing `@dbxAction` companion tags. Mirrors the scanner
6860
- * schema at `packages/dbx-components-mcp/src/scan/actions-extract.ts`. Class
6861
- * declarations carry the `@dbxAction` marker; enum declarations carry the
6862
- * `@dbxActionStateEnum` marker, and `@dbxActionStateTransitionsFrom/To` are
6863
- * valid on enum-member JSDocs.
6864
- */ var UTIL_REQUIRE_DBX_ACTION_COMPANION_TAGS_RULE = {
6865
- meta: {
6866
- type: 'suggestion',
6867
- fixable: 'code',
6868
- docs: {
6869
- description: 'Require the canonical `@dbxAction*` companion tags on `@dbxAction`-tagged classes and `@dbxActionStateEnum`-tagged enums.',
6870
- recommended: true
6871
- },
6872
- messages: {
6873
- missingSlug: '`@dbxAction`-tagged class is missing the required `@dbxActionSlug <slug>` companion tag.',
6874
- invalidSlugFormat: '`@dbxActionSlug` value `{{value}}` is not a valid kebab-case slug.',
6875
- invalidRole: '`@dbxActionRole` value `{{value}}` is not allowed. Use one of: {{allowed}}.',
6876
- invalidStateValue: '`@dbxActionStateInteraction` value `{{value}}` is not a valid state. Use one of: {{allowed}}.',
6877
- skillRefsNotKebab: '`@dbxActionSkillRefs` item `{{value}}` is not a kebab-case slug.',
6878
- stateTagOutsideEnumMember: '`@dbxAction{{name}}` is only valid on enum members of a `@dbxActionStateEnum`-tagged enum.',
6879
- unknownDbxActionTag: '`@dbxAction{{name}}` is not a recognized companion tag. Known companions: {{known}}.',
6880
- duplicateCompanionTag: '`@dbxAction{{name}}` is declared more than once.'
6881
- },
6882
- schema: [
6883
- {
6884
- type: 'object',
6885
- additionalProperties: false,
6886
- properties: {
6887
- allowedRoles: {
6888
- type: 'array',
6889
- items: {
6890
- type: 'string'
6891
- }
6892
- },
6893
- allowedStates: {
6894
- type: 'array',
6895
- items: {
6896
- type: 'string'
6897
- }
6898
- },
6899
- knownCompanions: {
6900
- type: 'array',
6901
- items: {
6902
- type: 'string'
6903
- }
6904
- },
6905
- requireBareMarker: {
6906
- type: 'boolean'
6907
- }
6908
- }
6909
- }
6910
- ]
6911
- },
6912
- create: function create(context) {
6913
- var _context_options_, _options_allowedRoles, _options_allowedStates, _options_knownCompanions;
6914
- var options = (_context_options_ = context.options[0]) !== null && _context_options_ !== void 0 ? _context_options_ : {};
6915
- var sourceCode = context.sourceCode;
6916
- var allowedRoles = (_options_allowedRoles = options.allowedRoles) !== null && _options_allowedRoles !== void 0 ? _options_allowedRoles : DEFAULT_ALLOWED_ROLES;
6917
- var allowedStates = (_options_allowedStates = options.allowedStates) !== null && _options_allowedStates !== void 0 ? _options_allowedStates : DEFAULT_ALLOWED_STATES;
6918
- var knownCompanions = (_options_knownCompanions = options.knownCompanions) !== null && _options_knownCompanions !== void 0 ? _options_knownCompanions : DEFAULT_KNOWN_COMPANIONS$3;
6919
- var requireBareMarker = options.requireBareMarker !== false;
6920
- function checkClassJsdoc(commentNode) {
6921
- var _ref, _companions_get, _companions_get1, _companions_get2, _companions_get3;
6922
- var _this, _Array_from_;
6923
- var parsed = parseJsdocComment(commentNode.value);
6924
- var _collectFamilyTags = collectFamilyTags(parsed), markerTag = _collectFamilyTags.markerTag, companions = _collectFamilyTags.companions;
6925
- if (!markerTag && companions.size === 0 || requireBareMarker && !markerTag) return;
6926
- var ctx = {
6927
- commentNode: commentNode,
6928
- parsed: parsed,
6929
- sourceCode: sourceCode,
6930
- report: context.report
6931
- };
6932
- var triggerLine = (_ref = (_this = markerTag !== null && markerTag !== void 0 ? markerTag : (_Array_from_ = Array.from(companions.values())[0]) === null || _Array_from_ === void 0 ? void 0 : _Array_from_[0]) === null || _this === void 0 ? void 0 : _this.startLineIndex) !== null && _ref !== void 0 ? _ref : 0;
6933
- reportClassUnknownAndMisplaced(ctx, companions, knownCompanions);
6934
- reportClassDuplicates(ctx, companions);
6935
- reportClassSlug(ctx, (_companions_get = companions.get('Slug')) !== null && _companions_get !== void 0 ? _companions_get : [], triggerLine);
6936
- reportClassRoles(ctx, (_companions_get1 = companions.get('Role')) !== null && _companions_get1 !== void 0 ? _companions_get1 : [], allowedRoles);
6937
- reportClassStateInteractions(ctx, (_companions_get2 = companions.get('StateInteraction')) !== null && _companions_get2 !== void 0 ? _companions_get2 : [], allowedStates);
6938
- reportClassSkillRefs(ctx, (_companions_get3 = companions.get('SkillRefs')) !== null && _companions_get3 !== void 0 ? _companions_get3 : []);
6939
- }
6940
- function checkEnumMemberJsdoc(commentNode) {
6941
- var parsed = parseJsdocComment(commentNode.value);
6942
- var fromTags = parsed.tags.filter(function(t) {
6943
- return t.tag === 'dbxActionStateTransitionsFrom';
6944
- });
6945
- var toTags = parsed.tags.filter(function(t) {
6946
- return t.tag === 'dbxActionStateTransitionsTo';
6947
- });
6948
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
6949
- try {
6950
- for(var _iterator = _to_consumable_array(fromTags).concat(_to_consumable_array(toTags))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
6951
- var tag = _step.value;
6952
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6953
- try {
6954
- for(var _iterator1 = splitCommaSeparated(tag.description)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6955
- var item = _step1.value;
6956
- if (!allowedStates.includes(item)) reportOnJsdocLine({
6821
+ value: v.value
6822
+ },
6823
+ report: context.report
6824
+ });
6825
+ break;
6826
+ case 'tags-not-lowercase':
6827
+ {
6828
+ if (v.suffix !== 'Tags') break;
6829
+ var fix = buildLowercaseTagsFix({
6830
+ commentNode: commentNode,
6831
+ parsed: parsed,
6832
+ sourceCode: sourceCode,
6833
+ tag: v.raw
6834
+ });
6835
+ var fixer = fix ? function(fixer2) {
6836
+ return fixer2.replaceTextRange([
6837
+ fix.startOffset,
6838
+ fix.endOffset
6839
+ ], fix.replacement);
6840
+ } : undefined;
6841
+ reportOnJsdocLine({
6842
+ commentNode: commentNode,
6843
+ parsed: parsed,
6844
+ sourceCode: sourceCode,
6845
+ lineIndex: v.lineIndex,
6846
+ messageId: 'tagsNotLowercase',
6847
+ data: {
6848
+ value: v.value
6849
+ },
6850
+ report: context.report,
6851
+ fix: fixer
6852
+ });
6853
+ break;
6854
+ }
6855
+ case 'unknown':
6856
+ reportOnJsdocLine({
6957
6857
  commentNode: commentNode,
6958
6858
  parsed: parsed,
6959
6859
  sourceCode: sourceCode,
6960
- lineIndex: tag.startLineIndex,
6961
- messageId: 'invalidStateValue',
6860
+ lineIndex: v.lineIndex,
6861
+ messageId: 'unknownDbxModelSnapshotFieldTag',
6962
6862
  data: {
6963
- value: item,
6964
- allowed: allowedStates.join(', ')
6863
+ name: v.suffix,
6864
+ known: knownCompanions.join(', ')
6965
6865
  },
6966
6866
  report: context.report
6967
6867
  });
6968
- }
6969
- } catch (err) {
6970
- _didIteratorError1 = true;
6971
- _iteratorError1 = err;
6972
- } finally{
6973
- try {
6974
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
6975
- _iterator1.return();
6976
- }
6977
- } finally{
6978
- if (_didIteratorError1) {
6979
- throw _iteratorError1;
6980
- }
6981
- }
6982
- }
6983
- }
6984
- } catch (err) {
6985
- _didIteratorError = true;
6986
- _iteratorError = err;
6987
- } finally{
6988
- try {
6989
- if (!_iteratorNormalCompletion && _iterator.return != null) {
6990
- _iterator.return();
6991
- }
6992
- } finally{
6993
- if (_didIteratorError) {
6994
- throw _iteratorError;
6868
+ break;
6869
+ case 'duplicate':
6870
+ reportOnJsdocLine({
6871
+ commentNode: commentNode,
6872
+ parsed: parsed,
6873
+ sourceCode: sourceCode,
6874
+ lineIndex: v.lineIndex,
6875
+ messageId: 'duplicateCompanionTag',
6876
+ data: {
6877
+ name: v.suffix
6878
+ },
6879
+ report: context.report
6880
+ });
6881
+ break;
6995
6882
  }
6996
6883
  }
6997
- }
6884
+ });
6998
6885
  }
6999
- function visitClass(node) {
6886
+ function visit(node) {
7000
6887
  var anchor = node.parent && (node.parent.type === 'ExportNamedDeclaration' || node.parent.type === 'ExportDefaultDeclaration') ? node.parent : node;
7001
6888
  var jsdoc = leadingJsdocFor(sourceCode, anchor);
7002
- if (jsdoc) checkClassJsdoc(jsdoc);
7003
- }
7004
- function visitEnumMember(node) {
7005
- var jsdoc = leadingJsdocFor(sourceCode, node);
7006
- if (jsdoc) checkEnumMemberJsdoc(jsdoc);
6889
+ if (jsdoc) checkJsdoc(jsdoc);
7007
6890
  }
7008
6891
  return {
7009
- ClassDeclaration: visitClass,
7010
- TSEnumMember: visitEnumMember
6892
+ FunctionDeclaration: function FunctionDeclaration(node) {
6893
+ if (!node.body) return;
6894
+ var jsdoc = leadingJsdocFor(sourceCode, getStatementAnchor(node));
6895
+ if (jsdoc) checkJsdoc(jsdoc);
6896
+ },
6897
+ VariableDeclaration: visit
7011
6898
  };
7012
6899
  }
7013
6900
  };
@@ -7020,6 +6907,12 @@ function _array_like_to_array$4(arr, len) {
7020
6907
  function _array_with_holes$4(arr) {
7021
6908
  if (Array.isArray(arr)) return arr;
7022
6909
  }
6910
+ function _array_without_holes(arr) {
6911
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
6912
+ }
6913
+ function _iterable_to_array(iter) {
6914
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6915
+ }
7023
6916
  function _iterable_to_array_limit$4(arr, i) {
7024
6917
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
7025
6918
  if (_i == null) return;
@@ -7047,192 +6940,119 @@ function _iterable_to_array_limit$4(arr, i) {
7047
6940
  function _non_iterable_rest$4() {
7048
6941
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7049
6942
  }
6943
+ function _non_iterable_spread() {
6944
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6945
+ }
7050
6946
  function _sliced_to_array$4(arr, i) {
7051
6947
  return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
7052
6948
  }
6949
+ function _to_consumable_array(arr) {
6950
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread();
6951
+ }
7053
6952
  function _unsupported_iterable_to_array$4(o, minLen) {
7054
6953
  if (!o) return;
7055
6954
  if (typeof o === "string") return _array_like_to_array$4(o, minLen);
7056
6955
  var n = Object.prototype.toString.call(o).slice(8, -1);
7057
6956
  if (n === "Object" && o.constructor) n = o.constructor.name;
7058
- if (n === "Map" || n === "Set") return Array.from(n);
7059
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
7060
- }
7061
- var FORM_MARKERS = new Set([
7062
- 'dbxFormField',
7063
- 'dbxFormFieldDerivative',
7064
- 'dbxFormFieldTemplate'
7065
- ]);
7066
- var COMPOSES_FROM_MARKERS = new Set([
7067
- 'dbxFormFieldDerivative',
7068
- 'dbxFormFieldTemplate'
7069
- ]);
7070
- var DEFAULT_ALLOWED_TIERS = [
7071
- 'field-factory',
7072
- 'field-derivative',
7073
- 'composite-builder',
7074
- 'template-builder',
7075
- 'primitive'
7076
- ];
7077
- var DEFAULT_ALLOWED_WRAPPER_PATTERNS = [
7078
- 'unwrapped',
7079
- 'material-form-field-wrapped'
7080
- ];
7081
- var DEFAULT_ALLOWED_SUFFIXES = [
7082
- 'Row',
7083
- 'Group',
7084
- 'Fields',
7085
- 'Field',
7086
- 'Wrapper',
7087
- 'Layout'
7088
- ];
7089
- var DEFAULT_ALLOWED_ARRAY_OUTPUTS = [
7090
- 'yes',
7091
- 'no',
7092
- 'optional'
7093
- ];
7094
- var DEFAULT_KNOWN_COMPANIONS$2 = [
7095
- 'Slug',
7096
- 'Tier',
7097
- 'Produces',
7098
- 'ArrayOutput',
7099
- 'WrapperPattern',
7100
- 'NgFormType',
7101
- 'Suffix',
7102
- 'Returns',
7103
- 'ComposesFrom',
7104
- 'ConfigInterface',
7105
- 'PropsInterface',
7106
- 'Generic',
7107
- 'PropName'
7108
- ];
7109
- /**
7110
- * Splits a `@dbxFormField` JSDoc into its marker tags and the map of
7111
- * `@dbxForm*` companion tags keyed by their suffix.
7112
- *
7113
- * @param parsed - The parsed JSDoc to inspect.
7114
- * @returns The list of marker tags and the map of companion suffix to tag instances.
7115
- */ function collectFormTags(parsed) {
7116
- var markers = [];
7117
- var companions = new Map();
7118
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7119
- try {
7120
- for(var _iterator = parsed.tags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7121
- var tag = _step.value;
7122
- if (FORM_MARKERS.has(tag.tag)) {
7123
- markers.push(tag);
7124
- } else if (tag.tag.startsWith('dbxForm') && !tag.tag.startsWith('dbxFormField')) {
7125
- var _companions_get;
7126
- var suffix = tag.tag.slice('dbxForm'.length);
7127
- var list = (_companions_get = companions.get(suffix)) !== null && _companions_get !== void 0 ? _companions_get : [];
7128
- list.push(tag);
7129
- companions.set(suffix, list);
7130
- }
7131
- }
7132
- } catch (err) {
7133
- _didIteratorError = true;
7134
- _iteratorError = err;
7135
- } finally{
7136
- try {
7137
- if (!_iteratorNormalCompletion && _iterator.return != null) {
7138
- _iterator.return();
7139
- }
7140
- } finally{
7141
- if (_didIteratorError) {
7142
- throw _iteratorError;
7143
- }
7144
- }
7145
- }
7146
- return {
7147
- markers: markers,
7148
- companions: companions
7149
- };
7150
- }
7151
- /**
7152
- * Resolves the effective tier for a `@dbxFormField`-family JSDoc by
7153
- * preferring marker-derived tiers (e.g. `@dbxFormFieldDerivative` →
7154
- * `'field-derivative'`) and falling back to the first `@dbxFormTier`.
7155
- *
7156
- * @param markers - The marker tags found on the JSDoc.
7157
- * @param tierTags - Any explicit `@dbxFormTier` tags found on the JSDoc.
7158
- * @returns The resolved tier, or `undefined` when none is present.
7159
- */ function determineTier(markers, tierTags) {
7160
- // Marker-derived tier takes precedence; `@dbxFormFieldDerivative` → 'field-derivative', `@dbxFormFieldTemplate` → 'template-builder'.
7161
- // `@dbxFormField` requires an explicit `@dbxFormTier`.
7162
- var derived;
7163
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7164
- try {
7165
- for(var _iterator = markers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7166
- var m = _step.value;
7167
- if (m.tag === 'dbxFormFieldDerivative') derived = 'field-derivative';
7168
- else if (m.tag === 'dbxFormFieldTemplate') derived = 'template-builder';
7169
- }
7170
- } catch (err) {
7171
- _didIteratorError = true;
7172
- _iteratorError = err;
7173
- } finally{
7174
- try {
7175
- if (!_iteratorNormalCompletion && _iterator.return != null) {
7176
- _iterator.return();
7177
- }
7178
- } finally{
7179
- if (_didIteratorError) {
7180
- throw _iteratorError;
7181
- }
7182
- }
7183
- }
7184
- if (derived !== undefined) {
7185
- return derived;
7186
- }
7187
- return tierTags.length > 0 ? tierTags[0].description.trim() : undefined;
7188
- }
7189
- function reportFormDuplicateMarkers(ctx, markers) {
7190
- if (markers.length <= 1) return;
7191
- for(var i = 1; i < markers.length; i += 1){
7192
- reportOnJsdocLine({
7193
- commentNode: ctx.commentNode,
7194
- parsed: ctx.parsed,
7195
- sourceCode: ctx.sourceCode,
7196
- lineIndex: markers[i].startLineIndex,
7197
- messageId: 'duplicateMarker',
7198
- report: ctx.report
7199
- });
7200
- }
6957
+ if (n === "Map" || n === "Set") return Array.from(n);
6958
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
7201
6959
  }
7202
- function reportFormUnknownCompanions(ctx, companions, knownCompanions) {
6960
+ var DEFAULT_ALLOWED_ROLES = [
6961
+ 'directive',
6962
+ 'store'
6963
+ ];
6964
+ var DEFAULT_ALLOWED_STATES = [
6965
+ 'IDLE',
6966
+ 'DISABLED',
6967
+ 'TRIGGERED',
6968
+ 'VALUE_READY',
6969
+ 'WORKING',
6970
+ 'RESOLVED',
6971
+ 'REJECTED'
6972
+ ];
6973
+ var DEFAULT_KNOWN_COMPANIONS$3 = [
6974
+ 'Slug',
6975
+ 'Role',
6976
+ 'StateInteraction',
6977
+ 'ProducesContext',
6978
+ 'ConsumesContext',
6979
+ 'SkillRefs',
6980
+ 'DisabledKey',
6981
+ 'StateEnum',
6982
+ 'StateTransitionsFrom',
6983
+ 'StateTransitionsTo'
6984
+ ];
6985
+ var PROPERTY_ONLY_COMPANIONS = new Set([
6986
+ 'StateTransitionsFrom',
6987
+ 'StateTransitionsTo'
6988
+ ]);
6989
+ function reportClassUnknownAndMisplaced(ctx, companions, knownCompanions) {
7203
6990
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7204
6991
  try {
7205
6992
  for(var _iterator = companions.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7206
6993
  var _step_value = _sliced_to_array$4(_step.value, 2), suffix = _step_value[0], instances = _step_value[1];
7207
- if (knownCompanions.includes(suffix)) continue;
7208
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7209
- try {
7210
- for(var _iterator1 = instances[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
7211
- var tag = _step1.value;
7212
- reportOnJsdocLine({
7213
- commentNode: ctx.commentNode,
7214
- parsed: ctx.parsed,
7215
- sourceCode: ctx.sourceCode,
7216
- lineIndex: tag.startLineIndex,
7217
- messageId: 'unknownDbxFormTag',
7218
- data: {
7219
- name: suffix,
7220
- known: knownCompanions.join(', ')
7221
- },
7222
- report: ctx.report
7223
- });
6994
+ if (!knownCompanions.includes(suffix)) {
6995
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
6996
+ try {
6997
+ for(var _iterator1 = instances[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
6998
+ var tag = _step1.value;
6999
+ reportOnJsdocLine({
7000
+ commentNode: ctx.commentNode,
7001
+ parsed: ctx.parsed,
7002
+ sourceCode: ctx.sourceCode,
7003
+ lineIndex: tag.startLineIndex,
7004
+ messageId: 'unknownDbxActionTag',
7005
+ data: {
7006
+ name: suffix,
7007
+ known: knownCompanions.join(', ')
7008
+ },
7009
+ report: ctx.report
7010
+ });
7011
+ }
7012
+ } catch (err) {
7013
+ _didIteratorError1 = true;
7014
+ _iteratorError1 = err;
7015
+ } finally{
7016
+ try {
7017
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
7018
+ _iterator1.return();
7019
+ }
7020
+ } finally{
7021
+ if (_didIteratorError1) {
7022
+ throw _iteratorError1;
7023
+ }
7024
+ }
7224
7025
  }
7225
- } catch (err) {
7226
- _didIteratorError1 = true;
7227
- _iteratorError1 = err;
7228
- } finally{
7026
+ }
7027
+ if (PROPERTY_ONLY_COMPANIONS.has(suffix)) {
7028
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
7229
7029
  try {
7230
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
7231
- _iterator1.return();
7030
+ for(var _iterator2 = instances[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
7031
+ var tag1 = _step2.value;
7032
+ reportOnJsdocLine({
7033
+ commentNode: ctx.commentNode,
7034
+ parsed: ctx.parsed,
7035
+ sourceCode: ctx.sourceCode,
7036
+ lineIndex: tag1.startLineIndex,
7037
+ messageId: 'stateTagOutsideEnumMember',
7038
+ data: {
7039
+ name: suffix
7040
+ },
7041
+ report: ctx.report
7042
+ });
7232
7043
  }
7044
+ } catch (err) {
7045
+ _didIteratorError2 = true;
7046
+ _iteratorError2 = err;
7233
7047
  } finally{
7234
- if (_didIteratorError1) {
7235
- throw _iteratorError1;
7048
+ try {
7049
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
7050
+ _iterator2.return();
7051
+ }
7052
+ } finally{
7053
+ if (_didIteratorError2) {
7054
+ throw _iteratorError2;
7055
+ }
7236
7056
  }
7237
7057
  }
7238
7058
  }
@@ -7252,7 +7072,7 @@ function reportFormUnknownCompanions(ctx, companions, knownCompanions) {
7252
7072
  }
7253
7073
  }
7254
7074
  }
7255
- function reportFormDuplicateCompanions(ctx, companions) {
7075
+ function reportClassDuplicates(ctx, companions) {
7256
7076
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7257
7077
  try {
7258
7078
  for(var _iterator = companions.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
@@ -7284,230 +7104,100 @@ function reportFormDuplicateCompanions(ctx, companions) {
7284
7104
  if (_didIteratorError) {
7285
7105
  throw _iteratorError;
7286
7106
  }
7287
- }
7288
- }
7289
- }
7290
- function reportFormSlug(ctx, slugTags, triggerLine) {
7291
- if (slugTags.length === 0) {
7292
- reportOnJsdocLine({
7293
- commentNode: ctx.commentNode,
7294
- parsed: ctx.parsed,
7295
- sourceCode: ctx.sourceCode,
7296
- lineIndex: triggerLine,
7297
- messageId: 'missingSlug',
7298
- report: ctx.report
7299
- });
7300
- return;
7301
- }
7302
- var value = slugTags[0].description.trim();
7303
- if (value.length === 0) {
7304
- reportOnJsdocLine({
7305
- commentNode: ctx.commentNode,
7306
- parsed: ctx.parsed,
7307
- sourceCode: ctx.sourceCode,
7308
- lineIndex: slugTags[0].startLineIndex,
7309
- messageId: 'missingSlug',
7310
- report: ctx.report
7311
- });
7312
- } else if (!KEBAB_SLUG_PATTERN.test(value)) {
7313
- reportOnJsdocLine({
7314
- commentNode: ctx.commentNode,
7315
- parsed: ctx.parsed,
7316
- sourceCode: ctx.sourceCode,
7317
- lineIndex: slugTags[0].startLineIndex,
7318
- messageId: 'invalidSlugFormat',
7319
- data: {
7320
- value: value
7321
- },
7322
- report: ctx.report
7323
- });
7324
- }
7325
- }
7326
- function reportFormProduces(ctx, producesTags, triggerLine) {
7327
- if (producesTags.length === 0 || producesTags[0].description.trim().length === 0) {
7328
- reportOnJsdocLine({
7329
- commentNode: ctx.commentNode,
7330
- parsed: ctx.parsed,
7331
- sourceCode: ctx.sourceCode,
7332
- lineIndex: triggerLine,
7333
- messageId: 'missingProduces',
7334
- report: ctx.report
7335
- });
7336
- }
7337
- }
7338
- function reportFormArrayOutput(input) {
7339
- var ctx = input.ctx, arrayOutputTags = input.arrayOutputTags, allowedArrayOutputs = input.allowedArrayOutputs, triggerLine = input.triggerLine;
7340
- if (arrayOutputTags.length === 0 || arrayOutputTags[0].description.trim().length === 0) {
7341
- reportOnJsdocLine({
7342
- commentNode: ctx.commentNode,
7343
- parsed: ctx.parsed,
7344
- sourceCode: ctx.sourceCode,
7345
- lineIndex: triggerLine,
7346
- messageId: 'missingArrayOutput',
7347
- report: ctx.report
7348
- });
7349
- return;
7350
- }
7351
- var value = arrayOutputTags[0].description.trim();
7352
- if (!allowedArrayOutputs.includes(value)) {
7353
- reportOnJsdocLine({
7354
- commentNode: ctx.commentNode,
7355
- parsed: ctx.parsed,
7356
- sourceCode: ctx.sourceCode,
7357
- lineIndex: arrayOutputTags[0].startLineIndex,
7358
- messageId: 'invalidArrayOutput',
7359
- data: {
7360
- value: value,
7361
- allowed: allowedArrayOutputs.join(', ')
7362
- },
7363
- report: ctx.report
7364
- });
7365
- }
7366
- }
7367
- function reportFormTier(input) {
7368
- var ctx = input.ctx, markers = input.markers, tierTags = input.tierTags, tier = input.tier, allowedTiers = input.allowedTiers, triggerLine = input.triggerLine;
7369
- if (!markers.some(function(m) {
7370
- return m.tag === 'dbxFormField';
7371
- })) return;
7372
- if (tier == null) {
7373
- reportOnJsdocLine({
7374
- commentNode: ctx.commentNode,
7375
- parsed: ctx.parsed,
7376
- sourceCode: ctx.sourceCode,
7377
- lineIndex: triggerLine,
7378
- messageId: 'missingTier',
7379
- report: ctx.report
7380
- });
7381
- } else if (!allowedTiers.includes(tier)) {
7382
- var _ref;
7383
- var _tierTags_;
7384
- reportOnJsdocLine({
7385
- commentNode: ctx.commentNode,
7386
- parsed: ctx.parsed,
7387
- sourceCode: ctx.sourceCode,
7388
- lineIndex: (_ref = (_tierTags_ = tierTags[0]) === null || _tierTags_ === void 0 ? void 0 : _tierTags_.startLineIndex) !== null && _ref !== void 0 ? _ref : triggerLine,
7389
- messageId: 'invalidTier',
7390
- data: {
7391
- value: tier,
7392
- allowed: allowedTiers.join(', ')
7393
- },
7394
- report: ctx.report
7395
- });
7396
- }
7397
- }
7398
- function reportFormWrapperPattern(input) {
7399
- var ctx = input.ctx, wrapperTags = input.wrapperTags, allowedWrapperPatterns = input.allowedWrapperPatterns, triggerLine = input.triggerLine;
7400
- if (wrapperTags.length === 0 || wrapperTags[0].description.trim().length === 0) {
7401
- reportOnJsdocLine({
7402
- commentNode: ctx.commentNode,
7403
- parsed: ctx.parsed,
7404
- sourceCode: ctx.sourceCode,
7405
- lineIndex: triggerLine,
7406
- messageId: 'missingWrapperPattern',
7407
- report: ctx.report
7408
- });
7409
- return;
7410
- }
7411
- var value = wrapperTags[0].description.trim();
7412
- if (!allowedWrapperPatterns.includes(value)) {
7413
- reportOnJsdocLine({
7414
- commentNode: ctx.commentNode,
7415
- parsed: ctx.parsed,
7416
- sourceCode: ctx.sourceCode,
7417
- lineIndex: wrapperTags[0].startLineIndex,
7418
- messageId: 'invalidWrapperPattern',
7419
- data: {
7420
- value: value,
7421
- allowed: allowedWrapperPatterns.join(', ')
7422
- },
7423
- report: ctx.report
7424
- });
7107
+ }
7425
7108
  }
7426
7109
  }
7427
- function reportFormFieldFactoryTier(input) {
7428
- var _companions_get, _companions_get1;
7429
- var ctx = input.ctx, companions = input.companions, allowedWrapperPatterns = input.allowedWrapperPatterns, triggerLine = input.triggerLine;
7430
- reportFormWrapperPattern({
7431
- ctx: ctx,
7432
- wrapperTags: (_companions_get = companions.get('WrapperPattern')) !== null && _companions_get !== void 0 ? _companions_get : [],
7433
- allowedWrapperPatterns: allowedWrapperPatterns,
7434
- triggerLine: triggerLine
7435
- });
7436
- var ngFormTags = (_companions_get1 = companions.get('NgFormType')) !== null && _companions_get1 !== void 0 ? _companions_get1 : [];
7437
- if (ngFormTags.length === 0 || ngFormTags[0].description.trim().length === 0) {
7110
+ function reportClassSlug(ctx, slugTags, triggerLine) {
7111
+ if (slugTags.length === 0) {
7438
7112
  reportOnJsdocLine({
7439
7113
  commentNode: ctx.commentNode,
7440
7114
  parsed: ctx.parsed,
7441
7115
  sourceCode: ctx.sourceCode,
7442
7116
  lineIndex: triggerLine,
7443
- messageId: 'missingNgFormType',
7117
+ messageId: 'missingSlug',
7444
7118
  report: ctx.report
7445
7119
  });
7120
+ return;
7446
7121
  }
7447
- }
7448
- function reportFormCompositeBuilderTier(input) {
7449
- var ctx = input.ctx, suffixTags = input.suffixTags, allowedSuffixes = input.allowedSuffixes, triggerLine = input.triggerLine;
7450
- if (suffixTags.length === 0 || suffixTags[0].description.trim().length === 0) {
7122
+ var value = slugTags[0].description.trim();
7123
+ if (value.length === 0) {
7451
7124
  reportOnJsdocLine({
7452
7125
  commentNode: ctx.commentNode,
7453
7126
  parsed: ctx.parsed,
7454
7127
  sourceCode: ctx.sourceCode,
7455
- lineIndex: triggerLine,
7456
- messageId: 'missingSuffix',
7128
+ lineIndex: slugTags[0].startLineIndex,
7129
+ messageId: 'missingSlug',
7457
7130
  report: ctx.report
7458
7131
  });
7459
- return;
7460
- }
7461
- var value = suffixTags[0].description.trim();
7462
- if (!allowedSuffixes.includes(value)) {
7132
+ } else if (!KEBAB_SLUG_PATTERN.test(value)) {
7463
7133
  reportOnJsdocLine({
7464
7134
  commentNode: ctx.commentNode,
7465
7135
  parsed: ctx.parsed,
7466
7136
  sourceCode: ctx.sourceCode,
7467
- lineIndex: suffixTags[0].startLineIndex,
7468
- messageId: 'invalidSuffix',
7137
+ lineIndex: slugTags[0].startLineIndex,
7138
+ messageId: 'invalidSlugFormat',
7469
7139
  data: {
7470
- value: value,
7471
- allowed: allowedSuffixes.join(', ')
7140
+ value: value
7472
7141
  },
7473
7142
  report: ctx.report
7474
7143
  });
7475
7144
  }
7476
7145
  }
7477
- function reportFormDerivativeTier(input) {
7478
- var ctx = input.ctx, markers = input.markers, composesFromTags = input.composesFromTags, triggerLine = input.triggerLine;
7479
- var markerCarriesComposes = markers.some(function(m) {
7480
- return COMPOSES_FROM_MARKERS.has(m.tag) && m.description.trim().length > 0;
7481
- });
7482
- if (composesFromTags.length === 0 && !markerCarriesComposes) {
7483
- reportOnJsdocLine({
7484
- commentNode: ctx.commentNode,
7485
- parsed: ctx.parsed,
7486
- sourceCode: ctx.sourceCode,
7487
- lineIndex: triggerLine,
7488
- messageId: 'missingComposesFrom',
7489
- report: ctx.report
7490
- });
7146
+ function reportClassRoles(ctx, roleTags, allowedRoles) {
7147
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7148
+ try {
7149
+ for(var _iterator = roleTags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7150
+ var tag = _step.value;
7151
+ var value = tag.description.trim();
7152
+ if (value.length > 0 && !allowedRoles.includes(value)) {
7153
+ reportOnJsdocLine({
7154
+ commentNode: ctx.commentNode,
7155
+ parsed: ctx.parsed,
7156
+ sourceCode: ctx.sourceCode,
7157
+ lineIndex: tag.startLineIndex,
7158
+ messageId: 'invalidRole',
7159
+ data: {
7160
+ value: value,
7161
+ allowed: allowedRoles.join(', ')
7162
+ },
7163
+ report: ctx.report
7164
+ });
7165
+ }
7166
+ }
7167
+ } catch (err) {
7168
+ _didIteratorError = true;
7169
+ _iteratorError = err;
7170
+ } finally{
7171
+ try {
7172
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7173
+ _iterator.return();
7174
+ }
7175
+ } finally{
7176
+ if (_didIteratorError) {
7177
+ throw _iteratorError;
7178
+ }
7179
+ }
7491
7180
  }
7492
7181
  }
7493
- function reportFormComposesFromKebab(ctx, composesFromTags, markers) {
7182
+ function reportClassStateInteractions(ctx, stateTags, allowedStates) {
7494
7183
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7495
7184
  try {
7496
- for(var _iterator = composesFromTags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7185
+ for(var _iterator = stateTags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7497
7186
  var tag = _step.value;
7498
7187
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7499
7188
  try {
7500
7189
  for(var _iterator1 = splitCommaSeparated(tag.description)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
7501
7190
  var item = _step1.value;
7502
- if (!KEBAB_SLUG_PATTERN.test(item)) {
7191
+ if (!allowedStates.includes(item)) {
7503
7192
  reportOnJsdocLine({
7504
7193
  commentNode: ctx.commentNode,
7505
7194
  parsed: ctx.parsed,
7506
7195
  sourceCode: ctx.sourceCode,
7507
7196
  lineIndex: tag.startLineIndex,
7508
- messageId: 'composesFromNotKebab',
7197
+ messageId: 'invalidStateValue',
7509
7198
  data: {
7510
- value: item
7199
+ value: item,
7200
+ allowed: allowedStates.join(', ')
7511
7201
  },
7512
7202
  report: ctx.report
7513
7203
  });
@@ -7542,114 +7232,137 @@ function reportFormComposesFromKebab(ctx, composesFromTags, markers) {
7542
7232
  }
7543
7233
  }
7544
7234
  }
7545
- var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
7235
+ }
7236
+ function reportClassSkillRefs(ctx, skillRefsTags) {
7237
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7546
7238
  try {
7547
- for(var _iterator2 = markers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
7548
- var m = _step2.value;
7549
- if (!COMPOSES_FROM_MARKERS.has(m.tag)) continue;
7550
- var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
7239
+ for(var _iterator = skillRefsTags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7240
+ var tag = _step.value;
7241
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7551
7242
  try {
7552
- for(var _iterator3 = splitCommaSeparated(m.description)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
7553
- var item1 = _step3.value;
7554
- if (!KEBAB_SLUG_PATTERN.test(item1)) {
7243
+ for(var _iterator1 = splitCommaSeparated(tag.description)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
7244
+ var item = _step1.value;
7245
+ if (!KEBAB_SLUG_PATTERN.test(item)) {
7555
7246
  reportOnJsdocLine({
7556
7247
  commentNode: ctx.commentNode,
7557
7248
  parsed: ctx.parsed,
7558
7249
  sourceCode: ctx.sourceCode,
7559
- lineIndex: m.startLineIndex,
7560
- messageId: 'composesFromNotKebab',
7250
+ lineIndex: tag.startLineIndex,
7251
+ messageId: 'skillRefsNotKebab',
7561
7252
  data: {
7562
- value: item1
7253
+ value: item
7563
7254
  },
7564
7255
  report: ctx.report
7565
7256
  });
7566
7257
  }
7567
7258
  }
7568
7259
  } catch (err) {
7569
- _didIteratorError3 = true;
7570
- _iteratorError3 = err;
7260
+ _didIteratorError1 = true;
7261
+ _iteratorError1 = err;
7571
7262
  } finally{
7572
7263
  try {
7573
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
7574
- _iterator3.return();
7264
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
7265
+ _iterator1.return();
7575
7266
  }
7576
7267
  } finally{
7577
- if (_didIteratorError3) {
7578
- throw _iteratorError3;
7268
+ if (_didIteratorError1) {
7269
+ throw _iteratorError1;
7579
7270
  }
7580
7271
  }
7581
7272
  }
7582
7273
  }
7583
7274
  } catch (err) {
7584
- _didIteratorError2 = true;
7585
- _iteratorError2 = err;
7275
+ _didIteratorError = true;
7276
+ _iteratorError = err;
7586
7277
  } finally{
7587
7278
  try {
7588
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
7589
- _iterator2.return();
7279
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7280
+ _iterator.return();
7590
7281
  }
7591
7282
  } finally{
7592
- if (_didIteratorError2) {
7593
- throw _iteratorError2;
7283
+ if (_didIteratorError) {
7284
+ throw _iteratorError;
7594
7285
  }
7595
7286
  }
7596
7287
  }
7597
7288
  }
7598
7289
  /**
7599
- * ESLint rule enforcing `@dbxFormField` companion tags. Mirrors the scanner
7600
- * schema at `packages/dbx-components-mcp/src/scan/forge-fields-extract.ts`,
7601
- * including the tier-conditional required-tag matrix.
7602
- */ var UTIL_REQUIRE_DBX_FORM_FIELD_COMPANION_TAGS_RULE = {
7290
+ * Splits an `@dbxAction`-family JSDoc into its marker tag and the map of
7291
+ * companion tags keyed by their suffix (e.g. `Slug`, `Role`).
7292
+ *
7293
+ * @param parsed - The parsed JSDoc to inspect.
7294
+ * @returns The marker tag (if any) and a map of companion suffix to tag instances.
7295
+ */ function collectFamilyTags(parsed) {
7296
+ var markerTag = parsed.tags.find(function(t) {
7297
+ return t.tag === 'dbxAction';
7298
+ });
7299
+ var groups = new Map();
7300
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7301
+ try {
7302
+ for(var _iterator = parsed.tags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7303
+ var tag = _step.value;
7304
+ var _groups_get;
7305
+ if (!tag.tag.startsWith('dbxAction') || tag.tag === 'dbxAction') continue;
7306
+ var suffix = tag.tag.slice('dbxAction'.length);
7307
+ var list = (_groups_get = groups.get(suffix)) !== null && _groups_get !== void 0 ? _groups_get : [];
7308
+ list.push(tag);
7309
+ groups.set(suffix, list);
7310
+ }
7311
+ } catch (err) {
7312
+ _didIteratorError = true;
7313
+ _iteratorError = err;
7314
+ } finally{
7315
+ try {
7316
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7317
+ _iterator.return();
7318
+ }
7319
+ } finally{
7320
+ if (_didIteratorError) {
7321
+ throw _iteratorError;
7322
+ }
7323
+ }
7324
+ }
7325
+ return {
7326
+ markerTag: markerTag,
7327
+ companions: groups
7328
+ };
7329
+ }
7330
+ /**
7331
+ * ESLint rule enforcing `@dbxAction` companion tags. Mirrors the scanner
7332
+ * schema at `packages/dbx-cli/src/lib/mcp-scan/scan/actions-extract.ts`. Class
7333
+ * declarations carry the `@dbxAction` marker; enum declarations carry the
7334
+ * `@dbxActionStateEnum` marker, and `@dbxActionStateTransitionsFrom/To` are
7335
+ * valid on enum-member JSDocs.
7336
+ */ var UTIL_REQUIRE_DBX_ACTION_COMPANION_TAGS_RULE = {
7603
7337
  meta: {
7604
7338
  type: 'suggestion',
7605
7339
  fixable: 'code',
7606
7340
  docs: {
7607
- description: 'Require the canonical `@dbxForm*` companion tags on `@dbxFormField`-tagged factories.',
7341
+ description: 'Require the canonical `@dbxAction*` companion tags on `@dbxAction`-tagged classes and `@dbxActionStateEnum`-tagged enums.',
7608
7342
  recommended: true
7609
7343
  },
7610
7344
  messages: {
7611
- duplicateMarker: '`@dbxFormField` / `@dbxFormFieldDerivative` / `@dbxFormFieldTemplate` are mutually exclusive; only one is allowed.',
7612
- missingTier: '`@dbxFormField`-tagged factory is missing the required `@dbxFormTier <tier>` companion tag.',
7613
- invalidTier: '`@dbxFormTier` value `{{value}}` is not allowed. Use one of: {{allowed}}.',
7614
- missingSlug: '`@dbxFormField`-tagged factory is missing the required `@dbxFormSlug <slug>` companion tag.',
7615
- invalidSlugFormat: '`@dbxFormSlug` value `{{value}}` is not a valid kebab-case slug.',
7616
- missingProduces: '`@dbxFormField`-tagged factory is missing the required `@dbxFormProduces <type>` companion tag.',
7617
- missingArrayOutput: '`@dbxFormField`-tagged factory is missing the required `@dbxFormArrayOutput <yes|no|optional>` companion tag.',
7618
- invalidArrayOutput: '`@dbxFormArrayOutput` value `{{value}}` is not allowed. Use one of: {{allowed}}.',
7619
- missingWrapperPattern: 'field-factory tier requires `@dbxFormWrapperPattern <unwrapped|material-form-field-wrapped>`.',
7620
- invalidWrapperPattern: '`@dbxFormWrapperPattern` value `{{value}}` is not allowed. Use one of: {{allowed}}.',
7621
- missingNgFormType: 'field-factory tier requires `@dbxFormNgFormType <type>`.',
7622
- missingSuffix: 'composite-builder tier requires `@dbxFormSuffix <Row|Group|Fields|Field|Wrapper|Layout>`.',
7623
- invalidSuffix: '`@dbxFormSuffix` value `{{value}}` is not allowed. Use one of: {{allowed}}.',
7624
- missingComposesFrom: '`@dbxFormFieldDerivative` / `@dbxFormFieldTemplate` require `@dbxFormComposesFrom <slug,...>`.',
7625
- composesFromNotKebab: '`@dbxFormComposesFrom` item `{{value}}` is not a kebab-case slug.',
7626
- unknownDbxFormTag: '`@dbxForm{{name}}` is not a recognized companion tag. Known companions: {{known}}.',
7627
- duplicateCompanionTag: '`@dbxForm{{name}}` is declared more than once.'
7345
+ missingSlug: '`@dbxAction`-tagged class is missing the required `@dbxActionSlug <slug>` companion tag.',
7346
+ invalidSlugFormat: '`@dbxActionSlug` value `{{value}}` is not a valid kebab-case slug.',
7347
+ invalidRole: '`@dbxActionRole` value `{{value}}` is not allowed. Use one of: {{allowed}}.',
7348
+ invalidStateValue: '`@dbxActionStateInteraction` value `{{value}}` is not a valid state. Use one of: {{allowed}}.',
7349
+ skillRefsNotKebab: '`@dbxActionSkillRefs` item `{{value}}` is not a kebab-case slug.',
7350
+ stateTagOutsideEnumMember: '`@dbxAction{{name}}` is only valid on enum members of a `@dbxActionStateEnum`-tagged enum.',
7351
+ unknownDbxActionTag: '`@dbxAction{{name}}` is not a recognized companion tag. Known companions: {{known}}.',
7352
+ duplicateCompanionTag: '`@dbxAction{{name}}` is declared more than once.'
7628
7353
  },
7629
7354
  schema: [
7630
7355
  {
7631
7356
  type: 'object',
7632
7357
  additionalProperties: false,
7633
7358
  properties: {
7634
- allowedTiers: {
7635
- type: 'array',
7636
- items: {
7637
- type: 'string'
7638
- }
7639
- },
7640
- allowedWrapperPatterns: {
7641
- type: 'array',
7642
- items: {
7643
- type: 'string'
7644
- }
7645
- },
7646
- allowedSuffixes: {
7359
+ allowedRoles: {
7647
7360
  type: 'array',
7648
7361
  items: {
7649
7362
  type: 'string'
7650
7363
  }
7651
7364
  },
7652
- allowedArrayOutputs: {
7365
+ allowedStates: {
7653
7366
  type: 'array',
7654
7367
  items: {
7655
7368
  type: 'string'
@@ -7669,87 +7382,104 @@ function reportFormComposesFromKebab(ctx, composesFromTags, markers) {
7669
7382
  ]
7670
7383
  },
7671
7384
  create: function create(context) {
7672
- var _context_options_, _options_allowedTiers, _options_allowedWrapperPatterns, _options_allowedSuffixes, _options_allowedArrayOutputs, _options_knownCompanions;
7385
+ var _context_options_, _options_allowedRoles, _options_allowedStates, _options_knownCompanions;
7673
7386
  var options = (_context_options_ = context.options[0]) !== null && _context_options_ !== void 0 ? _context_options_ : {};
7674
7387
  var sourceCode = context.sourceCode;
7675
- var allowedTiers = (_options_allowedTiers = options.allowedTiers) !== null && _options_allowedTiers !== void 0 ? _options_allowedTiers : DEFAULT_ALLOWED_TIERS;
7676
- var allowedWrapperPatterns = (_options_allowedWrapperPatterns = options.allowedWrapperPatterns) !== null && _options_allowedWrapperPatterns !== void 0 ? _options_allowedWrapperPatterns : DEFAULT_ALLOWED_WRAPPER_PATTERNS;
7677
- var allowedSuffixes = (_options_allowedSuffixes = options.allowedSuffixes) !== null && _options_allowedSuffixes !== void 0 ? _options_allowedSuffixes : DEFAULT_ALLOWED_SUFFIXES;
7678
- var allowedArrayOutputs = (_options_allowedArrayOutputs = options.allowedArrayOutputs) !== null && _options_allowedArrayOutputs !== void 0 ? _options_allowedArrayOutputs : DEFAULT_ALLOWED_ARRAY_OUTPUTS;
7679
- var knownCompanions = (_options_knownCompanions = options.knownCompanions) !== null && _options_knownCompanions !== void 0 ? _options_knownCompanions : DEFAULT_KNOWN_COMPANIONS$2;
7388
+ var allowedRoles = (_options_allowedRoles = options.allowedRoles) !== null && _options_allowedRoles !== void 0 ? _options_allowedRoles : DEFAULT_ALLOWED_ROLES;
7389
+ var allowedStates = (_options_allowedStates = options.allowedStates) !== null && _options_allowedStates !== void 0 ? _options_allowedStates : DEFAULT_ALLOWED_STATES;
7390
+ var knownCompanions = (_options_knownCompanions = options.knownCompanions) !== null && _options_knownCompanions !== void 0 ? _options_knownCompanions : DEFAULT_KNOWN_COMPANIONS$3;
7680
7391
  var requireBareMarker = options.requireBareMarker !== false;
7681
- function checkJsdoc(commentNode) {
7682
- var _ref, _companions_get, _companions_get1, _companions_get2, _companions_get3, _companions_get4;
7683
- var _markers_;
7392
+ function checkClassJsdoc(commentNode) {
7393
+ var _ref, _companions_get, _companions_get1, _companions_get2, _companions_get3;
7394
+ var _this, _Array_from_;
7684
7395
  var parsed = parseJsdocComment(commentNode.value);
7685
- var _collectFormTags = collectFormTags(parsed), markers = _collectFormTags.markers, companions = _collectFormTags.companions;
7686
- if (markers.length === 0 && companions.size === 0 || requireBareMarker && markers.length === 0) return;
7396
+ var _collectFamilyTags = collectFamilyTags(parsed), markerTag = _collectFamilyTags.markerTag, companions = _collectFamilyTags.companions;
7397
+ if (!markerTag && companions.size === 0 || requireBareMarker && !markerTag) return;
7687
7398
  var ctx = {
7688
7399
  commentNode: commentNode,
7689
7400
  parsed: parsed,
7690
7401
  sourceCode: sourceCode,
7691
7402
  report: context.report
7692
7403
  };
7693
- var triggerLine = (_ref = (_markers_ = markers[0]) === null || _markers_ === void 0 ? void 0 : _markers_.startLineIndex) !== null && _ref !== void 0 ? _ref : 0;
7694
- reportFormDuplicateMarkers(ctx, markers);
7695
- reportFormUnknownCompanions(ctx, companions, knownCompanions);
7696
- reportFormDuplicateCompanions(ctx, companions);
7697
- reportFormSlug(ctx, (_companions_get = companions.get('Slug')) !== null && _companions_get !== void 0 ? _companions_get : [], triggerLine);
7698
- reportFormProduces(ctx, (_companions_get1 = companions.get('Produces')) !== null && _companions_get1 !== void 0 ? _companions_get1 : [], triggerLine);
7699
- reportFormArrayOutput({
7700
- ctx: ctx,
7701
- arrayOutputTags: (_companions_get2 = companions.get('ArrayOutput')) !== null && _companions_get2 !== void 0 ? _companions_get2 : [],
7702
- allowedArrayOutputs: allowedArrayOutputs,
7703
- triggerLine: triggerLine
7404
+ var triggerLine = (_ref = (_this = markerTag !== null && markerTag !== void 0 ? markerTag : (_Array_from_ = Array.from(companions.values())[0]) === null || _Array_from_ === void 0 ? void 0 : _Array_from_[0]) === null || _this === void 0 ? void 0 : _this.startLineIndex) !== null && _ref !== void 0 ? _ref : 0;
7405
+ reportClassUnknownAndMisplaced(ctx, companions, knownCompanions);
7406
+ reportClassDuplicates(ctx, companions);
7407
+ reportClassSlug(ctx, (_companions_get = companions.get('Slug')) !== null && _companions_get !== void 0 ? _companions_get : [], triggerLine);
7408
+ reportClassRoles(ctx, (_companions_get1 = companions.get('Role')) !== null && _companions_get1 !== void 0 ? _companions_get1 : [], allowedRoles);
7409
+ reportClassStateInteractions(ctx, (_companions_get2 = companions.get('StateInteraction')) !== null && _companions_get2 !== void 0 ? _companions_get2 : [], allowedStates);
7410
+ reportClassSkillRefs(ctx, (_companions_get3 = companions.get('SkillRefs')) !== null && _companions_get3 !== void 0 ? _companions_get3 : []);
7411
+ }
7412
+ function checkEnumMemberJsdoc(commentNode) {
7413
+ var parsed = parseJsdocComment(commentNode.value);
7414
+ var fromTags = parsed.tags.filter(function(t) {
7415
+ return t.tag === 'dbxActionStateTransitionsFrom';
7704
7416
  });
7705
- var tierTags = (_companions_get3 = companions.get('Tier')) !== null && _companions_get3 !== void 0 ? _companions_get3 : [];
7706
- var tier = determineTier(markers, tierTags);
7707
- reportFormTier({
7708
- ctx: ctx,
7709
- markers: markers,
7710
- tierTags: tierTags,
7711
- tier: tier,
7712
- allowedTiers: allowedTiers,
7713
- triggerLine: triggerLine
7417
+ var toTags = parsed.tags.filter(function(t) {
7418
+ return t.tag === 'dbxActionStateTransitionsTo';
7714
7419
  });
7715
- var composesFromTags = (_companions_get4 = companions.get('ComposesFrom')) !== null && _companions_get4 !== void 0 ? _companions_get4 : [];
7716
- if (tier === 'field-factory') {
7717
- reportFormFieldFactoryTier({
7718
- ctx: ctx,
7719
- companions: companions,
7720
- allowedWrapperPatterns: allowedWrapperPatterns,
7721
- triggerLine: triggerLine
7722
- });
7723
- } else if (tier === 'composite-builder') {
7724
- var _companions_get5;
7725
- reportFormCompositeBuilderTier({
7726
- ctx: ctx,
7727
- suffixTags: (_companions_get5 = companions.get('Suffix')) !== null && _companions_get5 !== void 0 ? _companions_get5 : [],
7728
- allowedSuffixes: allowedSuffixes,
7729
- triggerLine: triggerLine
7730
- });
7731
- } else if (tier === 'field-derivative' || tier === 'template-builder') {
7732
- reportFormDerivativeTier({
7733
- ctx: ctx,
7734
- markers: markers,
7735
- composesFromTags: composesFromTags,
7736
- triggerLine: triggerLine
7737
- });
7420
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7421
+ try {
7422
+ for(var _iterator = _to_consumable_array(fromTags).concat(_to_consumable_array(toTags))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7423
+ var tag = _step.value;
7424
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7425
+ try {
7426
+ for(var _iterator1 = splitCommaSeparated(tag.description)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
7427
+ var item = _step1.value;
7428
+ if (!allowedStates.includes(item)) reportOnJsdocLine({
7429
+ commentNode: commentNode,
7430
+ parsed: parsed,
7431
+ sourceCode: sourceCode,
7432
+ lineIndex: tag.startLineIndex,
7433
+ messageId: 'invalidStateValue',
7434
+ data: {
7435
+ value: item,
7436
+ allowed: allowedStates.join(', ')
7437
+ },
7438
+ report: context.report
7439
+ });
7440
+ }
7441
+ } catch (err) {
7442
+ _didIteratorError1 = true;
7443
+ _iteratorError1 = err;
7444
+ } finally{
7445
+ try {
7446
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
7447
+ _iterator1.return();
7448
+ }
7449
+ } finally{
7450
+ if (_didIteratorError1) {
7451
+ throw _iteratorError1;
7452
+ }
7453
+ }
7454
+ }
7455
+ }
7456
+ } catch (err) {
7457
+ _didIteratorError = true;
7458
+ _iteratorError = err;
7459
+ } finally{
7460
+ try {
7461
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7462
+ _iterator.return();
7463
+ }
7464
+ } finally{
7465
+ if (_didIteratorError) {
7466
+ throw _iteratorError;
7467
+ }
7468
+ }
7738
7469
  }
7739
- reportFormComposesFromKebab(ctx, composesFromTags, markers);
7740
7470
  }
7741
- function visit(node) {
7471
+ function visitClass(node) {
7742
7472
  var anchor = node.parent && (node.parent.type === 'ExportNamedDeclaration' || node.parent.type === 'ExportDefaultDeclaration') ? node.parent : node;
7743
7473
  var jsdoc = leadingJsdocFor(sourceCode, anchor);
7744
- if (jsdoc) checkJsdoc(jsdoc);
7474
+ if (jsdoc) checkClassJsdoc(jsdoc);
7475
+ }
7476
+ function visitEnumMember(node) {
7477
+ var jsdoc = leadingJsdocFor(sourceCode, node);
7478
+ if (jsdoc) checkEnumMemberJsdoc(jsdoc);
7745
7479
  }
7746
7480
  return {
7747
- FunctionDeclaration: function FunctionDeclaration(node) {
7748
- if (!node.body) return;
7749
- var jsdoc = leadingJsdocFor(sourceCode, getStatementAnchor(node));
7750
- if (jsdoc) checkJsdoc(jsdoc);
7751
- },
7752
- VariableDeclaration: visit
7481
+ ClassDeclaration: visitClass,
7482
+ TSEnumMember: visitEnumMember
7753
7483
  };
7754
7484
  }
7755
7485
  };
@@ -7800,83 +7530,75 @@ function _unsupported_iterable_to_array$3(o, minLen) {
7800
7530
  if (n === "Map" || n === "Set") return Array.from(n);
7801
7531
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
7802
7532
  }
7803
- var MODEL_MARKERS = new Set([
7804
- 'dbxModel',
7805
- 'dbxModelSubObject',
7806
- 'dbxModelOrganizationalGroupRoot',
7807
- 'dbxModelGroup'
7533
+ var FORM_MARKERS = new Set([
7534
+ 'dbxFormField',
7535
+ 'dbxFormFieldDerivative',
7536
+ 'dbxFormFieldTemplate'
7808
7537
  ]);
7809
- var EXCLUSIVE_MODEL_MARKERS = new Set([
7810
- 'dbxModel',
7811
- 'dbxModelSubObject',
7812
- 'dbxModelOrganizationalGroupRoot'
7538
+ var COMPOSES_FROM_MARKERS = new Set([
7539
+ 'dbxFormFieldDerivative',
7540
+ 'dbxFormFieldTemplate'
7813
7541
  ]);
7814
- var MODEL_COMPANIONS = [
7815
- 'Archetype',
7816
- 'AggregatesFrom',
7817
- 'CompositeKey'
7542
+ var DEFAULT_ALLOWED_TIERS = [
7543
+ 'field-factory',
7544
+ 'field-derivative',
7545
+ 'composite-builder',
7546
+ 'template-builder',
7547
+ 'primitive'
7818
7548
  ];
7819
- var PROPERTY_COMPANIONS = [
7820
- 'Variable',
7821
- 'VariableSyncFlag'
7549
+ var DEFAULT_ALLOWED_WRAPPER_PATTERNS = [
7550
+ 'unwrapped',
7551
+ 'material-form-field-wrapped'
7822
7552
  ];
7823
- var DEFAULT_ALLOWED_ENCODINGS = [
7824
- 'two-way',
7825
- 'one-way'
7553
+ var DEFAULT_ALLOWED_SUFFIXES = [
7554
+ 'Row',
7555
+ 'Group',
7556
+ 'Fields',
7557
+ 'Field',
7558
+ 'Wrapper',
7559
+ 'Layout'
7826
7560
  ];
7827
- var ARCHETYPE_SLUG_PATTERN = /^[a-z][a-z0-9-]*$/;
7828
- var ARCHETYPE_AXIS_PATTERN = /^([A-Za-z_$][A-Za-z0-9_$]*)=([^,]+)$/;
7829
- function reportMutuallyExclusiveMarkers(ctx, markers) {
7830
- var exclusiveMarkers = markers.filter(function(m) {
7831
- return EXCLUSIVE_MODEL_MARKERS.has(m.tag);
7832
- });
7833
- if (exclusiveMarkers.length <= 1) return;
7834
- for(var i = 1; i < exclusiveMarkers.length; i += 1){
7835
- reportOnJsdocLine({
7836
- commentNode: ctx.commentNode,
7837
- parsed: ctx.parsed,
7838
- sourceCode: ctx.sourceCode,
7839
- lineIndex: exclusiveMarkers[i].startLineIndex,
7840
- messageId: 'mutuallyExclusiveMarkers',
7841
- report: ctx.report
7842
- });
7843
- }
7844
- }
7845
- function reportPropertyOnlyTags(ctx, companions) {
7561
+ var DEFAULT_ALLOWED_ARRAY_OUTPUTS = [
7562
+ 'yes',
7563
+ 'no',
7564
+ 'optional'
7565
+ ];
7566
+ var DEFAULT_KNOWN_COMPANIONS$2 = [
7567
+ 'Slug',
7568
+ 'Tier',
7569
+ 'Produces',
7570
+ 'ArrayOutput',
7571
+ 'WrapperPattern',
7572
+ 'NgFormType',
7573
+ 'Suffix',
7574
+ 'Returns',
7575
+ 'ComposesFrom',
7576
+ 'ConfigInterface',
7577
+ 'PropsInterface',
7578
+ 'Generic',
7579
+ 'PropName'
7580
+ ];
7581
+ /**
7582
+ * Splits a `@dbxFormField` JSDoc into its marker tags and the map of
7583
+ * `@dbxForm*` companion tags keyed by their suffix.
7584
+ *
7585
+ * @param parsed - The parsed JSDoc to inspect.
7586
+ * @returns The list of marker tags and the map of companion suffix to tag instances.
7587
+ */ function collectFormTags(parsed) {
7588
+ var markers = [];
7589
+ var companions = new Map();
7846
7590
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7847
7591
  try {
7848
- for(var _iterator = PROPERTY_COMPANIONS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7849
- var propOnly = _step.value;
7850
- var _companions_get;
7851
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7852
- try {
7853
- for(var _iterator1 = ((_companions_get = companions.get(propOnly)) !== null && _companions_get !== void 0 ? _companions_get : [])[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
7854
- var tag = _step1.value;
7855
- reportOnJsdocLine({
7856
- commentNode: ctx.commentNode,
7857
- parsed: ctx.parsed,
7858
- sourceCode: ctx.sourceCode,
7859
- lineIndex: tag.startLineIndex,
7860
- messageId: 'variableTagOutsideProperty',
7861
- data: {
7862
- name: propOnly
7863
- },
7864
- report: ctx.report
7865
- });
7866
- }
7867
- } catch (err) {
7868
- _didIteratorError1 = true;
7869
- _iteratorError1 = err;
7870
- } finally{
7871
- try {
7872
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
7873
- _iterator1.return();
7874
- }
7875
- } finally{
7876
- if (_didIteratorError1) {
7877
- throw _iteratorError1;
7878
- }
7879
- }
7592
+ for(var _iterator = parsed.tags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7593
+ var tag = _step.value;
7594
+ if (FORM_MARKERS.has(tag.tag)) {
7595
+ markers.push(tag);
7596
+ } else if (tag.tag.startsWith('dbxForm') && !tag.tag.startsWith('dbxFormField')) {
7597
+ var _companions_get;
7598
+ var suffix = tag.tag.slice('dbxForm'.length);
7599
+ var list = (_companions_get = companions.get(suffix)) !== null && _companions_get !== void 0 ? _companions_get : [];
7600
+ list.push(tag);
7601
+ companions.set(suffix, list);
7880
7602
  }
7881
7603
  }
7882
7604
  } catch (err) {
@@ -7893,13 +7615,67 @@ function reportPropertyOnlyTags(ctx, companions) {
7893
7615
  }
7894
7616
  }
7895
7617
  }
7618
+ return {
7619
+ markers: markers,
7620
+ companions: companions
7621
+ };
7622
+ }
7623
+ /**
7624
+ * Resolves the effective tier for a `@dbxFormField`-family JSDoc by
7625
+ * preferring marker-derived tiers (e.g. `@dbxFormFieldDerivative` →
7626
+ * `'field-derivative'`) and falling back to the first `@dbxFormTier`.
7627
+ *
7628
+ * @param markers - The marker tags found on the JSDoc.
7629
+ * @param tierTags - Any explicit `@dbxFormTier` tags found on the JSDoc.
7630
+ * @returns The resolved tier, or `undefined` when none is present.
7631
+ */ function determineTier(markers, tierTags) {
7632
+ // Marker-derived tier takes precedence; `@dbxFormFieldDerivative` → 'field-derivative', `@dbxFormFieldTemplate` → 'template-builder'.
7633
+ // `@dbxFormField` requires an explicit `@dbxFormTier`.
7634
+ var derived;
7635
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7636
+ try {
7637
+ for(var _iterator = markers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7638
+ var m = _step.value;
7639
+ if (m.tag === 'dbxFormFieldDerivative') derived = 'field-derivative';
7640
+ else if (m.tag === 'dbxFormFieldTemplate') derived = 'template-builder';
7641
+ }
7642
+ } catch (err) {
7643
+ _didIteratorError = true;
7644
+ _iteratorError = err;
7645
+ } finally{
7646
+ try {
7647
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7648
+ _iterator.return();
7649
+ }
7650
+ } finally{
7651
+ if (_didIteratorError) {
7652
+ throw _iteratorError;
7653
+ }
7654
+ }
7655
+ }
7656
+ if (derived !== undefined) {
7657
+ return derived;
7658
+ }
7659
+ return tierTags.length > 0 ? tierTags[0].description.trim() : undefined;
7660
+ }
7661
+ function reportFormDuplicateMarkers(ctx, markers) {
7662
+ if (markers.length <= 1) return;
7663
+ for(var i = 1; i < markers.length; i += 1){
7664
+ reportOnJsdocLine({
7665
+ commentNode: ctx.commentNode,
7666
+ parsed: ctx.parsed,
7667
+ sourceCode: ctx.sourceCode,
7668
+ lineIndex: markers[i].startLineIndex,
7669
+ messageId: 'duplicateMarker',
7670
+ report: ctx.report
7671
+ });
7672
+ }
7896
7673
  }
7897
- function reportUnknownModelCompanions(ctx, companions, knownCompanions) {
7674
+ function reportFormUnknownCompanions(ctx, companions, knownCompanions) {
7898
7675
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7899
7676
  try {
7900
7677
  for(var _iterator = companions.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7901
7678
  var _step_value = _sliced_to_array$3(_step.value, 2), suffix = _step_value[0], instances = _step_value[1];
7902
- if (PROPERTY_COMPANIONS.includes(suffix)) continue;
7903
7679
  if (knownCompanions.includes(suffix)) continue;
7904
7680
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7905
7681
  try {
@@ -7910,7 +7686,7 @@ function reportUnknownModelCompanions(ctx, companions, knownCompanions) {
7910
7686
  parsed: ctx.parsed,
7911
7687
  sourceCode: ctx.sourceCode,
7912
7688
  lineIndex: tag.startLineIndex,
7913
- messageId: 'unknownDbxModelTag',
7689
+ messageId: 'unknownDbxFormTag',
7914
7690
  data: {
7915
7691
  name: suffix,
7916
7692
  known: knownCompanions.join(', ')
@@ -7948,14 +7724,11 @@ function reportUnknownModelCompanions(ctx, companions, knownCompanions) {
7948
7724
  }
7949
7725
  }
7950
7726
  }
7951
- function reportModelDuplicates(ctx, companions, knownCompanions) {
7727
+ function reportFormDuplicateCompanions(ctx, companions) {
7952
7728
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7953
7729
  try {
7954
- for(var _iterator = knownCompanions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7955
- var suffix = _step.value;
7956
- var _companions_get;
7957
- if (suffix === 'Archetype') continue; // archetypes are repeatable.
7958
- var instances = (_companions_get = companions.get(suffix)) !== null && _companions_get !== void 0 ? _companions_get : [];
7730
+ for(var _iterator = companions.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7731
+ var _step_value = _sliced_to_array$3(_step.value, 2), suffix = _step_value[0], instances = _step_value[1];
7959
7732
  if (instances.length <= 1) continue;
7960
7733
  for(var i = 1; i < instances.length; i += 1){
7961
7734
  reportOnJsdocLine({
@@ -7986,180 +7759,246 @@ function reportModelDuplicates(ctx, companions, knownCompanions) {
7986
7759
  }
7987
7760
  }
7988
7761
  }
7989
- function reportArchetypeTag(ctx, tag) {
7990
- var text = tag.description.trim();
7991
- if (text.length === 0) return;
7992
- var spaceIdx = text.indexOf(' ');
7993
- var slug = spaceIdx >= 0 ? text.slice(0, spaceIdx).trim() : text;
7994
- if (!ARCHETYPE_SLUG_PATTERN.test(slug)) {
7762
+ function reportFormSlug(ctx, slugTags, triggerLine) {
7763
+ if (slugTags.length === 0) {
7764
+ reportOnJsdocLine({
7765
+ commentNode: ctx.commentNode,
7766
+ parsed: ctx.parsed,
7767
+ sourceCode: ctx.sourceCode,
7768
+ lineIndex: triggerLine,
7769
+ messageId: 'missingSlug',
7770
+ report: ctx.report
7771
+ });
7772
+ return;
7773
+ }
7774
+ var value = slugTags[0].description.trim();
7775
+ if (value.length === 0) {
7776
+ reportOnJsdocLine({
7777
+ commentNode: ctx.commentNode,
7778
+ parsed: ctx.parsed,
7779
+ sourceCode: ctx.sourceCode,
7780
+ lineIndex: slugTags[0].startLineIndex,
7781
+ messageId: 'missingSlug',
7782
+ report: ctx.report
7783
+ });
7784
+ } else if (!KEBAB_SLUG_PATTERN.test(value)) {
7995
7785
  reportOnJsdocLine({
7996
7786
  commentNode: ctx.commentNode,
7997
7787
  parsed: ctx.parsed,
7998
7788
  sourceCode: ctx.sourceCode,
7999
- lineIndex: tag.startLineIndex,
8000
- messageId: 'archetypeBadSlug',
7789
+ lineIndex: slugTags[0].startLineIndex,
7790
+ messageId: 'invalidSlugFormat',
8001
7791
  data: {
8002
- value: slug
7792
+ value: value
8003
7793
  },
8004
7794
  report: ctx.report
8005
7795
  });
7796
+ }
7797
+ }
7798
+ function reportFormProduces(ctx, producesTags, triggerLine) {
7799
+ if (producesTags.length === 0 || producesTags[0].description.trim().length === 0) {
7800
+ reportOnJsdocLine({
7801
+ commentNode: ctx.commentNode,
7802
+ parsed: ctx.parsed,
7803
+ sourceCode: ctx.sourceCode,
7804
+ lineIndex: triggerLine,
7805
+ messageId: 'missingProduces',
7806
+ report: ctx.report
7807
+ });
7808
+ }
7809
+ }
7810
+ function reportFormArrayOutput(input) {
7811
+ var ctx = input.ctx, arrayOutputTags = input.arrayOutputTags, allowedArrayOutputs = input.allowedArrayOutputs, triggerLine = input.triggerLine;
7812
+ if (arrayOutputTags.length === 0 || arrayOutputTags[0].description.trim().length === 0) {
7813
+ reportOnJsdocLine({
7814
+ commentNode: ctx.commentNode,
7815
+ parsed: ctx.parsed,
7816
+ sourceCode: ctx.sourceCode,
7817
+ lineIndex: triggerLine,
7818
+ messageId: 'missingArrayOutput',
7819
+ report: ctx.report
7820
+ });
8006
7821
  return;
8007
7822
  }
8008
- if (spaceIdx < 0) return;
8009
- var rest = text.slice(spaceIdx + 1).trim();
8010
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8011
- try {
8012
- for(var _iterator = rest.split(',')[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8013
- var pair = _step.value;
8014
- var trimmed = pair.trim();
8015
- if (trimmed.length === 0) continue;
8016
- if (!ARCHETYPE_AXIS_PATTERN.test(trimmed)) {
8017
- reportOnJsdocLine({
8018
- commentNode: ctx.commentNode,
8019
- parsed: ctx.parsed,
8020
- sourceCode: ctx.sourceCode,
8021
- lineIndex: tag.startLineIndex,
8022
- messageId: 'archetypeBadAxisPair',
8023
- data: {
8024
- value: trimmed
8025
- },
8026
- report: ctx.report
8027
- });
8028
- }
8029
- }
8030
- } catch (err) {
8031
- _didIteratorError = true;
8032
- _iteratorError = err;
8033
- } finally{
8034
- try {
8035
- if (!_iteratorNormalCompletion && _iterator.return != null) {
8036
- _iterator.return();
8037
- }
8038
- } finally{
8039
- if (_didIteratorError) {
8040
- throw _iteratorError;
8041
- }
8042
- }
7823
+ var value = arrayOutputTags[0].description.trim();
7824
+ if (!allowedArrayOutputs.includes(value)) {
7825
+ reportOnJsdocLine({
7826
+ commentNode: ctx.commentNode,
7827
+ parsed: ctx.parsed,
7828
+ sourceCode: ctx.sourceCode,
7829
+ lineIndex: arrayOutputTags[0].startLineIndex,
7830
+ messageId: 'invalidArrayOutput',
7831
+ data: {
7832
+ value: value,
7833
+ allowed: allowedArrayOutputs.join(', ')
7834
+ },
7835
+ report: ctx.report
7836
+ });
8043
7837
  }
8044
7838
  }
8045
- function reportCompositeKeyTag(ctx, tag, allowedEncodings) {
8046
- var text = tag.description.trim();
8047
- if (text.length === 0) {
7839
+ function reportFormTier(input) {
7840
+ var ctx = input.ctx, markers = input.markers, tierTags = input.tierTags, tier = input.tier, allowedTiers = input.allowedTiers, triggerLine = input.triggerLine;
7841
+ if (!markers.some(function(m) {
7842
+ return m.tag === 'dbxFormField';
7843
+ })) return;
7844
+ if (tier == null) {
7845
+ reportOnJsdocLine({
7846
+ commentNode: ctx.commentNode,
7847
+ parsed: ctx.parsed,
7848
+ sourceCode: ctx.sourceCode,
7849
+ lineIndex: triggerLine,
7850
+ messageId: 'missingTier',
7851
+ report: ctx.report
7852
+ });
7853
+ } else if (!allowedTiers.includes(tier)) {
7854
+ var _ref;
7855
+ var _tierTags_;
8048
7856
  reportOnJsdocLine({
8049
7857
  commentNode: ctx.commentNode,
8050
7858
  parsed: ctx.parsed,
8051
7859
  sourceCode: ctx.sourceCode,
8052
- lineIndex: tag.startLineIndex,
8053
- messageId: 'compositeKeyMissingFrom',
7860
+ lineIndex: (_ref = (_tierTags_ = tierTags[0]) === null || _tierTags_ === void 0 ? void 0 : _tierTags_.startLineIndex) !== null && _ref !== void 0 ? _ref : triggerLine,
7861
+ messageId: 'invalidTier',
7862
+ data: {
7863
+ value: tier,
7864
+ allowed: allowedTiers.join(', ')
7865
+ },
8054
7866
  report: ctx.report
8055
7867
  });
7868
+ }
7869
+ }
7870
+ function reportFormWrapperPattern(input) {
7871
+ var ctx = input.ctx, wrapperTags = input.wrapperTags, allowedWrapperPatterns = input.allowedWrapperPatterns, triggerLine = input.triggerLine;
7872
+ if (wrapperTags.length === 0 || wrapperTags[0].description.trim().length === 0) {
8056
7873
  reportOnJsdocLine({
8057
7874
  commentNode: ctx.commentNode,
8058
7875
  parsed: ctx.parsed,
8059
7876
  sourceCode: ctx.sourceCode,
8060
- lineIndex: tag.startLineIndex,
8061
- messageId: 'compositeKeyMissingEncoding',
7877
+ lineIndex: triggerLine,
7878
+ messageId: 'missingWrapperPattern',
8062
7879
  report: ctx.report
8063
7880
  });
8064
7881
  return;
8065
7882
  }
8066
- var hasFrom = false;
8067
- var encoding;
8068
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8069
- try {
8070
- for(var _iterator = text.split(/\s+/)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8071
- var token = _step.value;
8072
- var eq = token.indexOf('=');
8073
- if (eq <= 0) continue;
8074
- var key = token.slice(0, eq).trim();
8075
- var value = token.slice(eq + 1).trim();
8076
- if (key === 'from' && value.length > 0) hasFrom = true;
8077
- else if (key === 'encoding') encoding = value;
8078
- }
8079
- } catch (err) {
8080
- _didIteratorError = true;
8081
- _iteratorError = err;
8082
- } finally{
8083
- try {
8084
- if (!_iteratorNormalCompletion && _iterator.return != null) {
8085
- _iterator.return();
8086
- }
8087
- } finally{
8088
- if (_didIteratorError) {
8089
- throw _iteratorError;
8090
- }
8091
- }
7883
+ var value = wrapperTags[0].description.trim();
7884
+ if (!allowedWrapperPatterns.includes(value)) {
7885
+ reportOnJsdocLine({
7886
+ commentNode: ctx.commentNode,
7887
+ parsed: ctx.parsed,
7888
+ sourceCode: ctx.sourceCode,
7889
+ lineIndex: wrapperTags[0].startLineIndex,
7890
+ messageId: 'invalidWrapperPattern',
7891
+ data: {
7892
+ value: value,
7893
+ allowed: allowedWrapperPatterns.join(', ')
7894
+ },
7895
+ report: ctx.report
7896
+ });
8092
7897
  }
8093
- if (!hasFrom) {
7898
+ }
7899
+ function reportFormFieldFactoryTier(input) {
7900
+ var _companions_get, _companions_get1;
7901
+ var ctx = input.ctx, companions = input.companions, allowedWrapperPatterns = input.allowedWrapperPatterns, triggerLine = input.triggerLine;
7902
+ reportFormWrapperPattern({
7903
+ ctx: ctx,
7904
+ wrapperTags: (_companions_get = companions.get('WrapperPattern')) !== null && _companions_get !== void 0 ? _companions_get : [],
7905
+ allowedWrapperPatterns: allowedWrapperPatterns,
7906
+ triggerLine: triggerLine
7907
+ });
7908
+ var ngFormTags = (_companions_get1 = companions.get('NgFormType')) !== null && _companions_get1 !== void 0 ? _companions_get1 : [];
7909
+ if (ngFormTags.length === 0 || ngFormTags[0].description.trim().length === 0) {
8094
7910
  reportOnJsdocLine({
8095
7911
  commentNode: ctx.commentNode,
8096
7912
  parsed: ctx.parsed,
8097
7913
  sourceCode: ctx.sourceCode,
8098
- lineIndex: tag.startLineIndex,
8099
- messageId: 'compositeKeyMissingFrom',
7914
+ lineIndex: triggerLine,
7915
+ messageId: 'missingNgFormType',
8100
7916
  report: ctx.report
8101
7917
  });
8102
7918
  }
8103
- if (encoding == null) {
7919
+ }
7920
+ function reportFormCompositeBuilderTier(input) {
7921
+ var ctx = input.ctx, suffixTags = input.suffixTags, allowedSuffixes = input.allowedSuffixes, triggerLine = input.triggerLine;
7922
+ if (suffixTags.length === 0 || suffixTags[0].description.trim().length === 0) {
8104
7923
  reportOnJsdocLine({
8105
7924
  commentNode: ctx.commentNode,
8106
7925
  parsed: ctx.parsed,
8107
7926
  sourceCode: ctx.sourceCode,
8108
- lineIndex: tag.startLineIndex,
8109
- messageId: 'compositeKeyMissingEncoding',
7927
+ lineIndex: triggerLine,
7928
+ messageId: 'missingSuffix',
8110
7929
  report: ctx.report
8111
7930
  });
8112
- } else if (!allowedEncodings.includes(encoding)) {
7931
+ return;
7932
+ }
7933
+ var value = suffixTags[0].description.trim();
7934
+ if (!allowedSuffixes.includes(value)) {
8113
7935
  reportOnJsdocLine({
8114
7936
  commentNode: ctx.commentNode,
8115
7937
  parsed: ctx.parsed,
8116
7938
  sourceCode: ctx.sourceCode,
8117
- lineIndex: tag.startLineIndex,
8118
- messageId: 'compositeKeyInvalidEncoding',
7939
+ lineIndex: suffixTags[0].startLineIndex,
7940
+ messageId: 'invalidSuffix',
8119
7941
  data: {
8120
- value: encoding,
8121
- allowed: allowedEncodings.join(', ')
7942
+ value: value,
7943
+ allowed: allowedSuffixes.join(', ')
8122
7944
  },
8123
7945
  report: ctx.report
8124
7946
  });
8125
7947
  }
8126
7948
  }
8127
- /**
8128
- * Splits an interface JSDoc into the marker tags from `MODEL_MARKERS` and the
8129
- * map of `@dbxModel*` companion tags keyed by suffix. Property-only companions
8130
- * (`Variable`, `VariableSyncFlag`) are still surfaced so the caller can flag them
8131
- * as misplaced when found on an interface JSDoc.
8132
- *
8133
- * @param parsed - The parsed JSDoc to inspect.
8134
- * @returns The list of marker tags and the map of companion suffix to tag instances.
8135
- */ function collectInterfaceTags(parsed) {
8136
- var markers = [];
8137
- var companions = new Map();
7949
+ function reportFormDerivativeTier(input) {
7950
+ var ctx = input.ctx, markers = input.markers, composesFromTags = input.composesFromTags, triggerLine = input.triggerLine;
7951
+ var markerCarriesComposes = markers.some(function(m) {
7952
+ return COMPOSES_FROM_MARKERS.has(m.tag) && m.description.trim().length > 0;
7953
+ });
7954
+ if (composesFromTags.length === 0 && !markerCarriesComposes) {
7955
+ reportOnJsdocLine({
7956
+ commentNode: ctx.commentNode,
7957
+ parsed: ctx.parsed,
7958
+ sourceCode: ctx.sourceCode,
7959
+ lineIndex: triggerLine,
7960
+ messageId: 'missingComposesFrom',
7961
+ report: ctx.report
7962
+ });
7963
+ }
7964
+ }
7965
+ function reportFormComposesFromKebab(ctx, composesFromTags, markers) {
8138
7966
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8139
7967
  try {
8140
- for(var _iterator = parsed.tags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7968
+ for(var _iterator = composesFromTags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8141
7969
  var tag = _step.value;
8142
- var _companions_get;
8143
- if (MODEL_MARKERS.has(tag.tag)) {
8144
- markers.push(tag);
8145
- continue;
8146
- }
8147
- // Property-level tags (Variable / VariableSyncFlag) on an interface JSDoc → misplaced.
8148
- if (tag.tag === 'dbxModelVariable' || tag.tag === 'dbxModelVariableSyncFlag') {
8149
- var _companions_get1;
8150
- var suffix = tag.tag.slice('dbxModel'.length);
8151
- var list = (_companions_get1 = companions.get(suffix)) !== null && _companions_get1 !== void 0 ? _companions_get1 : [];
8152
- list.push(tag);
8153
- companions.set(suffix, list);
8154
- continue;
7970
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7971
+ try {
7972
+ for(var _iterator1 = splitCommaSeparated(tag.description)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
7973
+ var item = _step1.value;
7974
+ if (!KEBAB_SLUG_PATTERN.test(item)) {
7975
+ reportOnJsdocLine({
7976
+ commentNode: ctx.commentNode,
7977
+ parsed: ctx.parsed,
7978
+ sourceCode: ctx.sourceCode,
7979
+ lineIndex: tag.startLineIndex,
7980
+ messageId: 'composesFromNotKebab',
7981
+ data: {
7982
+ value: item
7983
+ },
7984
+ report: ctx.report
7985
+ });
7986
+ }
7987
+ }
7988
+ } catch (err) {
7989
+ _didIteratorError1 = true;
7990
+ _iteratorError1 = err;
7991
+ } finally{
7992
+ try {
7993
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
7994
+ _iterator1.return();
7995
+ }
7996
+ } finally{
7997
+ if (_didIteratorError1) {
7998
+ throw _iteratorError1;
7999
+ }
8000
+ }
8155
8001
  }
8156
- if (!tag.tag.startsWith('dbxModel')) continue;
8157
- // Exclude tag prefixes that belong to sibling families (handled by their own rules).
8158
- if (tag.tag.startsWith('dbxModelSnapshotField') || tag.tag.startsWith('dbxModelFirebaseIndex')) continue;
8159
- var suffix1 = tag.tag.slice('dbxModel'.length);
8160
- var list1 = (_companions_get = companions.get(suffix1)) !== null && _companions_get !== void 0 ? _companions_get : [];
8161
- list1.push(tag);
8162
- companions.set(suffix1, list1);
8163
8002
  }
8164
8003
  } catch (err) {
8165
8004
  _didIteratorError = true;
@@ -8175,44 +8014,114 @@ function reportCompositeKeyTag(ctx, tag, allowedEncodings) {
8175
8014
  }
8176
8015
  }
8177
8016
  }
8178
- return {
8179
- markers: markers,
8180
- companions: companions
8181
- };
8017
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
8018
+ try {
8019
+ for(var _iterator2 = markers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
8020
+ var m = _step2.value;
8021
+ if (!COMPOSES_FROM_MARKERS.has(m.tag)) continue;
8022
+ var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
8023
+ try {
8024
+ for(var _iterator3 = splitCommaSeparated(m.description)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
8025
+ var item1 = _step3.value;
8026
+ if (!KEBAB_SLUG_PATTERN.test(item1)) {
8027
+ reportOnJsdocLine({
8028
+ commentNode: ctx.commentNode,
8029
+ parsed: ctx.parsed,
8030
+ sourceCode: ctx.sourceCode,
8031
+ lineIndex: m.startLineIndex,
8032
+ messageId: 'composesFromNotKebab',
8033
+ data: {
8034
+ value: item1
8035
+ },
8036
+ report: ctx.report
8037
+ });
8038
+ }
8039
+ }
8040
+ } catch (err) {
8041
+ _didIteratorError3 = true;
8042
+ _iteratorError3 = err;
8043
+ } finally{
8044
+ try {
8045
+ if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
8046
+ _iterator3.return();
8047
+ }
8048
+ } finally{
8049
+ if (_didIteratorError3) {
8050
+ throw _iteratorError3;
8051
+ }
8052
+ }
8053
+ }
8054
+ }
8055
+ } catch (err) {
8056
+ _didIteratorError2 = true;
8057
+ _iteratorError2 = err;
8058
+ } finally{
8059
+ try {
8060
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
8061
+ _iterator2.return();
8062
+ }
8063
+ } finally{
8064
+ if (_didIteratorError2) {
8065
+ throw _iteratorError2;
8066
+ }
8067
+ }
8068
+ }
8182
8069
  }
8183
8070
  /**
8184
- * ESLint rule enforcing `@dbxModel` / `@dbxModelSubObject` / `@dbxModelOrganizationalGroupRoot`
8185
- * companion tags. Mirrors the scanner schema at
8186
- * `packages/dbx-components-mcp/src/scan/extract-models/find-interfaces.ts`.
8187
- *
8188
- * Does NOT enforce a Slug / Category / Tags shape because the scanner does
8189
- * not consume those for this family.
8190
- */ var UTIL_REQUIRE_DBX_MODEL_COMPANION_TAGS_RULE = {
8071
+ * ESLint rule enforcing `@dbxFormField` companion tags. Mirrors the scanner
8072
+ * schema at `packages/dbx-cli/src/lib/mcp-scan/scan/forge-fields-extract.ts`,
8073
+ * including the tier-conditional required-tag matrix.
8074
+ */ var UTIL_REQUIRE_DBX_FORM_FIELD_COMPANION_TAGS_RULE = {
8191
8075
  meta: {
8192
8076
  type: 'suggestion',
8193
8077
  fixable: 'code',
8194
8078
  docs: {
8195
- description: 'Require the canonical `@dbxModel*` companion tags on `@dbxModel`-tagged interfaces.',
8079
+ description: 'Require the canonical `@dbxForm*` companion tags on `@dbxFormField`-tagged factories.',
8196
8080
  recommended: true
8197
8081
  },
8198
8082
  messages: {
8199
- archetypeBadSlug: '`@dbxModelArchetype` slug `{{value}}` is not a valid kebab-case slug.',
8200
- archetypeBadAxisPair: '`@dbxModelArchetype` axis pair `{{value}}` is malformed; use `key=value` with non-empty key and value.',
8201
- aggregatesFromNotPascalCase: '`@dbxModelAggregatesFrom` value `{{value}}` is not a PascalCase identifier.',
8202
- compositeKeyMissingFrom: '`@dbxModelCompositeKey` is missing required `from=...` segment.',
8203
- compositeKeyMissingEncoding: '`@dbxModelCompositeKey` is missing required `encoding=<two-way|one-way>` segment.',
8204
- compositeKeyInvalidEncoding: '`@dbxModelCompositeKey` encoding `{{value}}` is invalid. Use one of: {{allowed}}.',
8205
- mutuallyExclusiveMarkers: '`@dbxModel`, `@dbxModelSubObject`, and `@dbxModelOrganizationalGroupRoot` are mutually exclusive markers; only one is allowed.',
8206
- variableTagOutsideProperty: '`@dbxModel{{name}}` is only valid on interface property declarations.',
8207
- unknownDbxModelTag: '`@dbxModel{{name}}` is not a recognized companion tag. Known companions: {{known}}.',
8208
- duplicateCompanionTag: '`@dbxModel{{name}}` is declared more than once.'
8083
+ duplicateMarker: '`@dbxFormField` / `@dbxFormFieldDerivative` / `@dbxFormFieldTemplate` are mutually exclusive; only one is allowed.',
8084
+ missingTier: '`@dbxFormField`-tagged factory is missing the required `@dbxFormTier <tier>` companion tag.',
8085
+ invalidTier: '`@dbxFormTier` value `{{value}}` is not allowed. Use one of: {{allowed}}.',
8086
+ missingSlug: '`@dbxFormField`-tagged factory is missing the required `@dbxFormSlug <slug>` companion tag.',
8087
+ invalidSlugFormat: '`@dbxFormSlug` value `{{value}}` is not a valid kebab-case slug.',
8088
+ missingProduces: '`@dbxFormField`-tagged factory is missing the required `@dbxFormProduces <type>` companion tag.',
8089
+ missingArrayOutput: '`@dbxFormField`-tagged factory is missing the required `@dbxFormArrayOutput <yes|no|optional>` companion tag.',
8090
+ invalidArrayOutput: '`@dbxFormArrayOutput` value `{{value}}` is not allowed. Use one of: {{allowed}}.',
8091
+ missingWrapperPattern: 'field-factory tier requires `@dbxFormWrapperPattern <unwrapped|material-form-field-wrapped>`.',
8092
+ invalidWrapperPattern: '`@dbxFormWrapperPattern` value `{{value}}` is not allowed. Use one of: {{allowed}}.',
8093
+ missingNgFormType: 'field-factory tier requires `@dbxFormNgFormType <type>`.',
8094
+ missingSuffix: 'composite-builder tier requires `@dbxFormSuffix <Row|Group|Fields|Field|Wrapper|Layout>`.',
8095
+ invalidSuffix: '`@dbxFormSuffix` value `{{value}}` is not allowed. Use one of: {{allowed}}.',
8096
+ missingComposesFrom: '`@dbxFormFieldDerivative` / `@dbxFormFieldTemplate` require `@dbxFormComposesFrom <slug,...>`.',
8097
+ composesFromNotKebab: '`@dbxFormComposesFrom` item `{{value}}` is not a kebab-case slug.',
8098
+ unknownDbxFormTag: '`@dbxForm{{name}}` is not a recognized companion tag. Known companions: {{known}}.',
8099
+ duplicateCompanionTag: '`@dbxForm{{name}}` is declared more than once.'
8209
8100
  },
8210
8101
  schema: [
8211
8102
  {
8212
8103
  type: 'object',
8213
8104
  additionalProperties: false,
8214
8105
  properties: {
8215
- allowedEncodings: {
8106
+ allowedTiers: {
8107
+ type: 'array',
8108
+ items: {
8109
+ type: 'string'
8110
+ }
8111
+ },
8112
+ allowedWrapperPatterns: {
8113
+ type: 'array',
8114
+ items: {
8115
+ type: 'string'
8116
+ }
8117
+ },
8118
+ allowedSuffixes: {
8119
+ type: 'array',
8120
+ items: {
8121
+ type: 'string'
8122
+ }
8123
+ },
8124
+ allowedArrayOutputs: {
8216
8125
  type: 'array',
8217
8126
  items: {
8218
8127
  type: 'string'
@@ -8232,16 +8141,20 @@ function reportCompositeKeyTag(ctx, tag, allowedEncodings) {
8232
8141
  ]
8233
8142
  },
8234
8143
  create: function create(context) {
8235
- var _context_options_, _options_allowedEncodings, _options_knownCompanions;
8144
+ var _context_options_, _options_allowedTiers, _options_allowedWrapperPatterns, _options_allowedSuffixes, _options_allowedArrayOutputs, _options_knownCompanions;
8236
8145
  var options = (_context_options_ = context.options[0]) !== null && _context_options_ !== void 0 ? _context_options_ : {};
8237
8146
  var sourceCode = context.sourceCode;
8238
- var allowedEncodings = (_options_allowedEncodings = options.allowedEncodings) !== null && _options_allowedEncodings !== void 0 ? _options_allowedEncodings : DEFAULT_ALLOWED_ENCODINGS;
8239
- var knownCompanions = (_options_knownCompanions = options.knownCompanions) !== null && _options_knownCompanions !== void 0 ? _options_knownCompanions : MODEL_COMPANIONS;
8147
+ var allowedTiers = (_options_allowedTiers = options.allowedTiers) !== null && _options_allowedTiers !== void 0 ? _options_allowedTiers : DEFAULT_ALLOWED_TIERS;
8148
+ var allowedWrapperPatterns = (_options_allowedWrapperPatterns = options.allowedWrapperPatterns) !== null && _options_allowedWrapperPatterns !== void 0 ? _options_allowedWrapperPatterns : DEFAULT_ALLOWED_WRAPPER_PATTERNS;
8149
+ var allowedSuffixes = (_options_allowedSuffixes = options.allowedSuffixes) !== null && _options_allowedSuffixes !== void 0 ? _options_allowedSuffixes : DEFAULT_ALLOWED_SUFFIXES;
8150
+ var allowedArrayOutputs = (_options_allowedArrayOutputs = options.allowedArrayOutputs) !== null && _options_allowedArrayOutputs !== void 0 ? _options_allowedArrayOutputs : DEFAULT_ALLOWED_ARRAY_OUTPUTS;
8151
+ var knownCompanions = (_options_knownCompanions = options.knownCompanions) !== null && _options_knownCompanions !== void 0 ? _options_knownCompanions : DEFAULT_KNOWN_COMPANIONS$2;
8240
8152
  var requireBareMarker = options.requireBareMarker !== false;
8241
- function checkInterfaceJsdoc(commentNode) {
8242
- var _companions_get, _companions_get1, _companions_get2;
8153
+ function checkJsdoc(commentNode) {
8154
+ var _ref, _companions_get, _companions_get1, _companions_get2, _companions_get3, _companions_get4;
8155
+ var _markers_;
8243
8156
  var parsed = parseJsdocComment(commentNode.value);
8244
- var _collectInterfaceTags = collectInterfaceTags(parsed), markers = _collectInterfaceTags.markers, companions = _collectInterfaceTags.companions;
8157
+ var _collectFormTags = collectFormTags(parsed), markers = _collectFormTags.markers, companions = _collectFormTags.companions;
8245
8158
  if (markers.length === 0 && companions.size === 0 || requireBareMarker && markers.length === 0) return;
8246
8159
  var ctx = {
8247
8160
  commentNode: commentNode,
@@ -8249,92 +8162,66 @@ function reportCompositeKeyTag(ctx, tag, allowedEncodings) {
8249
8162
  sourceCode: sourceCode,
8250
8163
  report: context.report
8251
8164
  };
8252
- reportMutuallyExclusiveMarkers(ctx, markers);
8253
- reportPropertyOnlyTags(ctx, companions);
8254
- reportUnknownModelCompanions(ctx, companions, knownCompanions);
8255
- reportModelDuplicates(ctx, companions, knownCompanions);
8256
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8257
- try {
8258
- for(var _iterator = ((_companions_get = companions.get('Archetype')) !== null && _companions_get !== void 0 ? _companions_get : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8259
- var tag = _step.value;
8260
- reportArchetypeTag(ctx, tag);
8261
- }
8262
- } catch (err) {
8263
- _didIteratorError = true;
8264
- _iteratorError = err;
8265
- } finally{
8266
- try {
8267
- if (!_iteratorNormalCompletion && _iterator.return != null) {
8268
- _iterator.return();
8269
- }
8270
- } finally{
8271
- if (_didIteratorError) {
8272
- throw _iteratorError;
8273
- }
8274
- }
8275
- }
8276
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
8277
- try {
8278
- for(var _iterator1 = ((_companions_get1 = companions.get('AggregatesFrom')) !== null && _companions_get1 !== void 0 ? _companions_get1 : [])[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
8279
- var tag1 = _step1.value;
8280
- var _tag_description_trim_split_;
8281
- var value = (_tag_description_trim_split_ = tag1.description.trim().split(/\s+/)[0]) !== null && _tag_description_trim_split_ !== void 0 ? _tag_description_trim_split_ : '';
8282
- if (value.length > 0 && !PASCAL_IDENTIFIER_PATTERN.test(value)) {
8283
- reportOnJsdocLine({
8284
- commentNode: commentNode,
8285
- parsed: parsed,
8286
- sourceCode: sourceCode,
8287
- lineIndex: tag1.startLineIndex,
8288
- messageId: 'aggregatesFromNotPascalCase',
8289
- data: {
8290
- value: value
8291
- },
8292
- report: context.report
8293
- });
8294
- }
8295
- }
8296
- } catch (err) {
8297
- _didIteratorError1 = true;
8298
- _iteratorError1 = err;
8299
- } finally{
8300
- try {
8301
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
8302
- _iterator1.return();
8303
- }
8304
- } finally{
8305
- if (_didIteratorError1) {
8306
- throw _iteratorError1;
8307
- }
8308
- }
8309
- }
8310
- var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
8311
- try {
8312
- for(var _iterator2 = ((_companions_get2 = companions.get('CompositeKey')) !== null && _companions_get2 !== void 0 ? _companions_get2 : [])[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
8313
- var tag2 = _step2.value;
8314
- reportCompositeKeyTag(ctx, tag2, allowedEncodings);
8315
- }
8316
- } catch (err) {
8317
- _didIteratorError2 = true;
8318
- _iteratorError2 = err;
8319
- } finally{
8320
- try {
8321
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
8322
- _iterator2.return();
8323
- }
8324
- } finally{
8325
- if (_didIteratorError2) {
8326
- throw _iteratorError2;
8327
- }
8328
- }
8165
+ var triggerLine = (_ref = (_markers_ = markers[0]) === null || _markers_ === void 0 ? void 0 : _markers_.startLineIndex) !== null && _ref !== void 0 ? _ref : 0;
8166
+ reportFormDuplicateMarkers(ctx, markers);
8167
+ reportFormUnknownCompanions(ctx, companions, knownCompanions);
8168
+ reportFormDuplicateCompanions(ctx, companions);
8169
+ reportFormSlug(ctx, (_companions_get = companions.get('Slug')) !== null && _companions_get !== void 0 ? _companions_get : [], triggerLine);
8170
+ reportFormProduces(ctx, (_companions_get1 = companions.get('Produces')) !== null && _companions_get1 !== void 0 ? _companions_get1 : [], triggerLine);
8171
+ reportFormArrayOutput({
8172
+ ctx: ctx,
8173
+ arrayOutputTags: (_companions_get2 = companions.get('ArrayOutput')) !== null && _companions_get2 !== void 0 ? _companions_get2 : [],
8174
+ allowedArrayOutputs: allowedArrayOutputs,
8175
+ triggerLine: triggerLine
8176
+ });
8177
+ var tierTags = (_companions_get3 = companions.get('Tier')) !== null && _companions_get3 !== void 0 ? _companions_get3 : [];
8178
+ var tier = determineTier(markers, tierTags);
8179
+ reportFormTier({
8180
+ ctx: ctx,
8181
+ markers: markers,
8182
+ tierTags: tierTags,
8183
+ tier: tier,
8184
+ allowedTiers: allowedTiers,
8185
+ triggerLine: triggerLine
8186
+ });
8187
+ var composesFromTags = (_companions_get4 = companions.get('ComposesFrom')) !== null && _companions_get4 !== void 0 ? _companions_get4 : [];
8188
+ if (tier === 'field-factory') {
8189
+ reportFormFieldFactoryTier({
8190
+ ctx: ctx,
8191
+ companions: companions,
8192
+ allowedWrapperPatterns: allowedWrapperPatterns,
8193
+ triggerLine: triggerLine
8194
+ });
8195
+ } else if (tier === 'composite-builder') {
8196
+ var _companions_get5;
8197
+ reportFormCompositeBuilderTier({
8198
+ ctx: ctx,
8199
+ suffixTags: (_companions_get5 = companions.get('Suffix')) !== null && _companions_get5 !== void 0 ? _companions_get5 : [],
8200
+ allowedSuffixes: allowedSuffixes,
8201
+ triggerLine: triggerLine
8202
+ });
8203
+ } else if (tier === 'field-derivative' || tier === 'template-builder') {
8204
+ reportFormDerivativeTier({
8205
+ ctx: ctx,
8206
+ markers: markers,
8207
+ composesFromTags: composesFromTags,
8208
+ triggerLine: triggerLine
8209
+ });
8329
8210
  }
8211
+ reportFormComposesFromKebab(ctx, composesFromTags, markers);
8330
8212
  }
8331
- function visitInterface(node) {
8213
+ function visit(node) {
8332
8214
  var anchor = node.parent && (node.parent.type === 'ExportNamedDeclaration' || node.parent.type === 'ExportDefaultDeclaration') ? node.parent : node;
8333
8215
  var jsdoc = leadingJsdocFor(sourceCode, anchor);
8334
- if (jsdoc) checkInterfaceJsdoc(jsdoc);
8216
+ if (jsdoc) checkJsdoc(jsdoc);
8335
8217
  }
8336
8218
  return {
8337
- TSInterfaceDeclaration: visitInterface
8219
+ FunctionDeclaration: function FunctionDeclaration(node) {
8220
+ if (!node.body) return;
8221
+ var jsdoc = leadingJsdocFor(sourceCode, getStatementAnchor(node));
8222
+ if (jsdoc) checkJsdoc(jsdoc);
8223
+ },
8224
+ VariableDeclaration: visit
8338
8225
  };
8339
8226
  }
8340
8227
  };
@@ -8394,7 +8281,7 @@ var DEFAULT_KNOWN_COMPANIONS$1 = [
8394
8281
  ];
8395
8282
  /**
8396
8283
  * ESLint rule enforcing the three `@dbxAuth*` marker families. Mirrors the
8397
- * scanner schema at `packages/dbx-components-mcp/src/scan/auth-extract.ts`.
8284
+ * scanner schema at `packages/dbx-cli/src/lib/mcp-scan/scan/auth-extract.ts`.
8398
8285
  *
8399
8286
  * - `@dbxAuthClaimsApp <slug>` on an interface / type alias.
8400
8287
  * - `@dbxAuthClaim` (bare) on a `PropertySignature` inside an interface.
@@ -9138,6 +9025,29 @@ function collectRuleCompanions(parsed) {
9138
9025
  * Used for cases where the rule's heuristics are wrong or the convention legitimately doesn't
9139
9026
  * apply (e.g. branded singleton instances exported via PascalCase).
9140
9027
  */ var DEFAULT_EXEMPT_JSDOC_TAG$2 = '@dbxAllowConstantName';
9028
+ /**
9029
+ * Default set of type annotation identifier names whose `export const X: T = {...}` declarations
9030
+ * are exempt from the rule.
9031
+ *
9032
+ * These are framework-prescribed singleton types whose author-facing convention is camelCase, so
9033
+ * enforcing UPPER_SNAKE_CASE would diverge from upstream documentation and break import sites.
9034
+ *
9035
+ * - `Ng2StateDeclaration` / `StateDeclaration` — UIRouter state config objects.
9036
+ * - `ApplicationConfig` — Angular standalone bootstrap config.
9037
+ * - `Routes` / `Route` — Angular Router config arrays/entries.
9038
+ * - `ModelFirebaseCrudFunctionConfigMap` — @dereekb/firebase CRUD function declaration map exported per model group.
9039
+ * - `FirebaseFunctionTypeConfigMap` — @dereekb/firebase function-type configuration map exported per model group.
9040
+ */ var DEFAULT_EXEMPT_TYPE_ANNOTATIONS = [
9041
+ 'Ng2StateDeclaration',
9042
+ 'StateDeclaration',
9043
+ 'ApplicationConfig',
9044
+ 'Routes',
9045
+ 'Route',
9046
+ 'ModelFirebaseCrudFunctionConfigMap',
9047
+ 'FirebaseFunctionTypeConfigMap',
9048
+ 'DevelopmentFirebaseFunctionConfigMap',
9049
+ 'SystemStateStoredDataConverterMap'
9050
+ ];
9141
9051
  /**
9142
9052
  * camelCase pattern accepted for function-typed constants.
9143
9053
  */ var CAMEL_CASE = /^[a-z][a-zA-Z0-9]*$/;
@@ -9200,6 +9110,40 @@ function collectRuleCompanions(parsed) {
9200
9110
  }
9201
9111
  return exempt;
9202
9112
  }
9113
+ /**
9114
+ * Returns the identifier text of a declarator's type annotation when the annotation is a simple
9115
+ * `TSTypeReference` to a named type.
9116
+ *
9117
+ * For `TSQualifiedName` (e.g. `Ng.Routes`) the leftmost segment is returned, which is the form
9118
+ * users would typically allowlist (the imported namespace).
9119
+ *
9120
+ * Returns `undefined` for shapes the allowlist can't meaningfully match: missing annotation,
9121
+ * `TSFunctionType`, `TSTypeLiteral`, intersections/unions, etc.
9122
+ *
9123
+ * @param declarator - The VariableDeclarator AST node.
9124
+ * @returns The identifier name of the type annotation, or `undefined` when the annotation has no
9125
+ * single matchable identifier.
9126
+ */ function getTypeAnnotationIdentifierName(declarator) {
9127
+ var _declarator_id_typeAnnotation, _declarator_id;
9128
+ var typeAnnotation = (_declarator_id = declarator.id) === null || _declarator_id === void 0 ? void 0 : (_declarator_id_typeAnnotation = _declarator_id.typeAnnotation) === null || _declarator_id_typeAnnotation === void 0 ? void 0 : _declarator_id_typeAnnotation.typeAnnotation;
9129
+ var result;
9130
+ if ((typeAnnotation === null || typeAnnotation === void 0 ? void 0 : typeAnnotation.type) === 'TSTypeReference') {
9131
+ var typeName = typeAnnotation.typeName;
9132
+ if ((typeName === null || typeName === void 0 ? void 0 : typeName.type) === 'Identifier') {
9133
+ result = typeName.name;
9134
+ } else if ((typeName === null || typeName === void 0 ? void 0 : typeName.type) === 'TSQualifiedName') {
9135
+ var _leftmost_left, _leftmost_left1;
9136
+ var leftmost = typeName;
9137
+ while(((_leftmost_left = leftmost.left) === null || _leftmost_left === void 0 ? void 0 : _leftmost_left.type) === 'TSQualifiedName'){
9138
+ leftmost = leftmost.left;
9139
+ }
9140
+ if (((_leftmost_left1 = leftmost.left) === null || _leftmost_left1 === void 0 ? void 0 : _leftmost_left1.type) === 'Identifier') {
9141
+ result = leftmost.left.name;
9142
+ }
9143
+ }
9144
+ }
9145
+ return result;
9146
+ }
9203
9147
  /**
9204
9148
  * Classifies a const variable declarator as function-typed, value-typed, or ambiguous, using only
9205
9149
  * syntactic signals. Ambiguous cases are skipped by the rule to avoid false positives.
@@ -9251,6 +9195,12 @@ function collectRuleCompanions(parsed) {
9251
9195
  * Use the exempt JSDoc tag (default `@dbxAllowConstantName`) to silence the rule on a specific
9252
9196
  * declaration when the heuristics get it wrong.
9253
9197
  *
9198
+ * Framework-prescribed singleton types (UIRouter's `Ng2StateDeclaration`, Angular's
9199
+ * `ApplicationConfig`, `Routes`, etc.) are exempt by default via the `exemptTypeAnnotations` option:
9200
+ * any `export const X: T = {...}` whose type annotation is a `TSTypeReference` to one of those
9201
+ * names is skipped regardless of casing. Pass `exemptTypeAnnotations: []` to opt out of the
9202
+ * defaults, or pass a non-empty array to replace the default allowlist with a project-specific set.
9203
+ *
9254
9204
  * Not auto-fixable: renaming an exported binding has cross-file impact that an autofix can't safely
9255
9205
  * propagate.
9256
9206
  *
@@ -9274,6 +9224,13 @@ function collectRuleCompanions(parsed) {
9274
9224
  exemptJsdocTag: {
9275
9225
  type: 'string',
9276
9226
  description: 'JSDoc tag that opts a const declaration out of the rule.'
9227
+ },
9228
+ exemptTypeAnnotations: {
9229
+ type: 'array',
9230
+ items: {
9231
+ type: 'string'
9232
+ },
9233
+ description: 'Type annotation identifier names whose `export const X: T = {...}` declarations are exempt. Pass an empty array to opt out of the defaults; pass a non-empty array to replace the defaults.'
9277
9234
  }
9278
9235
  },
9279
9236
  additionalProperties: false
@@ -9281,9 +9238,10 @@ function collectRuleCompanions(parsed) {
9281
9238
  ]
9282
9239
  },
9283
9240
  create: function create(context) {
9284
- var _context_options_, _options_exemptJsdocTag;
9241
+ var _context_options_, _options_exemptJsdocTag, _options_exemptTypeAnnotations;
9285
9242
  var options = (_context_options_ = context.options[0]) !== null && _context_options_ !== void 0 ? _context_options_ : {};
9286
9243
  var exemptTag = (_options_exemptJsdocTag = options.exemptJsdocTag) !== null && _options_exemptJsdocTag !== void 0 ? _options_exemptJsdocTag : DEFAULT_EXEMPT_JSDOC_TAG$2;
9244
+ var exemptTypeAnnotations = new Set((_options_exemptTypeAnnotations = options.exemptTypeAnnotations) !== null && _options_exemptTypeAnnotations !== void 0 ? _options_exemptTypeAnnotations : DEFAULT_EXEMPT_TYPE_ANNOTATIONS);
9287
9245
  var sourceCode = context.sourceCode;
9288
9246
  function checkExportNamedDeclaration(node) {
9289
9247
  var _decl_declarations;
@@ -9306,6 +9264,10 @@ function collectRuleCompanions(parsed) {
9306
9264
  if (name.startsWith('_')) {
9307
9265
  continue;
9308
9266
  }
9267
+ var typeAnnotationName = getTypeAnnotationIdentifierName(declarator);
9268
+ if (typeAnnotationName !== undefined && exemptTypeAnnotations.has(typeAnnotationName)) {
9269
+ continue;
9270
+ }
9309
9271
  var kind = classifyConstant(declarator);
9310
9272
  if (kind === 'function') {
9311
9273
  if (!CAMEL_CASE.test(name) && !UPPER_SNAKE_CASE$1.test(name)) {
@@ -9910,7 +9872,6 @@ function _unsupported_iterable_to_array(o, minLen) {
9910
9872
  'require-dbx-model-snapshot-field-companion-tags': UTIL_REQUIRE_DBX_MODEL_SNAPSHOT_FIELD_COMPANION_TAGS_RULE,
9911
9873
  'require-dbx-action-companion-tags': UTIL_REQUIRE_DBX_ACTION_COMPANION_TAGS_RULE,
9912
9874
  'require-dbx-form-field-companion-tags': UTIL_REQUIRE_DBX_FORM_FIELD_COMPANION_TAGS_RULE,
9913
- 'require-dbx-model-companion-tags': UTIL_REQUIRE_DBX_MODEL_COMPANION_TAGS_RULE,
9914
9875
  'require-dbx-auth-companion-tags': UTIL_REQUIRE_DBX_AUTH_COMPANION_TAGS_RULE,
9915
9876
  'require-dbx-rule-companion-tags': UTIL_REQUIRE_DBX_RULE_COMPANION_TAGS_RULE,
9916
9877
  'require-constant-naming': UTIL_REQUIRE_CONSTANT_NAMING_RULE,
@@ -9926,4 +9887,4 @@ function _unsupported_iterable_to_array(o, minLen) {
9926
9887
  * @dbxAllowConstantName
9927
9888
  */ var utilESLintPlugin = UTIL_ESLINT_PLUGIN;
9928
9889
 
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_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, utilESLintPlugin };
9890
+ 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 };