eslint-plugin-react-x 1.23.2 → 1.23.3-beta.2

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.
Files changed (3) hide show
  1. package/dist/index.js +524 -190
  2. package/dist/index.mjs +525 -191
  3. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ var ts__default = /*#__PURE__*/_interopDefault(ts);
42
42
 
43
43
  // package.json
44
44
  var name = "eslint-plugin-react-x";
45
- var version = "1.23.2";
45
+ var version = "1.23.3-beta.2";
46
46
  var createRule = shared.createRuleForPlugin("x");
47
47
 
48
48
  // src/rules/avoid-shorthand-boolean.ts
@@ -132,11 +132,17 @@ var ensure_forward_ref_using_ref_default = createRule({
132
132
  create(context) {
133
133
  return {
134
134
  CallExpression(node) {
135
- if (!core.isForwardRefCall(node, context)) return;
135
+ if (!core.isForwardRefCall(node, context)) {
136
+ return;
137
+ }
136
138
  const [component] = node.arguments;
137
- if (!component || !AST11__namespace.isFunction(component)) return;
139
+ if (!component || !AST11__namespace.isFunction(component)) {
140
+ return;
141
+ }
138
142
  const [_, ref] = component.params;
139
- if (ref) return;
143
+ if (ref) {
144
+ return;
145
+ }
140
146
  context.report({
141
147
  messageId: "ensureForwardRefUsingRef",
142
148
  node: component
@@ -179,17 +185,23 @@ var no_access_state_in_setstate_default = createRule({
179
185
  },
180
186
  name: RULE_NAME4,
181
187
  create(context) {
182
- if (!context.sourceCode.text.includes("setState")) return {};
188
+ if (!context.sourceCode.text.includes("setState")) {
189
+ return {};
190
+ }
183
191
  const classStack = [];
184
192
  const methodStack = [];
185
193
  const setStateStack = [];
186
194
  return {
187
195
  CallExpression(node) {
188
- if (!core.isThisSetState(node)) return;
196
+ if (!core.isThisSetState(node)) {
197
+ return;
198
+ }
189
199
  setStateStack.push([node, false]);
190
200
  },
191
201
  "CallExpression:exit"(node) {
192
- if (!core.isThisSetState(node)) return;
202
+ if (!core.isThisSetState(node)) {
203
+ return;
204
+ }
193
205
  setStateStack.pop();
194
206
  },
195
207
  ClassDeclaration(node) {
@@ -205,14 +217,24 @@ var no_access_state_in_setstate_default = createRule({
205
217
  classStack.pop();
206
218
  },
207
219
  MemberExpression(node) {
208
- if (!AST11__namespace.isThisExpression(node.object)) return;
220
+ if (!AST11__namespace.isThisExpression(node.object)) {
221
+ return;
222
+ }
209
223
  const [currClass, isComponent] = classStack.at(-1) ?? [];
210
- if (!currClass || !isComponent) return;
224
+ if (!currClass || !isComponent) {
225
+ return;
226
+ }
211
227
  const [currMethod, isStatic] = methodStack.at(-1) ?? [];
212
- if (!currMethod || isStatic) return;
228
+ if (!currMethod || isStatic) {
229
+ return;
230
+ }
213
231
  const [setState, hasThisState] = setStateStack.at(-1) ?? [];
214
- if (!setState || hasThisState) return;
215
- if (!eff.O.exists(getName(node.property), (name2) => name2 === "state")) return;
232
+ if (!setState || hasThisState) {
233
+ return;
234
+ }
235
+ if (!eff.O.exists(getName(node.property), (name2) => name2 === "state")) {
236
+ return;
237
+ }
216
238
  context.report({ messageId: "noAccessStateInSetstate", node });
217
239
  },
218
240
  MethodDefinition(node) {
@@ -229,19 +251,29 @@ var no_access_state_in_setstate_default = createRule({
229
251
  },
230
252
  VariableDeclarator(node) {
231
253
  const [currClass, isComponent] = classStack.at(-1) ?? [];
232
- if (!currClass || !isComponent) return;
254
+ if (!currClass || !isComponent) {
255
+ return;
256
+ }
233
257
  const [currMethod, isStatic] = methodStack.at(-1) ?? [];
234
- if (!currMethod || isStatic) return;
258
+ if (!currMethod || isStatic) {
259
+ return;
260
+ }
235
261
  const [setState, hasThisState] = setStateStack.at(-1) ?? [];
236
- if (!setState || hasThisState) return;
237
- if (!(node.init && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern)) return;
262
+ if (!setState || hasThisState) {
263
+ return;
264
+ }
265
+ if (!(node.init && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern)) {
266
+ return;
267
+ }
238
268
  const hasState = node.id.properties.some((prop) => {
239
269
  if (prop.type === types.AST_NODE_TYPES.Property && AST11__namespace.isKeyLiteralLike(prop, prop.key)) {
240
270
  return eff.O.exists(getName(prop.key), (name2) => name2 === "state");
241
271
  }
242
272
  return false;
243
273
  });
244
- if (!hasState) return;
274
+ if (!hasState) {
275
+ return;
276
+ }
245
277
  context.report({ messageId: "noAccessStateInSetstate", node });
246
278
  }
247
279
  };
@@ -286,9 +318,13 @@ function isUsingReactChildren(node, context) {
286
318
  if (!("property" in callee) || !("object" in callee) || !("name" in callee.property)) {
287
319
  return false;
288
320
  }
289
- if (!isReactChildrenMethod(callee.property.name)) return false;
321
+ if (!isReactChildrenMethod(callee.property.name)) {
322
+ return false;
323
+ }
290
324
  const initialScope = context.sourceCode.getScope(node);
291
- if (callee.object.type === types.AST_NODE_TYPES.Identifier && callee.object.name === "Children") return true;
325
+ if (callee.object.type === types.AST_NODE_TYPES.Identifier && callee.object.name === "Children") {
326
+ return true;
327
+ }
292
328
  if (callee.object.type === types.AST_NODE_TYPES.MemberExpression && "name" in callee.object.object) {
293
329
  return core.isInitializedFromReact(callee.object.object.name, initialScope, settings.importSource);
294
330
  }
@@ -296,19 +332,31 @@ function isUsingReactChildren(node, context) {
296
332
  }
297
333
  function getMapIndexParamName(node, context) {
298
334
  const { callee } = node;
299
- if (callee.type !== types.AST_NODE_TYPES.MemberExpression) return eff.O.none();
300
- if (callee.property.type !== types.AST_NODE_TYPES.Identifier) return eff.O.none();
335
+ if (callee.type !== types.AST_NODE_TYPES.MemberExpression) {
336
+ return eff.O.none();
337
+ }
338
+ if (callee.property.type !== types.AST_NODE_TYPES.Identifier) {
339
+ return eff.O.none();
340
+ }
301
341
  const { name: name2 } = callee.property;
302
- if (!iteratorFunctionIndexParamPosition.has(name2)) return eff.O.none();
342
+ if (!iteratorFunctionIndexParamPosition.has(name2)) {
343
+ return eff.O.none();
344
+ }
303
345
  const callbackArg = node.arguments[isUsingReactChildren(node, context) ? 1 : 0];
304
- if (!callbackArg) return eff.O.none();
346
+ if (!callbackArg) {
347
+ return eff.O.none();
348
+ }
305
349
  if (!AST11__namespace.isOneOf([types.AST_NODE_TYPES.ArrowFunctionExpression, types.AST_NODE_TYPES.FunctionExpression])(callbackArg)) {
306
350
  return eff.O.none();
307
351
  }
308
352
  const { params } = callbackArg;
309
353
  const indexParamPosition = iteratorFunctionIndexParamPosition.get(name2);
310
- if (eff.isNullable(indexParamPosition)) return eff.O.none();
311
- if (params.length < indexParamPosition + 1) return eff.O.none();
354
+ if (eff.isNullable(indexParamPosition)) {
355
+ return eff.O.none();
356
+ }
357
+ if (params.length < indexParamPosition + 1) {
358
+ return eff.O.none();
359
+ }
312
360
  const param = params.at(indexParamPosition);
313
361
  return param && "name" in param ? eff.O.some(param.name) : eff.O.none();
314
362
  }
@@ -332,16 +380,22 @@ var no_array_index_key_default = createRule({
332
380
  return node.type === types.AST_NODE_TYPES.Identifier && indexParamNames.some(eff.O.exists((name2) => name2 === node.name));
333
381
  }
334
382
  function getReportDescriptor(node) {
335
- if (isArrayIndex(node)) return [{ messageId: "noArrayIndexKey", node }];
383
+ if (isArrayIndex(node)) {
384
+ return [{ messageId: "noArrayIndexKey", node }];
385
+ }
336
386
  if (AST11__namespace.isOneOf([types.AST_NODE_TYPES.TemplateLiteral, types.AST_NODE_TYPES.BinaryExpression])(node)) {
337
387
  const exps = types.AST_NODE_TYPES.TemplateLiteral === node.type ? node.expressions : AST11__namespace.getIdentifiersFromBinaryExpression(node);
338
388
  return exps.reduce((acc, exp) => {
339
- if (isArrayIndex(exp)) return [...acc, { messageId: "noArrayIndexKey", node: exp }];
389
+ if (isArrayIndex(exp)) {
390
+ return [...acc, { messageId: "noArrayIndexKey", node: exp }];
391
+ }
340
392
  return acc;
341
393
  }, []);
342
394
  }
343
395
  if (isToStringCall(node)) {
344
- if (!("object" in node.callee && isArrayIndex(node.callee.object))) return [];
396
+ if (!("object" in node.callee && isArrayIndex(node.callee.object))) {
397
+ return [];
398
+ }
345
399
  return [{ messageId: "noArrayIndexKey", node: node.callee.object }];
346
400
  }
347
401
  const isStringCall = tsPattern.isMatching({
@@ -353,20 +407,32 @@ var no_array_index_key_default = createRule({
353
407
  }, node);
354
408
  if (isStringCall) {
355
409
  const [arg] = node.arguments;
356
- if (arg && isArrayIndex(arg)) return [{ messageId: "noArrayIndexKey", node: arg }];
410
+ if (arg && isArrayIndex(arg)) {
411
+ return [{ messageId: "noArrayIndexKey", node: arg }];
412
+ }
357
413
  }
358
414
  return [];
359
415
  }
360
416
  return {
361
417
  CallExpression(node) {
362
418
  indexParamNames.push(getMapIndexParamName(node, context));
363
- if (node.arguments.length === 0) return;
364
- if (!isCreateOrCloneElementCall(node)) return;
419
+ if (node.arguments.length === 0) {
420
+ return;
421
+ }
422
+ if (!isCreateOrCloneElementCall(node)) {
423
+ return;
424
+ }
365
425
  const [_, props] = node.arguments;
366
- if (props?.type !== types.AST_NODE_TYPES.ObjectExpression) return;
426
+ if (props?.type !== types.AST_NODE_TYPES.ObjectExpression) {
427
+ return;
428
+ }
367
429
  for (const prop of props.properties) {
368
- if (!tsPattern.isMatching({ key: { name: "key" } })(prop)) continue;
369
- if (!("value" in prop)) continue;
430
+ if (!tsPattern.isMatching({ key: { name: "key" } })(prop)) {
431
+ continue;
432
+ }
433
+ if (!("value" in prop)) {
434
+ continue;
435
+ }
370
436
  const descriptors = getReportDescriptor(prop.value);
371
437
  for (const descriptor of descriptors) {
372
438
  context.report(descriptor);
@@ -377,10 +443,16 @@ var no_array_index_key_default = createRule({
377
443
  indexParamNames.pop();
378
444
  },
379
445
  JSXAttribute(node) {
380
- if (node.name.name !== "key") return;
381
- if (indexParamNames.length === 0) return;
446
+ if (node.name.name !== "key") {
447
+ return;
448
+ }
449
+ if (indexParamNames.length === 0) {
450
+ return;
451
+ }
382
452
  const { value } = node;
383
- if (value?.type !== types.AST_NODE_TYPES.JSXExpressionContainer) return;
453
+ if (value?.type !== types.AST_NODE_TYPES.JSXExpressionContainer) {
454
+ return;
455
+ }
384
456
  const descriptors = getReportDescriptor(value.expression);
385
457
  for (const descriptor of descriptors) {
386
458
  context.report(descriptor);
@@ -578,22 +650,12 @@ var RULE_NAME12 = "no-class-component";
578
650
  var RULE_FEATURES12 = [
579
651
  "CHK"
580
652
  ];
581
- var isComponentDidCatch = tsPattern.isMatching({
582
- key: {
583
- type: types.AST_NODE_TYPES.Identifier,
584
- name: "componentDidCatch"
585
- },
586
- type: tsPattern.P.union(types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition),
587
- static: false
588
- });
589
- var isGetDerivedStateFromError = tsPattern.isMatching({
590
- key: {
591
- type: types.AST_NODE_TYPES.Identifier,
592
- name: "getDerivedStateFromError"
593
- },
594
- type: tsPattern.P.union(types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition),
595
- static: true
596
- });
653
+ function isComponentDidCatch(node) {
654
+ return (node.type === types.AST_NODE_TYPES.MethodDefinition || node.type === types.AST_NODE_TYPES.PropertyDefinition) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidCatch";
655
+ }
656
+ function isGetDerivedStateFromError(node) {
657
+ return (node.type === types.AST_NODE_TYPES.MethodDefinition || node.type === types.AST_NODE_TYPES.PropertyDefinition) && node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromError";
658
+ }
597
659
  var no_class_component_default = createRule({
598
660
  meta: {
599
661
  type: "problem",
@@ -608,14 +670,18 @@ var no_class_component_default = createRule({
608
670
  },
609
671
  name: RULE_NAME12,
610
672
  create(context) {
611
- if (!context.sourceCode.text.includes("Component")) return {};
673
+ if (!context.sourceCode.text.includes("Component")) {
674
+ return {};
675
+ }
612
676
  const { ctx, listeners } = core.useComponentCollectorLegacy();
613
677
  return {
614
678
  ...listeners,
615
679
  "Program:exit"(node) {
616
680
  const components = ctx.getAllComponents(node);
617
681
  for (const { name: name2, node: component } of components.values()) {
618
- if (component.body.body.some((m) => isComponentDidCatch(m) || isGetDerivedStateFromError(m))) continue;
682
+ if (component.body.body.some((m) => isComponentDidCatch(m) || isGetDerivedStateFromError(m))) {
683
+ continue;
684
+ }
619
685
  context.report({
620
686
  messageId: "noClassComponent",
621
687
  node: component,
@@ -650,7 +716,9 @@ var no_clone_element_default = createRule({
650
716
  create(context) {
651
717
  return {
652
718
  CallExpression(node) {
653
- if (!core.isCloneElementCall(node, context)) return;
719
+ if (!core.isCloneElementCall(node, context)) {
720
+ return;
721
+ }
654
722
  context.report({
655
723
  messageId: "noCloneElement",
656
724
  node
@@ -679,14 +747,22 @@ var no_comment_textnodes_default = createRule({
679
747
  name: RULE_NAME14,
680
748
  create(context) {
681
749
  function hasCommentLike(node) {
682
- if (AST11__namespace.isOneOf([types.AST_NODE_TYPES.JSXAttribute, types.AST_NODE_TYPES.JSXExpressionContainer])(node.parent)) return false;
750
+ if (AST11__namespace.isOneOf([types.AST_NODE_TYPES.JSXAttribute, types.AST_NODE_TYPES.JSXExpressionContainer])(node.parent)) {
751
+ return false;
752
+ }
683
753
  const rawValue = context.sourceCode.getText(node);
684
754
  return /^\s*\/(?:\/|\*)/mu.test(rawValue);
685
755
  }
686
756
  const getReportDescriptor = (node) => {
687
- if (!AST11__namespace.isOneOf([types.AST_NODE_TYPES.JSXElement, types.AST_NODE_TYPES.JSXFragment])(node.parent)) return eff.O.none();
688
- if (!hasCommentLike(node)) return eff.O.none();
689
- if (!node.parent.type.includes("JSX")) return eff.O.none();
757
+ if (!AST11__namespace.isOneOf([types.AST_NODE_TYPES.JSXElement, types.AST_NODE_TYPES.JSXFragment])(node.parent)) {
758
+ return eff.O.none();
759
+ }
760
+ if (!hasCommentLike(node)) {
761
+ return eff.O.none();
762
+ }
763
+ if (!node.parent.type.includes("JSX")) {
764
+ return eff.O.none();
765
+ }
690
766
  return eff.O.some({
691
767
  messageId: "noCommentTextnodes",
692
768
  node
@@ -720,11 +796,15 @@ var no_complex_conditional_rendering_default = createRule({
720
796
  create(context) {
721
797
  function getReportDescriptor(node) {
722
798
  const jsxExpContainer = node.parent?.parent;
723
- if (!AST11__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer)(jsxExpContainer)) return eff.O.none();
799
+ if (!AST11__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer)(jsxExpContainer)) {
800
+ return eff.O.none();
801
+ }
724
802
  if (!AST11__namespace.isOneOf([types.AST_NODE_TYPES.JSXElement, types.AST_NODE_TYPES.JSXFragment])(jsxExpContainer.parent)) {
725
803
  return eff.O.none();
726
804
  }
727
- if (!jsxExpContainer.parent.children.includes(jsxExpContainer)) return eff.O.none();
805
+ if (!jsxExpContainer.parent.children.includes(jsxExpContainer)) {
806
+ return eff.O.none();
807
+ }
728
808
  return eff.O.some({ messageId: "noComplexConditionalRendering", node: jsxExpContainer });
729
809
  }
730
810
  const visitorFunction = eff.F.flow(getReportDescriptor, eff.O.map(context.report), eff.F.constVoid);
@@ -761,7 +841,9 @@ var no_component_will_mount_default = createRule({
761
841
  },
762
842
  name: RULE_NAME16,
763
843
  create(context) {
764
- if (!context.sourceCode.text.includes("componentWillMount")) return {};
844
+ if (!context.sourceCode.text.includes("componentWillMount")) {
845
+ return {};
846
+ }
765
847
  const { ctx, listeners } = core.useComponentCollectorLegacy();
766
848
  return {
767
849
  ...listeners,
@@ -775,7 +857,9 @@ var no_component_will_mount_default = createRule({
775
857
  messageId: "noComponentWillMount",
776
858
  node: member,
777
859
  fix(fixer) {
778
- if (!("key" in member)) return null;
860
+ if (!("key" in member)) {
861
+ return null;
862
+ }
779
863
  return fixer.replaceText(member.key, "UNSAFE_componentWillMount");
780
864
  }
781
865
  });
@@ -810,7 +894,9 @@ var no_component_will_receive_props_default = createRule({
810
894
  },
811
895
  name: RULE_NAME17,
812
896
  create(context) {
813
- if (!context.sourceCode.text.includes("componentWillReceiveProps")) return {};
897
+ if (!context.sourceCode.text.includes("componentWillReceiveProps")) {
898
+ return {};
899
+ }
814
900
  const { ctx, listeners } = core.useComponentCollectorLegacy();
815
901
  return {
816
902
  ...listeners,
@@ -824,7 +910,9 @@ var no_component_will_receive_props_default = createRule({
824
910
  messageId: "noComponentWillReceiveProps",
825
911
  node: member,
826
912
  fix(fixer) {
827
- if (!("key" in member)) return null;
913
+ if (!("key" in member)) {
914
+ return null;
915
+ }
828
916
  return fixer.replaceText(member.key, "UNSAFE_componentWillReceiveProps");
829
917
  }
830
918
  });
@@ -859,7 +947,9 @@ var no_component_will_update_default = createRule({
859
947
  },
860
948
  name: RULE_NAME18,
861
949
  create(context) {
862
- if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
950
+ if (!context.sourceCode.text.includes("componentWillUpdate")) {
951
+ return {};
952
+ }
863
953
  const { ctx, listeners } = core.useComponentCollectorLegacy();
864
954
  return {
865
955
  ...listeners,
@@ -873,7 +963,9 @@ var no_component_will_update_default = createRule({
873
963
  messageId: "noComponentWillUpdate",
874
964
  node: member,
875
965
  fix(fixer) {
876
- if (!("key" in member)) return null;
966
+ if (!("key" in member)) {
967
+ return null;
968
+ }
877
969
  return fixer.replaceText(member.key, "UNSAFE_componentWillUpdate");
878
970
  }
879
971
  });
@@ -905,13 +997,19 @@ var no_context_provider_default = createRule({
905
997
  },
906
998
  name: RULE_NAME19,
907
999
  create(context) {
908
- if (!context.sourceCode.text.includes(".Provider")) return {};
1000
+ if (!context.sourceCode.text.includes(".Provider")) {
1001
+ return {};
1002
+ }
909
1003
  const { version: version2 } = shared.getSettingsFromContext(context);
910
- if (compareVersions.compare(version2, "19.0.0", "<")) return {};
1004
+ if (compareVersions.compare(version2, "19.0.0", "<")) {
1005
+ return {};
1006
+ }
911
1007
  return {
912
1008
  JSXElement(node) {
913
1009
  const elementName = JSX7__namespace.getElementName(node.openingElement);
914
- if (!elementName.endsWith(".Provider")) return;
1010
+ if (!elementName.endsWith(".Provider")) {
1011
+ return;
1012
+ }
915
1013
  context.report({
916
1014
  messageId: "noContextProvider",
917
1015
  node,
@@ -919,7 +1017,9 @@ var no_context_provider_default = createRule({
919
1017
  const providerName = elementName.replace(/\.Provider$/, "");
920
1018
  const openingElement = node.openingElement;
921
1019
  const closingElement = node.closingElement;
922
- if (!closingElement) return fixer.replaceText(openingElement.name, providerName);
1020
+ if (!closingElement) {
1021
+ return fixer.replaceText(openingElement.name, providerName);
1022
+ }
923
1023
  return [
924
1024
  fixer.replaceText(openingElement.name, providerName),
925
1025
  fixer.replaceText(closingElement.name, providerName)
@@ -951,8 +1051,12 @@ var no_create_ref_default = createRule({
951
1051
  create(context) {
952
1052
  return {
953
1053
  CallExpression(node) {
954
- if (!core.isCreateRefCall(node, context)) return;
955
- if (eff.O.isSome(AST11__namespace.findParentNode(node, core.isClassComponent))) return;
1054
+ if (!core.isCreateRefCall(node, context)) {
1055
+ return;
1056
+ }
1057
+ if (eff.O.isSome(AST11__namespace.findParentNode(node, core.isClassComponent))) {
1058
+ return;
1059
+ }
956
1060
  context.report({ messageId: "noCreateRef", node });
957
1061
  }
958
1062
  };
@@ -977,25 +1081,41 @@ var no_default_props_default = createRule({
977
1081
  },
978
1082
  name: RULE_NAME21,
979
1083
  create(context) {
980
- if (!context.sourceCode.text.includes("defaultProps")) return {};
1084
+ if (!context.sourceCode.text.includes("defaultProps")) {
1085
+ return {};
1086
+ }
981
1087
  return {
982
1088
  AssignmentExpression(node) {
983
- if (node.operator !== "=" || node.left.type !== types.AST_NODE_TYPES.MemberExpression) return;
1089
+ if (node.operator !== "=" || node.left.type !== types.AST_NODE_TYPES.MemberExpression) {
1090
+ return;
1091
+ }
984
1092
  const { object, property } = node.left;
985
- if (object.type !== types.AST_NODE_TYPES.Identifier) return;
986
- if (property.type !== types.AST_NODE_TYPES.Identifier || property.name !== "defaultProps") return;
987
- if (!core.isComponentName(object.name)) return;
1093
+ if (object.type !== types.AST_NODE_TYPES.Identifier) {
1094
+ return;
1095
+ }
1096
+ if (property.type !== types.AST_NODE_TYPES.Identifier || property.name !== "defaultProps") {
1097
+ return;
1098
+ }
1099
+ if (!core.isComponentName(object.name)) {
1100
+ return;
1101
+ }
988
1102
  const isComponent = eff.F.pipe(
989
1103
  VAR__namespace.findVariable(object.name, context.sourceCode.getScope(node)),
990
1104
  eff.O.flatMap(VAR__namespace.getVariableNode(0)),
991
1105
  eff.O.exists((n) => AST11__namespace.isFunction(n) || core.isClassComponent(n))
992
1106
  );
993
- if (!isComponent) return;
1107
+ if (!isComponent) {
1108
+ return;
1109
+ }
994
1110
  context.report({ messageId: "noDefaultProps", node: property });
995
1111
  },
996
1112
  PropertyDefinition(node) {
997
- if (!core.isClassComponent(node.parent.parent)) return;
998
- if (!node.static || node.key.type !== types.AST_NODE_TYPES.Identifier || node.key.name !== "defaultProps") return;
1113
+ if (!core.isClassComponent(node.parent.parent)) {
1114
+ return;
1115
+ }
1116
+ if (!node.static || node.key.type !== types.AST_NODE_TYPES.Identifier || node.key.name !== "defaultProps") {
1117
+ return;
1118
+ }
999
1119
  context.report({ messageId: "noDefaultProps", node });
1000
1120
  }
1001
1121
  };
@@ -1043,7 +1163,9 @@ var no_direct_mutation_state_default = createRule({
1043
1163
  name: RULE_NAME22,
1044
1164
  create(context) {
1045
1165
  function getReportDescriptor(node) {
1046
- if (!isAssignmentToThisState(node)) return eff.O.none();
1166
+ if (!isAssignmentToThisState(node)) {
1167
+ return eff.O.none();
1168
+ }
1047
1169
  return eff.F.pipe(
1048
1170
  eff.O.Do,
1049
1171
  eff.O.bind("parentClass", () => AST11__namespace.findParentNodeGuard(
@@ -1091,9 +1213,13 @@ var no_duplicate_jsx_props_default = createRule({
1091
1213
  JSXOpeningElement(node) {
1092
1214
  const props = [];
1093
1215
  for (const attr of node.attributes) {
1094
- if (attr.type === types.AST_NODE_TYPES.JSXSpreadAttribute) continue;
1216
+ if (attr.type === types.AST_NODE_TYPES.JSXSpreadAttribute) {
1217
+ continue;
1218
+ }
1095
1219
  const name2 = attr.name.name;
1096
- if (!eff.isString(name2)) continue;
1220
+ if (!eff.isString(name2)) {
1221
+ continue;
1222
+ }
1097
1223
  if (!props.includes(name2)) {
1098
1224
  props.push(name2);
1099
1225
  continue;
@@ -1126,12 +1252,16 @@ var no_duplicate_key_default = createRule({
1126
1252
  },
1127
1253
  name: RULE_NAME24,
1128
1254
  create(context) {
1129
- if (!context.sourceCode.getText().includes("key=")) return {};
1255
+ if (!context.sourceCode.getText().includes("key=")) {
1256
+ return {};
1257
+ }
1130
1258
  const keyedEntries = /* @__PURE__ */ new Map();
1131
1259
  function isKeyValueEqual(a, b) {
1132
1260
  const aValue = a.value;
1133
1261
  const bValue = b.value;
1134
- if (aValue === null || bValue === null) return false;
1262
+ if (aValue === null || bValue === null) {
1263
+ return false;
1264
+ }
1135
1265
  return AST11__namespace.isNodeEqual(aValue, bValue);
1136
1266
  }
1137
1267
  return {
@@ -1157,9 +1287,13 @@ var no_duplicate_key_default = createRule({
1157
1287
  eff.O.bind("iter", ({ call: call2 }) => AST11__namespace.findParentNodeStop(jsxElement, call2, AST11__namespace.isFunction)),
1158
1288
  eff.O.bind("arg0", ({ call: call2 }) => eff.O.fromNullable(call2.arguments[0]))
1159
1289
  );
1160
- if (eff.O.isNone(mbEntry)) return;
1290
+ if (eff.O.isNone(mbEntry)) {
1291
+ return;
1292
+ }
1161
1293
  const { arg0, call, iter } = mbEntry.value;
1162
- if (AST11__namespace.unwrapTypeExpression(arg0) !== iter) return;
1294
+ if (AST11__namespace.unwrapTypeExpression(arg0) !== iter) {
1295
+ return;
1296
+ }
1163
1297
  keyedEntries.set(call, {
1164
1298
  hasDuplicate: node.value?.type === types.AST_NODE_TYPES.Literal,
1165
1299
  keys: [node],
@@ -1170,7 +1304,9 @@ var no_duplicate_key_default = createRule({
1170
1304
  },
1171
1305
  "Program:exit"() {
1172
1306
  for (const { hasDuplicate, keys } of keyedEntries.values()) {
1173
- if (!hasDuplicate) continue;
1307
+ if (!hasDuplicate) {
1308
+ continue;
1309
+ }
1174
1310
  for (const key of keys) {
1175
1311
  context.report({
1176
1312
  messageId: "noDuplicateKey",
@@ -1206,12 +1342,18 @@ var no_forward_ref_default = createRule({
1206
1342
  },
1207
1343
  name: RULE_NAME25,
1208
1344
  create(context) {
1209
- if (!context.sourceCode.text.includes("forwardRef")) return {};
1345
+ if (!context.sourceCode.text.includes("forwardRef")) {
1346
+ return {};
1347
+ }
1210
1348
  const { version: version2 } = shared.getSettingsFromContext(context);
1211
- if (compareVersions.compare(version2, "19.0.0", "<")) return {};
1349
+ if (compareVersions.compare(version2, "19.0.0", "<")) {
1350
+ return {};
1351
+ }
1212
1352
  return {
1213
1353
  CallExpression(node) {
1214
- if (!core.isForwardRefCall(node, context)) return;
1354
+ if (!core.isForwardRefCall(node, context)) {
1355
+ return;
1356
+ }
1215
1357
  context.report({
1216
1358
  messageId: "noForwardRef",
1217
1359
  node,
@@ -1225,7 +1367,9 @@ var no_forward_ref_default = createRule({
1225
1367
  function getFix(node, context) {
1226
1368
  return (fixer) => {
1227
1369
  const [componentNode] = node.arguments;
1228
- if (!componentNode || !AST11__namespace.isFunction(componentNode)) return [];
1370
+ if (!componentNode || !AST11__namespace.isFunction(componentNode)) {
1371
+ return [];
1372
+ }
1229
1373
  return [
1230
1374
  // unwrap component from forwardRef call
1231
1375
  fixer.removeRange([node.range[0], componentNode.range[0]]),
@@ -1244,10 +1388,14 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
1244
1388
  const getText = (node2) => context.sourceCode.getText(node2);
1245
1389
  const [arg0, arg1] = node.params;
1246
1390
  const [typeArg0, typeArg1] = typeArguments;
1247
- if (!arg0) return [];
1391
+ if (!arg0) {
1392
+ return [];
1393
+ }
1248
1394
  const fixedArg0Text = tsPattern.match(arg0).with({ type: types.AST_NODE_TYPES.Identifier }, (n) => eff.O.some(`...${n.name}`)).with({ type: types.AST_NODE_TYPES.ObjectPattern }, (n) => eff.O.some(n.properties.map(getText).join(", "))).otherwise(eff.O.none);
1249
1395
  const fixedArg1Text = tsPattern.match(arg1).with(tsPattern.P.nullish, () => eff.O.some("ref")).with({ type: types.AST_NODE_TYPES.Identifier, name: "ref" }, () => eff.O.some("ref")).with({ type: types.AST_NODE_TYPES.Identifier, name: tsPattern.P.not("ref") }, (n) => eff.O.some(`ref: ${n.name}`)).otherwise(eff.O.none);
1250
- if (eff.O.isNone(fixedArg0Text) || eff.O.isNone(fixedArg1Text)) return [];
1396
+ if (eff.O.isNone(fixedArg0Text) || eff.O.isNone(fixedArg1Text)) {
1397
+ return [];
1398
+ }
1251
1399
  const fixedPropsText = fixedArg0Text.value;
1252
1400
  const fixedRefText = fixedArg1Text.value;
1253
1401
  if (!typeArg0 || !typeArg1) {
@@ -1427,7 +1575,9 @@ var no_leaked_conditional_rendering_default = createRule({
1427
1575
  },
1428
1576
  name: RULE_NAME27,
1429
1577
  create(context) {
1430
- if (!context.sourceCode.text.includes("&&") && !context.sourceCode.text.includes("?")) return {};
1578
+ if (!context.sourceCode.text.includes("&&") && !context.sourceCode.text.includes("?")) {
1579
+ return {};
1580
+ }
1431
1581
  const { version: version2 } = shared.getSettingsFromContext(context);
1432
1582
  const allowedVariants = [
1433
1583
  "any",
@@ -1445,7 +1595,9 @@ var no_leaked_conditional_rendering_default = createRule({
1445
1595
  function getReportDescriptor(node) {
1446
1596
  return tsPattern.match(node).when(AST11__namespace.isJSX, eff.O.none).with({ type: types.AST_NODE_TYPES.LogicalExpression, operator: "&&" }, ({ left, right }) => {
1447
1597
  const isLeftUnaryNot = tsPattern.isMatching({ type: types.AST_NODE_TYPES.UnaryExpression, operator: "!" }, left);
1448
- if (isLeftUnaryNot) return getReportDescriptor(right);
1598
+ if (isLeftUnaryNot) {
1599
+ return getReportDescriptor(right);
1600
+ }
1449
1601
  const initialScope = context.sourceCode.getScope(left);
1450
1602
  const isLeftNan = tsPattern.isMatching({ type: types.AST_NODE_TYPES.Identifier, name: "NaN" }, left) || eff.O.exists(VAR__namespace.getStaticValue(left, initialScope), (v) => v === "NaN");
1451
1603
  if (isLeftNan) {
@@ -1458,7 +1610,9 @@ var no_leaked_conditional_rendering_default = createRule({
1458
1610
  const leftType = typeUtils.getConstrainedTypeAtLocation(services, left);
1459
1611
  const leftTypeVariants = inspectVariantTypes(tsApiUtils.unionTypeParts(leftType));
1460
1612
  const isLeftValid = Array.from(leftTypeVariants.values()).every((type) => allowedVariants.some((allowed) => allowed === type));
1461
- if (isLeftValid) return getReportDescriptor(right);
1613
+ if (isLeftValid) {
1614
+ return getReportDescriptor(right);
1615
+ }
1462
1616
  return eff.O.some({
1463
1617
  messageId: "noLeakedConditionalRendering",
1464
1618
  node: left,
@@ -1500,7 +1654,9 @@ var no_missing_component_display_name_default = createRule({
1500
1654
  },
1501
1655
  name: RULE_NAME28,
1502
1656
  create(context) {
1503
- if (!context.sourceCode.text.includes("memo") && !context.sourceCode.text.includes("forwardRef")) return {};
1657
+ if (!context.sourceCode.text.includes("memo") && !context.sourceCode.text.includes("forwardRef")) {
1658
+ return {};
1659
+ }
1504
1660
  const { ctx, listeners } = core.useComponentCollector(context);
1505
1661
  return {
1506
1662
  ...listeners,
@@ -1508,8 +1664,12 @@ var no_missing_component_display_name_default = createRule({
1508
1664
  const components = ctx.getAllComponents(node);
1509
1665
  for (const { node: node2, displayName, flag } of components.values()) {
1510
1666
  const isMemoOrForwardRef = Boolean(flag & core.ERFunctionComponentFlag.ForwardRef) || Boolean(flag & core.ERFunctionComponentFlag.Memo);
1511
- if (eff.O.isSome(AST11__namespace.getFunctionIdentifier(node2))) continue;
1512
- if (!isMemoOrForwardRef) continue;
1667
+ if (eff.O.isSome(AST11__namespace.getFunctionIdentifier(node2))) {
1668
+ continue;
1669
+ }
1670
+ if (!isMemoOrForwardRef) {
1671
+ continue;
1672
+ }
1513
1673
  if (eff.O.isNone(displayName)) {
1514
1674
  context.report({
1515
1675
  messageId: "noMissingComponentDisplayName",
@@ -1567,13 +1727,17 @@ var no_missing_key_default = createRule({
1567
1727
  function checkExpression(node) {
1568
1728
  switch (node.type) {
1569
1729
  case types.AST_NODE_TYPES.ConditionalExpression:
1570
- if (!("consequent" in node)) return eff.O.none();
1730
+ if (!("consequent" in node)) {
1731
+ return eff.O.none();
1732
+ }
1571
1733
  return eff.O.orElse(checkIteratorElement(node.consequent), () => checkIteratorElement(node.alternate));
1572
1734
  case types.AST_NODE_TYPES.JSXElement:
1573
1735
  case types.AST_NODE_TYPES.JSXFragment:
1574
1736
  return checkIteratorElement(node);
1575
1737
  case types.AST_NODE_TYPES.LogicalExpression:
1576
- if (!("left" in node)) return eff.O.none();
1738
+ if (!("left" in node)) {
1739
+ return eff.O.none();
1740
+ }
1577
1741
  return eff.O.orElse(checkIteratorElement(node.left), () => checkIteratorElement(node.right));
1578
1742
  default:
1579
1743
  return eff.O.none();
@@ -1581,16 +1745,22 @@ var no_missing_key_default = createRule({
1581
1745
  }
1582
1746
  function checkBlockStatement(node) {
1583
1747
  return AST11__namespace.getNestedReturnStatements(node).reduce((acc, statement) => {
1584
- if (!statement.argument) return acc;
1748
+ if (!statement.argument) {
1749
+ return acc;
1750
+ }
1585
1751
  const mbDescriptor = checkIteratorElement(statement.argument);
1586
1752
  return eff.O.isNone(mbDescriptor) ? acc : [...acc, mbDescriptor.value];
1587
1753
  }, []);
1588
1754
  }
1589
1755
  return {
1590
1756
  ArrayExpression(node) {
1591
- if (state.isWithinChildrenToArray) return;
1757
+ if (state.isWithinChildrenToArray) {
1758
+ return;
1759
+ }
1592
1760
  const elements = node.elements.filter(AST11__namespace.is(types.AST_NODE_TYPES.JSXElement));
1593
- if (elements.length === 0) return;
1761
+ if (elements.length === 0) {
1762
+ return;
1763
+ }
1594
1764
  const initialScope = context.sourceCode.getScope(node);
1595
1765
  for (const element of elements) {
1596
1766
  if (!JSX7__namespace.hasProp(element.openingElement.attributes, "key", initialScope)) {
@@ -1603,7 +1773,9 @@ var no_missing_key_default = createRule({
1603
1773
  },
1604
1774
  CallExpression(node) {
1605
1775
  state.isWithinChildrenToArray ||= core.isChildrenToArrayCall(node, context);
1606
- if (state.isWithinChildrenToArray) return;
1776
+ if (state.isWithinChildrenToArray) {
1777
+ return;
1778
+ }
1607
1779
  const isMapCall = AST11__namespace.isMapCallLoose(node);
1608
1780
  const isArrayFromCall = tsPattern.isMatching({
1609
1781
  type: types.AST_NODE_TYPES.CallExpression,
@@ -1614,9 +1786,13 @@ var no_missing_key_default = createRule({
1614
1786
  }
1615
1787
  }
1616
1788
  }, node);
1617
- if (!isMapCall && !isArrayFromCall) return;
1789
+ if (!isMapCall && !isArrayFromCall) {
1790
+ return;
1791
+ }
1618
1792
  const fn = node.arguments[isMapCall ? 0 : 1];
1619
- if (!AST11__namespace.isOneOf([types.AST_NODE_TYPES.ArrowFunctionExpression, types.AST_NODE_TYPES.FunctionExpression])(fn)) return;
1793
+ if (!AST11__namespace.isOneOf([types.AST_NODE_TYPES.ArrowFunctionExpression, types.AST_NODE_TYPES.FunctionExpression])(fn)) {
1794
+ return;
1795
+ }
1620
1796
  if (fn.body.type === types.AST_NODE_TYPES.BlockStatement) {
1621
1797
  for (const descriptor of checkBlockStatement(fn.body)) {
1622
1798
  context.report(descriptor);
@@ -1626,11 +1802,15 @@ var no_missing_key_default = createRule({
1626
1802
  eff.O.map(checkExpression(fn.body), context.report);
1627
1803
  },
1628
1804
  "CallExpression:exit"(node) {
1629
- if (!core.isChildrenToArrayCall(node, context)) return;
1805
+ if (!core.isChildrenToArrayCall(node, context)) {
1806
+ return;
1807
+ }
1630
1808
  state.isWithinChildrenToArray = false;
1631
1809
  },
1632
1810
  JSXFragment(node) {
1633
- if (state.isWithinChildrenToArray) return;
1811
+ if (state.isWithinChildrenToArray) {
1812
+ return;
1813
+ }
1634
1814
  if (node.parent.type === types.AST_NODE_TYPES.ArrayExpression) {
1635
1815
  context.report({
1636
1816
  messageId: "noMissingKeyWithFragment",
@@ -1661,7 +1841,7 @@ var no_nested_components_default = createRule({
1661
1841
  },
1662
1842
  name: RULE_NAME30,
1663
1843
  create(context) {
1664
- const hint = core.ERComponentHint.SkipMapCallback | core.ERComponentHint.SkipNullLiteral | core.ERComponentHint.SkipUndefinedLiteral | core.ERComponentHint.SkipBooleanLiteral | core.ERComponentHint.SkipStringLiteral | core.ERComponentHint.SkipNumberLiteral | core.ERComponentHint.StrictLogical | core.ERComponentHint.StrictConditional;
1844
+ const hint = core.ERComponentHint.SkipMapCallback | core.ERComponentHint.SkipNullLiteral | core.ERComponentHint.SkipUndefined | core.ERComponentHint.SkipBooleanLiteral | core.ERComponentHint.SkipStringLiteral | core.ERComponentHint.SkipNumberLiteral | core.ERComponentHint.StrictLogical | core.ERComponentHint.StrictConditional;
1665
1845
  const collector = core.useComponentCollector(context, hint);
1666
1846
  const collectorLegacy = core.useComponentCollectorLegacy();
1667
1847
  return {
@@ -1677,8 +1857,12 @@ var no_nested_components_default = createRule({
1677
1857
  return AST11__namespace.isClass(node2) && classComponents.some((component) => component.node === node2);
1678
1858
  };
1679
1859
  for (const { name: componentName, node: component } of functionComponents) {
1680
- if (core.isDirectValueOfRenderPropertyLoose(component)) continue;
1681
- if (eff.O.isNone(componentName)) continue;
1860
+ if (core.isDirectValueOfRenderPropertyLoose(component)) {
1861
+ continue;
1862
+ }
1863
+ if (eff.O.isNone(componentName)) {
1864
+ continue;
1865
+ }
1682
1866
  const name2 = componentName.value;
1683
1867
  const isInsideProperty = component.parent.type === types.AST_NODE_TYPES.Property;
1684
1868
  const isInsideJSXPropValue = component.parent.type === types.AST_NODE_TYPES.JSXAttribute || eff.O.isSome(JSX7__namespace.findParentProp(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer));
@@ -1766,25 +1950,41 @@ var no_prop_types_default = createRule({
1766
1950
  },
1767
1951
  name: RULE_NAME31,
1768
1952
  create(context) {
1769
- if (!context.sourceCode.text.includes("propTypes")) return {};
1953
+ if (!context.sourceCode.text.includes("propTypes")) {
1954
+ return {};
1955
+ }
1770
1956
  return {
1771
1957
  AssignmentExpression(node) {
1772
- if (node.operator !== "=" || node.left.type !== types.AST_NODE_TYPES.MemberExpression) return;
1958
+ if (node.operator !== "=" || node.left.type !== types.AST_NODE_TYPES.MemberExpression) {
1959
+ return;
1960
+ }
1773
1961
  const { object, property } = node.left;
1774
- if (object.type !== types.AST_NODE_TYPES.Identifier) return;
1775
- if (property.type !== types.AST_NODE_TYPES.Identifier || property.name !== "propTypes") return;
1776
- if (!core.isComponentName(object.name)) return;
1962
+ if (object.type !== types.AST_NODE_TYPES.Identifier) {
1963
+ return;
1964
+ }
1965
+ if (property.type !== types.AST_NODE_TYPES.Identifier || property.name !== "propTypes") {
1966
+ return;
1967
+ }
1968
+ if (!core.isComponentName(object.name)) {
1969
+ return;
1970
+ }
1777
1971
  const isComponent = eff.F.pipe(
1778
1972
  VAR__namespace.findVariable(object.name, context.sourceCode.getScope(node)),
1779
1973
  eff.O.flatMap(VAR__namespace.getVariableNode(0)),
1780
1974
  eff.O.exists((n) => AST11__namespace.isFunction(n) || core.isClassComponent(n))
1781
1975
  );
1782
- if (!isComponent) return;
1976
+ if (!isComponent) {
1977
+ return;
1978
+ }
1783
1979
  context.report({ messageId: "noPropTypes", node: property });
1784
1980
  },
1785
1981
  PropertyDefinition(node) {
1786
- if (!core.isClassComponent(node.parent.parent)) return;
1787
- if (!node.static || node.key.type !== types.AST_NODE_TYPES.Identifier || node.key.name !== "propTypes") return;
1982
+ if (!core.isClassComponent(node.parent.parent)) {
1983
+ return;
1984
+ }
1985
+ if (!node.static || node.key.type !== types.AST_NODE_TYPES.Identifier || node.key.name !== "propTypes") {
1986
+ return;
1987
+ }
1788
1988
  context.report({ messageId: "noPropTypes", node });
1789
1989
  }
1790
1990
  };
@@ -1812,14 +2012,18 @@ var no_redundant_should_component_update_default = createRule({
1812
2012
  },
1813
2013
  name: RULE_NAME32,
1814
2014
  create(context) {
1815
- if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
2015
+ if (!context.sourceCode.text.includes("shouldComponentUpdate")) {
2016
+ return {};
2017
+ }
1816
2018
  const { ctx, listeners } = core.useComponentCollectorLegacy();
1817
2019
  return {
1818
2020
  ...listeners,
1819
2021
  "Program:exit"(node) {
1820
2022
  const components = ctx.getAllComponents(node);
1821
2023
  for (const { name: name2, node: component, flag } of components.values()) {
1822
- if (!(flag & core.ERClassComponentFlag.PureComponent)) continue;
2024
+ if (!(flag & core.ERClassComponentFlag.PureComponent)) {
2025
+ continue;
2026
+ }
1823
2027
  const { body } = component.body;
1824
2028
  for (const member of body) {
1825
2029
  if (isShouldComponentUpdate(member)) {
@@ -1859,9 +2063,13 @@ var no_set_state_in_component_did_mount_default = createRule({
1859
2063
  },
1860
2064
  name: RULE_NAME33,
1861
2065
  create(context) {
1862
- if (!context.sourceCode.text.includes("componentDidMount")) return {};
2066
+ if (!context.sourceCode.text.includes("componentDidMount")) {
2067
+ return {};
2068
+ }
1863
2069
  function getReportDescriptor(node) {
1864
- if (!core.isThisSetState(node)) return eff.O.none();
2070
+ if (!core.isThisSetState(node)) {
2071
+ return eff.O.none();
2072
+ }
1865
2073
  return eff.F.pipe(
1866
2074
  eff.O.Do,
1867
2075
  eff.O.bind("clazz", () => AST11__namespace.findParentNodeGuard(node, core.isClassComponent)),
@@ -1909,9 +2117,13 @@ var no_set_state_in_component_did_update_default = createRule({
1909
2117
  },
1910
2118
  name: RULE_NAME34,
1911
2119
  create(context) {
1912
- if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
2120
+ if (!context.sourceCode.text.includes("componentDidUpdate")) {
2121
+ return {};
2122
+ }
1913
2123
  function getReportDescriptor(node) {
1914
- if (!core.isThisSetState(node)) return eff.O.none();
2124
+ if (!core.isThisSetState(node)) {
2125
+ return eff.O.none();
2126
+ }
1915
2127
  return eff.F.pipe(
1916
2128
  eff.O.Do,
1917
2129
  eff.O.bind("clazz", () => AST11__namespace.findParentNodeGuard(node, core.isClassComponent)),
@@ -1959,9 +2171,13 @@ var no_set_state_in_component_will_update_default = createRule({
1959
2171
  },
1960
2172
  name: RULE_NAME35,
1961
2173
  create(context) {
1962
- if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
2174
+ if (!context.sourceCode.text.includes("componentWillUpdate")) {
2175
+ return {};
2176
+ }
1963
2177
  function getReportDescriptor(node) {
1964
- if (!core.isThisSetState(node)) return eff.O.none();
2178
+ if (!core.isThisSetState(node)) {
2179
+ return eff.O.none();
2180
+ }
1965
2181
  return eff.F.pipe(
1966
2182
  eff.O.Do,
1967
2183
  eff.O.bind("clazz", () => AST11__namespace.findParentNodeGuard(node, core.isClassComponent)),
@@ -1996,8 +2212,12 @@ function containsStringLiteral({ value }) {
1996
2212
  return value?.type === types.AST_NODE_TYPES.Literal && eff.isString(value.value);
1997
2213
  }
1998
2214
  function containsStringExpressionContainer({ value }) {
1999
- if (value?.type !== types.AST_NODE_TYPES.JSXExpressionContainer) return false;
2000
- if (value.expression.type === types.AST_NODE_TYPES.Literal) return eff.isString(value.expression.value);
2215
+ if (value?.type !== types.AST_NODE_TYPES.JSXExpressionContainer) {
2216
+ return false;
2217
+ }
2218
+ if (value.expression.type === types.AST_NODE_TYPES.Literal) {
2219
+ return eff.isString(value.expression.value);
2220
+ }
2001
2221
  return value.expression.type === types.AST_NODE_TYPES.TemplateLiteral;
2002
2222
  }
2003
2223
  var no_string_refs_default = createRule({
@@ -2016,7 +2236,9 @@ var no_string_refs_default = createRule({
2016
2236
  create(context) {
2017
2237
  return {
2018
2238
  JSXAttribute(node) {
2019
- if (node.name.name !== "ref") return;
2239
+ if (node.name.name !== "ref") {
2240
+ return;
2241
+ }
2020
2242
  if (containsStringLiteral(node) || containsStringExpressionContainer(node)) {
2021
2243
  context.report({
2022
2244
  messageId: "noStringRefs",
@@ -2049,7 +2271,9 @@ var no_unsafe_component_will_mount_default = createRule({
2049
2271
  },
2050
2272
  name: RULE_NAME37,
2051
2273
  create(context) {
2052
- if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
2274
+ if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) {
2275
+ return {};
2276
+ }
2053
2277
  const { ctx, listeners } = core.useComponentCollectorLegacy();
2054
2278
  return {
2055
2279
  ...listeners,
@@ -2092,7 +2316,9 @@ var no_unsafe_component_will_receive_props_default = createRule({
2092
2316
  },
2093
2317
  name: RULE_NAME38,
2094
2318
  create(context) {
2095
- if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) return {};
2319
+ if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) {
2320
+ return {};
2321
+ }
2096
2322
  const { ctx, listeners } = core.useComponentCollectorLegacy();
2097
2323
  return {
2098
2324
  ...listeners,
@@ -2135,7 +2361,9 @@ var no_unsafe_component_will_update_default = createRule({
2135
2361
  },
2136
2362
  name: RULE_NAME39,
2137
2363
  create(context) {
2138
- if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
2364
+ if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) {
2365
+ return {};
2366
+ }
2139
2367
  const { ctx, listeners } = core.useComponentCollectorLegacy();
2140
2368
  return {
2141
2369
  ...listeners,
@@ -2183,8 +2411,12 @@ var no_unstable_context_value_default = createRule({
2183
2411
  ...listeners,
2184
2412
  JSXOpeningElement(node) {
2185
2413
  const openingElementName = node.name;
2186
- if (openingElementName.type !== types.AST_NODE_TYPES.JSXMemberExpression) return;
2187
- if (openingElementName.property.name !== "Provider") return;
2414
+ if (openingElementName.type !== types.AST_NODE_TYPES.JSXMemberExpression) {
2415
+ return;
2416
+ }
2417
+ if (openingElementName.property.name !== "Provider") {
2418
+ return;
2419
+ }
2188
2420
  eff.F.pipe(
2189
2421
  eff.O.Do,
2190
2422
  eff.O.bind("function", ctx.getCurrentFunction),
@@ -2200,8 +2432,12 @@ var no_unstable_context_value_default = createRule({
2200
2432
  return eff.O.some(VAR__namespace.getValueConstruction(valueExpression, initialScope));
2201
2433
  }),
2202
2434
  eff.O.map((vc) => {
2203
- if (vc.construction.kind === "None") return;
2204
- if (core.isReactHookCall(vc.construction.node)) return;
2435
+ if (vc.construction.kind === "None") {
2436
+ return;
2437
+ }
2438
+ if (core.isReactHookCall(vc.construction.node)) {
2439
+ return;
2440
+ }
2205
2441
  const prevs = constructions.get(vc.function.node) ?? [];
2206
2442
  constructions.set(vc.function.node, [...prevs, vc.construction]);
2207
2443
  })
@@ -2211,7 +2447,9 @@ var no_unstable_context_value_default = createRule({
2211
2447
  const components = ctx.getAllComponents(node).values();
2212
2448
  for (const { node: component } of components) {
2213
2449
  for (const construction of constructions.get(component) ?? []) {
2214
- if (construction.kind === "None") continue;
2450
+ if (construction.kind === "None") {
2451
+ continue;
2452
+ }
2215
2453
  const { kind, node: constructionNode } = construction;
2216
2454
  const messageId = kind.startsWith("Function") ? "noUnstableContextValueWithFunction" : "noUnstableContextValueWithIdentifier";
2217
2455
  context.report({
@@ -2255,12 +2493,16 @@ var no_unstable_default_props_default = createRule({
2255
2493
  for (const { node: component } of components.values()) {
2256
2494
  const { params } = component;
2257
2495
  const [props] = params;
2258
- if (!props) continue;
2496
+ if (!props) {
2497
+ continue;
2498
+ }
2259
2499
  const properties = tsPattern.match(props).with({ type: types.AST_NODE_TYPES.ObjectPattern }, ({ properties: properties2 }) => properties2).with({ type: types.AST_NODE_TYPES.Identifier }, ({ name: name2 }) => {
2260
2500
  return declarators.get(component)?.filter((d) => d.init.name === name2).flatMap((d) => d.id.properties) ?? [];
2261
2501
  }).otherwise(() => []);
2262
2502
  for (const prop of properties) {
2263
- if (prop.type !== types.AST_NODE_TYPES.Property || prop.value.type !== types.AST_NODE_TYPES.AssignmentPattern) continue;
2503
+ if (prop.type !== types.AST_NODE_TYPES.Property || prop.value.type !== types.AST_NODE_TYPES.AssignmentPattern) {
2504
+ continue;
2505
+ }
2264
2506
  const { value } = prop;
2265
2507
  const { right } = value;
2266
2508
  const initialScope = context.sourceCode.getScope(value);
@@ -2269,8 +2511,12 @@ var no_unstable_default_props_default = createRule({
2269
2511
  initialScope,
2270
2512
  VAR__namespace.ValueConstructionHint.StrictCallExpression
2271
2513
  );
2272
- if (construction.kind === "None") continue;
2273
- if (core.isReactHookCall(construction.node)) continue;
2514
+ if (construction.kind === "None") {
2515
+ continue;
2516
+ }
2517
+ if (core.isReactHookCall(construction.node)) {
2518
+ continue;
2519
+ }
2274
2520
  const forbiddenType = AST11__namespace.toReadableNodeType(right);
2275
2521
  context.report({
2276
2522
  messageId: "noUnstableDefaultProps",
@@ -2284,7 +2530,9 @@ var no_unstable_default_props_default = createRule({
2284
2530
  },
2285
2531
  "VariableDeclarator[id.type='ObjectPattern'][init.type='Identifier']"(node) {
2286
2532
  const mbEntry = ctx.getCurrentFunction();
2287
- if (eff.O.isNone(mbEntry)) return;
2533
+ if (eff.O.isNone(mbEntry)) {
2534
+ return;
2535
+ }
2288
2536
  const entry = mbEntry.value;
2289
2537
  const prevs = declarators.get(entry.node) ?? [];
2290
2538
  declarators.set(entry.node, [...prevs, node]);
@@ -2349,21 +2597,31 @@ var no_unused_class_component_members_default = createRule({
2349
2597
  const propertyUsages = /* @__PURE__ */ new WeakMap();
2350
2598
  function classEnter(node) {
2351
2599
  classStack.push(node);
2352
- if (!core.isClassComponent(node)) return;
2600
+ if (!core.isClassComponent(node)) {
2601
+ return;
2602
+ }
2353
2603
  propertyDefs.set(node, /* @__PURE__ */ new Set());
2354
2604
  propertyUsages.set(node, /* @__PURE__ */ new Set());
2355
2605
  }
2356
2606
  function classExit() {
2357
2607
  const currentClass = classStack.pop();
2358
- if (!currentClass || !core.isClassComponent(currentClass)) return;
2608
+ if (!currentClass || !core.isClassComponent(currentClass)) {
2609
+ return;
2610
+ }
2359
2611
  const className = eff.O.map(AST11__namespace.getClassIdentifier(currentClass), (id) => id.name);
2360
2612
  const defs = propertyDefs.get(currentClass);
2361
2613
  const usages = propertyUsages.get(currentClass);
2362
- if (!defs) return;
2614
+ if (!defs) {
2615
+ return;
2616
+ }
2363
2617
  for (const def of defs) {
2364
2618
  const name2 = getName3(def);
2365
- if (eff.O.isNone(name2)) continue;
2366
- if (usages?.has(name2.value) || LIFECYCLE_METHODS.has(name2.value)) continue;
2619
+ if (eff.O.isNone(name2)) {
2620
+ continue;
2621
+ }
2622
+ if (usages?.has(name2.value) || LIFECYCLE_METHODS.has(name2.value)) {
2623
+ continue;
2624
+ }
2367
2625
  context.report({
2368
2626
  messageId: "noUnusedClassComponentMembers",
2369
2627
  node: def,
@@ -2377,8 +2635,12 @@ var no_unused_class_component_members_default = createRule({
2377
2635
  function methodEnter(node) {
2378
2636
  methodStack.push(node);
2379
2637
  const currentClass = classStack.at(-1);
2380
- if (!currentClass || !core.isClassComponent(currentClass)) return;
2381
- if (node.static) return;
2638
+ if (!currentClass || !core.isClassComponent(currentClass)) {
2639
+ return;
2640
+ }
2641
+ if (node.static) {
2642
+ return;
2643
+ }
2382
2644
  if (AST11__namespace.isKeyLiteralLike(node, node.key)) {
2383
2645
  propertyDefs.get(currentClass)?.add(node.key);
2384
2646
  }
@@ -2394,9 +2656,15 @@ var no_unused_class_component_members_default = createRule({
2394
2656
  MemberExpression(node) {
2395
2657
  const currentClass = classStack.at(-1);
2396
2658
  const currentMethod = methodStack.at(-1);
2397
- if (!currentClass || !currentMethod) return;
2398
- if (!core.isClassComponent(currentClass) || currentMethod.static) return;
2399
- if (!AST11__namespace.isThisExpression(node.object) || !AST11__namespace.isKeyLiteralLike(node, node.property)) return;
2659
+ if (!currentClass || !currentMethod) {
2660
+ return;
2661
+ }
2662
+ if (!core.isClassComponent(currentClass) || currentMethod.static) {
2663
+ return;
2664
+ }
2665
+ if (!AST11__namespace.isThisExpression(node.object) || !AST11__namespace.isKeyLiteralLike(node, node.property)) {
2666
+ return;
2667
+ }
2400
2668
  if (node.parent.type === types.AST_NODE_TYPES.AssignmentExpression && node.parent.left === node) {
2401
2669
  propertyDefs.get(currentClass)?.add(node.property);
2402
2670
  return;
@@ -2410,8 +2678,12 @@ var no_unused_class_component_members_default = createRule({
2410
2678
  VariableDeclarator(node) {
2411
2679
  const currentClass = classStack.at(-1);
2412
2680
  const currentMethod = methodStack.at(-1);
2413
- if (!currentClass || !currentMethod) return;
2414
- if (!core.isClassComponent(currentClass) || currentMethod.static) return;
2681
+ if (!currentClass || !currentMethod) {
2682
+ return;
2683
+ }
2684
+ if (!core.isClassComponent(currentClass) || currentMethod.static) {
2685
+ return;
2686
+ }
2415
2687
  if (node.init && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern) {
2416
2688
  for (const prop of node.id.properties) {
2417
2689
  if (prop.type === types.AST_NODE_TYPES.Property && AST11__namespace.isKeyLiteralLike(prop, prop.key)) {
@@ -2483,10 +2755,14 @@ var no_unused_state_default = createRule({
2483
2755
  }
2484
2756
  function classExit() {
2485
2757
  const currentClass = classStack.pop();
2486
- if (!currentClass || !core.isClassComponent(currentClass)) return;
2758
+ if (!currentClass || !core.isClassComponent(currentClass)) {
2759
+ return;
2760
+ }
2487
2761
  const className = eff.O.map(AST11__namespace.getClassIdentifier(currentClass), (id) => id.name);
2488
2762
  const [def, isUsed] = stateDefs.get(currentClass) ?? [eff.O.none(), false];
2489
- if (eff.O.isNone(def) || isUsed) return;
2763
+ if (eff.O.isNone(def) || isUsed) {
2764
+ return;
2765
+ }
2490
2766
  context.report({
2491
2767
  messageId: "noUnusedState",
2492
2768
  node: def.value,
@@ -2498,7 +2774,9 @@ var no_unused_state_default = createRule({
2498
2774
  function methodEnter(node) {
2499
2775
  methodStack.push(node);
2500
2776
  const currentClass = classStack.at(-1);
2501
- if (!currentClass || !core.isClassComponent(currentClass)) return;
2777
+ if (!currentClass || !core.isClassComponent(currentClass)) {
2778
+ return;
2779
+ }
2502
2780
  if (node.static) {
2503
2781
  if (isGetDerivedStateFromProps(node) && node.value.params.length > 1) {
2504
2782
  const [def] = stateDefs.get(currentClass) ?? [eff.O.none()];
@@ -2521,11 +2799,17 @@ var no_unused_state_default = createRule({
2521
2799
  }
2522
2800
  return {
2523
2801
  AssignmentExpression(node) {
2524
- if (!isAssignmentToThisState2(node)) return;
2802
+ if (!isAssignmentToThisState2(node)) {
2803
+ return;
2804
+ }
2525
2805
  const currentClass = classStack.at(-1);
2526
- if (!currentClass || !core.isClassComponent(currentClass)) return;
2806
+ if (!currentClass || !core.isClassComponent(currentClass)) {
2807
+ return;
2808
+ }
2527
2809
  const currentConstructor = constructorStack.at(-1);
2528
- if (!currentConstructor || !currentClass.body.body.includes(currentConstructor)) return;
2810
+ if (!currentConstructor || !currentClass.body.body.includes(currentConstructor)) {
2811
+ return;
2812
+ }
2529
2813
  const [_, isUsed] = stateDefs.get(currentClass) ?? [eff.O.none(), false];
2530
2814
  stateDefs.set(currentClass, [eff.O.some(node.left), isUsed]);
2531
2815
  },
@@ -2534,14 +2818,26 @@ var no_unused_state_default = createRule({
2534
2818
  ClassExpression: classEnter,
2535
2819
  "ClassExpression:exit": classExit,
2536
2820
  MemberExpression(node) {
2537
- if (!AST11__namespace.isThisExpression(node.object)) return;
2538
- if (!eff.O.exists(getName4(node.property), (name2) => name2 === "state")) return;
2821
+ if (!AST11__namespace.isThisExpression(node.object)) {
2822
+ return;
2823
+ }
2824
+ if (!eff.O.exists(getName4(node.property), (name2) => name2 === "state")) {
2825
+ return;
2826
+ }
2539
2827
  const currentClass = classStack.at(-1);
2540
- if (!currentClass || !core.isClassComponent(currentClass)) return;
2828
+ if (!currentClass || !core.isClassComponent(currentClass)) {
2829
+ return;
2830
+ }
2541
2831
  const currentMethod = methodStack.at(-1);
2542
- if (!currentMethod || currentMethod.static) return;
2543
- if (currentMethod === constructorStack.at(-1)) return;
2544
- if (!currentClass.body.body.includes(currentMethod)) return;
2832
+ if (!currentMethod || currentMethod.static) {
2833
+ return;
2834
+ }
2835
+ if (currentMethod === constructorStack.at(-1)) {
2836
+ return;
2837
+ }
2838
+ if (!currentClass.body.body.includes(currentMethod)) {
2839
+ return;
2840
+ }
2545
2841
  const [def] = stateDefs.get(currentClass) ?? [eff.O.none(), false];
2546
2842
  stateDefs.set(currentClass, [def, true]);
2547
2843
  },
@@ -2553,19 +2849,31 @@ var no_unused_state_default = createRule({
2553
2849
  "PropertyDefinition:exit": methodExit,
2554
2850
  VariableDeclarator(node) {
2555
2851
  const currentClass = classStack.at(-1);
2556
- if (!currentClass || !core.isClassComponent(currentClass)) return;
2852
+ if (!currentClass || !core.isClassComponent(currentClass)) {
2853
+ return;
2854
+ }
2557
2855
  const currentMethod = methodStack.at(-1);
2558
- if (!currentMethod || currentMethod.static) return;
2559
- if (currentMethod === constructorStack.at(-1)) return;
2560
- if (!currentClass.body.body.includes(currentMethod)) return;
2561
- if (!(node.init && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern)) return;
2856
+ if (!currentMethod || currentMethod.static) {
2857
+ return;
2858
+ }
2859
+ if (currentMethod === constructorStack.at(-1)) {
2860
+ return;
2861
+ }
2862
+ if (!currentClass.body.body.includes(currentMethod)) {
2863
+ return;
2864
+ }
2865
+ if (!(node.init && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern)) {
2866
+ return;
2867
+ }
2562
2868
  const hasState = node.id.properties.some((prop) => {
2563
2869
  if (prop.type === types.AST_NODE_TYPES.Property && AST11__namespace.isKeyLiteralLike(prop, prop.key)) {
2564
2870
  return eff.O.exists(getName4(prop.key), (name2) => name2 === "state");
2565
2871
  }
2566
2872
  return false;
2567
2873
  });
2568
- if (!hasState) return;
2874
+ if (!hasState) {
2875
+ return;
2876
+ }
2569
2877
  const [def] = stateDefs.get(currentClass) ?? [eff.O.none(), false];
2570
2878
  stateDefs.set(currentClass, [def, true]);
2571
2879
  }
@@ -2579,8 +2887,12 @@ var defaultOptions = [{
2579
2887
  }];
2580
2888
  function checkAndReport(node, context, allowExpressions) {
2581
2889
  const initialScope = context.sourceCode.getScope(node);
2582
- if (JSX7__namespace.isKeyedElement(node, initialScope)) return;
2583
- if (JSX7__namespace.isBuiltInElement(node.parent)) context.report({ messageId: "noUselessFragmentInBuiltIn", node });
2890
+ if (JSX7__namespace.isKeyedElement(node, initialScope)) {
2891
+ return;
2892
+ }
2893
+ if (JSX7__namespace.isBuiltInElement(node.parent)) {
2894
+ context.report({ messageId: "noUselessFragmentInBuiltIn", node });
2895
+ }
2584
2896
  if (node.children.length === 0) {
2585
2897
  context.report({ messageId: "noUselessFragment", node });
2586
2898
  return;
@@ -2639,7 +2951,9 @@ var no_useless_fragment_default = createRule({
2639
2951
  const { allowExpressions = true } = option;
2640
2952
  return {
2641
2953
  JSXElement(node) {
2642
- if (JSX7__namespace.getElementName(node.openingElement).split(".").at(-1) !== "Fragment") return;
2954
+ if (JSX7__namespace.getElementName(node.openingElement).split(".").at(-1) !== "Fragment") {
2955
+ return;
2956
+ }
2643
2957
  checkAndReport(node, context, allowExpressions);
2644
2958
  },
2645
2959
  JSXFragment(node) {
@@ -2683,7 +2997,9 @@ var prefer_destructuring_assignment_default = createRule({
2683
2997
  "Program:exit"(node) {
2684
2998
  const components = Array.from(ctx.getAllComponents(node).values());
2685
2999
  function isFunctionComponent(block) {
2686
- if (!AST11__namespace.isFunction(block)) return false;
3000
+ if (!AST11__namespace.isFunction(block)) {
3001
+ return false;
3002
+ }
2687
3003
  return eff.O.exists(
2688
3004
  AST11__namespace.getFunctionIdentifier(block),
2689
3005
  (id) => core.isComponentName(id.name) && components.some((component) => component.node === block)
@@ -2696,9 +3012,13 @@ var prefer_destructuring_assignment_default = createRule({
2696
3012
  scope = scope.upper;
2697
3013
  isComponent = isFunctionComponent(scope.block);
2698
3014
  }
2699
- if (!isComponent) continue;
3015
+ if (!isComponent) {
3016
+ continue;
3017
+ }
2700
3018
  const component = scope.block;
2701
- if (!("params" in component)) continue;
3019
+ if (!("params" in component)) {
3020
+ continue;
3021
+ }
2702
3022
  const [props, ctx2] = component.params;
2703
3023
  const isMatch = tsPattern.isMatching({ name: memberExpression.object.name });
2704
3024
  if (isMatch(props)) {
@@ -2814,9 +3134,13 @@ var prefer_read_only_props_default = createRule({
2814
3134
  const components = ctx.getAllComponents(node);
2815
3135
  for (const [_, component] of components) {
2816
3136
  const [props] = component.node.params;
2817
- if (!props) continue;
3137
+ if (!props) {
3138
+ continue;
3139
+ }
2818
3140
  const propsType = typeUtils.getConstrainedTypeAtLocation(services, props);
2819
- if (typeUtils.isTypeReadonly(services.program, propsType) || isReadonlyType(propsType, services)) continue;
3141
+ if (typeUtils.isTypeReadonly(services.program, propsType) || isReadonlyType(propsType, services)) {
3142
+ continue;
3143
+ }
2820
3144
  context.report({ messageId: "preferReadOnlyProps", node: props });
2821
3145
  }
2822
3146
  }
@@ -2848,7 +3172,9 @@ var prefer_shorthand_boolean_default = createRule({
2848
3172
  const { value } = node;
2849
3173
  const propName = JSX7__namespace.getPropName(node);
2850
3174
  const hasValueTrue = value?.type === types.AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === types.AST_NODE_TYPES.Literal && value.expression.value === true;
2851
- if (!hasValueTrue) return eff.O.none();
3175
+ if (!hasValueTrue) {
3176
+ return eff.O.none();
3177
+ }
2852
3178
  return eff.O.some({
2853
3179
  messageId: "preferShorthandBoolean",
2854
3180
  node,
@@ -2885,15 +3211,21 @@ var prefer_shorthand_fragment_default = createRule({
2885
3211
  name: RULE_NAME49,
2886
3212
  create(context) {
2887
3213
  function getReportDescriptor(node) {
2888
- if (JSX7__namespace.getElementName(node.openingElement).split(".").at(-1) !== "Fragment") return eff.O.none();
3214
+ if (JSX7__namespace.getElementName(node.openingElement).split(".").at(-1) !== "Fragment") {
3215
+ return eff.O.none();
3216
+ }
2889
3217
  const hasAttributes = node.openingElement.attributes.length > 0;
2890
- if (hasAttributes) return eff.O.none();
3218
+ if (hasAttributes) {
3219
+ return eff.O.none();
3220
+ }
2891
3221
  return eff.O.some({
2892
3222
  messageId: "preferShorthandFragment",
2893
3223
  node,
2894
3224
  fix: (fixer) => {
2895
3225
  const { closingElement, openingElement } = node;
2896
- if (!closingElement) return [];
3226
+ if (!closingElement) {
3227
+ return [];
3228
+ }
2897
3229
  return [
2898
3230
  fixer.replaceTextRange([openingElement.range[0], openingElement.range[1]], "<>"),
2899
3231
  fixer.replaceTextRange([closingElement.range[0], closingElement.range[1]], "</>")
@@ -2936,7 +3268,9 @@ var use_jsx_vars_default = createRule({
2936
3268
  }
2937
3269
  return {
2938
3270
  JSXOpeningElement(node) {
2939
- if (node.name.type === types.AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.name.name)) return;
3271
+ if (node.name.type === types.AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.name.name)) {
3272
+ return;
3273
+ }
2940
3274
  for (const name2 of eff.O.toArray(getName5(node.name))) {
2941
3275
  context.sourceCode.markVariableAsUsed(name2, node);
2942
3276
  }