eslint-plugin-react-x 1.23.3-next.5 → 1.23.3-next.6

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.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.3-next.5";
45
+ var version = "1.23.3-next.6";
46
46
  var createRule = shared.createRuleForPlugin("x");
47
47
 
48
48
  // src/rules/avoid-shorthand-boolean.ts
@@ -66,7 +66,7 @@ var avoid_shorthand_boolean_default = createRule({
66
66
  name: RULE_NAME,
67
67
  create(context) {
68
68
  function getReportDescriptor(node) {
69
- return node.value ? eff.O.none() : eff.O.some({
69
+ return node.value != null ? eff.O.none() : eff.O.some({
70
70
  messageId: "avoidShorthandBoolean",
71
71
  node,
72
72
  data: {
@@ -136,11 +136,11 @@ var ensure_forward_ref_using_ref_default = createRule({
136
136
  return;
137
137
  }
138
138
  const [component] = node.arguments;
139
- if (!component || !AST11__namespace.isFunction(component)) {
139
+ if (component == null || !AST11__namespace.isFunction(component)) {
140
140
  return;
141
141
  }
142
142
  const [_, ref] = component.params;
143
- if (ref) {
143
+ if (ref != null) {
144
144
  return;
145
145
  }
146
146
  context.report({
@@ -221,15 +221,15 @@ var no_access_state_in_setstate_default = createRule({
221
221
  return;
222
222
  }
223
223
  const [currClass, isComponent] = classStack.at(-1) ?? [];
224
- if (!currClass || !isComponent) {
224
+ if (currClass == null || !isComponent) {
225
225
  return;
226
226
  }
227
227
  const [currMethod, isStatic] = methodStack.at(-1) ?? [];
228
- if (!currMethod || isStatic) {
228
+ if (currMethod == null || isStatic) {
229
229
  return;
230
230
  }
231
231
  const [setState, hasThisState] = setStateStack.at(-1) ?? [];
232
- if (!setState || hasThisState) {
232
+ if (setState == null || hasThisState) {
233
233
  return;
234
234
  }
235
235
  if (!eff.O.exists(getName(node.property), (name2) => name2 === "state")) {
@@ -251,18 +251,18 @@ var no_access_state_in_setstate_default = createRule({
251
251
  },
252
252
  VariableDeclarator(node) {
253
253
  const [currClass, isComponent] = classStack.at(-1) ?? [];
254
- if (!currClass || !isComponent) {
254
+ if (currClass == null || !isComponent) {
255
255
  return;
256
256
  }
257
257
  const [currMethod, isStatic] = methodStack.at(-1) ?? [];
258
- if (!currMethod || isStatic) {
258
+ if (currMethod == null || isStatic) {
259
259
  return;
260
260
  }
261
261
  const [setState, hasThisState] = setStateStack.at(-1) ?? [];
262
- if (!setState || hasThisState) {
262
+ if (setState == null || hasThisState) {
263
263
  return;
264
264
  }
265
- if (!(node.init && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern)) {
265
+ if (!(node.init != null && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern)) {
266
266
  return;
267
267
  }
268
268
  const hasState = node.id.properties.some((prop) => {
@@ -333,7 +333,7 @@ function getMapIndexParamName(node, context) {
333
333
  return eff.O.none();
334
334
  }
335
335
  const callbackArg = node.arguments[isUsingReactChildren(node, context) ? 1 : 0];
336
- if (!callbackArg) {
336
+ if (callbackArg == null) {
337
337
  return eff.O.none();
338
338
  }
339
339
  if (!AST11__namespace.isOneOf([types.AST_NODE_TYPES.ArrowFunctionExpression, types.AST_NODE_TYPES.FunctionExpression])(callbackArg)) {
@@ -348,7 +348,7 @@ function getMapIndexParamName(node, context) {
348
348
  return eff.O.none();
349
349
  }
350
350
  const param = params.at(indexParamPosition);
351
- return param && "name" in param ? eff.O.some(param.name) : eff.O.none();
351
+ return param != null && "name" in param ? eff.O.some(param.name) : eff.O.none();
352
352
  }
353
353
  var no_array_index_key_default = createRule({
354
354
  meta: {
@@ -409,7 +409,7 @@ var no_array_index_key_default = createRule({
409
409
  }];
410
410
  }
411
411
  // key={String(bar)}
412
- case (node.callee.type === types.AST_NODE_TYPES.Identifier && node.callee.name === "String" && node.arguments[0] && isArrayIndex(node.arguments[0])): {
412
+ case (node.callee.type === types.AST_NODE_TYPES.Identifier && node.callee.name === "String" && node.arguments[0] != null && isArrayIndex(node.arguments[0])): {
413
413
  return [{
414
414
  messageId: "noArrayIndexKey",
415
415
  node: node.arguments[0]
@@ -1023,7 +1023,7 @@ var no_context_provider_default = createRule({
1023
1023
  const providerName = elementName.replace(/\.Provider$/, "");
1024
1024
  const openingElement = node.openingElement;
1025
1025
  const closingElement = node.closingElement;
1026
- if (!closingElement) {
1026
+ if (closingElement == null) {
1027
1027
  return fixer.replaceText(openingElement.name, providerName);
1028
1028
  }
1029
1029
  return [
@@ -1265,7 +1265,7 @@ var no_duplicate_key_default = createRule({
1265
1265
  function isKeyValueEqual(a, b) {
1266
1266
  const aValue = a.value;
1267
1267
  const bValue = b.value;
1268
- if (aValue === null || bValue === null) {
1268
+ if (aValue == null || bValue == null) {
1269
1269
  return false;
1270
1270
  }
1271
1271
  return AST11__namespace.isNodeEqual(aValue, bValue);
@@ -1373,7 +1373,7 @@ var no_forward_ref_default = createRule({
1373
1373
  function getFix(node, context) {
1374
1374
  return (fixer) => {
1375
1375
  const [componentNode] = node.arguments;
1376
- if (!componentNode || !AST11__namespace.isFunction(componentNode)) {
1376
+ if (componentNode == null || !AST11__namespace.isFunction(componentNode)) {
1377
1377
  return [];
1378
1378
  }
1379
1379
  return [
@@ -1394,7 +1394,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
1394
1394
  const getText = (node2) => context.sourceCode.getText(node2);
1395
1395
  const [arg0, arg1] = node.params;
1396
1396
  const [typeArg0, typeArg1] = typeArguments;
1397
- if (!arg0) {
1397
+ if (arg0 == null) {
1398
1398
  return [];
1399
1399
  }
1400
1400
  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);
@@ -1404,7 +1404,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
1404
1404
  }
1405
1405
  const fixedPropsText = fixedArg0Text.value;
1406
1406
  const fixedRefText = fixedArg1Text.value;
1407
- if (!typeArg0 || !typeArg1) {
1407
+ if (typeArg0 == null || typeArg1 == null) {
1408
1408
  return [
1409
1409
  fixer.replaceText(
1410
1410
  arg0,
@@ -1415,7 +1415,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
1415
1415
  "}"
1416
1416
  ].join(" ")
1417
1417
  ),
1418
- ...arg1 ? [fixer.remove(arg1), fixer.removeRange([arg0.range[1], arg1.range[0]])] : []
1418
+ ...arg1 == null ? [] : [fixer.remove(arg1), fixer.removeRange([arg0.range[1], arg1.range[0]])]
1419
1419
  ];
1420
1420
  }
1421
1421
  return [
@@ -1434,7 +1434,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
1434
1434
  "}"
1435
1435
  ].join(" ")
1436
1436
  ),
1437
- ...arg1 ? [fixer.remove(arg1), fixer.removeRange([arg0.range[1], arg1.range[0]])] : []
1437
+ ...arg1 == null ? [] : [fixer.remove(arg1), fixer.removeRange([arg0.range[1], arg1.range[0]])]
1438
1438
  ];
1439
1439
  }
1440
1440
  var RULE_NAME26 = "no-implicit-key";
@@ -1510,7 +1510,7 @@ function inspectVariantTypes(types) {
1510
1510
  }
1511
1511
  const booleans = types.filter(tsHelpers.isBooleanType);
1512
1512
  switch (true) {
1513
- case (booleans.length === 1 && !!booleans[0]): {
1513
+ case (booleans.length === 1 && booleans[0] != null): {
1514
1514
  const [first] = booleans;
1515
1515
  const evaluated = eff.F.pipe(
1516
1516
  tsPattern.match(first).when(tsApiUtils.isTrueLiteralType, () => eff.O.some("truthy boolean")).when(tsApiUtils.isFalseLiteralType, () => eff.O.some("falsy boolean")).otherwise(eff.O.none)
@@ -1669,7 +1669,7 @@ var no_missing_component_display_name_default = createRule({
1669
1669
  "Program:exit"(node) {
1670
1670
  const components = ctx.getAllComponents(node);
1671
1671
  for (const { node: node2, displayName, flag } of components.values()) {
1672
- const isMemoOrForwardRef = Boolean(flag & core.ERFunctionComponentFlag.ForwardRef) || Boolean(flag & core.ERFunctionComponentFlag.Memo);
1672
+ const isMemoOrForwardRef = (flag & (core.ERFunctionComponentFlag.ForwardRef | core.ERFunctionComponentFlag.Memo)) > 0n;
1673
1673
  if (eff.O.isSome(AST11__namespace.getFunctionIdentifier(node2))) {
1674
1674
  continue;
1675
1675
  }
@@ -1751,7 +1751,7 @@ var no_missing_key_default = createRule({
1751
1751
  }
1752
1752
  function checkBlockStatement(node) {
1753
1753
  return AST11__namespace.getNestedReturnStatements(node).reduce((acc, statement) => {
1754
- if (!statement.argument) {
1754
+ if (statement.argument == null) {
1755
1755
  return acc;
1756
1756
  }
1757
1757
  const mbDescriptor = checkIteratorElement(statement.argument);
@@ -2027,7 +2027,7 @@ var no_redundant_should_component_update_default = createRule({
2027
2027
  "Program:exit"(node) {
2028
2028
  const components = ctx.getAllComponents(node);
2029
2029
  for (const { name: name2, node: component, flag } of components.values()) {
2030
- if (!(flag & core.ERClassComponentFlag.PureComponent)) {
2030
+ if ((flag & core.ERClassComponentFlag.PureComponent) === 0n) {
2031
2031
  continue;
2032
2032
  }
2033
2033
  const { body } = component.body;
@@ -2499,7 +2499,7 @@ var no_unstable_default_props_default = createRule({
2499
2499
  for (const { node: component } of components.values()) {
2500
2500
  const { params } = component;
2501
2501
  const [props] = params;
2502
- if (!props) {
2502
+ if (props == null) {
2503
2503
  continue;
2504
2504
  }
2505
2505
  const properties = tsPattern.match(props).with({ type: types.AST_NODE_TYPES.ObjectPattern }, ({ properties: properties2 }) => properties2).with({ type: types.AST_NODE_TYPES.Identifier }, ({ name: name2 }) => {
@@ -2611,13 +2611,13 @@ var no_unused_class_component_members_default = createRule({
2611
2611
  }
2612
2612
  function classExit() {
2613
2613
  const currentClass = classStack.pop();
2614
- if (!currentClass || !core.isClassComponent(currentClass)) {
2614
+ if (currentClass == null || !core.isClassComponent(currentClass)) {
2615
2615
  return;
2616
2616
  }
2617
2617
  const className = eff.O.map(AST11__namespace.getClassIdentifier(currentClass), (id) => id.name);
2618
2618
  const defs = propertyDefs.get(currentClass);
2619
2619
  const usages = propertyUsages.get(currentClass);
2620
- if (!defs) {
2620
+ if (defs == null) {
2621
2621
  return;
2622
2622
  }
2623
2623
  for (const def of defs) {
@@ -2641,7 +2641,7 @@ var no_unused_class_component_members_default = createRule({
2641
2641
  function methodEnter(node) {
2642
2642
  methodStack.push(node);
2643
2643
  const currentClass = classStack.at(-1);
2644
- if (!currentClass || !core.isClassComponent(currentClass)) {
2644
+ if (currentClass == null || !core.isClassComponent(currentClass)) {
2645
2645
  return;
2646
2646
  }
2647
2647
  if (node.static) {
@@ -2662,7 +2662,7 @@ var no_unused_class_component_members_default = createRule({
2662
2662
  MemberExpression(node) {
2663
2663
  const currentClass = classStack.at(-1);
2664
2664
  const currentMethod = methodStack.at(-1);
2665
- if (!currentClass || !currentMethod) {
2665
+ if (currentClass == null || currentMethod == null) {
2666
2666
  return;
2667
2667
  }
2668
2668
  if (!core.isClassComponent(currentClass) || currentMethod.static) {
@@ -2684,13 +2684,13 @@ var no_unused_class_component_members_default = createRule({
2684
2684
  VariableDeclarator(node) {
2685
2685
  const currentClass = classStack.at(-1);
2686
2686
  const currentMethod = methodStack.at(-1);
2687
- if (!currentClass || !currentMethod) {
2687
+ if (currentClass == null || currentMethod == null) {
2688
2688
  return;
2689
2689
  }
2690
2690
  if (!core.isClassComponent(currentClass) || currentMethod.static) {
2691
2691
  return;
2692
2692
  }
2693
- if (node.init && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern) {
2693
+ if (node.init != null && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern) {
2694
2694
  for (const prop of node.id.properties) {
2695
2695
  if (prop.type === types.AST_NODE_TYPES.Property && AST11__namespace.isKeyLiteralLike(prop, prop.key)) {
2696
2696
  const mbName = getName3(prop.key);
@@ -2761,7 +2761,7 @@ var no_unused_state_default = createRule({
2761
2761
  }
2762
2762
  function classExit() {
2763
2763
  const currentClass = classStack.pop();
2764
- if (!currentClass || !core.isClassComponent(currentClass)) {
2764
+ if (currentClass == null || !core.isClassComponent(currentClass)) {
2765
2765
  return;
2766
2766
  }
2767
2767
  const className = eff.O.map(AST11__namespace.getClassIdentifier(currentClass), (id) => id.name);
@@ -2780,7 +2780,7 @@ var no_unused_state_default = createRule({
2780
2780
  function methodEnter(node) {
2781
2781
  methodStack.push(node);
2782
2782
  const currentClass = classStack.at(-1);
2783
- if (!currentClass || !core.isClassComponent(currentClass)) {
2783
+ if (currentClass == null || !core.isClassComponent(currentClass)) {
2784
2784
  return;
2785
2785
  }
2786
2786
  if (node.static) {
@@ -2809,11 +2809,11 @@ var no_unused_state_default = createRule({
2809
2809
  return;
2810
2810
  }
2811
2811
  const currentClass = classStack.at(-1);
2812
- if (!currentClass || !core.isClassComponent(currentClass)) {
2812
+ if (currentClass == null || !core.isClassComponent(currentClass)) {
2813
2813
  return;
2814
2814
  }
2815
2815
  const currentConstructor = constructorStack.at(-1);
2816
- if (!currentConstructor || !currentClass.body.body.includes(currentConstructor)) {
2816
+ if (currentConstructor == null || !currentClass.body.body.includes(currentConstructor)) {
2817
2817
  return;
2818
2818
  }
2819
2819
  const [_, isUsed] = stateDefs.get(currentClass) ?? [eff.O.none(), false];
@@ -2831,11 +2831,11 @@ var no_unused_state_default = createRule({
2831
2831
  return;
2832
2832
  }
2833
2833
  const currentClass = classStack.at(-1);
2834
- if (!currentClass || !core.isClassComponent(currentClass)) {
2834
+ if (currentClass == null || !core.isClassComponent(currentClass)) {
2835
2835
  return;
2836
2836
  }
2837
2837
  const currentMethod = methodStack.at(-1);
2838
- if (!currentMethod || currentMethod.static) {
2838
+ if (currentMethod == null || currentMethod.static) {
2839
2839
  return;
2840
2840
  }
2841
2841
  if (currentMethod === constructorStack.at(-1)) {
@@ -2855,11 +2855,11 @@ var no_unused_state_default = createRule({
2855
2855
  "PropertyDefinition:exit": methodExit,
2856
2856
  VariableDeclarator(node) {
2857
2857
  const currentClass = classStack.at(-1);
2858
- if (!currentClass || !core.isClassComponent(currentClass)) {
2858
+ if (currentClass == null || !core.isClassComponent(currentClass)) {
2859
2859
  return;
2860
2860
  }
2861
2861
  const currentMethod = methodStack.at(-1);
2862
- if (!currentMethod || currentMethod.static) {
2862
+ if (currentMethod == null || currentMethod.static) {
2863
2863
  return;
2864
2864
  }
2865
2865
  if (currentMethod === constructorStack.at(-1)) {
@@ -2868,7 +2868,7 @@ var no_unused_state_default = createRule({
2868
2868
  if (!currentClass.body.body.includes(currentMethod)) {
2869
2869
  return;
2870
2870
  }
2871
- if (!(node.init && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern)) {
2871
+ if (!(node.init != null && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern)) {
2872
2872
  return;
2873
2873
  }
2874
2874
  const hasState = node.id.properties.some((prop) => {
@@ -3014,7 +3014,7 @@ var prefer_destructuring_assignment_default = createRule({
3014
3014
  for (const [initialScope, memberExpression] of memberExpressionWithNames) {
3015
3015
  let scope = initialScope;
3016
3016
  let isComponent = isFunctionComponent(scope.block);
3017
- while (!isComponent && scope.upper && scope.upper !== scope) {
3017
+ while (!isComponent && scope.upper != null && scope.upper !== scope) {
3018
3018
  scope = scope.upper;
3019
3019
  isComponent = isFunctionComponent(scope.block);
3020
3020
  }
@@ -3140,7 +3140,7 @@ var prefer_read_only_props_default = createRule({
3140
3140
  const components = ctx.getAllComponents(node);
3141
3141
  for (const [_, component] of components) {
3142
3142
  const [props] = component.node.params;
3143
- if (!props) {
3143
+ if (props == null) {
3144
3144
  continue;
3145
3145
  }
3146
3146
  const propsType = typeUtils.getConstrainedTypeAtLocation(services, props);
@@ -3229,7 +3229,7 @@ var prefer_shorthand_fragment_default = createRule({
3229
3229
  node,
3230
3230
  fix: (fixer) => {
3231
3231
  const { closingElement, openingElement } = node;
3232
- if (!closingElement) {
3232
+ if (closingElement == null) {
3233
3233
  return [];
3234
3234
  }
3235
3235
  return [
package/dist/index.mjs CHANGED
@@ -15,7 +15,7 @@ import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReado
15
15
 
16
16
  // package.json
17
17
  var name = "eslint-plugin-react-x";
18
- var version = "1.23.3-next.5";
18
+ var version = "1.23.3-next.6";
19
19
  var createRule = createRuleForPlugin("x");
20
20
 
21
21
  // src/rules/avoid-shorthand-boolean.ts
@@ -39,7 +39,7 @@ var avoid_shorthand_boolean_default = createRule({
39
39
  name: RULE_NAME,
40
40
  create(context) {
41
41
  function getReportDescriptor(node) {
42
- return node.value ? O.none() : O.some({
42
+ return node.value != null ? O.none() : O.some({
43
43
  messageId: "avoidShorthandBoolean",
44
44
  node,
45
45
  data: {
@@ -109,11 +109,11 @@ var ensure_forward_ref_using_ref_default = createRule({
109
109
  return;
110
110
  }
111
111
  const [component] = node.arguments;
112
- if (!component || !AST11.isFunction(component)) {
112
+ if (component == null || !AST11.isFunction(component)) {
113
113
  return;
114
114
  }
115
115
  const [_, ref] = component.params;
116
- if (ref) {
116
+ if (ref != null) {
117
117
  return;
118
118
  }
119
119
  context.report({
@@ -194,15 +194,15 @@ var no_access_state_in_setstate_default = createRule({
194
194
  return;
195
195
  }
196
196
  const [currClass, isComponent] = classStack.at(-1) ?? [];
197
- if (!currClass || !isComponent) {
197
+ if (currClass == null || !isComponent) {
198
198
  return;
199
199
  }
200
200
  const [currMethod, isStatic] = methodStack.at(-1) ?? [];
201
- if (!currMethod || isStatic) {
201
+ if (currMethod == null || isStatic) {
202
202
  return;
203
203
  }
204
204
  const [setState, hasThisState] = setStateStack.at(-1) ?? [];
205
- if (!setState || hasThisState) {
205
+ if (setState == null || hasThisState) {
206
206
  return;
207
207
  }
208
208
  if (!O.exists(getName(node.property), (name2) => name2 === "state")) {
@@ -224,18 +224,18 @@ var no_access_state_in_setstate_default = createRule({
224
224
  },
225
225
  VariableDeclarator(node) {
226
226
  const [currClass, isComponent] = classStack.at(-1) ?? [];
227
- if (!currClass || !isComponent) {
227
+ if (currClass == null || !isComponent) {
228
228
  return;
229
229
  }
230
230
  const [currMethod, isStatic] = methodStack.at(-1) ?? [];
231
- if (!currMethod || isStatic) {
231
+ if (currMethod == null || isStatic) {
232
232
  return;
233
233
  }
234
234
  const [setState, hasThisState] = setStateStack.at(-1) ?? [];
235
- if (!setState || hasThisState) {
235
+ if (setState == null || hasThisState) {
236
236
  return;
237
237
  }
238
- if (!(node.init && AST11.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern)) {
238
+ if (!(node.init != null && AST11.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern)) {
239
239
  return;
240
240
  }
241
241
  const hasState = node.id.properties.some((prop) => {
@@ -306,7 +306,7 @@ function getMapIndexParamName(node, context) {
306
306
  return O.none();
307
307
  }
308
308
  const callbackArg = node.arguments[isUsingReactChildren(node, context) ? 1 : 0];
309
- if (!callbackArg) {
309
+ if (callbackArg == null) {
310
310
  return O.none();
311
311
  }
312
312
  if (!AST11.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(callbackArg)) {
@@ -321,7 +321,7 @@ function getMapIndexParamName(node, context) {
321
321
  return O.none();
322
322
  }
323
323
  const param = params.at(indexParamPosition);
324
- return param && "name" in param ? O.some(param.name) : O.none();
324
+ return param != null && "name" in param ? O.some(param.name) : O.none();
325
325
  }
326
326
  var no_array_index_key_default = createRule({
327
327
  meta: {
@@ -382,7 +382,7 @@ var no_array_index_key_default = createRule({
382
382
  }];
383
383
  }
384
384
  // key={String(bar)}
385
- case (node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === "String" && node.arguments[0] && isArrayIndex(node.arguments[0])): {
385
+ case (node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === "String" && node.arguments[0] != null && isArrayIndex(node.arguments[0])): {
386
386
  return [{
387
387
  messageId: "noArrayIndexKey",
388
388
  node: node.arguments[0]
@@ -996,7 +996,7 @@ var no_context_provider_default = createRule({
996
996
  const providerName = elementName.replace(/\.Provider$/, "");
997
997
  const openingElement = node.openingElement;
998
998
  const closingElement = node.closingElement;
999
- if (!closingElement) {
999
+ if (closingElement == null) {
1000
1000
  return fixer.replaceText(openingElement.name, providerName);
1001
1001
  }
1002
1002
  return [
@@ -1238,7 +1238,7 @@ var no_duplicate_key_default = createRule({
1238
1238
  function isKeyValueEqual(a, b) {
1239
1239
  const aValue = a.value;
1240
1240
  const bValue = b.value;
1241
- if (aValue === null || bValue === null) {
1241
+ if (aValue == null || bValue == null) {
1242
1242
  return false;
1243
1243
  }
1244
1244
  return AST11.isNodeEqual(aValue, bValue);
@@ -1346,7 +1346,7 @@ var no_forward_ref_default = createRule({
1346
1346
  function getFix(node, context) {
1347
1347
  return (fixer) => {
1348
1348
  const [componentNode] = node.arguments;
1349
- if (!componentNode || !AST11.isFunction(componentNode)) {
1349
+ if (componentNode == null || !AST11.isFunction(componentNode)) {
1350
1350
  return [];
1351
1351
  }
1352
1352
  return [
@@ -1367,7 +1367,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
1367
1367
  const getText = (node2) => context.sourceCode.getText(node2);
1368
1368
  const [arg0, arg1] = node.params;
1369
1369
  const [typeArg0, typeArg1] = typeArguments;
1370
- if (!arg0) {
1370
+ if (arg0 == null) {
1371
1371
  return [];
1372
1372
  }
1373
1373
  const fixedArg0Text = match(arg0).with({ type: AST_NODE_TYPES.Identifier }, (n) => O.some(`...${n.name}`)).with({ type: AST_NODE_TYPES.ObjectPattern }, (n) => O.some(n.properties.map(getText).join(", "))).otherwise(O.none);
@@ -1377,7 +1377,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
1377
1377
  }
1378
1378
  const fixedPropsText = fixedArg0Text.value;
1379
1379
  const fixedRefText = fixedArg1Text.value;
1380
- if (!typeArg0 || !typeArg1) {
1380
+ if (typeArg0 == null || typeArg1 == null) {
1381
1381
  return [
1382
1382
  fixer.replaceText(
1383
1383
  arg0,
@@ -1388,7 +1388,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
1388
1388
  "}"
1389
1389
  ].join(" ")
1390
1390
  ),
1391
- ...arg1 ? [fixer.remove(arg1), fixer.removeRange([arg0.range[1], arg1.range[0]])] : []
1391
+ ...arg1 == null ? [] : [fixer.remove(arg1), fixer.removeRange([arg0.range[1], arg1.range[0]])]
1392
1392
  ];
1393
1393
  }
1394
1394
  return [
@@ -1407,7 +1407,7 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
1407
1407
  "}"
1408
1408
  ].join(" ")
1409
1409
  ),
1410
- ...arg1 ? [fixer.remove(arg1), fixer.removeRange([arg0.range[1], arg1.range[0]])] : []
1410
+ ...arg1 == null ? [] : [fixer.remove(arg1), fixer.removeRange([arg0.range[1], arg1.range[0]])]
1411
1411
  ];
1412
1412
  }
1413
1413
  var RULE_NAME26 = "no-implicit-key";
@@ -1483,7 +1483,7 @@ function inspectVariantTypes(types) {
1483
1483
  }
1484
1484
  const booleans = types.filter(tsHelpers.isBooleanType);
1485
1485
  switch (true) {
1486
- case (booleans.length === 1 && !!booleans[0]): {
1486
+ case (booleans.length === 1 && booleans[0] != null): {
1487
1487
  const [first] = booleans;
1488
1488
  const evaluated = F.pipe(
1489
1489
  match(first).when(isTrueLiteralType, () => O.some("truthy boolean")).when(isFalseLiteralType, () => O.some("falsy boolean")).otherwise(O.none)
@@ -1642,7 +1642,7 @@ var no_missing_component_display_name_default = createRule({
1642
1642
  "Program:exit"(node) {
1643
1643
  const components = ctx.getAllComponents(node);
1644
1644
  for (const { node: node2, displayName, flag } of components.values()) {
1645
- const isMemoOrForwardRef = Boolean(flag & ERFunctionComponentFlag.ForwardRef) || Boolean(flag & ERFunctionComponentFlag.Memo);
1645
+ const isMemoOrForwardRef = (flag & (ERFunctionComponentFlag.ForwardRef | ERFunctionComponentFlag.Memo)) > 0n;
1646
1646
  if (O.isSome(AST11.getFunctionIdentifier(node2))) {
1647
1647
  continue;
1648
1648
  }
@@ -1724,7 +1724,7 @@ var no_missing_key_default = createRule({
1724
1724
  }
1725
1725
  function checkBlockStatement(node) {
1726
1726
  return AST11.getNestedReturnStatements(node).reduce((acc, statement) => {
1727
- if (!statement.argument) {
1727
+ if (statement.argument == null) {
1728
1728
  return acc;
1729
1729
  }
1730
1730
  const mbDescriptor = checkIteratorElement(statement.argument);
@@ -2000,7 +2000,7 @@ var no_redundant_should_component_update_default = createRule({
2000
2000
  "Program:exit"(node) {
2001
2001
  const components = ctx.getAllComponents(node);
2002
2002
  for (const { name: name2, node: component, flag } of components.values()) {
2003
- if (!(flag & ERClassComponentFlag.PureComponent)) {
2003
+ if ((flag & ERClassComponentFlag.PureComponent) === 0n) {
2004
2004
  continue;
2005
2005
  }
2006
2006
  const { body } = component.body;
@@ -2472,7 +2472,7 @@ var no_unstable_default_props_default = createRule({
2472
2472
  for (const { node: component } of components.values()) {
2473
2473
  const { params } = component;
2474
2474
  const [props] = params;
2475
- if (!props) {
2475
+ if (props == null) {
2476
2476
  continue;
2477
2477
  }
2478
2478
  const properties = match(props).with({ type: AST_NODE_TYPES.ObjectPattern }, ({ properties: properties2 }) => properties2).with({ type: AST_NODE_TYPES.Identifier }, ({ name: name2 }) => {
@@ -2584,13 +2584,13 @@ var no_unused_class_component_members_default = createRule({
2584
2584
  }
2585
2585
  function classExit() {
2586
2586
  const currentClass = classStack.pop();
2587
- if (!currentClass || !isClassComponent(currentClass)) {
2587
+ if (currentClass == null || !isClassComponent(currentClass)) {
2588
2588
  return;
2589
2589
  }
2590
2590
  const className = O.map(AST11.getClassIdentifier(currentClass), (id) => id.name);
2591
2591
  const defs = propertyDefs.get(currentClass);
2592
2592
  const usages = propertyUsages.get(currentClass);
2593
- if (!defs) {
2593
+ if (defs == null) {
2594
2594
  return;
2595
2595
  }
2596
2596
  for (const def of defs) {
@@ -2614,7 +2614,7 @@ var no_unused_class_component_members_default = createRule({
2614
2614
  function methodEnter(node) {
2615
2615
  methodStack.push(node);
2616
2616
  const currentClass = classStack.at(-1);
2617
- if (!currentClass || !isClassComponent(currentClass)) {
2617
+ if (currentClass == null || !isClassComponent(currentClass)) {
2618
2618
  return;
2619
2619
  }
2620
2620
  if (node.static) {
@@ -2635,7 +2635,7 @@ var no_unused_class_component_members_default = createRule({
2635
2635
  MemberExpression(node) {
2636
2636
  const currentClass = classStack.at(-1);
2637
2637
  const currentMethod = methodStack.at(-1);
2638
- if (!currentClass || !currentMethod) {
2638
+ if (currentClass == null || currentMethod == null) {
2639
2639
  return;
2640
2640
  }
2641
2641
  if (!isClassComponent(currentClass) || currentMethod.static) {
@@ -2657,13 +2657,13 @@ var no_unused_class_component_members_default = createRule({
2657
2657
  VariableDeclarator(node) {
2658
2658
  const currentClass = classStack.at(-1);
2659
2659
  const currentMethod = methodStack.at(-1);
2660
- if (!currentClass || !currentMethod) {
2660
+ if (currentClass == null || currentMethod == null) {
2661
2661
  return;
2662
2662
  }
2663
2663
  if (!isClassComponent(currentClass) || currentMethod.static) {
2664
2664
  return;
2665
2665
  }
2666
- if (node.init && AST11.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern) {
2666
+ if (node.init != null && AST11.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern) {
2667
2667
  for (const prop of node.id.properties) {
2668
2668
  if (prop.type === AST_NODE_TYPES.Property && AST11.isKeyLiteralLike(prop, prop.key)) {
2669
2669
  const mbName = getName3(prop.key);
@@ -2734,7 +2734,7 @@ var no_unused_state_default = createRule({
2734
2734
  }
2735
2735
  function classExit() {
2736
2736
  const currentClass = classStack.pop();
2737
- if (!currentClass || !isClassComponent(currentClass)) {
2737
+ if (currentClass == null || !isClassComponent(currentClass)) {
2738
2738
  return;
2739
2739
  }
2740
2740
  const className = O.map(AST11.getClassIdentifier(currentClass), (id) => id.name);
@@ -2753,7 +2753,7 @@ var no_unused_state_default = createRule({
2753
2753
  function methodEnter(node) {
2754
2754
  methodStack.push(node);
2755
2755
  const currentClass = classStack.at(-1);
2756
- if (!currentClass || !isClassComponent(currentClass)) {
2756
+ if (currentClass == null || !isClassComponent(currentClass)) {
2757
2757
  return;
2758
2758
  }
2759
2759
  if (node.static) {
@@ -2782,11 +2782,11 @@ var no_unused_state_default = createRule({
2782
2782
  return;
2783
2783
  }
2784
2784
  const currentClass = classStack.at(-1);
2785
- if (!currentClass || !isClassComponent(currentClass)) {
2785
+ if (currentClass == null || !isClassComponent(currentClass)) {
2786
2786
  return;
2787
2787
  }
2788
2788
  const currentConstructor = constructorStack.at(-1);
2789
- if (!currentConstructor || !currentClass.body.body.includes(currentConstructor)) {
2789
+ if (currentConstructor == null || !currentClass.body.body.includes(currentConstructor)) {
2790
2790
  return;
2791
2791
  }
2792
2792
  const [_, isUsed] = stateDefs.get(currentClass) ?? [O.none(), false];
@@ -2804,11 +2804,11 @@ var no_unused_state_default = createRule({
2804
2804
  return;
2805
2805
  }
2806
2806
  const currentClass = classStack.at(-1);
2807
- if (!currentClass || !isClassComponent(currentClass)) {
2807
+ if (currentClass == null || !isClassComponent(currentClass)) {
2808
2808
  return;
2809
2809
  }
2810
2810
  const currentMethod = methodStack.at(-1);
2811
- if (!currentMethod || currentMethod.static) {
2811
+ if (currentMethod == null || currentMethod.static) {
2812
2812
  return;
2813
2813
  }
2814
2814
  if (currentMethod === constructorStack.at(-1)) {
@@ -2828,11 +2828,11 @@ var no_unused_state_default = createRule({
2828
2828
  "PropertyDefinition:exit": methodExit,
2829
2829
  VariableDeclarator(node) {
2830
2830
  const currentClass = classStack.at(-1);
2831
- if (!currentClass || !isClassComponent(currentClass)) {
2831
+ if (currentClass == null || !isClassComponent(currentClass)) {
2832
2832
  return;
2833
2833
  }
2834
2834
  const currentMethod = methodStack.at(-1);
2835
- if (!currentMethod || currentMethod.static) {
2835
+ if (currentMethod == null || currentMethod.static) {
2836
2836
  return;
2837
2837
  }
2838
2838
  if (currentMethod === constructorStack.at(-1)) {
@@ -2841,7 +2841,7 @@ var no_unused_state_default = createRule({
2841
2841
  if (!currentClass.body.body.includes(currentMethod)) {
2842
2842
  return;
2843
2843
  }
2844
- if (!(node.init && AST11.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern)) {
2844
+ if (!(node.init != null && AST11.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern)) {
2845
2845
  return;
2846
2846
  }
2847
2847
  const hasState = node.id.properties.some((prop) => {
@@ -2987,7 +2987,7 @@ var prefer_destructuring_assignment_default = createRule({
2987
2987
  for (const [initialScope, memberExpression] of memberExpressionWithNames) {
2988
2988
  let scope = initialScope;
2989
2989
  let isComponent = isFunctionComponent(scope.block);
2990
- while (!isComponent && scope.upper && scope.upper !== scope) {
2990
+ while (!isComponent && scope.upper != null && scope.upper !== scope) {
2991
2991
  scope = scope.upper;
2992
2992
  isComponent = isFunctionComponent(scope.block);
2993
2993
  }
@@ -3113,7 +3113,7 @@ var prefer_read_only_props_default = createRule({
3113
3113
  const components = ctx.getAllComponents(node);
3114
3114
  for (const [_, component] of components) {
3115
3115
  const [props] = component.node.params;
3116
- if (!props) {
3116
+ if (props == null) {
3117
3117
  continue;
3118
3118
  }
3119
3119
  const propsType = getConstrainedTypeAtLocation(services, props);
@@ -3202,7 +3202,7 @@ var prefer_shorthand_fragment_default = createRule({
3202
3202
  node,
3203
3203
  fix: (fixer) => {
3204
3204
  const { closingElement, openingElement } = node;
3205
- if (!closingElement) {
3205
+ if (closingElement == null) {
3206
3206
  return [];
3207
3207
  }
3208
3208
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "1.23.3-next.5",
3
+ "version": "1.23.3-next.6",
4
4
  "description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
5
5
  "keywords": [
6
6
  "react",
@@ -48,13 +48,13 @@
48
48
  "is-immutable-type": "^5.0.1",
49
49
  "string-ts": "^2.2.0",
50
50
  "ts-pattern": "^5.6.0",
51
- "@eslint-react/ast": "1.23.3-next.5",
52
- "@eslint-react/core": "1.23.3-next.5",
53
- "@eslint-react/eff": "1.23.3-next.5",
54
- "@eslint-react/shared": "1.23.3-next.5",
55
- "@eslint-react/types": "1.23.3-next.5",
56
- "@eslint-react/var": "1.23.3-next.5",
57
- "@eslint-react/jsx": "1.23.3-next.5"
51
+ "@eslint-react/ast": "1.23.3-next.6",
52
+ "@eslint-react/core": "1.23.3-next.6",
53
+ "@eslint-react/jsx": "1.23.3-next.6",
54
+ "@eslint-react/eff": "1.23.3-next.6",
55
+ "@eslint-react/shared": "1.23.3-next.6",
56
+ "@eslint-react/var": "1.23.3-next.6",
57
+ "@eslint-react/types": "1.23.3-next.6"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/react": "^19.0.4",