@eslint-react/ast 1.46.0 → 1.47.0-next.0
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.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -287,7 +287,7 @@ declare function isThisExpression(node: TSESTree.Expression): boolean;
|
|
|
287
287
|
* @param getText A function that returns the text of the node in the source code
|
|
288
288
|
* @returns Human readable node name
|
|
289
289
|
*/
|
|
290
|
-
declare function
|
|
290
|
+
declare function stringify(node: TSESTree.Node, getText: (node: TSESTree.Node) => string): string;
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
293
|
* Returns human readable node type for given AST node
|
|
@@ -297,4 +297,4 @@ declare function toReadableNodeName(node: TSESTree.Node, getText: (node: TSESTre
|
|
|
297
297
|
declare function toReadableNodeType(node: TSESTree.Node): "property" | "RegExp literal" | "string literal" | "number literal" | "bigint literal" | "boolean literal" | "symbol literal" | "undefined literal" | "object literal" | "function literal" | "null literal" | "identifier" | "member expression" | "JSX attribute" | "JSX element" | "JSX fragment" | "JSX identifier" | "JSX text" | "JSX closing element" | "JSX closing fragment" | "JSX empty expression" | "JSX expression container" | "JSX member expression" | "JSX namespaced name" | "JSX opening element" | "JSX opening fragment" | "JSX spread attribute" | "JSX spread child" | "decorator" | "program" | "super" | "accessor property" | "array expression" | "array pattern" | "function expression" | "arrow function expression" | "assignment expression" | "assignment pattern" | "await expression" | "binary expression" | "block statement" | "break statement" | "call expression" | "catch clause" | "chain expression" | "class body" | "class declaration" | "class expression" | "conditional expression" | "continue statement" | "debugger statement" | "while statement" | "do while statement" | "empty statement" | "export all declaration" | "export default declaration" | "export named declaration" | "export specifier" | "expression statement" | "for in statement" | "for of statement" | "for statement" | "function declaration" | "if statement" | "import attribute" | "import declaration" | "import default specifier" | "import expression" | "import namespace specifier" | "import specifier" | "labeled statement" | "logical expression" | "meta property" | "method definition" | "new expression" | "object expression" | "object pattern" | "private identifier" | "property definition" | "rest element" | "return statement" | "sequence expression" | "spread element" | "static block" | "switch case" | "switch statement" | "tagged template expression" | "template element" | "template literal" | "this expression" | "throw statement" | "try statement" | "unary expression" | "update expression" | "variable declaration" | "variable declarator" | "with statement" | "yield expression" | "ts abstract accessor property" | "ts abstract keyword" | "ts abstract method definition" | "ts abstract property definition" | "ts any keyword" | "ts array type" | "ts as expression" | "ts async keyword" | "ts big int keyword" | "ts boolean keyword" | "ts call signature declaration" | "ts class implements" | "ts conditional type" | "ts constructor type" | "ts construct signature declaration" | "ts declare function" | "ts declare keyword" | "ts empty body function expression" | "ts enum body" | "ts enum declaration" | "ts enum member" | "ts export assignment" | "ts export keyword" | "ts external module reference" | "ts function type" | "ts import equals declaration" | "ts import type" | "ts indexed access type" | "ts index signature" | "ts infer type" | "ts instantiation expression" | "ts interface body" | "ts interface declaration" | "ts interface heritage" | "ts intersection type" | "ts intrinsic keyword" | "ts literal type" | "ts mapped type" | "ts method signature" | "ts module block" | "ts module declaration" | "ts named tuple member" | "ts namespace export declaration" | "ts never keyword" | "ts non null expression" | "ts null keyword" | "ts number keyword" | "ts object keyword" | "ts optional type" | "ts parameter property" | "ts private keyword" | "ts property signature" | "ts protected keyword" | "ts public keyword" | "ts qualified name" | "ts readonly keyword" | "ts rest type" | "ts satisfies expression" | "ts static keyword" | "ts string keyword" | "ts symbol keyword" | "ts template literal type" | "ts this type" | "ts tuple type" | "ts type alias declaration" | "ts type annotation" | "ts type assertion" | "ts type literal" | "ts type operator" | "ts type parameter" | "ts type parameter declaration" | "ts type parameter instantiation" | "ts type predicate" | "ts type query" | "ts type reference" | "ts undefined keyword" | "ts union type" | "ts unknown keyword" | "ts void keyword";
|
|
298
298
|
type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
|
|
299
299
|
|
|
300
|
-
export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getArrayMethodCallbackIndexParamPosition, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression,
|
|
300
|
+
export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getArrayMethodCallbackIndexParamPosition, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, stringify, toReadableNodeType };
|
package/dist/index.d.ts
CHANGED
|
@@ -287,7 +287,7 @@ declare function isThisExpression(node: TSESTree.Expression): boolean;
|
|
|
287
287
|
* @param getText A function that returns the text of the node in the source code
|
|
288
288
|
* @returns Human readable node name
|
|
289
289
|
*/
|
|
290
|
-
declare function
|
|
290
|
+
declare function stringify(node: TSESTree.Node, getText: (node: TSESTree.Node) => string): string;
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
293
|
* Returns human readable node type for given AST node
|
|
@@ -297,4 +297,4 @@ declare function toReadableNodeName(node: TSESTree.Node, getText: (node: TSESTre
|
|
|
297
297
|
declare function toReadableNodeType(node: TSESTree.Node): "property" | "RegExp literal" | "string literal" | "number literal" | "bigint literal" | "boolean literal" | "symbol literal" | "undefined literal" | "object literal" | "function literal" | "null literal" | "identifier" | "member expression" | "JSX attribute" | "JSX element" | "JSX fragment" | "JSX identifier" | "JSX text" | "JSX closing element" | "JSX closing fragment" | "JSX empty expression" | "JSX expression container" | "JSX member expression" | "JSX namespaced name" | "JSX opening element" | "JSX opening fragment" | "JSX spread attribute" | "JSX spread child" | "decorator" | "program" | "super" | "accessor property" | "array expression" | "array pattern" | "function expression" | "arrow function expression" | "assignment expression" | "assignment pattern" | "await expression" | "binary expression" | "block statement" | "break statement" | "call expression" | "catch clause" | "chain expression" | "class body" | "class declaration" | "class expression" | "conditional expression" | "continue statement" | "debugger statement" | "while statement" | "do while statement" | "empty statement" | "export all declaration" | "export default declaration" | "export named declaration" | "export specifier" | "expression statement" | "for in statement" | "for of statement" | "for statement" | "function declaration" | "if statement" | "import attribute" | "import declaration" | "import default specifier" | "import expression" | "import namespace specifier" | "import specifier" | "labeled statement" | "logical expression" | "meta property" | "method definition" | "new expression" | "object expression" | "object pattern" | "private identifier" | "property definition" | "rest element" | "return statement" | "sequence expression" | "spread element" | "static block" | "switch case" | "switch statement" | "tagged template expression" | "template element" | "template literal" | "this expression" | "throw statement" | "try statement" | "unary expression" | "update expression" | "variable declaration" | "variable declarator" | "with statement" | "yield expression" | "ts abstract accessor property" | "ts abstract keyword" | "ts abstract method definition" | "ts abstract property definition" | "ts any keyword" | "ts array type" | "ts as expression" | "ts async keyword" | "ts big int keyword" | "ts boolean keyword" | "ts call signature declaration" | "ts class implements" | "ts conditional type" | "ts constructor type" | "ts construct signature declaration" | "ts declare function" | "ts declare keyword" | "ts empty body function expression" | "ts enum body" | "ts enum declaration" | "ts enum member" | "ts export assignment" | "ts export keyword" | "ts external module reference" | "ts function type" | "ts import equals declaration" | "ts import type" | "ts indexed access type" | "ts index signature" | "ts infer type" | "ts instantiation expression" | "ts interface body" | "ts interface declaration" | "ts interface heritage" | "ts intersection type" | "ts intrinsic keyword" | "ts literal type" | "ts mapped type" | "ts method signature" | "ts module block" | "ts module declaration" | "ts named tuple member" | "ts namespace export declaration" | "ts never keyword" | "ts non null expression" | "ts null keyword" | "ts number keyword" | "ts object keyword" | "ts optional type" | "ts parameter property" | "ts private keyword" | "ts property signature" | "ts protected keyword" | "ts public keyword" | "ts qualified name" | "ts readonly keyword" | "ts rest type" | "ts satisfies expression" | "ts static keyword" | "ts string keyword" | "ts symbol keyword" | "ts template literal type" | "ts this type" | "ts tuple type" | "ts type alias declaration" | "ts type annotation" | "ts type assertion" | "ts type literal" | "ts type operator" | "ts type parameter" | "ts type parameter declaration" | "ts type parameter instantiation" | "ts type predicate" | "ts type query" | "ts type reference" | "ts undefined keyword" | "ts union type" | "ts unknown keyword" | "ts void keyword";
|
|
298
298
|
type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
|
|
299
299
|
|
|
300
|
-
export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getArrayMethodCallbackIndexParamPosition, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression,
|
|
300
|
+
export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getArrayMethodCallbackIndexParamPosition, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, stringify, toReadableNodeType };
|
package/dist/index.js
CHANGED
|
@@ -563,17 +563,17 @@ function isProcessEnvNodeEnvCompare(node, operator, value) {
|
|
|
563
563
|
function isThisExpression(node) {
|
|
564
564
|
return getEcmaExpression(node).type === types.AST_NODE_TYPES.ThisExpression;
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function stringify(node, getText) {
|
|
567
567
|
switch (node.type) {
|
|
568
568
|
case types.AST_NODE_TYPES.CallExpression:
|
|
569
|
-
return
|
|
569
|
+
return stringify(node.callee, getText);
|
|
570
570
|
case types.AST_NODE_TYPES.Identifier:
|
|
571
571
|
case types.AST_NODE_TYPES.PrivateIdentifier:
|
|
572
572
|
return node.name;
|
|
573
573
|
case types.AST_NODE_TYPES.JSXIdentifier:
|
|
574
574
|
return `<${node.name}>`;
|
|
575
575
|
case types.AST_NODE_TYPES.JSXMemberExpression:
|
|
576
|
-
return `${
|
|
576
|
+
return `${stringify(node.object, getText)}.${stringify(node.property, getText)}`;
|
|
577
577
|
case types.AST_NODE_TYPES.JSXNamespacedName:
|
|
578
578
|
return `${node.namespace.name}:${node.name.name}`;
|
|
579
579
|
case types.AST_NODE_TYPES.JSXText:
|
|
@@ -581,7 +581,7 @@ function toReadableNodeName(node, getText) {
|
|
|
581
581
|
case types.AST_NODE_TYPES.Literal:
|
|
582
582
|
return node.raw;
|
|
583
583
|
case types.AST_NODE_TYPES.MemberExpression:
|
|
584
|
-
return `${
|
|
584
|
+
return `${stringify(node.object, getText)}.${stringify(node.property, getText)}`;
|
|
585
585
|
default:
|
|
586
586
|
return getText(node);
|
|
587
587
|
}
|
|
@@ -644,5 +644,5 @@ exports.isThisExpression = isThisExpression;
|
|
|
644
644
|
exports.isTypeAssertionExpression = isTypeAssertionExpression;
|
|
645
645
|
exports.isTypeDeclaration = isTypeDeclaration;
|
|
646
646
|
exports.isTypeExpression = isTypeExpression;
|
|
647
|
-
exports.
|
|
647
|
+
exports.stringify = stringify;
|
|
648
648
|
exports.toReadableNodeType = toReadableNodeType;
|
package/dist/index.mjs
CHANGED
|
@@ -561,17 +561,17 @@ function isProcessEnvNodeEnvCompare(node, operator, value) {
|
|
|
561
561
|
function isThisExpression(node) {
|
|
562
562
|
return getEcmaExpression(node).type === AST_NODE_TYPES.ThisExpression;
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function stringify(node, getText) {
|
|
565
565
|
switch (node.type) {
|
|
566
566
|
case AST_NODE_TYPES.CallExpression:
|
|
567
|
-
return
|
|
567
|
+
return stringify(node.callee, getText);
|
|
568
568
|
case AST_NODE_TYPES.Identifier:
|
|
569
569
|
case AST_NODE_TYPES.PrivateIdentifier:
|
|
570
570
|
return node.name;
|
|
571
571
|
case AST_NODE_TYPES.JSXIdentifier:
|
|
572
572
|
return `<${node.name}>`;
|
|
573
573
|
case AST_NODE_TYPES.JSXMemberExpression:
|
|
574
|
-
return `${
|
|
574
|
+
return `${stringify(node.object, getText)}.${stringify(node.property, getText)}`;
|
|
575
575
|
case AST_NODE_TYPES.JSXNamespacedName:
|
|
576
576
|
return `${node.namespace.name}:${node.name.name}`;
|
|
577
577
|
case AST_NODE_TYPES.JSXText:
|
|
@@ -579,7 +579,7 @@ function toReadableNodeName(node, getText) {
|
|
|
579
579
|
case AST_NODE_TYPES.Literal:
|
|
580
580
|
return node.raw;
|
|
581
581
|
case AST_NODE_TYPES.MemberExpression:
|
|
582
|
-
return `${
|
|
582
|
+
return `${stringify(node.object, getText)}.${stringify(node.property, getText)}`;
|
|
583
583
|
default:
|
|
584
584
|
return getText(node);
|
|
585
585
|
}
|
|
@@ -597,4 +597,4 @@ function toReadableNodeType(node) {
|
|
|
597
597
|
return toLowerCase(delimiterCase(node.type, " "));
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
export { findParentNode, getArrayMethodCallbackIndexParamPosition, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression,
|
|
600
|
+
export { findParentNode, getArrayMethodCallbackIndexParamPosition, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, stringify, toReadableNodeType };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0-next.0",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@typescript-eslint/utils": "^8.29.1",
|
|
41
41
|
"string-ts": "^2.2.1",
|
|
42
42
|
"ts-pattern": "^5.7.0",
|
|
43
|
-
"@eslint-react/eff": "1.
|
|
43
|
+
"@eslint-react/eff": "1.47.0-next.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"tsup": "^8.4.0",
|