🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@eslint-react/ast

Package Overview
Dependencies
Maintainers
1
Versions
2646
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eslint-react/ast - npm Package Compare versions

Comparing version
5.14.8
to
5.14.10
+8
-2
dist/index.d.ts

@@ -52,7 +52,13 @@ import { AST_NODE_TYPES, TSESTree } from "@typescript-eslint/types";

declare namespace extract_d_exports {
export { getFullyQualifiedName, getPropertyName, getRootIdentifier, unwrap };
export { getCalleeName, getFullyQualifiedName, getRootIdentifier, unwrap };
}
declare function unwrap(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTypeExpression>;
declare function getRootIdentifier(node: TSESTree.Expression | TSESTree.PrivateIdentifier): TSESTree.Identifier | null;
declare function getPropertyName(node: TSESTree.Node, resolve?: (n: TSESTree.Identifier | TSESTree.PrivateIdentifier) => string | null): string | null;
/**
* Get the name of a call expression's callee when it is an identifier
* or a non-computed member expression whose property is an identifier
* @param node The call expression node
* @returns The callee name, or `null` if it cannot be determined
*/
declare function getCalleeName(node: TSESTree.CallExpression): string | null;
declare function getFullyQualifiedName(node: TSESTree.Node, getText: (node: TSESTree.Node) => string): string;

@@ -59,0 +65,0 @@ declare namespace traverse_d_exports {

+11
-6

@@ -242,4 +242,4 @@ import { t as __exportAll } from "./rolldown-runtime-w6R9maHv.js";

var extract_exports = /* @__PURE__ */ __exportAll({
getCalleeName: () => getCalleeName,
getFullyQualifiedName: () => getFullyQualifiedName,
getPropertyName: () => getPropertyName,
getRootIdentifier: () => getRootIdentifier,

@@ -258,7 +258,12 @@ unwrap: () => unwrap

}
function getPropertyName(node, resolve = (n) => n.name) {
node = unwrap(node);
if (node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.PrivateIdentifier) return resolve(node);
if (node.type === AST_NODE_TYPES.Literal) return String(node.value);
if (node.type === AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) return node.quasis[0]?.value.cooked ?? node.quasis[0]?.value.raw ?? null;
/**
* Get the name of a call expression's callee when it is an identifier
* or a non-computed member expression whose property is an identifier
* @param node The call expression node
* @returns The callee name, or `null` if it cannot be determined
*/
function getCalleeName(node) {
const callee = unwrap(node.callee);
if (callee.type === AST_NODE_TYPES.Identifier) return callee.name;
if (callee.type === AST_NODE_TYPES.MemberExpression && !callee.computed && callee.property.type === AST_NODE_TYPES.Identifier) return callee.property.name;
return null;

@@ -265,0 +270,0 @@ }

{
"name": "@eslint-react/ast",
"version": "5.14.8",
"version": "5.14.10",
"description": "ESLint React's TSESTree AST utility module.",

@@ -40,3 +40,3 @@ "homepage": "https://github.com/Rel1cx/eslint-react",

"eslint": "^10.7.0",
"tsdown": "^0.22.5",
"tsdown": "^0.22.7",
"typescript": "6.0.3",

@@ -43,0 +43,0 @@ "vitest": "^4.1.10",