Skip to content

Commit 60862ad

Browse files
committed
Avoid false positives when destructuring async queries
1 parent 78e321a commit 60862ad

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/rules/await-async-query.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626

2727
create: function(context) {
2828
return {
29-
[`CallExpression Identifier[name=${ASYNC_QUERIES_REGEXP}]`](node) {
29+
[`CallExpression > Identifier[name=${ASYNC_QUERIES_REGEXP}]`](node) {
3030
let hasError = true;
3131
try {
3232
if (VALID_PARENTS.includes(node.parent.parent.type)) {

tests/lib/rules/await-async-query.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const RuleTester = require('eslint').RuleTester;
1414
const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 2018 } });
1515
ruleTester.run('await-async-query', rule, {
1616
valid: [
17+
{
18+
code: `
19+
const { findByText } = setUp()
20+
`,
21+
},
1722
{
1823
code: `async () => {
1924
const foo = await findByText('foo')

0 commit comments

Comments
 (0)