@@ -15,6 +15,21 @@ export const removePromiseForCallExpression = (
15
15
) . object ;
16
16
break ;
17
17
}
18
+ case "ArrowFunctionExpression" :
19
+ case "AwaitExpression" :
20
+ case "CallExpression" :
21
+ case "ExpressionStatement" :
22
+ case "ObjectProperty" :
23
+ case "ReturnStatement" :
24
+ case "VariableDeclarator" : {
25
+ const currentCalleeObject = ( callExpression . value . callee as MemberExpression )
26
+ . object as CallExpression ;
27
+ if ( currentCalleeObject . arguments . length > 0 ) {
28
+ callExpression . value . arguments = currentCalleeObject . arguments ;
29
+ }
30
+ callExpression . value . callee = currentCalleeObject . callee ;
31
+ break ;
32
+ }
18
33
default : {
19
34
emitWarning (
20
35
`Removal of .promise() not implemented for parentPath: ${ callExpression . parentPath . value . type } \n` +
@@ -34,21 +49,5 @@ export const removePromiseForCallExpression = (
34
49
) ;
35
50
callExpression . parentPath . node . comments = comments ;
36
51
}
37
- // eslint-disable-next-line no-fallthrough
38
- case "ArrowFunctionExpression" :
39
- case "AwaitExpression" :
40
- case "CallExpression" :
41
- case "ExpressionStatement" :
42
- case "ObjectProperty" :
43
- case "ReturnStatement" :
44
- case "VariableDeclarator" : {
45
- const currentCalleeObject = ( callExpression . value . callee as MemberExpression )
46
- . object as CallExpression ;
47
- if ( currentCalleeObject . arguments . length > 0 ) {
48
- callExpression . value . arguments = currentCalleeObject . arguments ;
49
- }
50
- callExpression . value . callee = currentCalleeObject . callee ;
51
- break ;
52
- }
53
52
}
54
53
} ;
0 commit comments