@eslint-react/ast 5.18.2 → 5.18.3

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.d.ts CHANGED
@@ -89,7 +89,7 @@ declare const isEqual: {
89
89
  (a: TSESTree.Node, b: TSESTree.Node): boolean;
90
90
  };
91
91
  declare namespace extract_d_exports {
92
- export { findProperty, getCalleeName, getFullyQualifiedName, getIdentifierAt, getPropertyName, unwrap };
92
+ export { findProperty, getCalleeName, getFullyQualifiedName, getIdentifierAt, getInnermostCall, getPropertyName, unwrap };
93
93
  }
94
94
  /**
95
95
  * Recursively unwrap TypeScript type expressions and chain expressions to get the underlying expression.
@@ -110,6 +110,13 @@ declare function findProperty(properties: TSESTree.ObjectLiteralElement[], name:
110
110
  * @returns The callee name (ex: `"useState"`), or `null` when it cannot be statically determined.
111
111
  */
112
112
  declare function getCalleeName(node: TSESTree.CallExpression): string | null;
113
+ /**
114
+ * Unwrap curried call wrappers like `connect(...)(Component)` to get the innermost call expression.
115
+ * Type expressions and chain expressions around each callee are unwrapped along the way.
116
+ * @param node The outermost call expression to inspect.
117
+ * @returns The innermost call expression, whose callee is not itself a call expression.
118
+ */
119
+ declare function getInnermostCall(node: TSESTree.CallExpression): TSESTree.CallExpression;
113
120
  /**
114
121
  * Get the static name of an object property's key.
115
122
  * @param property The property to inspect.
package/dist/index.js CHANGED
@@ -642,6 +642,7 @@ var extract_exports = /* @__PURE__ */ __exportAll({
642
642
  getCalleeName: () => getCalleeName,
643
643
  getFullyQualifiedName: () => getFullyQualifiedName,
644
644
  getIdentifierAt: () => getIdentifierAt,
645
+ getInnermostCall: () => getInnermostCall,
645
646
  getPropertyName: () => getPropertyName,
646
647
  unwrap: () => unwrap
647
648
  });
@@ -682,6 +683,21 @@ function getCalleeName(node) {
682
683
  return null;
683
684
  }
684
685
  /**
686
+ * Unwrap curried call wrappers like `connect(...)(Component)` to get the innermost call expression.
687
+ * Type expressions and chain expressions around each callee are unwrapped along the way.
688
+ * @param node The outermost call expression to inspect.
689
+ * @returns The innermost call expression, whose callee is not itself a call expression.
690
+ */
691
+ function getInnermostCall(node) {
692
+ let call = node;
693
+ let callee = unwrap(call.callee);
694
+ while (callee.type === AST_NODE_TYPES.CallExpression) {
695
+ call = callee;
696
+ callee = unwrap(call.callee);
697
+ }
698
+ return call;
699
+ }
700
+ /**
685
701
  * Get the static name of an object property's key.
686
702
  * @param property The property to inspect.
687
703
  * @param effort `"min"` only matches plain identifiers; `"max"` also resolves string literals and simple template literals.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/ast",
3
- "version": "5.18.2",
3
+ "version": "5.18.3",
4
4
  "description": "ESLint React's TSESTree AST utility module.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -29,20 +29,20 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@typescript-eslint/types": "^8.65.0",
33
- "@typescript-eslint/typescript-estree": "^8.65.0",
34
- "@typescript-eslint/utils": "^8.65.0",
32
+ "@typescript-eslint/types": "^8.66.0",
33
+ "@typescript-eslint/typescript-estree": "^8.66.0",
34
+ "@typescript-eslint/utils": "^8.66.0",
35
35
  "string-ts": "^2.3.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@typescript-eslint/parser": "^8.65.0",
38
+ "@typescript-eslint/parser": "^8.66.0",
39
39
  "eslint": "^10.8.0",
40
40
  "tsdown": "^0.22.14",
41
41
  "typescript": "6.0.3",
42
42
  "vitest": "^4.1.10",
43
- "@local/eff": "0.0.0",
43
+ "@local/configs": "0.0.0",
44
44
  "@local/testkit": "0.0.0",
45
- "@local/configs": "0.0.0"
45
+ "@local/eff": "0.0.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "eslint": "*",