eslint-plugin-react-x 1.32.1 → 1.33.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRuleForPlugin, getSettingsFromContext, unsafeDecodeSettings, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
2
2
  import * as JSX8 from '@eslint-react/jsx';
3
- import * as AST12 from '@eslint-react/ast';
4
- import { isForwardRefCall, isClassComponent, isThisSetState, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isComponentDidCatch, isGetDerivedStateFromError, isCloneElementCall, isComponentNameLoose, isCreateRefCall, isAssignmentToThisState, useComponentCollector, DEFAULT_COMPONENT_HINT, ERComponentFlag, getInstanceId, isInstanceIdEqual, DISPLAY_NAME_ASSIGNMENT_SELECTOR, isCreateContextCall, isChildrenToArrayCall, ERComponentHint, isDirectValueOfRenderPropertyLoose, isDeclaredInRenderPropLoose, isInsideRenderMethod, isCreateElementCall, isReactHookCall, isReactHookCallWithNameAlias, isGetDerivedStateFromProps, isInitializedFromReact } from '@eslint-react/core';
3
+ import * as AST11 from '@eslint-react/ast';
4
+ import { isClassComponent, isThisSetState, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isComponentDidCatch, isGetDerivedStateFromError, isCloneElementCall, isComponentNameLoose, isCreateRefCall, isAssignmentToThisState, isForwardRefCall, useComponentCollector, DEFAULT_COMPONENT_HINT, ERComponentFlag, getInstanceId, isInstanceIdEqual, DISPLAY_NAME_ASSIGNMENT_SELECTOR, isCreateContextCall, isChildrenToArrayCall, ERComponentHint, isDirectValueOfRenderPropertyLoose, isDeclaredInRenderPropLoose, isInsideRenderMethod, isCreateElementCall, isReactHookCall, isReactHookCallWithNameAlias, isGetDerivedStateFromProps, isInitializedFromReact } from '@eslint-react/core';
5
5
  import { _, getOrUpdate, constTrue, constFalse, identity } from '@eslint-react/eff';
6
6
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
7
7
  import { isMatching, match, P } from 'ts-pattern';
@@ -27,7 +27,6 @@ __export(recommended_exports, {
27
27
  });
28
28
  var name = "react-x/recommended";
29
29
  var rules = {
30
- "react-x/ensure-forward-ref-using-ref": "warn",
31
30
  "react-x/no-access-state-in-setstate": "error",
32
31
  "react-x/no-array-index-key": "warn",
33
32
  "react-x/no-children-count": "warn",
@@ -64,6 +63,7 @@ var rules = {
64
63
  "react-x/no-unused-class-component-members": "warn",
65
64
  "react-x/no-unused-state": "warn",
66
65
  "react-x/no-use-context": "warn",
66
+ "react-x/no-useless-forward-ref": "warn",
67
67
  "react-x/use-jsx-vars": "warn"
68
68
  };
69
69
  var settings = {
@@ -109,7 +109,7 @@ var settings3 = {
109
109
 
110
110
  // package.json
111
111
  var name4 = "eslint-plugin-react-x";
112
- var version = "1.32.1";
112
+ var version = "1.33.0-beta.0";
113
113
  var createRule = createRuleForPlugin("x");
114
114
 
115
115
  // src/rules/avoid-shorthand-boolean.ts
@@ -180,50 +180,10 @@ var avoid_shorthand_fragment_default = createRule({
180
180
  },
181
181
  defaultOptions: []
182
182
  });
183
- var RULE_NAME3 = "ensure-forward-ref-using-ref";
183
+ var RULE_NAME3 = "no-access-state-in-setstate";
184
184
  var RULE_FEATURES3 = [
185
185
  "CHK"
186
186
  ];
187
- var ensure_forward_ref_using_ref_default = createRule({
188
- meta: {
189
- type: "problem",
190
- docs: {
191
- description: "require a 'ref' parameter to be set when using 'forwardRef'",
192
- [Symbol.for("rule_features")]: RULE_FEATURES3
193
- },
194
- messages: {
195
- ensureForwardRefUsingRef: "A 'forwardRef' is used with this component but no 'ref' parameter is set."
196
- },
197
- schema: []
198
- },
199
- name: RULE_NAME3,
200
- create(context) {
201
- return {
202
- CallExpression(node) {
203
- if (!isForwardRefCall(context, node)) {
204
- return;
205
- }
206
- const [component] = node.arguments;
207
- if (component == null || !AST12.isFunction(component)) {
208
- return;
209
- }
210
- const ref = component.params[1];
211
- if (ref != null) {
212
- return;
213
- }
214
- context.report({
215
- messageId: "ensureForwardRefUsingRef",
216
- node: component
217
- });
218
- }
219
- };
220
- },
221
- defaultOptions: []
222
- });
223
- var RULE_NAME4 = "no-access-state-in-setstate";
224
- var RULE_FEATURES4 = [
225
- "CHK"
226
- ];
227
187
  function isKeyLiteral(node, key) {
228
188
  return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({ type: AST_NODE_TYPES.TemplateLiteral, expressions: [] }, constTrue).with({ type: AST_NODE_TYPES.Identifier }, () => !node.computed).otherwise(constFalse);
229
189
  }
@@ -232,14 +192,14 @@ var no_access_state_in_setstate_default = createRule({
232
192
  type: "problem",
233
193
  docs: {
234
194
  description: "disallow accessing 'this.state' within 'setState'",
235
- [Symbol.for("rule_features")]: RULE_FEATURES4
195
+ [Symbol.for("rule_features")]: RULE_FEATURES3
236
196
  },
237
197
  messages: {
238
198
  noAccessStateInSetstate: "Do not access 'this.state' within 'setState'. Use the update function instead."
239
199
  },
240
200
  schema: []
241
201
  },
242
- name: RULE_NAME4,
202
+ name: RULE_NAME3,
243
203
  create(context) {
244
204
  if (!context.sourceCode.text.includes("setState")) {
245
205
  return {};
@@ -273,7 +233,7 @@ var no_access_state_in_setstate_default = createRule({
273
233
  classEntries.pop();
274
234
  },
275
235
  MemberExpression(node) {
276
- if (!AST12.isThisExpression(node.object)) {
236
+ if (!AST11.isThisExpression(node.object)) {
277
237
  return;
278
238
  }
279
239
  const [currClass, isComponent = false] = classEntries.at(-1) ?? [];
@@ -288,7 +248,7 @@ var no_access_state_in_setstate_default = createRule({
288
248
  if (setState == null || hasThisState) {
289
249
  return;
290
250
  }
291
- if (AST12.getPropertyName(node.property) !== "state") {
251
+ if (AST11.getPropertyName(node.property) !== "state") {
292
252
  return;
293
253
  }
294
254
  context.report({ messageId: "noAccessStateInSetstate", node });
@@ -318,11 +278,11 @@ var no_access_state_in_setstate_default = createRule({
318
278
  if (setState == null || hasThisState) {
319
279
  return;
320
280
  }
321
- if (node.init == null || !AST12.isThisExpression(node.init) || node.id.type !== AST_NODE_TYPES.ObjectPattern) {
281
+ if (node.init == null || !AST11.isThisExpression(node.init) || node.id.type !== AST_NODE_TYPES.ObjectPattern) {
322
282
  return;
323
283
  }
324
284
  const hasState = node.id.properties.some(
325
- (prop) => prop.type === AST_NODE_TYPES.Property && isKeyLiteral(prop, prop.key) && AST12.getPropertyName(prop.key) === "state"
285
+ (prop) => prop.type === AST_NODE_TYPES.Property && isKeyLiteral(prop, prop.key) && AST11.getPropertyName(prop.key) === "state"
326
286
  );
327
287
  if (!hasState) {
328
288
  return;
@@ -333,8 +293,8 @@ var no_access_state_in_setstate_default = createRule({
333
293
  },
334
294
  defaultOptions: []
335
295
  });
336
- var RULE_NAME5 = "no-array-index-key";
337
- var RULE_FEATURES5 = [
296
+ var RULE_NAME4 = "no-array-index-key";
297
+ var RULE_FEATURES4 = [
338
298
  "CHK"
339
299
  ];
340
300
  var reactChildrenMethod = ["forEach", "map"];
@@ -389,7 +349,7 @@ function getMapIndexParamName(context, node) {
389
349
  if (callbackArg == null) {
390
350
  return _;
391
351
  }
392
- if (!AST12.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(callbackArg)) {
352
+ if (!AST11.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(callbackArg)) {
393
353
  return _;
394
354
  }
395
355
  const { params } = callbackArg;
@@ -408,14 +368,14 @@ var no_array_index_key_default = createRule({
408
368
  type: "problem",
409
369
  docs: {
410
370
  description: "disallow using an item's index in the array as its key",
411
- [Symbol.for("rule_features")]: RULE_FEATURES5
371
+ [Symbol.for("rule_features")]: RULE_FEATURES4
412
372
  },
413
373
  messages: {
414
374
  noArrayIndexKey: "Do not use item index in the array as its key."
415
375
  },
416
376
  schema: []
417
377
  },
418
- name: RULE_NAME5,
378
+ name: RULE_NAME4,
419
379
  create(context) {
420
380
  const indexParamNames = [];
421
381
  function isArrayIndex(node) {
@@ -533,8 +493,8 @@ function getIdentifiersFromBinaryExpression(side) {
533
493
  }
534
494
  return [];
535
495
  }
536
- var RULE_NAME6 = "no-children-count";
537
- var RULE_FEATURES6 = [
496
+ var RULE_NAME5 = "no-children-count";
497
+ var RULE_FEATURES5 = [
538
498
  "CHK"
539
499
  ];
540
500
  var no_children_count_default = createRule({
@@ -542,14 +502,14 @@ var no_children_count_default = createRule({
542
502
  type: "problem",
543
503
  docs: {
544
504
  description: "disallow using 'Children.count'",
545
- [Symbol.for("rule_features")]: RULE_FEATURES6
505
+ [Symbol.for("rule_features")]: RULE_FEATURES5
546
506
  },
547
507
  messages: {
548
508
  noChildrenCount: "Using 'Children.count' is uncommon and can lead to fragile code. Use alternatives instead."
549
509
  },
550
510
  schema: []
551
511
  },
552
- name: RULE_NAME6,
512
+ name: RULE_NAME5,
553
513
  create(context) {
554
514
  return {
555
515
  MemberExpression(node) {
@@ -564,8 +524,8 @@ var no_children_count_default = createRule({
564
524
  },
565
525
  defaultOptions: []
566
526
  });
567
- var RULE_NAME7 = "no-children-for-each";
568
- var RULE_FEATURES7 = [
527
+ var RULE_NAME6 = "no-children-for-each";
528
+ var RULE_FEATURES6 = [
569
529
  "CHK"
570
530
  ];
571
531
  var no_children_for_each_default = createRule({
@@ -573,14 +533,14 @@ var no_children_for_each_default = createRule({
573
533
  type: "problem",
574
534
  docs: {
575
535
  description: "disallow using 'Children.forEach'",
576
- [Symbol.for("rule_features")]: RULE_FEATURES7
536
+ [Symbol.for("rule_features")]: RULE_FEATURES6
577
537
  },
578
538
  messages: {
579
539
  noChildrenForEach: "Using 'Children.forEach' is uncommon and can lead to fragile code. Use alternatives instead."
580
540
  },
581
541
  schema: []
582
542
  },
583
- name: RULE_NAME7,
543
+ name: RULE_NAME6,
584
544
  create(context) {
585
545
  return {
586
546
  MemberExpression(node) {
@@ -595,8 +555,8 @@ var no_children_for_each_default = createRule({
595
555
  },
596
556
  defaultOptions: []
597
557
  });
598
- var RULE_NAME8 = "no-children-map";
599
- var RULE_FEATURES8 = [
558
+ var RULE_NAME7 = "no-children-map";
559
+ var RULE_FEATURES7 = [
600
560
  "CHK"
601
561
  ];
602
562
  var no_children_map_default = createRule({
@@ -604,14 +564,14 @@ var no_children_map_default = createRule({
604
564
  type: "problem",
605
565
  docs: {
606
566
  description: "disallow using 'Children.map'",
607
- [Symbol.for("rule_features")]: RULE_FEATURES8
567
+ [Symbol.for("rule_features")]: RULE_FEATURES7
608
568
  },
609
569
  messages: {
610
570
  noChildrenMap: "Using 'Children.map' is uncommon and can lead to fragile code. Use alternatives instead."
611
571
  },
612
572
  schema: []
613
573
  },
614
- name: RULE_NAME8,
574
+ name: RULE_NAME7,
615
575
  create(context) {
616
576
  return {
617
577
  MemberExpression(node) {
@@ -626,8 +586,8 @@ var no_children_map_default = createRule({
626
586
  },
627
587
  defaultOptions: []
628
588
  });
629
- var RULE_NAME9 = "no-children-only";
630
- var RULE_FEATURES9 = [
589
+ var RULE_NAME8 = "no-children-only";
590
+ var RULE_FEATURES8 = [
631
591
  "CHK"
632
592
  ];
633
593
  var no_children_only_default = createRule({
@@ -635,14 +595,14 @@ var no_children_only_default = createRule({
635
595
  type: "problem",
636
596
  docs: {
637
597
  description: "disallow using 'Children.only'",
638
- [Symbol.for("rule_features")]: RULE_FEATURES9
598
+ [Symbol.for("rule_features")]: RULE_FEATURES8
639
599
  },
640
600
  messages: {
641
601
  noChildrenOnly: "Using 'Children.only' is uncommon and can lead to fragile code. Use alternatives instead."
642
602
  },
643
603
  schema: []
644
604
  },
645
- name: RULE_NAME9,
605
+ name: RULE_NAME8,
646
606
  create(context) {
647
607
  return {
648
608
  MemberExpression(node) {
@@ -657,8 +617,8 @@ var no_children_only_default = createRule({
657
617
  },
658
618
  defaultOptions: []
659
619
  });
660
- var RULE_NAME10 = "no-children-prop";
661
- var RULE_FEATURES10 = [
620
+ var RULE_NAME9 = "no-children-prop";
621
+ var RULE_FEATURES9 = [
662
622
  "CHK"
663
623
  ];
664
624
  var no_children_prop_default = createRule({
@@ -666,14 +626,14 @@ var no_children_prop_default = createRule({
666
626
  type: "problem",
667
627
  docs: {
668
628
  description: "disallow passing 'children' as props",
669
- [Symbol.for("rule_features")]: RULE_FEATURES10
629
+ [Symbol.for("rule_features")]: RULE_FEATURES9
670
630
  },
671
631
  messages: {
672
632
  noChildrenProp: "Do not pass 'children' as props."
673
633
  },
674
634
  schema: []
675
635
  },
676
- name: RULE_NAME10,
636
+ name: RULE_NAME9,
677
637
  create(context) {
678
638
  return {
679
639
  JSXElement(node) {
@@ -693,8 +653,8 @@ var no_children_prop_default = createRule({
693
653
  },
694
654
  defaultOptions: []
695
655
  });
696
- var RULE_NAME11 = "no-children-to-array";
697
- var RULE_FEATURES11 = [
656
+ var RULE_NAME10 = "no-children-to-array";
657
+ var RULE_FEATURES10 = [
698
658
  "CHK"
699
659
  ];
700
660
  var no_children_to_array_default = createRule({
@@ -702,14 +662,14 @@ var no_children_to_array_default = createRule({
702
662
  type: "problem",
703
663
  docs: {
704
664
  description: "disallow using 'Children.toArray'",
705
- [Symbol.for("rule_features")]: RULE_FEATURES11
665
+ [Symbol.for("rule_features")]: RULE_FEATURES10
706
666
  },
707
667
  messages: {
708
668
  noChildrenToArray: "Using 'Children.toArray' is uncommon and can lead to fragile code. Use alternatives instead."
709
669
  },
710
670
  schema: []
711
671
  },
712
- name: RULE_NAME11,
672
+ name: RULE_NAME10,
713
673
  create(context) {
714
674
  return {
715
675
  MemberExpression(node) {
@@ -724,8 +684,8 @@ var no_children_to_array_default = createRule({
724
684
  },
725
685
  defaultOptions: []
726
686
  });
727
- var RULE_NAME12 = "no-class-component";
728
- var RULE_FEATURES12 = [
687
+ var RULE_NAME11 = "no-class-component";
688
+ var RULE_FEATURES11 = [
729
689
  "CHK"
730
690
  ];
731
691
  var no_class_component_default = createRule({
@@ -733,14 +693,14 @@ var no_class_component_default = createRule({
733
693
  type: "problem",
734
694
  docs: {
735
695
  description: "disallow using class components",
736
- [Symbol.for("rule_features")]: RULE_FEATURES12
696
+ [Symbol.for("rule_features")]: RULE_FEATURES11
737
697
  },
738
698
  messages: {
739
699
  noClassComponent: "Do not use class components. Use function components instead."
740
700
  },
741
701
  schema: []
742
702
  },
743
- name: RULE_NAME12,
703
+ name: RULE_NAME11,
744
704
  create(context) {
745
705
  if (!context.sourceCode.text.includes("Component")) {
746
706
  return {};
@@ -767,8 +727,8 @@ var no_class_component_default = createRule({
767
727
  },
768
728
  defaultOptions: []
769
729
  });
770
- var RULE_NAME13 = "no-clone-element";
771
- var RULE_FEATURES13 = [
730
+ var RULE_NAME12 = "no-clone-element";
731
+ var RULE_FEATURES12 = [
772
732
  "CHK"
773
733
  ];
774
734
  var no_clone_element_default = createRule({
@@ -776,14 +736,14 @@ var no_clone_element_default = createRule({
776
736
  type: "problem",
777
737
  docs: {
778
738
  description: "disallow using 'cloneElement'",
779
- [Symbol.for("rule_features")]: RULE_FEATURES13
739
+ [Symbol.for("rule_features")]: RULE_FEATURES12
780
740
  },
781
741
  messages: {
782
742
  noCloneElement: "Using 'cloneElement' is uncommon and can lead to fragile code. Use alternatives instead."
783
743
  },
784
744
  schema: []
785
745
  },
786
- name: RULE_NAME13,
746
+ name: RULE_NAME12,
787
747
  create(context) {
788
748
  return {
789
749
  CallExpression(node) {
@@ -799,8 +759,8 @@ var no_clone_element_default = createRule({
799
759
  },
800
760
  defaultOptions: []
801
761
  });
802
- var RULE_NAME14 = "no-comment-textnodes";
803
- var RULE_FEATURES14 = [
762
+ var RULE_NAME13 = "no-comment-textnodes";
763
+ var RULE_FEATURES13 = [
804
764
  "CHK"
805
765
  ];
806
766
  var no_comment_textnodes_default = createRule({
@@ -808,24 +768,24 @@ var no_comment_textnodes_default = createRule({
808
768
  type: "problem",
809
769
  docs: {
810
770
  description: "disallow comments from being inserted as text nodes",
811
- [Symbol.for("rule_features")]: RULE_FEATURES14
771
+ [Symbol.for("rule_features")]: RULE_FEATURES13
812
772
  },
813
773
  messages: {
814
774
  noCommentTextnodes: "Possible misused comment in text node. Comments inside children section of tag should be placed inside braces."
815
775
  },
816
776
  schema: []
817
777
  },
818
- name: RULE_NAME14,
778
+ name: RULE_NAME13,
819
779
  create(context) {
820
780
  function hasCommentLike(node) {
821
- if (AST12.isOneOf([AST_NODE_TYPES.JSXAttribute, AST_NODE_TYPES.JSXExpressionContainer])(node.parent)) {
781
+ if (AST11.isOneOf([AST_NODE_TYPES.JSXAttribute, AST_NODE_TYPES.JSXExpressionContainer])(node.parent)) {
822
782
  return false;
823
783
  }
824
784
  const rawValue = context.sourceCode.getText(node);
825
785
  return /^\s*\/(?:\/|\*)/mu.test(rawValue);
826
786
  }
827
787
  const visitorFunction = (node) => {
828
- if (!AST12.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent)) {
788
+ if (!AST11.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent)) {
829
789
  return;
830
790
  }
831
791
  if (!hasCommentLike(node)) {
@@ -846,8 +806,8 @@ var no_comment_textnodes_default = createRule({
846
806
  },
847
807
  defaultOptions: []
848
808
  });
849
- var RULE_NAME15 = "no-complex-conditional-rendering";
850
- var RULE_FEATURES15 = [
809
+ var RULE_NAME14 = "no-complex-conditional-rendering";
810
+ var RULE_FEATURES14 = [
851
811
  "CHK"
852
812
  ];
853
813
  var no_complex_conditional_rendering_default = createRule({
@@ -855,21 +815,21 @@ var no_complex_conditional_rendering_default = createRule({
855
815
  type: "problem",
856
816
  docs: {
857
817
  description: "disallow complex conditional rendering",
858
- [Symbol.for("rule_features")]: RULE_FEATURES15
818
+ [Symbol.for("rule_features")]: RULE_FEATURES14
859
819
  },
860
820
  messages: {
861
821
  noComplexConditionalRendering: "Avoid complex conditional rendering. Extract the logic into separate elements or components."
862
822
  },
863
823
  schema: []
864
824
  },
865
- name: RULE_NAME15,
825
+ name: RULE_NAME14,
866
826
  create(context) {
867
827
  const visitorFunction = (node) => {
868
828
  const jsxExpContainer = node.parent?.parent;
869
- if (!AST12.is(AST_NODE_TYPES.JSXExpressionContainer)(jsxExpContainer)) {
829
+ if (!AST11.is(AST_NODE_TYPES.JSXExpressionContainer)(jsxExpContainer)) {
870
830
  return;
871
831
  }
872
- if (!AST12.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(jsxExpContainer.parent)) {
832
+ if (!AST11.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(jsxExpContainer.parent)) {
873
833
  return;
874
834
  }
875
835
  if (!jsxExpContainer.parent.children.includes(jsxExpContainer)) {
@@ -890,20 +850,20 @@ var no_complex_conditional_rendering_default = createRule({
890
850
  },
891
851
  defaultOptions: []
892
852
  });
893
- var RULE_NAME16 = "no-component-will-mount";
894
- var RULE_FEATURES16 = [
853
+ var RULE_NAME15 = "no-component-will-mount";
854
+ var RULE_FEATURES15 = [
895
855
  "CHK",
896
856
  "MOD"
897
857
  ];
898
858
  function isComponentWillMount(node) {
899
- return AST12.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillMount";
859
+ return AST11.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillMount";
900
860
  }
901
861
  var no_component_will_mount_default = createRule({
902
862
  meta: {
903
863
  type: "problem",
904
864
  docs: {
905
865
  description: "replace usages of 'componentWillMount' with 'UNSAFE_componentWillMount'",
906
- [Symbol.for("rule_features")]: RULE_FEATURES16
866
+ [Symbol.for("rule_features")]: RULE_FEATURES15
907
867
  },
908
868
  fixable: "code",
909
869
  messages: {
@@ -911,7 +871,7 @@ var no_component_will_mount_default = createRule({
911
871
  },
912
872
  schema: []
913
873
  },
914
- name: RULE_NAME16,
874
+ name: RULE_NAME15,
915
875
  create(context) {
916
876
  if (!context.sourceCode.text.includes("componentWillMount")) {
917
877
  return {};
@@ -943,20 +903,20 @@ var no_component_will_mount_default = createRule({
943
903
  },
944
904
  defaultOptions: []
945
905
  });
946
- var RULE_NAME17 = "no-component-will-receive-props";
947
- var RULE_FEATURES17 = [
906
+ var RULE_NAME16 = "no-component-will-receive-props";
907
+ var RULE_FEATURES16 = [
948
908
  "CHK",
949
909
  "MOD"
950
910
  ];
951
911
  function isComponentWillUpdate(node) {
952
- return AST12.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillReceiveProps";
912
+ return AST11.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillReceiveProps";
953
913
  }
954
914
  var no_component_will_receive_props_default = createRule({
955
915
  meta: {
956
916
  type: "problem",
957
917
  docs: {
958
918
  description: "replace usages of 'componentWillReceiveProps' with 'UNSAFE_componentWillReceiveProps'",
959
- [Symbol.for("rule_features")]: RULE_FEATURES17
919
+ [Symbol.for("rule_features")]: RULE_FEATURES16
960
920
  },
961
921
  fixable: "code",
962
922
  messages: {
@@ -964,7 +924,7 @@ var no_component_will_receive_props_default = createRule({
964
924
  },
965
925
  schema: []
966
926
  },
967
- name: RULE_NAME17,
927
+ name: RULE_NAME16,
968
928
  create(context) {
969
929
  if (!context.sourceCode.text.includes("componentWillReceiveProps")) {
970
930
  return {};
@@ -996,20 +956,20 @@ var no_component_will_receive_props_default = createRule({
996
956
  },
997
957
  defaultOptions: []
998
958
  });
999
- var RULE_NAME18 = "no-component-will-update";
1000
- var RULE_FEATURES18 = [
959
+ var RULE_NAME17 = "no-component-will-update";
960
+ var RULE_FEATURES17 = [
1001
961
  "CHK",
1002
962
  "MOD"
1003
963
  ];
1004
964
  function isComponentWillUpdate2(node) {
1005
- return AST12.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
965
+ return AST11.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
1006
966
  }
1007
967
  var no_component_will_update_default = createRule({
1008
968
  meta: {
1009
969
  type: "problem",
1010
970
  docs: {
1011
971
  description: "replace usages of 'componentWillUpdate' with 'UNSAFE_componentWillUpdate'",
1012
- [Symbol.for("rule_features")]: RULE_FEATURES18
972
+ [Symbol.for("rule_features")]: RULE_FEATURES17
1013
973
  },
1014
974
  fixable: "code",
1015
975
  messages: {
@@ -1017,7 +977,7 @@ var no_component_will_update_default = createRule({
1017
977
  },
1018
978
  schema: []
1019
979
  },
1020
- name: RULE_NAME18,
980
+ name: RULE_NAME17,
1021
981
  create(context) {
1022
982
  if (!context.sourceCode.text.includes("componentWillUpdate")) {
1023
983
  return {};
@@ -1049,8 +1009,8 @@ var no_component_will_update_default = createRule({
1049
1009
  },
1050
1010
  defaultOptions: []
1051
1011
  });
1052
- var RULE_NAME19 = "no-context-provider";
1053
- var RULE_FEATURES19 = [
1012
+ var RULE_NAME18 = "no-context-provider";
1013
+ var RULE_FEATURES18 = [
1054
1014
  "CHK",
1055
1015
  "MOD"
1056
1016
  ];
@@ -1059,7 +1019,7 @@ var no_context_provider_default = createRule({
1059
1019
  type: "problem",
1060
1020
  docs: {
1061
1021
  description: "replace usages of '<Context.Provider>' with '<Context>'",
1062
- [Symbol.for("rule_features")]: RULE_FEATURES19
1022
+ [Symbol.for("rule_features")]: RULE_FEATURES18
1063
1023
  },
1064
1024
  fixable: "code",
1065
1025
  messages: {
@@ -1067,7 +1027,7 @@ var no_context_provider_default = createRule({
1067
1027
  },
1068
1028
  schema: []
1069
1029
  },
1070
- name: RULE_NAME19,
1030
+ name: RULE_NAME18,
1071
1031
  create(context) {
1072
1032
  if (!context.sourceCode.text.includes("Provider")) return {};
1073
1033
  const { version: version2 } = getSettingsFromContext(context);
@@ -1102,8 +1062,8 @@ var no_context_provider_default = createRule({
1102
1062
  },
1103
1063
  defaultOptions: []
1104
1064
  });
1105
- var RULE_NAME20 = "no-create-ref";
1106
- var RULE_FEATURES20 = [
1065
+ var RULE_NAME19 = "no-create-ref";
1066
+ var RULE_FEATURES19 = [
1107
1067
  "CHK"
1108
1068
  ];
1109
1069
  var no_create_ref_default = createRule({
@@ -1111,18 +1071,18 @@ var no_create_ref_default = createRule({
1111
1071
  type: "problem",
1112
1072
  docs: {
1113
1073
  description: "disallow using 'createRef' in function components",
1114
- [Symbol.for("rule_features")]: RULE_FEATURES20
1074
+ [Symbol.for("rule_features")]: RULE_FEATURES19
1115
1075
  },
1116
1076
  messages: {
1117
1077
  noCreateRef: "[Deprecated] Use 'useRef' instead."
1118
1078
  },
1119
1079
  schema: []
1120
1080
  },
1121
- name: RULE_NAME20,
1081
+ name: RULE_NAME19,
1122
1082
  create(context) {
1123
1083
  return {
1124
1084
  CallExpression(node) {
1125
- if (isCreateRefCall(context, node) && AST12.findParentNode(node, isClassComponent) == null) {
1085
+ if (isCreateRefCall(context, node) && AST11.findParentNode(node, isClassComponent) == null) {
1126
1086
  context.report({ messageId: "noCreateRef", node });
1127
1087
  }
1128
1088
  }
@@ -1130,8 +1090,8 @@ var no_create_ref_default = createRule({
1130
1090
  },
1131
1091
  defaultOptions: []
1132
1092
  });
1133
- var RULE_NAME21 = "no-default-props";
1134
- var RULE_FEATURES21 = [
1093
+ var RULE_NAME20 = "no-default-props";
1094
+ var RULE_FEATURES20 = [
1135
1095
  "CHK"
1136
1096
  ];
1137
1097
  var no_default_props_default = createRule({
@@ -1139,14 +1099,14 @@ var no_default_props_default = createRule({
1139
1099
  type: "problem",
1140
1100
  docs: {
1141
1101
  description: "disallow using 'defaultProps' property in components",
1142
- [Symbol.for("rule_features")]: RULE_FEATURES21
1102
+ [Symbol.for("rule_features")]: RULE_FEATURES20
1143
1103
  },
1144
1104
  messages: {
1145
1105
  noDefaultProps: "[Deprecated] Use ES6 default parameters instead."
1146
1106
  },
1147
1107
  schema: []
1148
1108
  },
1149
- name: RULE_NAME21,
1109
+ name: RULE_NAME20,
1150
1110
  create(context) {
1151
1111
  if (!context.sourceCode.text.includes("defaultProps")) {
1152
1112
  return {};
@@ -1169,7 +1129,7 @@ var no_default_props_default = createRule({
1169
1129
  const variable = VAR.findVariable(object.name, context.sourceCode.getScope(node));
1170
1130
  const variableNode = VAR.getVariableInitNode(variable, 0);
1171
1131
  if (variableNode == null) return;
1172
- if (!AST12.isFunction(variableNode) && !isClassComponent(variableNode)) return;
1132
+ if (!AST11.isFunction(variableNode) && !isClassComponent(variableNode)) return;
1173
1133
  context.report({ messageId: "noDefaultProps", node: property });
1174
1134
  },
1175
1135
  PropertyDefinition(node) {
@@ -1185,41 +1145,41 @@ var no_default_props_default = createRule({
1185
1145
  },
1186
1146
  defaultOptions: []
1187
1147
  });
1188
- var RULE_NAME22 = "no-direct-mutation-state";
1189
- var RULE_FEATURES22 = [
1148
+ var RULE_NAME21 = "no-direct-mutation-state";
1149
+ var RULE_FEATURES21 = [
1190
1150
  "CHK"
1191
1151
  ];
1192
1152
  function isConstructorFunction(node) {
1193
- return AST12.isOneOf([AST_NODE_TYPES.FunctionDeclaration, AST_NODE_TYPES.FunctionExpression])(node) && AST12.isMethodOrProperty(node.parent) && node.parent.key.type === AST_NODE_TYPES.Identifier && node.parent.key.name === "constructor";
1153
+ return AST11.isOneOf([AST_NODE_TYPES.FunctionDeclaration, AST_NODE_TYPES.FunctionExpression])(node) && AST11.isMethodOrProperty(node.parent) && node.parent.key.type === AST_NODE_TYPES.Identifier && node.parent.key.name === "constructor";
1194
1154
  }
1195
1155
  var no_direct_mutation_state_default = createRule({
1196
1156
  meta: {
1197
1157
  type: "problem",
1198
1158
  docs: {
1199
1159
  description: "disallow direct mutation of state",
1200
- [Symbol.for("rule_features")]: RULE_FEATURES22
1160
+ [Symbol.for("rule_features")]: RULE_FEATURES21
1201
1161
  },
1202
1162
  messages: {
1203
1163
  noDirectMutationState: "Do not mutate state directly. Use 'setState()' instead."
1204
1164
  },
1205
1165
  schema: []
1206
1166
  },
1207
- name: RULE_NAME22,
1167
+ name: RULE_NAME21,
1208
1168
  create(context) {
1209
1169
  return {
1210
1170
  AssignmentExpression(node) {
1211
1171
  if (!isAssignmentToThisState(node)) {
1212
1172
  return;
1213
1173
  }
1214
- const parentClass = AST12.findParentNode(
1174
+ const parentClass = AST11.findParentNode(
1215
1175
  node,
1216
- AST12.isOneOf([
1176
+ AST11.isOneOf([
1217
1177
  AST_NODE_TYPES.ClassDeclaration,
1218
1178
  AST_NODE_TYPES.ClassExpression
1219
1179
  ])
1220
1180
  );
1221
1181
  if (parentClass == null) return;
1222
- if (isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST12.findParentNode(node, isConstructorFunction)) {
1182
+ if (isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST11.findParentNode(node, isConstructorFunction)) {
1223
1183
  context.report({
1224
1184
  messageId: "noDirectMutationState",
1225
1185
  node
@@ -1230,8 +1190,8 @@ var no_direct_mutation_state_default = createRule({
1230
1190
  },
1231
1191
  defaultOptions: []
1232
1192
  });
1233
- var RULE_NAME23 = "no-duplicate-jsx-props";
1234
- var RULE_FEATURES23 = [
1193
+ var RULE_NAME22 = "no-duplicate-jsx-props";
1194
+ var RULE_FEATURES22 = [
1235
1195
  "CHK"
1236
1196
  ];
1237
1197
  var no_duplicate_jsx_props_default = createRule({
@@ -1239,14 +1199,14 @@ var no_duplicate_jsx_props_default = createRule({
1239
1199
  type: "problem",
1240
1200
  docs: {
1241
1201
  description: "disallow duplicate props",
1242
- [Symbol.for("rule_features")]: RULE_FEATURES23
1202
+ [Symbol.for("rule_features")]: RULE_FEATURES22
1243
1203
  },
1244
1204
  messages: {
1245
1205
  noDuplicateJsxProps: "This JSX property is assigned multiple times."
1246
1206
  },
1247
1207
  schema: []
1248
1208
  },
1249
- name: RULE_NAME23,
1209
+ name: RULE_NAME22,
1250
1210
  create(context) {
1251
1211
  return {
1252
1212
  JSXOpeningElement(node) {
@@ -1273,8 +1233,8 @@ var no_duplicate_jsx_props_default = createRule({
1273
1233
  },
1274
1234
  defaultOptions: []
1275
1235
  });
1276
- var RULE_NAME24 = "no-duplicate-key";
1277
- var RULE_FEATURES24 = [
1236
+ var RULE_NAME23 = "no-duplicate-key";
1237
+ var RULE_FEATURES23 = [
1278
1238
  "CHK"
1279
1239
  ];
1280
1240
  var no_duplicate_key_default = createRule({
@@ -1282,14 +1242,14 @@ var no_duplicate_key_default = createRule({
1282
1242
  type: "problem",
1283
1243
  docs: {
1284
1244
  description: "disallow duplicate keys when rendering list",
1285
- [Symbol.for("rule_features")]: RULE_FEATURES24
1245
+ [Symbol.for("rule_features")]: RULE_FEATURES23
1286
1246
  },
1287
1247
  messages: {
1288
1248
  noDuplicateKey: "A key must be unique. '{{value}}' is duplicated."
1289
1249
  },
1290
1250
  schema: []
1291
1251
  },
1292
- name: RULE_NAME24,
1252
+ name: RULE_NAME23,
1293
1253
  create(context) {
1294
1254
  if (!context.sourceCode.getText().includes("key=")) {
1295
1255
  return {};
@@ -1301,7 +1261,7 @@ var no_duplicate_key_default = createRule({
1301
1261
  if (aValue == null || bValue == null) {
1302
1262
  return false;
1303
1263
  }
1304
- return AST12.isNodeEqual(aValue, bValue);
1264
+ return AST11.isNodeEqual(aValue, bValue);
1305
1265
  }
1306
1266
  return {
1307
1267
  "JSXAttribute[name.name='key']"(node) {
@@ -1320,12 +1280,12 @@ var no_duplicate_key_default = createRule({
1320
1280
  break;
1321
1281
  }
1322
1282
  default: {
1323
- const call = AST12.findParentNode(jsxElement, AST12.isMapCallLoose);
1324
- const iter = AST12.findParentNode(jsxElement, (n) => n === call || AST12.isFunction(n));
1325
- if (!AST12.isFunction(iter)) return;
1283
+ const call = AST11.findParentNode(jsxElement, AST11.isMapCallLoose);
1284
+ const iter = AST11.findParentNode(jsxElement, (n) => n === call || AST11.isFunction(n));
1285
+ if (!AST11.isFunction(iter)) return;
1326
1286
  const arg0 = call?.arguments[0];
1327
1287
  if (call == null || arg0 == null) return;
1328
- if (AST12.getEcmaExpression(arg0) !== iter) {
1288
+ if (AST11.getEcmaExpression(arg0) !== iter) {
1329
1289
  return;
1330
1290
  }
1331
1291
  keyedEntries.set(call, {
@@ -1356,8 +1316,8 @@ var no_duplicate_key_default = createRule({
1356
1316
  },
1357
1317
  defaultOptions: []
1358
1318
  });
1359
- var RULE_NAME25 = "no-forward-ref";
1360
- var RULE_FEATURES25 = [
1319
+ var RULE_NAME24 = "no-forward-ref";
1320
+ var RULE_FEATURES24 = [
1361
1321
  "CHK",
1362
1322
  "MOD"
1363
1323
  ];
@@ -1366,7 +1326,7 @@ var no_forward_ref_default = createRule({
1366
1326
  type: "problem",
1367
1327
  docs: {
1368
1328
  description: "replace usages of 'forwardRef' with passing 'ref' as a prop",
1369
- [Symbol.for("rule_features")]: RULE_FEATURES25
1329
+ [Symbol.for("rule_features")]: RULE_FEATURES24
1370
1330
  },
1371
1331
  fixable: "code",
1372
1332
  messages: {
@@ -1374,7 +1334,7 @@ var no_forward_ref_default = createRule({
1374
1334
  },
1375
1335
  schema: []
1376
1336
  },
1377
- name: RULE_NAME25,
1337
+ name: RULE_NAME24,
1378
1338
  create(context) {
1379
1339
  if (!context.sourceCode.text.includes("forwardRef")) {
1380
1340
  return {};
@@ -1401,7 +1361,7 @@ var no_forward_ref_default = createRule({
1401
1361
  function getFix(context, node) {
1402
1362
  return (fixer) => {
1403
1363
  const [componentNode] = node.arguments;
1404
- if (componentNode == null || !AST12.isFunction(componentNode)) {
1364
+ if (componentNode == null || !AST11.isFunction(componentNode)) {
1405
1365
  return [];
1406
1366
  }
1407
1367
  return [
@@ -1465,8 +1425,8 @@ function getComponentPropsFixes(context, fixer, node, typeArguments) {
1465
1425
  ...arg1 == null ? [] : [fixer.remove(arg1), fixer.removeRange([arg0.range[1], arg1.range[0]])]
1466
1426
  ];
1467
1427
  }
1468
- var RULE_NAME26 = "no-implicit-key";
1469
- var RULE_FEATURES26 = [
1428
+ var RULE_NAME25 = "no-implicit-key";
1429
+ var RULE_FEATURES25 = [
1470
1430
  "CHK"
1471
1431
  ];
1472
1432
  var no_implicit_key_default = createRule({
@@ -1474,14 +1434,14 @@ var no_implicit_key_default = createRule({
1474
1434
  type: "problem",
1475
1435
  docs: {
1476
1436
  description: "disallow implicit 'key' props",
1477
- [Symbol.for("rule_features")]: RULE_FEATURES26
1437
+ [Symbol.for("rule_features")]: RULE_FEATURES25
1478
1438
  },
1479
1439
  messages: {
1480
1440
  noImplicitKey: "Do not use implicit 'key' props."
1481
1441
  },
1482
1442
  schema: []
1483
1443
  },
1484
- name: RULE_NAME26,
1444
+ name: RULE_NAME25,
1485
1445
  create(context) {
1486
1446
  return {
1487
1447
  JSXOpeningElement(node) {
@@ -1498,8 +1458,8 @@ var no_implicit_key_default = createRule({
1498
1458
  },
1499
1459
  defaultOptions: []
1500
1460
  });
1501
- var RULE_NAME27 = "no-leaked-conditional-rendering";
1502
- var RULE_FEATURES27 = [
1461
+ var RULE_NAME26 = "no-leaked-conditional-rendering";
1462
+ var RULE_FEATURES26 = [
1503
1463
  "CHK",
1504
1464
  "TSC"
1505
1465
  ];
@@ -1586,14 +1546,14 @@ var no_leaked_conditional_rendering_default = createRule({
1586
1546
  type: "problem",
1587
1547
  docs: {
1588
1548
  description: "disallow problematic leaked values from being rendered",
1589
- [Symbol.for("rule_features")]: RULE_FEATURES27
1549
+ [Symbol.for("rule_features")]: RULE_FEATURES26
1590
1550
  },
1591
1551
  messages: {
1592
1552
  noLeakedConditionalRendering: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes."
1593
1553
  },
1594
1554
  schema: []
1595
1555
  },
1596
- name: RULE_NAME27,
1556
+ name: RULE_NAME26,
1597
1557
  create(context) {
1598
1558
  if (!context.sourceCode.text.includes("&&") && !context.sourceCode.text.includes("?")) {
1599
1559
  return {};
@@ -1614,7 +1574,7 @@ var no_leaked_conditional_rendering_default = createRule({
1614
1574
  const services = ESLintUtils.getParserServices(context, false);
1615
1575
  function getReportDescriptor(node) {
1616
1576
  if (node == null) return _;
1617
- return match(node).when(AST12.isJSX, () => _).with({ type: AST_NODE_TYPES.LogicalExpression, operator: "&&" }, ({ left, right }) => {
1577
+ return match(node).when(AST11.isJSX, () => _).with({ type: AST_NODE_TYPES.LogicalExpression, operator: "&&" }, ({ left, right }) => {
1618
1578
  const isLeftUnaryNot = left.type === AST_NODE_TYPES.UnaryExpression && left.operator === "!";
1619
1579
  if (isLeftUnaryNot) {
1620
1580
  return getReportDescriptor(right);
@@ -1659,8 +1619,8 @@ var no_leaked_conditional_rendering_default = createRule({
1659
1619
  },
1660
1620
  defaultOptions: []
1661
1621
  });
1662
- var RULE_NAME28 = "no-missing-component-display-name";
1663
- var RULE_FEATURES28 = [
1622
+ var RULE_NAME27 = "no-missing-component-display-name";
1623
+ var RULE_FEATURES27 = [
1664
1624
  "CHK"
1665
1625
  ];
1666
1626
  var no_missing_component_display_name_default = createRule({
@@ -1668,14 +1628,14 @@ var no_missing_component_display_name_default = createRule({
1668
1628
  type: "problem",
1669
1629
  docs: {
1670
1630
  description: "require 'displayName' for 'memo' and 'forwardRef' components",
1671
- [Symbol.for("rule_features")]: RULE_FEATURES28
1631
+ [Symbol.for("rule_features")]: RULE_FEATURES27
1672
1632
  },
1673
1633
  messages: {
1674
1634
  noMissingComponentDisplayName: "Add missing 'displayName' for component."
1675
1635
  },
1676
1636
  schema: []
1677
1637
  },
1678
- name: RULE_NAME28,
1638
+ name: RULE_NAME27,
1679
1639
  create(context) {
1680
1640
  if (!context.sourceCode.text.includes("memo") && !context.sourceCode.text.includes("forwardRef")) {
1681
1641
  return {};
@@ -1697,7 +1657,7 @@ var no_missing_component_display_name_default = createRule({
1697
1657
  const components = ctx.getAllComponents(node);
1698
1658
  for (const { node: node2, displayName, flag } of components.values()) {
1699
1659
  const isMemoOrForwardRef = (flag & (ERComponentFlag.ForwardRef | ERComponentFlag.Memo)) > 0n;
1700
- if (AST12.getFunctionIdentifier(node2) != null) {
1660
+ if (AST11.getFunctionIdentifier(node2) != null) {
1701
1661
  continue;
1702
1662
  }
1703
1663
  if (!isMemoOrForwardRef) {
@@ -1715,8 +1675,8 @@ var no_missing_component_display_name_default = createRule({
1715
1675
  },
1716
1676
  defaultOptions: []
1717
1677
  });
1718
- var RULE_NAME29 = "no-missing-context-display-name";
1719
- var RULE_FEATURES29 = [
1678
+ var RULE_NAME28 = "no-missing-context-display-name";
1679
+ var RULE_FEATURES28 = [
1720
1680
  "CHK"
1721
1681
  ];
1722
1682
  var no_missing_context_display_name_default = createRule({
@@ -1724,14 +1684,14 @@ var no_missing_context_display_name_default = createRule({
1724
1684
  type: "problem",
1725
1685
  docs: {
1726
1686
  description: "require 'displayName' for contexts.",
1727
- [Symbol.for("rule_features")]: RULE_FEATURES29
1687
+ [Symbol.for("rule_features")]: RULE_FEATURES28
1728
1688
  },
1729
1689
  messages: {
1730
1690
  noMissingContextDisplayName: "Add missing 'displayName' for context."
1731
1691
  },
1732
1692
  schema: []
1733
1693
  },
1734
- name: RULE_NAME29,
1694
+ name: RULE_NAME28,
1735
1695
  create(context) {
1736
1696
  if (!context.sourceCode.text.includes("createContext")) return {};
1737
1697
  const createCalls = [];
@@ -1772,8 +1732,8 @@ var no_missing_context_display_name_default = createRule({
1772
1732
  },
1773
1733
  defaultOptions: []
1774
1734
  });
1775
- var RULE_NAME30 = "no-missing-key";
1776
- var RULE_FEATURES30 = [
1735
+ var RULE_NAME29 = "no-missing-key";
1736
+ var RULE_FEATURES29 = [
1777
1737
  "CHK"
1778
1738
  ];
1779
1739
  var no_missing_key_default = createRule({
@@ -1781,7 +1741,7 @@ var no_missing_key_default = createRule({
1781
1741
  type: "problem",
1782
1742
  docs: {
1783
1743
  description: "require 'key' when rendering list",
1784
- [Symbol.for("rule_features")]: RULE_FEATURES30
1744
+ [Symbol.for("rule_features")]: RULE_FEATURES29
1785
1745
  },
1786
1746
  messages: {
1787
1747
  missingKey: "Missing 'key' for element when rendering list.",
@@ -1789,7 +1749,7 @@ var no_missing_key_default = createRule({
1789
1749
  },
1790
1750
  schema: []
1791
1751
  },
1792
- name: RULE_NAME30,
1752
+ name: RULE_NAME29,
1793
1753
  create(context) {
1794
1754
  const state = { isWithinChildrenToArray: false };
1795
1755
  function checkIteratorElement(node) {
@@ -1835,7 +1795,7 @@ var no_missing_key_default = createRule({
1835
1795
  }
1836
1796
  function checkBlockStatement(node) {
1837
1797
  const descriptors = [];
1838
- for (const statement of AST12.getNestedReturnStatements(node)) {
1798
+ for (const statement of AST11.getNestedReturnStatements(node)) {
1839
1799
  if (statement.argument == null) {
1840
1800
  continue;
1841
1801
  }
@@ -1851,7 +1811,7 @@ var no_missing_key_default = createRule({
1851
1811
  if (state.isWithinChildrenToArray) {
1852
1812
  return;
1853
1813
  }
1854
- const elements = node.elements.filter(AST12.is(AST_NODE_TYPES.JSXElement));
1814
+ const elements = node.elements.filter(AST11.is(AST_NODE_TYPES.JSXElement));
1855
1815
  if (elements.length === 0) {
1856
1816
  return;
1857
1817
  }
@@ -1870,7 +1830,7 @@ var no_missing_key_default = createRule({
1870
1830
  if (state.isWithinChildrenToArray) {
1871
1831
  return;
1872
1832
  }
1873
- const isMapCallLike = AST12.isMapCallLoose(node);
1833
+ const isMapCallLike = AST11.isMapCallLoose(node);
1874
1834
  if (!isMapCallLike && !isArrayFromCall(node)) {
1875
1835
  return;
1876
1836
  }
@@ -1913,8 +1873,8 @@ var no_missing_key_default = createRule({
1913
1873
  function isArrayFromCall(node) {
1914
1874
  return node.type === AST_NODE_TYPES.CallExpression && node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "from";
1915
1875
  }
1916
- var RULE_NAME31 = "no-nested-components";
1917
- var RULE_FEATURES31 = [
1876
+ var RULE_NAME30 = "no-nested-components";
1877
+ var RULE_FEATURES30 = [
1918
1878
  "CHK"
1919
1879
  ];
1920
1880
  var no_nested_components_default = createRule({
@@ -1922,7 +1882,7 @@ var no_nested_components_default = createRule({
1922
1882
  type: "problem",
1923
1883
  docs: {
1924
1884
  description: "disallow using unstable nested components",
1925
- [Symbol.for("rule_features")]: RULE_FEATURES31
1885
+ [Symbol.for("rule_features")]: RULE_FEATURES30
1926
1886
  },
1927
1887
  messages: {
1928
1888
  nestedComponent: "Do not nest components inside other components. Move it to the top level.",
@@ -1930,7 +1890,7 @@ var no_nested_components_default = createRule({
1930
1890
  },
1931
1891
  schema: []
1932
1892
  },
1933
- name: RULE_NAME31,
1893
+ name: RULE_NAME30,
1934
1894
  create(context) {
1935
1895
  const hint = ERComponentHint.SkipMapCallback | ERComponentHint.SkipNullLiteral | ERComponentHint.SkipUndefined | ERComponentHint.SkipBooleanLiteral | ERComponentHint.SkipStringLiteral | ERComponentHint.SkipNumberLiteral | ERComponentHint.StrictLogical | ERComponentHint.StrictConditional;
1936
1896
  const collector = useComponentCollector(context, { hint });
@@ -1946,10 +1906,10 @@ var no_nested_components_default = createRule({
1946
1906
  ...collectorLegacy.ctx.getAllComponents(node).values()
1947
1907
  ];
1948
1908
  const isFunctionComponent = (node2) => {
1949
- return AST12.isFunction(node2) && functionComponents.some((component) => component.node === node2);
1909
+ return AST11.isFunction(node2) && functionComponents.some((component) => component.node === node2);
1950
1910
  };
1951
1911
  const isClassComponent11 = (node2) => {
1952
- return AST12.isClass(node2) && classComponents.some((component) => component.node === node2);
1912
+ return AST11.isClass(node2) && classComponents.some((component) => component.node === node2);
1953
1913
  };
1954
1914
  for (const { name: name5, node: component } of functionComponents) {
1955
1915
  if (isDirectValueOfRenderPropertyLoose(component)) {
@@ -1982,7 +1942,7 @@ var no_nested_components_default = createRule({
1982
1942
  });
1983
1943
  continue;
1984
1944
  }
1985
- const parentComponent = AST12.findParentNode(component, isFunctionComponent);
1945
+ const parentComponent = AST11.findParentNode(component, isFunctionComponent);
1986
1946
  const isParentComponentNotDirectValueOfRenderProperty = parentComponent != null && !isDirectValueOfRenderPropertyLoose(parentComponent);
1987
1947
  if (isParentComponentNotDirectValueOfRenderProperty) {
1988
1948
  context.report({
@@ -2005,7 +1965,7 @@ var no_nested_components_default = createRule({
2005
1965
  }
2006
1966
  }
2007
1967
  for (const { name: name5 = "unknown", node: component } of classComponents) {
2008
- if (AST12.findParentNode(component, (n) => isClassComponent11(n) || isFunctionComponent(n)) == null) {
1968
+ if (AST11.findParentNode(component, (n) => isClassComponent11(n) || isFunctionComponent(n)) == null) {
2009
1969
  continue;
2010
1970
  }
2011
1971
  context.report({
@@ -2022,14 +1982,14 @@ var no_nested_components_default = createRule({
2022
1982
  defaultOptions: []
2023
1983
  });
2024
1984
  function isInsideCreateElementProps(context, node) {
2025
- const call = AST12.findParentNode(node, isCreateElementCall(context));
1985
+ const call = AST11.findParentNode(node, isCreateElementCall(context));
2026
1986
  if (call == null) return false;
2027
- const prop = AST12.findParentNode(node, AST12.is(AST_NODE_TYPES.ObjectExpression));
1987
+ const prop = AST11.findParentNode(node, AST11.is(AST_NODE_TYPES.ObjectExpression));
2028
1988
  if (prop == null) return false;
2029
1989
  return prop === call.arguments[1];
2030
1990
  }
2031
- var RULE_NAME32 = "no-prop-types";
2032
- var RULE_FEATURES32 = [
1991
+ var RULE_NAME31 = "no-prop-types";
1992
+ var RULE_FEATURES31 = [
2033
1993
  "CHK"
2034
1994
  ];
2035
1995
  var no_prop_types_default = createRule({
@@ -2037,14 +1997,14 @@ var no_prop_types_default = createRule({
2037
1997
  type: "problem",
2038
1998
  docs: {
2039
1999
  description: "disallow using 'propTypes' property in components",
2040
- [Symbol.for("rule_features")]: RULE_FEATURES32
2000
+ [Symbol.for("rule_features")]: RULE_FEATURES31
2041
2001
  },
2042
2002
  messages: {
2043
2003
  noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead."
2044
2004
  },
2045
2005
  schema: []
2046
2006
  },
2047
- name: RULE_NAME32,
2007
+ name: RULE_NAME31,
2048
2008
  create(context) {
2049
2009
  if (!context.sourceCode.text.includes("propTypes")) {
2050
2010
  return {};
@@ -2066,7 +2026,7 @@ var no_prop_types_default = createRule({
2066
2026
  }
2067
2027
  const variable = VAR.findVariable(object.name, context.sourceCode.getScope(node));
2068
2028
  const variableNode = VAR.getVariableInitNode(variable, 0);
2069
- if (variableNode != null && (AST12.isFunction(variableNode) || isClassComponent(variableNode))) {
2029
+ if (variableNode != null && (AST11.isFunction(variableNode) || isClassComponent(variableNode))) {
2070
2030
  context.report({ messageId: "noPropTypes", node: property });
2071
2031
  }
2072
2032
  },
@@ -2083,26 +2043,26 @@ var no_prop_types_default = createRule({
2083
2043
  },
2084
2044
  defaultOptions: []
2085
2045
  });
2086
- var RULE_NAME33 = "no-redundant-should-component-update";
2087
- var RULE_FEATURES33 = [
2046
+ var RULE_NAME32 = "no-redundant-should-component-update";
2047
+ var RULE_FEATURES32 = [
2088
2048
  "CHK"
2089
2049
  ];
2090
2050
  function isShouldComponentUpdate(node) {
2091
- return AST12.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
2051
+ return AST11.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
2092
2052
  }
2093
2053
  var no_redundant_should_component_update_default = createRule({
2094
2054
  meta: {
2095
2055
  type: "problem",
2096
2056
  docs: {
2097
2057
  description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'",
2098
- [Symbol.for("rule_features")]: RULE_FEATURES33
2058
+ [Symbol.for("rule_features")]: RULE_FEATURES32
2099
2059
  },
2100
2060
  messages: {
2101
2061
  noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'."
2102
2062
  },
2103
2063
  schema: []
2104
2064
  },
2105
- name: RULE_NAME33,
2065
+ name: RULE_NAME32,
2106
2066
  create(context) {
2107
2067
  if (!context.sourceCode.text.includes("shouldComponentUpdate")) {
2108
2068
  return {};
@@ -2134,26 +2094,26 @@ var no_redundant_should_component_update_default = createRule({
2134
2094
  },
2135
2095
  defaultOptions: []
2136
2096
  });
2137
- var RULE_NAME34 = "no-set-state-in-component-did-mount";
2138
- var RULE_FEATURES34 = [
2097
+ var RULE_NAME33 = "no-set-state-in-component-did-mount";
2098
+ var RULE_FEATURES33 = [
2139
2099
  "CHK"
2140
2100
  ];
2141
2101
  function isComponentDidMount(node) {
2142
- return AST12.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
2102
+ return AST11.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
2143
2103
  }
2144
2104
  var no_set_state_in_component_did_mount_default = createRule({
2145
2105
  meta: {
2146
2106
  type: "problem",
2147
2107
  docs: {
2148
2108
  description: "disallow using 'setState' in 'componentDidMount'",
2149
- [Symbol.for("rule_features")]: RULE_FEATURES34
2109
+ [Symbol.for("rule_features")]: RULE_FEATURES33
2150
2110
  },
2151
2111
  messages: {
2152
2112
  noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks."
2153
2113
  },
2154
2114
  schema: []
2155
2115
  },
2156
- name: RULE_NAME34,
2116
+ name: RULE_NAME33,
2157
2117
  create(context) {
2158
2118
  if (!context.sourceCode.text.includes("componentDidMount")) {
2159
2119
  return {};
@@ -2163,8 +2123,8 @@ var no_set_state_in_component_did_mount_default = createRule({
2163
2123
  if (!isThisSetState(node)) {
2164
2124
  return;
2165
2125
  }
2166
- const clazz = AST12.findParentNode(node, isClassComponent);
2167
- const method = AST12.findParentNode(node, (n) => n === clazz || isComponentDidMount(n));
2126
+ const clazz = AST11.findParentNode(node, isClassComponent);
2127
+ const method = AST11.findParentNode(node, (n) => n === clazz || isComponentDidMount(n));
2168
2128
  if (clazz == null || method == null || method === clazz) return;
2169
2129
  const methodScope = context.sourceCode.getScope(method);
2170
2130
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2179,26 +2139,26 @@ var no_set_state_in_component_did_mount_default = createRule({
2179
2139
  },
2180
2140
  defaultOptions: []
2181
2141
  });
2182
- var RULE_NAME35 = "no-set-state-in-component-did-update";
2183
- var RULE_FEATURES35 = [
2142
+ var RULE_NAME34 = "no-set-state-in-component-did-update";
2143
+ var RULE_FEATURES34 = [
2184
2144
  "CHK"
2185
2145
  ];
2186
2146
  function isComponentDidUpdate(node) {
2187
- return AST12.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidUpdate";
2147
+ return AST11.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidUpdate";
2188
2148
  }
2189
2149
  var no_set_state_in_component_did_update_default = createRule({
2190
2150
  meta: {
2191
2151
  type: "problem",
2192
2152
  docs: {
2193
2153
  description: "disallow using 'setState' in 'componentDidUpdate'",
2194
- [Symbol.for("rule_features")]: RULE_FEATURES35
2154
+ [Symbol.for("rule_features")]: RULE_FEATURES34
2195
2155
  },
2196
2156
  messages: {
2197
2157
  noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks."
2198
2158
  },
2199
2159
  schema: []
2200
2160
  },
2201
- name: RULE_NAME35,
2161
+ name: RULE_NAME34,
2202
2162
  create(context) {
2203
2163
  if (!context.sourceCode.text.includes("componentDidUpdate")) {
2204
2164
  return {};
@@ -2208,8 +2168,8 @@ var no_set_state_in_component_did_update_default = createRule({
2208
2168
  if (!isThisSetState(node)) {
2209
2169
  return;
2210
2170
  }
2211
- const clazz = AST12.findParentNode(node, isClassComponent);
2212
- const method = AST12.findParentNode(node, (n) => n === clazz || isComponentDidUpdate(n));
2171
+ const clazz = AST11.findParentNode(node, isClassComponent);
2172
+ const method = AST11.findParentNode(node, (n) => n === clazz || isComponentDidUpdate(n));
2213
2173
  if (clazz == null || method == null || method === clazz) return;
2214
2174
  const methodScope = context.sourceCode.getScope(method);
2215
2175
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2224,26 +2184,26 @@ var no_set_state_in_component_did_update_default = createRule({
2224
2184
  },
2225
2185
  defaultOptions: []
2226
2186
  });
2227
- var RULE_NAME36 = "no-set-state-in-component-will-update";
2228
- var RULE_FEATURES36 = [
2187
+ var RULE_NAME35 = "no-set-state-in-component-will-update";
2188
+ var RULE_FEATURES35 = [
2229
2189
  "CHK"
2230
2190
  ];
2231
2191
  function isComponentWillUpdate3(node) {
2232
- return AST12.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
2192
+ return AST11.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
2233
2193
  }
2234
2194
  var no_set_state_in_component_will_update_default = createRule({
2235
2195
  meta: {
2236
2196
  type: "problem",
2237
2197
  docs: {
2238
2198
  description: "disallow using 'setState' in 'componentWillUpdate'",
2239
- [Symbol.for("rule_features")]: RULE_FEATURES36
2199
+ [Symbol.for("rule_features")]: RULE_FEATURES35
2240
2200
  },
2241
2201
  messages: {
2242
2202
  noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks."
2243
2203
  },
2244
2204
  schema: []
2245
2205
  },
2246
- name: RULE_NAME36,
2206
+ name: RULE_NAME35,
2247
2207
  create(context) {
2248
2208
  if (!context.sourceCode.text.includes("componentWillUpdate")) {
2249
2209
  return {};
@@ -2253,8 +2213,8 @@ var no_set_state_in_component_will_update_default = createRule({
2253
2213
  if (!isThisSetState(node)) {
2254
2214
  return;
2255
2215
  }
2256
- const clazz = AST12.findParentNode(node, isClassComponent);
2257
- const method = AST12.findParentNode(node, (n) => n === clazz || isComponentWillUpdate3(n));
2216
+ const clazz = AST11.findParentNode(node, isClassComponent);
2217
+ const method = AST11.findParentNode(node, (n) => n === clazz || isComponentWillUpdate3(n));
2258
2218
  if (clazz == null || method == null || method === clazz) return;
2259
2219
  const methodScope = context.sourceCode.getScope(method);
2260
2220
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2269,8 +2229,8 @@ var no_set_state_in_component_will_update_default = createRule({
2269
2229
  },
2270
2230
  defaultOptions: []
2271
2231
  });
2272
- var RULE_NAME37 = "no-string-refs";
2273
- var RULE_FEATURES37 = [
2232
+ var RULE_NAME36 = "no-string-refs";
2233
+ var RULE_FEATURES36 = [
2274
2234
  "CHK"
2275
2235
  ];
2276
2236
  function containsStringLiteral({ value }) {
@@ -2290,14 +2250,14 @@ var no_string_refs_default = createRule({
2290
2250
  type: "problem",
2291
2251
  docs: {
2292
2252
  description: "disallow using deprecated string refs",
2293
- [Symbol.for("rule_features")]: RULE_FEATURES37
2253
+ [Symbol.for("rule_features")]: RULE_FEATURES36
2294
2254
  },
2295
2255
  messages: {
2296
2256
  noStringRefs: "[Deprecated] Use callback refs instead."
2297
2257
  },
2298
2258
  schema: []
2299
2259
  },
2300
- name: RULE_NAME37,
2260
+ name: RULE_NAME36,
2301
2261
  create(context) {
2302
2262
  return {
2303
2263
  JSXAttribute(node) {
@@ -2315,26 +2275,26 @@ var no_string_refs_default = createRule({
2315
2275
  },
2316
2276
  defaultOptions: []
2317
2277
  });
2318
- var RULE_NAME38 = "no-unsafe-component-will-mount";
2319
- var RULE_FEATURES38 = [
2278
+ var RULE_NAME37 = "no-unsafe-component-will-mount";
2279
+ var RULE_FEATURES37 = [
2320
2280
  "CHK"
2321
2281
  ];
2322
2282
  function isUnsafeComponentWillMount(node) {
2323
- return AST12.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillMount";
2283
+ return AST11.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillMount";
2324
2284
  }
2325
2285
  var no_unsafe_component_will_mount_default = createRule({
2326
2286
  meta: {
2327
2287
  type: "problem",
2328
2288
  docs: {
2329
2289
  description: "disallow using 'UNSAFE_componentWillMount'",
2330
- [Symbol.for("rule_features")]: RULE_FEATURES38
2290
+ [Symbol.for("rule_features")]: RULE_FEATURES37
2331
2291
  },
2332
2292
  messages: {
2333
2293
  noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'."
2334
2294
  },
2335
2295
  schema: []
2336
2296
  },
2337
- name: RULE_NAME38,
2297
+ name: RULE_NAME37,
2338
2298
  create(context) {
2339
2299
  if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) {
2340
2300
  return {};
@@ -2360,26 +2320,26 @@ var no_unsafe_component_will_mount_default = createRule({
2360
2320
  },
2361
2321
  defaultOptions: []
2362
2322
  });
2363
- var RULE_NAME39 = "no-unsafe-component-will-receive-props";
2364
- var RULE_FEATURES39 = [
2323
+ var RULE_NAME38 = "no-unsafe-component-will-receive-props";
2324
+ var RULE_FEATURES38 = [
2365
2325
  "CHK"
2366
2326
  ];
2367
2327
  function isUnsafeComponentWillReceiveProps(node) {
2368
- return AST12.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillReceiveProps";
2328
+ return AST11.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillReceiveProps";
2369
2329
  }
2370
2330
  var no_unsafe_component_will_receive_props_default = createRule({
2371
2331
  meta: {
2372
2332
  type: "problem",
2373
2333
  docs: {
2374
2334
  description: "disallow using 'UNSAFE_componentWillReceiveProps'",
2375
- [Symbol.for("rule_features")]: RULE_FEATURES39
2335
+ [Symbol.for("rule_features")]: RULE_FEATURES38
2376
2336
  },
2377
2337
  messages: {
2378
2338
  noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'."
2379
2339
  },
2380
2340
  schema: []
2381
2341
  },
2382
- name: RULE_NAME39,
2342
+ name: RULE_NAME38,
2383
2343
  create(context) {
2384
2344
  if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) {
2385
2345
  return {};
@@ -2405,26 +2365,26 @@ var no_unsafe_component_will_receive_props_default = createRule({
2405
2365
  },
2406
2366
  defaultOptions: []
2407
2367
  });
2408
- var RULE_NAME40 = "no-unsafe-component-will-update";
2409
- var RULE_FEATURES40 = [
2368
+ var RULE_NAME39 = "no-unsafe-component-will-update";
2369
+ var RULE_FEATURES39 = [
2410
2370
  "CHK"
2411
2371
  ];
2412
2372
  function isUnsafeComponentWillUpdate(node) {
2413
- return AST12.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillUpdate";
2373
+ return AST11.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillUpdate";
2414
2374
  }
2415
2375
  var no_unsafe_component_will_update_default = createRule({
2416
2376
  meta: {
2417
2377
  type: "problem",
2418
2378
  docs: {
2419
2379
  description: "disallow using 'UNSAFE_componentWillUpdate'",
2420
- [Symbol.for("rule_features")]: RULE_FEATURES40
2380
+ [Symbol.for("rule_features")]: RULE_FEATURES39
2421
2381
  },
2422
2382
  messages: {
2423
2383
  noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'."
2424
2384
  },
2425
2385
  schema: []
2426
2386
  },
2427
- name: RULE_NAME40,
2387
+ name: RULE_NAME39,
2428
2388
  create(context) {
2429
2389
  if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) {
2430
2390
  return {};
@@ -2450,8 +2410,8 @@ var no_unsafe_component_will_update_default = createRule({
2450
2410
  },
2451
2411
  defaultOptions: []
2452
2412
  });
2453
- var RULE_NAME41 = "no-unstable-context-value";
2454
- var RULE_FEATURES41 = [
2413
+ var RULE_NAME40 = "no-unstable-context-value";
2414
+ var RULE_FEATURES40 = [
2455
2415
  "CHK"
2456
2416
  ];
2457
2417
  var no_unstable_context_value_default = createRule({
@@ -2459,14 +2419,14 @@ var no_unstable_context_value_default = createRule({
2459
2419
  type: "problem",
2460
2420
  docs: {
2461
2421
  description: "disallow passing constructed values to context providers",
2462
- [Symbol.for("rule_features")]: RULE_FEATURES41
2422
+ [Symbol.for("rule_features")]: RULE_FEATURES40
2463
2423
  },
2464
2424
  messages: {
2465
2425
  unstableContextValue: "A/an '{{type}}' passed as the value prop to the context provider should not be constructed. It will change on every render. {{suggestion}}"
2466
2426
  },
2467
2427
  schema: []
2468
2428
  },
2469
- name: RULE_NAME41,
2429
+ name: RULE_NAME40,
2470
2430
  create(context) {
2471
2431
  const { version: version2 } = getSettingsFromContext(context);
2472
2432
  const isReact18OrBelow = compare(version2, "19.0.0", "<");
@@ -2506,7 +2466,7 @@ var no_unstable_context_value_default = createRule({
2506
2466
  messageId: "unstableContextValue",
2507
2467
  node: constructionNode,
2508
2468
  data: {
2509
- type: AST12.toReadableNodeType(constructionNode),
2469
+ type: AST11.toReadableNodeType(constructionNode),
2510
2470
  suggestion
2511
2471
  }
2512
2472
  });
@@ -2524,8 +2484,8 @@ function isContextName(name5, isReact18OrBelow) {
2524
2484
  }
2525
2485
  return false;
2526
2486
  }
2527
- var RULE_NAME42 = "no-unstable-default-props";
2528
- var RULE_FEATURES42 = [
2487
+ var RULE_NAME41 = "no-unstable-default-props";
2488
+ var RULE_FEATURES41 = [
2529
2489
  "CHK"
2530
2490
  ];
2531
2491
  var no_unstable_default_props_default = createRule({
@@ -2533,14 +2493,14 @@ var no_unstable_default_props_default = createRule({
2533
2493
  type: "problem",
2534
2494
  docs: {
2535
2495
  description: "disallow using unstable value as default param in function component",
2536
- [Symbol.for("rule_features")]: RULE_FEATURES42
2496
+ [Symbol.for("rule_features")]: RULE_FEATURES41
2537
2497
  },
2538
2498
  messages: {
2539
2499
  noUnstableDefaultProps: "A/an '{{forbiddenType}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{forbiddenType}}'."
2540
2500
  },
2541
2501
  schema: []
2542
2502
  },
2543
- name: RULE_NAME42,
2503
+ name: RULE_NAME41,
2544
2504
  create(context) {
2545
2505
  const { ctx, listeners } = useComponentCollector(context);
2546
2506
  const declarators = /* @__PURE__ */ new Map();
@@ -2575,7 +2535,7 @@ var no_unstable_default_props_default = createRule({
2575
2535
  if (isReactHookCall(construction.node)) {
2576
2536
  continue;
2577
2537
  }
2578
- const forbiddenType = AST12.toReadableNodeType(right);
2538
+ const forbiddenType = AST11.toReadableNodeType(right);
2579
2539
  context.report({
2580
2540
  messageId: "noUnstableDefaultProps",
2581
2541
  node: right,
@@ -2599,8 +2559,8 @@ var no_unstable_default_props_default = createRule({
2599
2559
  },
2600
2560
  defaultOptions: []
2601
2561
  });
2602
- var RULE_NAME43 = "no-unused-class-component-members";
2603
- var RULE_FEATURES43 = [
2562
+ var RULE_NAME42 = "no-unused-class-component-members";
2563
+ var RULE_FEATURES42 = [
2604
2564
  "CHK"
2605
2565
  ];
2606
2566
  var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
@@ -2628,14 +2588,14 @@ var no_unused_class_component_members_default = createRule({
2628
2588
  type: "problem",
2629
2589
  docs: {
2630
2590
  description: "disallow unused class component members",
2631
- [Symbol.for("rule_features")]: RULE_FEATURES43
2591
+ [Symbol.for("rule_features")]: RULE_FEATURES42
2632
2592
  },
2633
2593
  messages: {
2634
2594
  noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'."
2635
2595
  },
2636
2596
  schema: []
2637
2597
  },
2638
- name: RULE_NAME43,
2598
+ name: RULE_NAME42,
2639
2599
  create(context) {
2640
2600
  const classEntries = [];
2641
2601
  const methodEntries = [];
@@ -2654,14 +2614,14 @@ var no_unused_class_component_members_default = createRule({
2654
2614
  if (currentClass == null || !isClassComponent(currentClass)) {
2655
2615
  return;
2656
2616
  }
2657
- const className = AST12.getClassIdentifier(currentClass)?.name;
2617
+ const className = AST11.getClassIdentifier(currentClass)?.name;
2658
2618
  const defs = propertyDefs.get(currentClass);
2659
2619
  const usages = propertyUsages.get(currentClass);
2660
2620
  if (defs == null) {
2661
2621
  return;
2662
2622
  }
2663
2623
  for (const def of defs) {
2664
- const methodName = AST12.getPropertyName(def);
2624
+ const methodName = AST11.getPropertyName(def);
2665
2625
  if (methodName == null) {
2666
2626
  continue;
2667
2627
  }
@@ -2708,14 +2668,14 @@ var no_unused_class_component_members_default = createRule({
2708
2668
  if (!isClassComponent(currentClass) || currentMethod.static) {
2709
2669
  return;
2710
2670
  }
2711
- if (!AST12.isThisExpression(node.object) || !isKeyLiteral2(node, node.property)) {
2671
+ if (!AST11.isThisExpression(node.object) || !isKeyLiteral2(node, node.property)) {
2712
2672
  return;
2713
2673
  }
2714
2674
  if (node.parent.type === AST_NODE_TYPES.AssignmentExpression && node.parent.left === node) {
2715
2675
  propertyDefs.get(currentClass)?.add(node.property);
2716
2676
  return;
2717
2677
  }
2718
- const propertyName = AST12.getPropertyName(node.property);
2678
+ const propertyName = AST11.getPropertyName(node.property);
2719
2679
  if (propertyName != null) {
2720
2680
  propertyUsages.get(currentClass)?.add(propertyName);
2721
2681
  }
@@ -2733,10 +2693,10 @@ var no_unused_class_component_members_default = createRule({
2733
2693
  if (!isClassComponent(currentClass) || currentMethod.static) {
2734
2694
  return;
2735
2695
  }
2736
- if (node.init != null && AST12.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern) {
2696
+ if (node.init != null && AST11.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern) {
2737
2697
  for (const prop of node.id.properties) {
2738
2698
  if (prop.type === AST_NODE_TYPES.Property && isKeyLiteral2(prop, prop.key)) {
2739
- const keyName = AST12.getPropertyName(prop.key);
2699
+ const keyName = AST11.getPropertyName(prop.key);
2740
2700
  if (keyName != null) {
2741
2701
  propertyUsages.get(currentClass)?.add(keyName);
2742
2702
  }
@@ -2748,8 +2708,8 @@ var no_unused_class_component_members_default = createRule({
2748
2708
  },
2749
2709
  defaultOptions: []
2750
2710
  });
2751
- var RULE_NAME44 = "no-unused-state";
2752
- var RULE_FEATURES44 = [
2711
+ var RULE_NAME43 = "no-unused-state";
2712
+ var RULE_FEATURES43 = [
2753
2713
  "CHK"
2754
2714
  ];
2755
2715
  function isKeyLiteral3(node, key) {
@@ -2760,14 +2720,14 @@ var no_unused_state_default = createRule({
2760
2720
  type: "problem",
2761
2721
  docs: {
2762
2722
  description: "disallow unused state of class component",
2763
- [Symbol.for("rule_features")]: RULE_FEATURES44
2723
+ [Symbol.for("rule_features")]: RULE_FEATURES43
2764
2724
  },
2765
2725
  messages: {
2766
2726
  noUnusedState: "Unused class component state in '{{className}}'"
2767
2727
  },
2768
2728
  schema: []
2769
2729
  },
2770
- name: RULE_NAME44,
2730
+ name: RULE_NAME43,
2771
2731
  create(context) {
2772
2732
  const classEntries = [];
2773
2733
  const methodEntries = [];
@@ -2781,7 +2741,7 @@ var no_unused_state_default = createRule({
2781
2741
  if (currentClass == null || !isClassComponent(currentClass)) {
2782
2742
  return;
2783
2743
  }
2784
- const className = AST12.getClassIdentifier(currentClass)?.name;
2744
+ const className = AST11.getClassIdentifier(currentClass)?.name;
2785
2745
  const { node: defNode, isUsed = false } = stateDefs.get(currentClass) ?? {};
2786
2746
  if (defNode == null || isUsed) {
2787
2747
  return;
@@ -2807,7 +2767,7 @@ var no_unused_state_default = createRule({
2807
2767
  }
2808
2768
  return;
2809
2769
  }
2810
- if (AST12.getPropertyName(node.key) === "state") {
2770
+ if (AST11.getPropertyName(node.key) === "state") {
2811
2771
  stateDefs.set(currentClass, { node: node.key, isUsed: false });
2812
2772
  }
2813
2773
  }
@@ -2841,10 +2801,10 @@ var no_unused_state_default = createRule({
2841
2801
  ClassExpression: classEnter,
2842
2802
  "ClassExpression:exit": classExit,
2843
2803
  MemberExpression(node) {
2844
- if (!AST12.isThisExpression(node.object)) {
2804
+ if (!AST11.isThisExpression(node.object)) {
2845
2805
  return;
2846
2806
  }
2847
- if (AST12.getPropertyName(node.property) !== "state") {
2807
+ if (AST11.getPropertyName(node.property) !== "state") {
2848
2808
  return;
2849
2809
  }
2850
2810
  const currentClass = classEntries.at(-1);
@@ -2885,12 +2845,12 @@ var no_unused_state_default = createRule({
2885
2845
  if (!currentClass.body.body.includes(currentMethod)) {
2886
2846
  return;
2887
2847
  }
2888
- if (node.init == null || !AST12.isThisExpression(node.init) || node.id.type !== AST_NODE_TYPES.ObjectPattern) {
2848
+ if (node.init == null || !AST11.isThisExpression(node.init) || node.id.type !== AST_NODE_TYPES.ObjectPattern) {
2889
2849
  return;
2890
2850
  }
2891
2851
  const hasState = node.id.properties.some((prop) => {
2892
2852
  if (prop.type === AST_NODE_TYPES.Property && isKeyLiteral3(prop, prop.key)) {
2893
- return AST12.getPropertyName(prop.key) === "state";
2853
+ return AST11.getPropertyName(prop.key) === "state";
2894
2854
  }
2895
2855
  return false;
2896
2856
  });
@@ -2904,8 +2864,8 @@ var no_unused_state_default = createRule({
2904
2864
  },
2905
2865
  defaultOptions: []
2906
2866
  });
2907
- var RULE_NAME45 = "no-use-context";
2908
- var RULE_FEATURES45 = [
2867
+ var RULE_NAME44 = "no-use-context";
2868
+ var RULE_FEATURES44 = [
2909
2869
  "CHK",
2910
2870
  "MOD"
2911
2871
  ];
@@ -2914,7 +2874,7 @@ var no_use_context_default = createRule({
2914
2874
  type: "problem",
2915
2875
  docs: {
2916
2876
  description: "replace usages of 'useContext' with 'use'",
2917
- [Symbol.for("rule_features")]: RULE_FEATURES45
2877
+ [Symbol.for("rule_features")]: RULE_FEATURES44
2918
2878
  },
2919
2879
  fixable: "code",
2920
2880
  messages: {
@@ -2922,7 +2882,7 @@ var no_use_context_default = createRule({
2922
2882
  },
2923
2883
  schema: []
2924
2884
  },
2925
- name: RULE_NAME45,
2885
+ name: RULE_NAME44,
2926
2886
  create(context) {
2927
2887
  if (!context.sourceCode.text.includes("useContext")) return {};
2928
2888
  const settings4 = getSettingsFromContext(context);
@@ -3003,6 +2963,46 @@ function getAssociatedTokens(context, node) {
3003
2963
  return tokens;
3004
2964
  }
3005
2965
  }
2966
+ var RULE_NAME45 = "no-useless-forward-ref";
2967
+ var RULE_FEATURES45 = [
2968
+ "CHK"
2969
+ ];
2970
+ var no_useless_forward_ref_default = createRule({
2971
+ meta: {
2972
+ type: "problem",
2973
+ docs: {
2974
+ description: "require a 'ref' parameter to be set when using 'forwardRef'",
2975
+ [Symbol.for("rule_features")]: RULE_FEATURES45
2976
+ },
2977
+ messages: {
2978
+ noUselessForwardRef: "A 'forwardRef' is used with this component but no 'ref' parameter is set."
2979
+ },
2980
+ schema: []
2981
+ },
2982
+ name: RULE_NAME45,
2983
+ create(context) {
2984
+ return {
2985
+ CallExpression(node) {
2986
+ if (!isForwardRefCall(context, node)) {
2987
+ return;
2988
+ }
2989
+ const [component] = node.arguments;
2990
+ if (component == null || !AST11.isFunction(component)) {
2991
+ return;
2992
+ }
2993
+ const ref = component.params[1];
2994
+ if (ref != null) {
2995
+ return;
2996
+ }
2997
+ context.report({
2998
+ messageId: "noUselessForwardRef",
2999
+ node: component
3000
+ });
3001
+ }
3002
+ };
3003
+ },
3004
+ defaultOptions: []
3005
+ });
3006
3006
  var RULE_NAME46 = "no-useless-fragment";
3007
3007
  var defaultOptions = [{
3008
3008
  allowExpressions: true
@@ -3021,7 +3021,7 @@ function checkAndReport(context, node, allowExpressions) {
3021
3021
  return null;
3022
3022
  }
3023
3023
  if (node.children.some(
3024
- (child) => JSX8.isLiteral(child) && !JSX8.isWhiteSpace(child) || AST12.is(AST_NODE_TYPES.JSXExpressionContainer)(child)
3024
+ (child) => JSX8.isLiteral(child) && !JSX8.isWhiteSpace(child) || AST11.is(AST_NODE_TYPES.JSXExpressionContainer)(child)
3025
3025
  )) {
3026
3026
  return null;
3027
3027
  }
@@ -3059,7 +3059,7 @@ function checkAndReport(context, node, allowExpressions) {
3059
3059
  });
3060
3060
  return;
3061
3061
  }
3062
- const isChildElement = AST12.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent);
3062
+ const isChildElement = AST11.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent);
3063
3063
  switch (true) {
3064
3064
  // <Foo content={<>ee eeee eeee ...</>} />
3065
3065
  case (allowExpressions && !isChildElement && node.children.length === 1 && JSX8.isLiteral(node.children.at(0))): {
@@ -3180,10 +3180,10 @@ var prefer_destructuring_assignment_default = createRule({
3180
3180
  ...ctx.getAllComponents(node).values()
3181
3181
  ];
3182
3182
  function isFunctionComponent(block) {
3183
- if (!AST12.isFunction(block)) {
3183
+ if (!AST11.isFunction(block)) {
3184
3184
  return false;
3185
3185
  }
3186
- const id = AST12.getFunctionIdentifier(block);
3186
+ const id = AST11.getFunctionIdentifier(block);
3187
3187
  return id != null && isComponentNameLoose(id.name) && components.some((component) => component.node === block);
3188
3188
  }
3189
3189
  for (const [initialScope, memberExpression] of memberExpressionWithNames) {
@@ -3457,7 +3457,6 @@ var plugin = {
3457
3457
  rules: {
3458
3458
  "avoid-shorthand-boolean": avoid_shorthand_boolean_default,
3459
3459
  "avoid-shorthand-fragment": avoid_shorthand_fragment_default,
3460
- "ensure-forward-ref-using-ref": ensure_forward_ref_using_ref_default,
3461
3460
  "no-access-state-in-setstate": no_access_state_in_setstate_default,
3462
3461
  "no-array-index-key": no_array_index_key_default,
3463
3462
  "no-children-count": no_children_count_default,
@@ -3500,6 +3499,7 @@ var plugin = {
3500
3499
  "no-unused-class-component-members": no_unused_class_component_members_default,
3501
3500
  "no-unused-state": no_unused_state_default,
3502
3501
  "no-use-context": no_use_context_default,
3502
+ "no-useless-forward-ref": no_useless_forward_ref_default,
3503
3503
  "no-useless-fragment": no_useless_fragment_default,
3504
3504
  "prefer-destructuring-assignment": prefer_destructuring_assignment_default,
3505
3505
  "prefer-react-namespace-import": prefer_react_namespace_import_default,
@@ -3508,6 +3508,8 @@ var plugin = {
3508
3508
  "prefer-shorthand-fragment": prefer_shorthand_fragment_default,
3509
3509
  "use-jsx-vars": use_jsx_vars_default,
3510
3510
  // Part: deprecated rules
3511
+ /** @deprecated Use `no-useless-forward-ref` instead */
3512
+ "ensure-forward-ref-using-ref": no_useless_forward_ref_default,
3511
3513
  /** @deprecated Use `no-duplicate-jsx-props` instead */
3512
3514
  "jsx-no-duplicate-props": no_duplicate_jsx_props_default,
3513
3515
  /** @deprecated Use `use-jsx-vars` instead */