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