eslint-plugin-react-x 5.8.12 → 5.8.14

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 (2) hide show
  1. package/dist/index.js +58 -58
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -143,7 +143,7 @@ const rules$6 = {
143
143
  //#endregion
144
144
  //#region package.json
145
145
  var name$6 = "eslint-plugin-react-x";
146
- var version = "5.8.12";
146
+ var version = "5.8.14";
147
147
 
148
148
  //#endregion
149
149
  //#region src/utils/create-rule.ts
@@ -1721,7 +1721,7 @@ function create$47(context) {
1721
1721
  const classStack = [];
1722
1722
  const methodStack = [];
1723
1723
  const setStateStack = [];
1724
- return merge({
1724
+ return {
1725
1725
  CallExpression(node) {
1726
1726
  if (!core.isThisSetStateCall(node)) return;
1727
1727
  setStateStack.push([node, false]);
@@ -1782,7 +1782,7 @@ function create$47(context) {
1782
1782
  node
1783
1783
  });
1784
1784
  }
1785
- });
1785
+ };
1786
1786
  }
1787
1787
 
1788
1788
  //#endregion
@@ -1892,7 +1892,7 @@ function create$46(context) {
1892
1892
  }
1893
1893
  return [];
1894
1894
  }
1895
- return merge({
1895
+ return {
1896
1896
  CallExpression(node) {
1897
1897
  indexParamNames.push(getMapIndexParamName(context, node));
1898
1898
  if (node.arguments.length === 0) return;
@@ -1914,7 +1914,7 @@ function create$46(context) {
1914
1914
  if (node.value?.type !== AST_NODE_TYPES.JSXExpressionContainer) return;
1915
1915
  for (const descriptor of getReportDescriptors(node.value.expression)) report$2(context)(descriptor);
1916
1916
  }
1917
- });
1917
+ };
1918
1918
  }
1919
1919
 
1920
1920
  //#endregion
@@ -1932,12 +1932,12 @@ var no_children_count_default = createRule({
1932
1932
  defaultOptions: []
1933
1933
  });
1934
1934
  function create$45(context) {
1935
- return merge({ MemberExpression(node) {
1935
+ return { MemberExpression(node) {
1936
1936
  if (core.isChildrenCount(context, node)) context.report({
1937
1937
  messageId: "default",
1938
1938
  node: node.property
1939
1939
  });
1940
- } });
1940
+ } };
1941
1941
  }
1942
1942
 
1943
1943
  //#endregion
@@ -1955,12 +1955,12 @@ var no_children_for_each_default = createRule({
1955
1955
  defaultOptions: []
1956
1956
  });
1957
1957
  function create$44(context) {
1958
- return merge({ MemberExpression(node) {
1958
+ return { MemberExpression(node) {
1959
1959
  if (core.isChildrenForEach(context, node)) context.report({
1960
1960
  messageId: "default",
1961
1961
  node: node.property
1962
1962
  });
1963
- } });
1963
+ } };
1964
1964
  }
1965
1965
 
1966
1966
  //#endregion
@@ -1978,12 +1978,12 @@ var no_children_map_default = createRule({
1978
1978
  defaultOptions: []
1979
1979
  });
1980
1980
  function create$43(context) {
1981
- return merge({ MemberExpression(node) {
1981
+ return { MemberExpression(node) {
1982
1982
  if (core.isChildrenMap(context, node)) context.report({
1983
1983
  messageId: "default",
1984
1984
  node: node.property
1985
1985
  });
1986
- } });
1986
+ } };
1987
1987
  }
1988
1988
 
1989
1989
  //#endregion
@@ -2001,12 +2001,12 @@ var no_children_only_default = createRule({
2001
2001
  defaultOptions: []
2002
2002
  });
2003
2003
  function create$42(context) {
2004
- return merge({ MemberExpression(node) {
2004
+ return { MemberExpression(node) {
2005
2005
  if (core.isChildrenOnly(context, node)) context.report({
2006
2006
  messageId: "default",
2007
2007
  node: node.property
2008
2008
  });
2009
- } });
2009
+ } };
2010
2010
  }
2011
2011
 
2012
2012
  //#endregion
@@ -2024,12 +2024,12 @@ var no_children_to_array_default = createRule({
2024
2024
  defaultOptions: []
2025
2025
  });
2026
2026
  function create$41(context) {
2027
- return merge({ MemberExpression(node) {
2027
+ return { MemberExpression(node) {
2028
2028
  if (core.isChildrenToArray(context, node)) context.report({
2029
2029
  messageId: "default",
2030
2030
  node: node.property
2031
2031
  });
2032
- } });
2032
+ } };
2033
2033
  }
2034
2034
 
2035
2035
  //#endregion
@@ -2076,12 +2076,12 @@ var no_clone_element_default = createRule({
2076
2076
  defaultOptions: []
2077
2077
  });
2078
2078
  function create$39(context) {
2079
- return merge({ CallExpression(node) {
2079
+ return { CallExpression(node) {
2080
2080
  if (core.isCloneElementCall(context, node)) context.report({
2081
2081
  messageId: "default",
2082
2082
  node
2083
2083
  });
2084
- } });
2084
+ } };
2085
2085
  }
2086
2086
 
2087
2087
  //#endregion
@@ -2206,7 +2206,7 @@ function create$35(context) {
2206
2206
  if (!context.sourceCode.text.includes("Provider")) return {};
2207
2207
  const { version } = getSettingsFromContext(context);
2208
2208
  if (compare(version, "19.0.0", "<")) return {};
2209
- return merge({ JSXElement(node) {
2209
+ return { JSXElement(node) {
2210
2210
  const parts = getElementFullType(node).split(".");
2211
2211
  const selfName = parts.pop();
2212
2212
  const contextFullName = parts.join(".");
@@ -2227,7 +2227,7 @@ function create$35(context) {
2227
2227
  messageId: "replace"
2228
2228
  }]
2229
2229
  });
2230
- } });
2230
+ } };
2231
2231
  }
2232
2232
 
2233
2233
  //#endregion
@@ -2287,7 +2287,7 @@ var no_direct_mutation_state_default = createRule({
2287
2287
  defaultOptions: []
2288
2288
  });
2289
2289
  function create$33(context) {
2290
- return merge({ AssignmentExpression(node) {
2290
+ return { AssignmentExpression(node) {
2291
2291
  if (!core.isAssignmentToThisState(node)) return;
2292
2292
  const parentClass = Traverse.findParent(node, isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]));
2293
2293
  if (parentClass == null) return;
@@ -2295,7 +2295,7 @@ function create$33(context) {
2295
2295
  messageId: "default",
2296
2296
  node
2297
2297
  });
2298
- } });
2298
+ } };
2299
2299
  }
2300
2300
 
2301
2301
  //#endregion
@@ -2321,7 +2321,7 @@ function create$32(context) {
2321
2321
  if (aValue == null || bValue == null) return false;
2322
2322
  return Compare.isEqual(aValue, bValue);
2323
2323
  }
2324
- return merge({
2324
+ return {
2325
2325
  "JSXAttribute[name.name='key']"(node) {
2326
2326
  const jsxElement = node.parent.parent;
2327
2327
  switch (jsxElement.parent.type) {
@@ -2366,7 +2366,7 @@ function create$32(context) {
2366
2366
  });
2367
2367
  }
2368
2368
  }
2369
- });
2369
+ };
2370
2370
  }
2371
2371
 
2372
2372
  //#endregion
@@ -2392,7 +2392,7 @@ function create$31(context) {
2392
2392
  if (!context.sourceCode.text.includes("forwardRef")) return {};
2393
2393
  const { version } = getSettingsFromContext(context);
2394
2394
  if (compare(version, "19.0.0", "<")) return {};
2395
- return merge({ CallExpression(node) {
2395
+ return { CallExpression(node) {
2396
2396
  if (!core.isForwardRefCall(context, node)) return;
2397
2397
  const id = core.getFunctionId(node);
2398
2398
  const suggest = canFix(context, node) ? [{
@@ -2404,7 +2404,7 @@ function create$31(context) {
2404
2404
  node: id ?? node,
2405
2405
  suggest
2406
2406
  });
2407
- } });
2407
+ } };
2408
2408
  }
2409
2409
  /**
2410
2410
  * Determine whether the given CallExpression can be safely auto-fixed by replacing
@@ -2510,7 +2510,7 @@ var no_implicit_children_default = createRule({
2510
2510
  function create$30(context) {
2511
2511
  const services = ESLintUtils.getParserServices(context, false);
2512
2512
  const checker = services.program.getTypeChecker();
2513
- return merge({ JSXSpreadAttribute(node) {
2513
+ return { JSXSpreadAttribute(node) {
2514
2514
  for (const type of unionConstituents(getConstrainedTypeAtLocation(services, node.argument))) {
2515
2515
  const children = type.getProperty("children");
2516
2516
  if (children == null) continue;
@@ -2527,7 +2527,7 @@ function create$30(context) {
2527
2527
  node
2528
2528
  });
2529
2529
  }
2530
- } });
2530
+ } };
2531
2531
  }
2532
2532
 
2533
2533
  //#endregion
@@ -2547,7 +2547,7 @@ var no_implicit_key_default = createRule({
2547
2547
  function create$29(context) {
2548
2548
  const services = ESLintUtils.getParserServices(context, false);
2549
2549
  const checker = services.program.getTypeChecker();
2550
- return merge({ JSXSpreadAttribute(node) {
2550
+ return { JSXSpreadAttribute(node) {
2551
2551
  for (const type of unionConstituents(getConstrainedTypeAtLocation(services, node.argument))) {
2552
2552
  const key = type.getProperty("key");
2553
2553
  if (key == null) continue;
@@ -2561,7 +2561,7 @@ function create$29(context) {
2561
2561
  node
2562
2562
  });
2563
2563
  }
2564
- } });
2564
+ } };
2565
2565
  }
2566
2566
 
2567
2567
  //#endregion
@@ -2582,7 +2582,7 @@ var no_implicit_ref_default = createRule({
2582
2582
  function create$28(context) {
2583
2583
  const services = ESLintUtils.getParserServices(context, false);
2584
2584
  const checker = services.program.getTypeChecker();
2585
- return merge({ JSXSpreadAttribute(node) {
2585
+ return { JSXSpreadAttribute(node) {
2586
2586
  for (const type of unionConstituents(getConstrainedTypeAtLocation(services, node.argument))) {
2587
2587
  const ref = type.getProperty("ref");
2588
2588
  if (ref == null) continue;
@@ -2598,7 +2598,7 @@ function create$28(context) {
2598
2598
  node
2599
2599
  });
2600
2600
  }
2601
- } });
2601
+ } };
2602
2602
  }
2603
2603
 
2604
2604
  //#endregion
@@ -2632,7 +2632,7 @@ var no_leaked_conditional_rendering_default = createRule({
2632
2632
  function create$27(context) {
2633
2633
  if (!context.sourceCode.text.includes("&&")) return {};
2634
2634
  const { version } = getSettingsFromContext(context);
2635
- const allowedVariants = [
2635
+ const allowedTypeVariants = [
2636
2636
  "any",
2637
2637
  "boolean",
2638
2638
  "nullish",
@@ -2670,7 +2670,7 @@ function create$27(context) {
2670
2670
  };
2671
2671
  const leftType = getConstrainedTypeAtLocation(services, left);
2672
2672
  const leftTypeVariants = core.getTypeVariants(unionConstituents(leftType));
2673
- if (Array.from(leftTypeVariants.values()).every((type) => allowedVariants.some((allowed) => allowed === type))) return getReportDescriptor(right, visited);
2673
+ if (Array.from(leftTypeVariants.values()).every((t) => allowedTypeVariants.some((a) => a === t))) return getReportDescriptor(right, visited);
2674
2674
  return {
2675
2675
  data: { value: context.sourceCode.getText(left) },
2676
2676
  messageId: "default",
@@ -2685,7 +2685,7 @@ function create$27(context) {
2685
2685
  return match(variableDefNode).with({ init: P.select({ type: P.not(AST_NODE_TYPES.VariableDeclaration) }) }, (init) => getReportDescriptor(init, visited)).otherwise(() => null);
2686
2686
  }).otherwise(() => null);
2687
2687
  }
2688
- return merge({ JSXExpressionContainer: flow(getReportDescriptor, report$1(context)) });
2688
+ return { JSXExpressionContainer: flow(getReportDescriptor, report$1(context)) };
2689
2689
  }
2690
2690
 
2691
2691
  //#endregion
@@ -2741,7 +2741,7 @@ function create$25(context) {
2741
2741
  if (!context.sourceCode.text.includes("createContext")) return {};
2742
2742
  const createCalls = [];
2743
2743
  const displayNameAssignments = [];
2744
- return merge({
2744
+ return {
2745
2745
  CallExpression(node) {
2746
2746
  if (!core.isCreateContextCall(context, node)) return;
2747
2747
  createCalls.push(node);
@@ -2784,7 +2784,7 @@ function create$25(context) {
2784
2784
  });
2785
2785
  }
2786
2786
  }
2787
- });
2787
+ };
2788
2788
  }
2789
2789
 
2790
2790
  //#endregion
@@ -2866,7 +2866,7 @@ function create$24(context) {
2866
2866
  }
2867
2867
  return descriptors;
2868
2868
  }
2869
- return merge({
2869
+ return {
2870
2870
  ArrayExpression(node) {
2871
2871
  if (inChildrenToArray) return;
2872
2872
  const elements = node.elements.filter(is(AST_NODE_TYPES.JSXElement));
@@ -2900,7 +2900,7 @@ function create$24(context) {
2900
2900
  node
2901
2901
  });
2902
2902
  }
2903
- });
2903
+ };
2904
2904
  }
2905
2905
 
2906
2906
  //#endregion
@@ -2955,7 +2955,7 @@ var no_misused_capture_owner_stack_default = createRule({
2955
2955
  function create$23(context) {
2956
2956
  if (!context.sourceCode.text.includes("captureOwnerStack")) return {};
2957
2957
  const { importSource } = getSettingsFromContext(context);
2958
- return merge({
2958
+ return {
2959
2959
  CallExpression(node) {
2960
2960
  if (!core.isCaptureOwnerStackCall(context, node)) return;
2961
2961
  if (Traverse.findParent(node, (n) => isDevelopmentOnlyCheck(context, n)) == null) context.report({
@@ -2974,7 +2974,7 @@ function create$23(context) {
2974
2974
  });
2975
2975
  }
2976
2976
  }
2977
- });
2977
+ };
2978
2978
  }
2979
2979
 
2980
2980
  //#endregion
@@ -3150,7 +3150,7 @@ var no_set_state_in_component_did_mount_default = createRule({
3150
3150
  });
3151
3151
  function create$20(context) {
3152
3152
  if (!context.sourceCode.text.includes("componentDidMount")) return {};
3153
- return merge({ CallExpression(node) {
3153
+ return { CallExpression(node) {
3154
3154
  if (!core.isThisSetStateCall(node)) return;
3155
3155
  const enclosingClassNode = Traverse.findParent(node, core.isClassComponent);
3156
3156
  const enclosingMethodNode = Traverse.findParent(node, (n) => n === enclosingClassNode || core.isComponentDidMount(n));
@@ -3161,7 +3161,7 @@ function create$20(context) {
3161
3161
  messageId: "default",
3162
3162
  node
3163
3163
  });
3164
- } });
3164
+ } };
3165
3165
  }
3166
3166
 
3167
3167
  //#endregion
@@ -3180,7 +3180,7 @@ var no_set_state_in_component_did_update_default = createRule({
3180
3180
  });
3181
3181
  function create$19(context) {
3182
3182
  if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
3183
- return merge({ CallExpression(node) {
3183
+ return { CallExpression(node) {
3184
3184
  if (!core.isThisSetStateCall(node)) return;
3185
3185
  const enclosingClassNode = Traverse.findParent(node, core.isClassComponent);
3186
3186
  const enclosingMethodNode = Traverse.findParent(node, (n) => n === enclosingClassNode || core.isComponentDidUpdate(n));
@@ -3191,7 +3191,7 @@ function create$19(context) {
3191
3191
  messageId: "default",
3192
3192
  node
3193
3193
  });
3194
- } });
3194
+ } };
3195
3195
  }
3196
3196
 
3197
3197
  //#endregion
@@ -3210,7 +3210,7 @@ var no_set_state_in_component_will_update_default = createRule({
3210
3210
  });
3211
3211
  function create$18(context) {
3212
3212
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
3213
- return merge({ CallExpression(node) {
3213
+ return { CallExpression(node) {
3214
3214
  if (!core.isThisSetStateCall(node)) return;
3215
3215
  const enclosingClassNode = Traverse.findParent(node, core.isClassComponent);
3216
3216
  const enclosingMethodNode = Traverse.findParent(node, (n) => n === enclosingClassNode || core.isComponentWillUpdate(n));
@@ -3221,7 +3221,7 @@ function create$18(context) {
3221
3221
  messageId: "default",
3222
3222
  node
3223
3223
  });
3224
- } });
3224
+ } };
3225
3225
  }
3226
3226
 
3227
3227
  //#endregion
@@ -3594,7 +3594,7 @@ function create$11(context) {
3594
3594
  function methodExit() {
3595
3595
  methodStack.pop();
3596
3596
  }
3597
- return merge({
3597
+ return {
3598
3598
  ClassDeclaration: classEnter,
3599
3599
  "ClassDeclaration:exit": classExit,
3600
3600
  ClassExpression: classEnter,
@@ -3628,7 +3628,7 @@ function create$11(context) {
3628
3628
  }
3629
3629
  }
3630
3630
  }
3631
- });
3631
+ };
3632
3632
  }
3633
3633
 
3634
3634
  //#endregion
@@ -3822,7 +3822,7 @@ function create$8(context) {
3822
3822
  if (!context.sourceCode.text.includes("useContext")) return {};
3823
3823
  const { version } = getSettingsFromContext(context);
3824
3824
  if (compare(version, "19.0.0", "<")) return {};
3825
- return merge({ CallExpression(node) {
3825
+ return { CallExpression(node) {
3826
3826
  if (!core.isUseContextCall(context, node)) return;
3827
3827
  context.report({
3828
3828
  messageId: "default",
@@ -3838,7 +3838,7 @@ function create$8(context) {
3838
3838
  messageId: "replace"
3839
3839
  }]
3840
3840
  });
3841
- } });
3841
+ } };
3842
3842
  }
3843
3843
 
3844
3844
  //#endregion
@@ -6856,7 +6856,7 @@ function create$5(context) {
6856
6856
  default: return false;
6857
6857
  }
6858
6858
  }
6859
- return merge({
6859
+ return {
6860
6860
  ":function"(node) {
6861
6861
  const kind = getFunctionKind(node);
6862
6862
  functionEntries.push({
@@ -6990,7 +6990,7 @@ function create$5(context) {
6990
6990
  }
6991
6991
  }
6992
6992
  }
6993
- });
6993
+ };
6994
6994
  }
6995
6995
 
6996
6996
  //#endregion
@@ -7084,7 +7084,7 @@ function create$4(context) {
7084
7084
  if (parent.type === AST_NODE_TYPES.CallExpression && parent.callee !== node) return "callback";
7085
7085
  return "other";
7086
7086
  }
7087
- return merge({
7087
+ return {
7088
7088
  ":function"(node) {
7089
7089
  const kind = getFunctionKind(node);
7090
7090
  functionEntries.push({
@@ -7131,7 +7131,7 @@ function create$4(context) {
7131
7131
  const idx = body.indexOf(stmt);
7132
7132
  if (idx !== -1 && idx < body.length - 1) componentHasEarlyReturn.current = true;
7133
7133
  }
7134
- });
7134
+ };
7135
7135
  }
7136
7136
 
7137
7137
  //#endregion
@@ -7431,7 +7431,7 @@ function create$1(context) {
7431
7431
  } });
7432
7432
  return violations;
7433
7433
  }
7434
- return merge({ CallExpression(node) {
7434
+ return { CallExpression(node) {
7435
7435
  if (!core.isUseMemoCall(context, node)) return;
7436
7436
  let parent = node.parent;
7437
7437
  while (Check.isTypeExpression(parent)) parent = parent.parent;
@@ -7473,7 +7473,7 @@ function create$1(context) {
7473
7473
  messageId: "mustReturnAValue",
7474
7474
  node: callbackArg
7475
7475
  });
7476
- } });
7476
+ } };
7477
7477
  }
7478
7478
 
7479
7479
  //#endregion
@@ -7620,7 +7620,7 @@ var use_state_default = createRule({
7620
7620
  function create(context) {
7621
7621
  const { enforceAssignment = true, enforceLazyInitialization = true, enforceSetterName = true } = context.options[0] ?? defaultOptions[0];
7622
7622
  const { additionalStateHooks } = getSettingsFromContext(context);
7623
- return merge({ CallExpression(node) {
7623
+ return { CallExpression(node) {
7624
7624
  if (!core.isUseStateLikeCall(node, additionalStateHooks)) return;
7625
7625
  if (enforceLazyInitialization) {
7626
7626
  const [useStateInput] = node.arguments;
@@ -7693,7 +7693,7 @@ function create(context) {
7693
7693
  messageId: "invalidSetterName",
7694
7694
  node: setter
7695
7695
  });
7696
- } });
7696
+ } };
7697
7697
  }
7698
7698
 
7699
7699
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "5.8.12",
3
+ "version": "5.8.14",
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",
@@ -45,21 +45,21 @@
45
45
  "string-ts": "^2.3.1",
46
46
  "ts-api-utils": "^2.5.0",
47
47
  "ts-pattern": "^5.9.0",
48
- "@eslint-react/ast": "5.8.12",
49
- "@eslint-react/eslint": "5.8.12",
50
- "@eslint-react/shared": "5.8.12",
51
- "@eslint-react/jsx": "5.8.12",
52
- "@eslint-react/core": "5.8.12",
53
- "@eslint-react/var": "5.8.12"
48
+ "@eslint-react/ast": "5.8.14",
49
+ "@eslint-react/core": "5.8.14",
50
+ "@eslint-react/jsx": "5.8.14",
51
+ "@eslint-react/shared": "5.8.14",
52
+ "@eslint-react/var": "5.8.14",
53
+ "@eslint-react/eslint": "5.8.14"
54
54
  },
55
55
  "devDependencies": {
56
- "@types/react": "^19.2.16",
56
+ "@types/react": "^19.2.17",
57
57
  "@types/react-dom": "^19.2.3",
58
58
  "dedent": "^1.7.2",
59
59
  "eslint": "^10.4.1",
60
60
  "react": "^19.2.7",
61
61
  "react-dom": "^19.2.7",
62
- "tsdown": "^0.22.1",
62
+ "tsdown": "^0.22.2",
63
63
  "tsl": "^1.0.30",
64
64
  "tsl-dx": "^0.12.2",
65
65
  "typescript": "6.0.3",