@eslint-react/ast 5.21.1 → 5.21.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 +13 -1
- package/dist/index.js +18 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ type TSESTreeDirective = TSESTree.ExpressionStatement & {
|
|
|
20
20
|
/** Union of TypeScript type expression node types. */
|
|
21
21
|
type TSESTreeTypeExpression = TSESTree.TSAsExpression | TSESTree.TSTypeAssertion | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSInstantiationExpression;
|
|
22
22
|
declare namespace check_d_exports {
|
|
23
|
-
export { is, isClass, isConditional, isDirective, isExpression, isFunction, isIdentifier, isJSX, isJSXElement, isJSXElementOrFragment, isJSXFragment, isJSXTagNameExpression, isOneOf, isProperty, isPropertyOrMethod, isTypeAssertionExpression, isTypeExpression };
|
|
23
|
+
export { is, isCallExpression, isClass, isConditional, isDirective, isExpression, isFunction, isIdentifier, isJSX, isJSXElement, isJSXElementOrFragment, isJSXExpressionContainer, isJSXFragment, isJSXSpreadAttribute, isJSXTagNameExpression, isMemberExpression, isObjectExpression, isOneOf, isProperty, isPropertyOrMethod, isReturnStatement, isTypeAssertionExpression, isTypeExpression };
|
|
24
24
|
}
|
|
25
25
|
/** Check if a node is of the given type. */
|
|
26
26
|
declare const is: <NodeType extends AST_NODE_TYPES>(nodeType: NodeType) => (node: TSESTree.Node | null | undefined) => node is Extract<TSESTree.Node, {
|
|
@@ -44,6 +44,14 @@ declare function isDirective(node: TSESTree.Node, name?: string): node is TSESTr
|
|
|
44
44
|
* @returns `true` if the node is a matching identifier.
|
|
45
45
|
*/
|
|
46
46
|
declare function isIdentifier(node: TSESTree.Node, name?: string): node is TSESTree.Identifier;
|
|
47
|
+
/** Check if a node is a call expression. */
|
|
48
|
+
declare const isCallExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.CallExpression;
|
|
49
|
+
/** Check if a node is a member expression. */
|
|
50
|
+
declare const isMemberExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName;
|
|
51
|
+
/** Check if a node is an object expression. */
|
|
52
|
+
declare const isObjectExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.ObjectExpression;
|
|
53
|
+
/** Check if a node is a return statement. */
|
|
54
|
+
declare const isReturnStatement: (node: TSESTree.Node | null | undefined) => node is TSESTree.ReturnStatement;
|
|
47
55
|
/** Check if a node is a class declaration or class expression. */
|
|
48
56
|
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression;
|
|
49
57
|
/** Check if a node is a function declaration, function expression, or arrow function expression. */
|
|
@@ -54,6 +62,10 @@ declare const isProperty: (node: TSESTree.Node | null | undefined) => node is TS
|
|
|
54
62
|
declare const isPropertyOrMethod: (node: TSESTree.Node | null | undefined) => node is TSESTree.MethodDefinitionComputedName | TSESTree.MethodDefinitionNonComputedName | TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName;
|
|
55
63
|
/** Check if a node is a JSX element. */
|
|
56
64
|
declare const isJSXElement: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXElement;
|
|
65
|
+
/** Check if a node is a JSX expression container. */
|
|
66
|
+
declare const isJSXExpressionContainer: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXExpressionContainer;
|
|
67
|
+
/** Check if a node is a JSX spread attribute. */
|
|
68
|
+
declare const isJSXSpreadAttribute: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXSpreadAttribute;
|
|
57
69
|
/** Check if a node is a JSX fragment. */
|
|
58
70
|
declare const isJSXFragment: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXFragment;
|
|
59
71
|
/** Check if a node is a JSX element or JSX fragment. */
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import * as ASTUtils from "@typescript-eslint/utils/ast-utils";
|
|
|
5
5
|
//#region src/check.ts
|
|
6
6
|
var check_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
is: () => is,
|
|
8
|
+
isCallExpression: () => isCallExpression,
|
|
8
9
|
isClass: () => isClass,
|
|
9
10
|
isConditional: () => isConditional,
|
|
10
11
|
isDirective: () => isDirective,
|
|
@@ -14,11 +15,16 @@ var check_exports = /* @__PURE__ */ __exportAll({
|
|
|
14
15
|
isJSX: () => isJSX,
|
|
15
16
|
isJSXElement: () => isJSXElement,
|
|
16
17
|
isJSXElementOrFragment: () => isJSXElementOrFragment,
|
|
18
|
+
isJSXExpressionContainer: () => isJSXExpressionContainer,
|
|
17
19
|
isJSXFragment: () => isJSXFragment,
|
|
20
|
+
isJSXSpreadAttribute: () => isJSXSpreadAttribute,
|
|
18
21
|
isJSXTagNameExpression: () => isJSXTagNameExpression,
|
|
22
|
+
isMemberExpression: () => isMemberExpression,
|
|
23
|
+
isObjectExpression: () => isObjectExpression,
|
|
19
24
|
isOneOf: () => isOneOf,
|
|
20
25
|
isProperty: () => isProperty,
|
|
21
26
|
isPropertyOrMethod: () => isPropertyOrMethod,
|
|
27
|
+
isReturnStatement: () => isReturnStatement,
|
|
22
28
|
isTypeAssertionExpression: () => isTypeAssertionExpression,
|
|
23
29
|
isTypeExpression: () => isTypeExpression
|
|
24
30
|
});
|
|
@@ -44,6 +50,14 @@ function isDirective(node, name) {
|
|
|
44
50
|
function isIdentifier(node, name) {
|
|
45
51
|
return node.type === AST_NODE_TYPES.Identifier && (name == null || node.name === name);
|
|
46
52
|
}
|
|
53
|
+
/** Check if a node is a call expression. */
|
|
54
|
+
const isCallExpression = is(AST_NODE_TYPES.CallExpression);
|
|
55
|
+
/** Check if a node is a member expression. */
|
|
56
|
+
const isMemberExpression = is(AST_NODE_TYPES.MemberExpression);
|
|
57
|
+
/** Check if a node is an object expression. */
|
|
58
|
+
const isObjectExpression = is(AST_NODE_TYPES.ObjectExpression);
|
|
59
|
+
/** Check if a node is a return statement. */
|
|
60
|
+
const isReturnStatement = is(AST_NODE_TYPES.ReturnStatement);
|
|
47
61
|
/** Check if a node is a class declaration or class expression. */
|
|
48
62
|
const isClass = isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]);
|
|
49
63
|
/** Check if a node is a function declaration, function expression, or arrow function expression. */
|
|
@@ -63,6 +77,10 @@ const isProperty = isOneOf([
|
|
|
63
77
|
const isPropertyOrMethod = isOneOf([AST_NODE_TYPES.PropertyDefinition, AST_NODE_TYPES.MethodDefinition]);
|
|
64
78
|
/** Check if a node is a JSX element. */
|
|
65
79
|
const isJSXElement = is(AST_NODE_TYPES.JSXElement);
|
|
80
|
+
/** Check if a node is a JSX expression container. */
|
|
81
|
+
const isJSXExpressionContainer = is(AST_NODE_TYPES.JSXExpressionContainer);
|
|
82
|
+
/** Check if a node is a JSX spread attribute. */
|
|
83
|
+
const isJSXSpreadAttribute = is(AST_NODE_TYPES.JSXSpreadAttribute);
|
|
66
84
|
/** Check if a node is a JSX fragment. */
|
|
67
85
|
const isJSXFragment = is(AST_NODE_TYPES.JSXFragment);
|
|
68
86
|
/** Check if a node is a JSX element or JSX fragment. */
|