Skip to content

Commit 9b3ef57

Browse files
authored
fix(prefer-await-to-then):member access without call (#362)
1 parent 08052e8 commit 9b3ef57

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

__tests__/prefer-await-to-then.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ ruleTester.run('prefer-await-to-then', rule, {
2121
}`,
2222
'something().then(async () => await somethingElse())',
2323
'function foo() { hey.somethingElse(x => {}) }',
24+
`const isThenable = (obj) => {
25+
return obj && typeof obj.then === 'function';
26+
};`,
27+
`function isThenable(obj) {
28+
return obj && typeof obj.then === 'function';
29+
}`,
2430
],
2531

2632
invalid: [

rules/prefer-await-to-then.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = {
3535
}
3636

3737
return {
38-
MemberExpression(node) {
38+
'CallExpression > MemberExpression.callee'(node) {
3939
if (isTopLevelScoped() || isInsideYieldOrAwait()) {
4040
return
4141
}

0 commit comments

Comments
 (0)