eslint-plugin-react-x 5.18.4 → 5.18.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.
Files changed (2) hide show
  1. package/dist/index.js +10 -21
  2. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -145,7 +145,7 @@ const rules$6 = {
145
145
  //#endregion
146
146
  //#region package.json
147
147
  var name$6 = "eslint-plugin-react-x";
148
- var version = "5.18.4";
148
+ var version = "5.18.6";
149
149
 
150
150
  //#endregion
151
151
  //#region src/utils/create-rule.ts
@@ -1729,8 +1729,11 @@ function create$46(context) {
1729
1729
  function isArrayIndex(node) {
1730
1730
  return node.type === AST_NODE_TYPES.Identifier && isArrayIndexReference(context, node);
1731
1731
  }
1732
- function isCreateOrCloneElementCall(node) {
1733
- return core.isCreateElementCall(context, node) || core.isCloneElementCall(context, node);
1732
+ function getPropsObject(node) {
1733
+ const props = node.arguments[1];
1734
+ if (core.isCreateElementCall(context, node)) return core.getCreateElementPropsObject(context, node);
1735
+ if (!core.isCloneElementCall(context, node)) return null;
1736
+ return props?.type === AST_NODE_TYPES.ObjectExpression ? props : null;
1734
1737
  }
1735
1738
  /**
1736
1739
  * Checks an expression used as a 'key' value, recursing into the branches
@@ -1772,10 +1775,9 @@ function create$46(context) {
1772
1775
  }
1773
1776
  return {
1774
1777
  CallExpression(node) {
1775
- if (!isCreateOrCloneElementCall(node)) return;
1776
- const [, props] = node.arguments;
1777
- if (props?.type !== AST_NODE_TYPES.ObjectExpression) return;
1778
- for (const property of props.properties) {
1778
+ const propsObject = getPropsObject(node);
1779
+ if (propsObject == null) return;
1780
+ for (const property of propsObject.properties) {
1779
1781
  const value = getKeyPropValue(property);
1780
1782
  if (value == null) continue;
1781
1783
  for (const desc of visitKeyExpression(value)) context.report(desc);
@@ -3486,19 +3488,6 @@ function getWrapperCallBoundName(context, node) {
3486
3488
  return parent.id.name;
3487
3489
  }
3488
3490
  /**
3489
- * Check if the node is inside `createElement`'s props argument
3490
- * @param context The rule context
3491
- * @param node The AST node to check
3492
- * @returns `true` if the node is inside `createElement`'s props
3493
- */
3494
- function isInsideCreateElementProps(context, node) {
3495
- const call = Traverse.findParent(node, core.isCreateElementCall(context));
3496
- if (call == null) return false;
3497
- const prop = Traverse.findParent(node, Check.is(AST_NODE_TYPES.ObjectExpression));
3498
- if (prop == null) return false;
3499
- return prop === call.arguments[1];
3500
- }
3501
- /**
3502
3491
  * Check if the node is inside a JSX attribute value
3503
3492
  * @param node The AST node to check
3504
3493
  * @returns `true` if the node is inside a JSX attribute value
@@ -3560,7 +3549,7 @@ function create$22(context) {
3560
3549
  });
3561
3550
  continue;
3562
3551
  }
3563
- if (isInsideCreateElementProps(context, component)) {
3552
+ if (core.isInsideCreateElementProps(context, component)) {
3564
3553
  context.report({
3565
3554
  data: {
3566
3555
  name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "5.18.4",
3
+ "version": "5.18.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",
@@ -36,21 +36,21 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@typescript-eslint/scope-manager": "^8.66.0",
40
- "@typescript-eslint/type-utils": "^8.66.0",
41
- "@typescript-eslint/types": "^8.66.0",
42
- "@typescript-eslint/typescript-estree": "^8.66.0",
43
- "@typescript-eslint/utils": "^8.66.0",
39
+ "@typescript-eslint/scope-manager": "^8.67.0",
40
+ "@typescript-eslint/type-utils": "^8.67.0",
41
+ "@typescript-eslint/types": "^8.67.0",
42
+ "@typescript-eslint/typescript-estree": "^8.67.0",
43
+ "@typescript-eslint/utils": "^8.67.0",
44
44
  "compare-versions": "^6.1.1",
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.18.4",
49
- "@eslint-react/core": "5.18.4",
50
- "@eslint-react/eslint": "5.18.4",
51
- "@eslint-react/jsx": "5.18.4",
52
- "@eslint-react/var": "5.18.4",
53
- "@eslint-react/shared": "5.18.4"
48
+ "@eslint-react/ast": "5.18.6",
49
+ "@eslint-react/jsx": "5.18.6",
50
+ "@eslint-react/shared": "5.18.6",
51
+ "@eslint-react/eslint": "5.18.6",
52
+ "@eslint-react/var": "5.18.6",
53
+ "@eslint-react/core": "5.18.6"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/react": "^19.2.18",