@@ -7,6 +7,20 @@ import {
77} from '@typescript-eslint/experimental-utils' ;
88import { RuleContext } from '@typescript-eslint/experimental-utils/dist/ts-eslint' ;
99
10+ import {
11+ isArrayExpression ,
12+ isArrowFunctionExpression ,
13+ isBlockStatement ,
14+ isCallExpression ,
15+ isExpressionStatement ,
16+ isImportDeclaration ,
17+ isLiteral ,
18+ isMemberExpression ,
19+ isReturnStatement ,
20+ } from './is-node-of-type' ;
21+
22+ export * from './is-node-of-type' ;
23+
1024const ValidLeftHandSideExpressions = [
1125 AST_NODE_TYPES . CallExpression ,
1226 AST_NODE_TYPES . ClassExpression ,
@@ -35,78 +49,6 @@ const ValidLeftHandSideExpressions = [
3549 AST_NODE_TYPES . ArrowFunctionExpression ,
3650] ;
3751
38- export function isCallExpression (
39- node : TSESTree . Node | null | undefined
40- ) : node is TSESTree . CallExpression {
41- return node ?. type === AST_NODE_TYPES . CallExpression ;
42- }
43-
44- export function isNewExpression (
45- node : TSESTree . Node | null | undefined
46- ) : node is TSESTree . NewExpression {
47- return node ?. type === 'NewExpression' ;
48- }
49-
50- export function isMemberExpression (
51- node : TSESTree . Node | null | undefined
52- ) : node is TSESTree . MemberExpression {
53- return node ?. type === AST_NODE_TYPES . MemberExpression ;
54- }
55-
56- export function isLiteral (
57- node : TSESTree . Node | null | undefined
58- ) : node is TSESTree . Literal {
59- return node ?. type === AST_NODE_TYPES . Literal ;
60- }
61-
62- export function isImportSpecifier (
63- node : TSESTree . Node | null | undefined
64- ) : node is TSESTree . ImportSpecifier {
65- return node ?. type === AST_NODE_TYPES . ImportSpecifier ;
66- }
67-
68- export function isImportNamespaceSpecifier (
69- node : TSESTree . Node | null | undefined
70- ) : node is TSESTree . ImportNamespaceSpecifier {
71- return node ?. type === AST_NODE_TYPES . ImportNamespaceSpecifier ;
72- }
73-
74- export function isImportDefaultSpecifier (
75- node : TSESTree . Node | null | undefined
76- ) : node is TSESTree . ImportDefaultSpecifier {
77- return node ?. type === AST_NODE_TYPES . ImportDefaultSpecifier ;
78- }
79-
80- export function isBlockStatement (
81- node : TSESTree . Node | null | undefined
82- ) : node is TSESTree . BlockStatement {
83- return node ?. type === AST_NODE_TYPES . BlockStatement ;
84- }
85-
86- export function isObjectPattern (
87- node : TSESTree . Node | null | undefined
88- ) : node is TSESTree . ObjectPattern {
89- return node ?. type === AST_NODE_TYPES . ObjectPattern ;
90- }
91-
92- export function isProperty (
93- node : TSESTree . Node | null | undefined
94- ) : node is TSESTree . Property {
95- return node ?. type === AST_NODE_TYPES . Property ;
96- }
97-
98- export function isJSXAttribute (
99- node : TSESTree . Node | null | undefined
100- ) : node is TSESTree . JSXAttribute {
101- return node ?. type === AST_NODE_TYPES . JSXAttribute ;
102- }
103-
104- export function isExpressionStatement (
105- node : TSESTree . Node | null | undefined
106- ) : node is TSESTree . ExpressionStatement {
107- return node ?. type === AST_NODE_TYPES . ExpressionStatement ;
108- }
109-
11052/**
11153 * Finds the closest CallExpression node for a given node.
11254 * @param node
@@ -153,12 +95,6 @@ export function findClosestCallNode(
15395 }
15496}
15597
156- export function isObjectExpression (
157- node : TSESTree . Expression
158- ) : node is TSESTree . ObjectExpression {
159- return node ?. type === AST_NODE_TYPES . ObjectExpression ;
160- }
161-
16298export function hasThenProperty ( node : TSESTree . Node ) : boolean {
16399 return (
164100 isMemberExpression ( node ) &&
@@ -167,30 +103,6 @@ export function hasThenProperty(node: TSESTree.Node): boolean {
167103 ) ;
168104}
169105
170- export function isArrowFunctionExpression (
171- node : TSESTree . Node
172- ) : node is TSESTree . ArrowFunctionExpression {
173- return node ?. type === AST_NODE_TYPES . ArrowFunctionExpression ;
174- }
175-
176- export function isReturnStatement (
177- node : TSESTree . Node
178- ) : node is TSESTree . ReturnStatement {
179- return node ?. type === AST_NODE_TYPES . ReturnStatement ;
180- }
181-
182- export function isArrayExpression (
183- node : TSESTree . Node
184- ) : node is TSESTree . ArrayExpression {
185- return node ?. type === AST_NODE_TYPES . ArrayExpression ;
186- }
187-
188- export function isImportDeclaration (
189- node : TSESTree . Node | null | undefined
190- ) : node is TSESTree . ImportDeclaration {
191- return node ?. type === AST_NODE_TYPES . ImportDeclaration ;
192- }
193-
194106export function hasChainedThen ( node : TSESTree . Node ) : boolean {
195107 const parent = node . parent ;
196108
0 commit comments