🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@eslint-react/ast

Package Overview
Dependencies
Maintainers
1
Versions
2621
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.10.4
to
5.11.0
+3
-4
dist/index.d.ts

@@ -16,3 +16,3 @@ import { AST_NODE_TYPES, TSESTree } from "@typescript-eslint/types";

declare namespace check_d_exports {
export { is, isClass, isDirective, isFunction, isIdentifier, isJSX, isJSXElement, isJSXElementOrFragment, isJSXFragment, isJSXTagNameExpression, isOneOf, isProperty, isPropertyOrMethod, isStringLiteral, isTypeAssertionExpression, isTypeExpression };
export { is, isClass, isDirective, isFunction, isIdentifier, isJSX, isJSXElement, isJSXElementOrFragment, isJSXFragment, isJSXTagNameExpression, isOneOf, isProperty, isPropertyOrMethod, isTypeAssertionExpression, isTypeExpression };
}

@@ -25,5 +25,4 @@ declare const is: <NodeType extends AST_NODE_TYPES>(nodeType: NodeType) => (node: TSESTree.Node | null | undefined) => node is Extract<TSESTree.Node, {

}>;
declare function isDirective(name: string): (node: TSESTree.Node) => node is TSESTreeDirective;
declare function isIdentifier(name: string): (node: TSESTree.Node) => node is TSESTree.Identifier;
declare function isStringLiteral(node: TSESTree.Node): node is TSESTree.StringLiteral;
declare function isDirective(node: TSESTree.Node, name?: string): node is TSESTreeDirective;
declare function isIdentifier(node: TSESTree.Node, name?: string): node is TSESTree.Identifier;
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression;

@@ -30,0 +29,0 @@ declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpressionWithBlockBody | TSESTree.ArrowFunctionExpressionWithExpressionBody | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression;

@@ -20,3 +20,2 @@ import { t as __exportAll } from "./rolldown-runtime-w6R9maHv.js";

isPropertyOrMethod: () => isPropertyOrMethod,
isStringLiteral: () => isStringLiteral,
isTypeAssertionExpression: () => isTypeAssertionExpression,

@@ -27,11 +26,8 @@ isTypeExpression: () => isTypeExpression

const isOneOf = ASTUtils.isNodeOfTypes;
function isDirective(name) {
return (node) => node.type === AST_NODE_TYPES.ExpressionStatement && node.directive === name;
function isDirective(node, name) {
return node.type === AST_NODE_TYPES.ExpressionStatement && (name == null || node.directive === name);
}
function isIdentifier(name) {
return (node) => node.type === AST_NODE_TYPES.Identifier && node.name === name;
function isIdentifier(node, name) {
return node.type === AST_NODE_TYPES.Identifier && (name == null || node.name === name);
}
function isStringLiteral(node) {
return node.type === AST_NODE_TYPES.Literal && typeof node.value === "string";
}
const isClass = isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]);

@@ -233,15 +229,15 @@ const isFunction = isOneOf([

function getFullyQualifiedName(node, getText) {
node = unwrap(node);
switch (node.type) {
const expr = unwrap(node);
switch (expr.type) {
case AST_NODE_TYPES.Identifier:
case AST_NODE_TYPES.JSXIdentifier:
case AST_NODE_TYPES.PrivateIdentifier: return node.name;
case AST_NODE_TYPES.PrivateIdentifier: return expr.name;
case AST_NODE_TYPES.MemberExpression:
if (node.computed) return getText(node);
return `${getFullyQualifiedName(node.object, getText)}.${getFullyQualifiedName(node.property, getText)}`;
case AST_NODE_TYPES.JSXMemberExpression: return `${getFullyQualifiedName(node.object, getText)}.${getFullyQualifiedName(node.property, getText)}`;
case AST_NODE_TYPES.JSXNamespacedName: return `${node.namespace.name}:${node.name.name}`;
case AST_NODE_TYPES.JSXText: return node.value;
case AST_NODE_TYPES.Literal: return node.raw;
default: return getText(node);
if (expr.computed) return getText(expr);
return `${getFullyQualifiedName(expr.object, getText)}.${getFullyQualifiedName(expr.property, getText)}`;
case AST_NODE_TYPES.JSXMemberExpression: return `${getFullyQualifiedName(expr.object, getText)}.${getFullyQualifiedName(expr.property, getText)}`;
case AST_NODE_TYPES.JSXNamespacedName: return `${expr.namespace.name}:${expr.name.name}`;
case AST_NODE_TYPES.JSXText: return expr.value;
case AST_NODE_TYPES.Literal: return expr.raw;
default: return getText(expr);
}

@@ -248,0 +244,0 @@ }

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

@@ -5,0 +5,0 @@ "homepage": "https://github.com/Rel1cx/eslint-react",