|
1 |
| -import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils'; |
| 1 | +import { AST_NODE_TYPES, ASTUtils } from '@typescript-eslint/utils'; |
2 | 2 |
|
3 |
| -const isNodeOfType = |
4 |
| - <NodeType extends AST_NODE_TYPES>(nodeType: NodeType) => |
5 |
| - ( |
6 |
| - node: TSESTree.Node | null | undefined |
7 |
| - ): node is TSESTree.Node & { type: NodeType } => |
8 |
| - node?.type === nodeType; |
9 |
| - |
10 |
| -export const isArrayExpression = isNodeOfType(AST_NODE_TYPES.ArrayExpression); |
11 |
| -export const isArrowFunctionExpression = isNodeOfType( |
| 3 | +export const isArrayExpression = ASTUtils.isNodeOfType( |
| 4 | + AST_NODE_TYPES.ArrayExpression |
| 5 | +); |
| 6 | +export const isArrowFunctionExpression = ASTUtils.isNodeOfType( |
12 | 7 | AST_NODE_TYPES.ArrowFunctionExpression
|
13 | 8 | );
|
14 |
| -export const isBlockStatement = isNodeOfType(AST_NODE_TYPES.BlockStatement); |
15 |
| -export const isCallExpression = isNodeOfType(AST_NODE_TYPES.CallExpression); |
16 |
| -export const isExpressionStatement = isNodeOfType( |
| 9 | +export const isBlockStatement = ASTUtils.isNodeOfType( |
| 10 | + AST_NODE_TYPES.BlockStatement |
| 11 | +); |
| 12 | +export const isCallExpression = ASTUtils.isNodeOfType( |
| 13 | + AST_NODE_TYPES.CallExpression |
| 14 | +); |
| 15 | +export const isExpressionStatement = ASTUtils.isNodeOfType( |
17 | 16 | AST_NODE_TYPES.ExpressionStatement
|
18 | 17 | );
|
19 |
| -export const isVariableDeclaration = isNodeOfType( |
| 18 | +export const isVariableDeclaration = ASTUtils.isNodeOfType( |
20 | 19 | AST_NODE_TYPES.VariableDeclaration
|
21 | 20 | );
|
22 |
| -export const isAssignmentExpression = isNodeOfType( |
| 21 | +export const isAssignmentExpression = ASTUtils.isNodeOfType( |
23 | 22 | AST_NODE_TYPES.AssignmentExpression
|
24 | 23 | );
|
25 |
| -export const isSequenceExpression = isNodeOfType( |
| 24 | +export const isSequenceExpression = ASTUtils.isNodeOfType( |
26 | 25 | AST_NODE_TYPES.SequenceExpression
|
27 | 26 | );
|
28 |
| -export const isImportDeclaration = isNodeOfType( |
| 27 | +export const isImportDeclaration = ASTUtils.isNodeOfType( |
29 | 28 | AST_NODE_TYPES.ImportDeclaration
|
30 | 29 | );
|
31 |
| -export const isImportDefaultSpecifier = isNodeOfType( |
| 30 | +export const isImportDefaultSpecifier = ASTUtils.isNodeOfType( |
32 | 31 | AST_NODE_TYPES.ImportDefaultSpecifier
|
33 | 32 | );
|
34 |
| -export const isImportNamespaceSpecifier = isNodeOfType( |
| 33 | +export const isImportNamespaceSpecifier = ASTUtils.isNodeOfType( |
35 | 34 | AST_NODE_TYPES.ImportNamespaceSpecifier
|
36 | 35 | );
|
37 |
| -export const isImportSpecifier = isNodeOfType(AST_NODE_TYPES.ImportSpecifier); |
38 |
| -export const isJSXAttribute = isNodeOfType(AST_NODE_TYPES.JSXAttribute); |
39 |
| -export const isLiteral = isNodeOfType(AST_NODE_TYPES.Literal); |
40 |
| -export const isMemberExpression = isNodeOfType(AST_NODE_TYPES.MemberExpression); |
41 |
| -export const isNewExpression = isNodeOfType(AST_NODE_TYPES.NewExpression); |
42 |
| -export const isObjectExpression = isNodeOfType(AST_NODE_TYPES.ObjectExpression); |
43 |
| -export const isObjectPattern = isNodeOfType(AST_NODE_TYPES.ObjectPattern); |
44 |
| -export const isProperty = isNodeOfType(AST_NODE_TYPES.Property); |
45 |
| -export const isReturnStatement = isNodeOfType(AST_NODE_TYPES.ReturnStatement); |
46 |
| -export const isFunctionExpression = isNodeOfType( |
| 36 | +export const isImportSpecifier = ASTUtils.isNodeOfType( |
| 37 | + AST_NODE_TYPES.ImportSpecifier |
| 38 | +); |
| 39 | +export const isJSXAttribute = ASTUtils.isNodeOfType( |
| 40 | + AST_NODE_TYPES.JSXAttribute |
| 41 | +); |
| 42 | +export const isLiteral = ASTUtils.isNodeOfType(AST_NODE_TYPES.Literal); |
| 43 | +export const isMemberExpression = ASTUtils.isNodeOfType( |
| 44 | + AST_NODE_TYPES.MemberExpression |
| 45 | +); |
| 46 | +export const isNewExpression = ASTUtils.isNodeOfType( |
| 47 | + AST_NODE_TYPES.NewExpression |
| 48 | +); |
| 49 | +export const isObjectExpression = ASTUtils.isNodeOfType( |
| 50 | + AST_NODE_TYPES.ObjectExpression |
| 51 | +); |
| 52 | +export const isObjectPattern = ASTUtils.isNodeOfType( |
| 53 | + AST_NODE_TYPES.ObjectPattern |
| 54 | +); |
| 55 | +export const isProperty = ASTUtils.isNodeOfType(AST_NODE_TYPES.Property); |
| 56 | +export const isReturnStatement = ASTUtils.isNodeOfType( |
| 57 | + AST_NODE_TYPES.ReturnStatement |
| 58 | +); |
| 59 | +export const isFunctionExpression = ASTUtils.isNodeOfType( |
47 | 60 | AST_NODE_TYPES.FunctionExpression
|
48 | 61 | );
|
0 commit comments