@eslint-react/ast 5.14.8 → 5.14.9
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 +8 -2
- package/dist/index.js +11 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -49,11 +49,17 @@ declare const isEqual: {
|
|
|
49
49
|
(a: TSESTree.Node, b: TSESTree.Node): boolean;
|
|
50
50
|
};
|
|
51
51
|
declare namespace extract_d_exports {
|
|
52
|
-
export {
|
|
52
|
+
export { getCalleeName, getFullyQualifiedName, getRootIdentifier, unwrap };
|
|
53
53
|
}
|
|
54
54
|
declare function unwrap(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTypeExpression>;
|
|
55
55
|
declare function getRootIdentifier(node: TSESTree.Expression | TSESTree.PrivateIdentifier): TSESTree.Identifier | null;
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Get the name of a call expression's callee when it is an identifier
|
|
58
|
+
* or a member expression whose property is an identifier
|
|
59
|
+
* @param node The call expression node
|
|
60
|
+
* @returns The callee name, or `null` if it cannot be determined
|
|
61
|
+
*/
|
|
62
|
+
declare function getCalleeName(node: TSESTree.CallExpression): string | null;
|
|
57
63
|
declare function getFullyQualifiedName(node: TSESTree.Node, getText: (node: TSESTree.Node) => string): string;
|
|
58
64
|
declare namespace traverse_d_exports {
|
|
59
65
|
export { findParent };
|
package/dist/index.js
CHANGED
|
@@ -239,8 +239,8 @@ const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
|
|
|
239
239
|
//#endregion
|
|
240
240
|
//#region src/extract.ts
|
|
241
241
|
var extract_exports = /* @__PURE__ */ __exportAll({
|
|
242
|
+
getCalleeName: () => getCalleeName,
|
|
242
243
|
getFullyQualifiedName: () => getFullyQualifiedName,
|
|
243
|
-
getPropertyName: () => getPropertyName,
|
|
244
244
|
getRootIdentifier: () => getRootIdentifier,
|
|
245
245
|
unwrap: () => unwrap
|
|
246
246
|
});
|
|
@@ -254,11 +254,16 @@ function getRootIdentifier(node) {
|
|
|
254
254
|
if (expr.type === AST_NODE_TYPES.MemberExpression) return getRootIdentifier(expr.object);
|
|
255
255
|
return null;
|
|
256
256
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
257
|
+
/**
|
|
258
|
+
* Get the name of a call expression's callee when it is an identifier
|
|
259
|
+
* or a member expression whose property is an identifier
|
|
260
|
+
* @param node The call expression node
|
|
261
|
+
* @returns The callee name, or `null` if it cannot be determined
|
|
262
|
+
*/
|
|
263
|
+
function getCalleeName(node) {
|
|
264
|
+
const callee = unwrap(node.callee);
|
|
265
|
+
if (callee.type === AST_NODE_TYPES.Identifier) return callee.name;
|
|
266
|
+
if (callee.type === AST_NODE_TYPES.MemberExpression && callee.property.type === AST_NODE_TYPES.Identifier) return callee.property.name;
|
|
262
267
|
return null;
|
|
263
268
|
}
|
|
264
269
|
function getFullyQualifiedName(node, getText) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "5.14.
|
|
3
|
+
"version": "5.14.9",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@typescript-eslint/parser": "^8.63.0",
|
|
39
39
|
"eslint": "^10.7.0",
|
|
40
|
-
"tsdown": "^0.22.
|
|
40
|
+
"tsdown": "^0.22.7",
|
|
41
41
|
"typescript": "6.0.3",
|
|
42
42
|
"vitest": "^4.1.10",
|
|
43
43
|
"@local/configs": "0.0.0",
|