Skip to content

Commit

Permalink
fix(prefer-await-to-then):member access without call (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi authored Sep 29, 2022
1 parent 08052e8 commit 9b3ef57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions __tests__/prefer-await-to-then.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ ruleTester.run('prefer-await-to-then', rule, {
}`,
'something().then(async () => await somethingElse())',
'function foo() { hey.somethingElse(x => {}) }',
`const isThenable = (obj) => {
return obj && typeof obj.then === 'function';
};`,
`function isThenable(obj) {
return obj && typeof obj.then === 'function';
}`,
],

invalid: [
Expand Down
2 changes: 1 addition & 1 deletion rules/prefer-await-to-then.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
}

return {
MemberExpression(node) {
'CallExpression > MemberExpression.callee'(node) {
if (isTopLevelScoped() || isInsideYieldOrAwait()) {
return
}
Expand Down

0 comments on commit 9b3ef57

Please sign in to comment.