Skip to content

Commit 2ad6cbd

Browse files
authored
fix(await-async-query): avoid duplicated reports (#16)
1 parent 3cc2940 commit 2ad6cbd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/rules/await-async-query.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module.exports = {
6161
},
6262
});
6363
} else {
64-
references.forEach(reference => {
64+
for (const reference of references) {
6565
const referenceNode = reference.identifier;
6666
if (
6767
!isAwaited(referenceNode.parent) &&
@@ -74,8 +74,10 @@ module.exports = {
7474
name: node.name,
7575
},
7676
});
77+
78+
break;
7779
}
78-
});
80+
}
7981
}
8082
});
8183
},

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ ruleTester.run('await-async-query', rule, {
139139
code: `async () => {
140140
const foo = ${query}('foo')
141141
expect(foo).toBeInTheDocument()
142+
expect(foo).toHaveAttribute('src', 'bar');
142143
}
143144
`,
144145
errors: [
145146
{
147+
line: 2,
146148
message: `\`${query}\` must have \`await\` operator`,
147149
},
148150
],

0 commit comments

Comments
 (0)