From 9ce33e4477eb665e364f96658e5a2b1ee98daa0c Mon Sep 17 00:00:00 2001 From: Isaac Kannay Date: Sun, 9 Oct 2022 02:52:48 +0300 Subject: [PATCH 1/2] fix: filtered out queries ending with 'ByType' from await-async-query rule. --- lib/rules/await-async-query.ts | 2 +- tests/lib/rules/await-async-query.test.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/rules/await-async-query.ts b/lib/rules/await-async-query.ts index 0af105a5..569a31ce 100644 --- a/lib/rules/await-async-query.ts +++ b/lib/rules/await-async-query.ts @@ -52,7 +52,7 @@ export default createTestingLibraryRule({ CallExpression(node) { const identifierNode = getDeepestIdentifierNode(node); - if (!identifierNode) { + if (!identifierNode || identifierNode.name.endsWith('Type')) { return; } diff --git a/tests/lib/rules/await-async-query.test.ts b/tests/lib/rules/await-async-query.test.ts index 8054035a..6b2314f3 100644 --- a/tests/lib/rules/await-async-query.test.ts +++ b/tests/lib/rules/await-async-query.test.ts @@ -330,6 +330,11 @@ ruleTester.run(RULE_NAME, rule, { // valid async query usage without any function defined // so there is no innermost function scope found `const element = await findByRole('button')`, + + // edge case for files using + // findByType or findAllByType + // from react-test-renderer + `const example = findByType('div')`, ], invalid: [ From e76a9e6924a1532d0509ab469642b0dc7333337e Mon Sep 17 00:00:00 2001 From: Isaac Kannay Date: Sun, 9 Oct 2022 03:05:05 +0300 Subject: [PATCH 2/2] chore: re generated rule list --- lib/rules/await-async-query.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/await-async-query.ts b/lib/rules/await-async-query.ts index 569a31ce..b665dc5f 100644 --- a/lib/rules/await-async-query.ts +++ b/lib/rules/await-async-query.ts @@ -52,7 +52,7 @@ export default createTestingLibraryRule({ CallExpression(node) { const identifierNode = getDeepestIdentifierNode(node); - if (!identifierNode || identifierNode.name.endsWith('Type')) { + if (!identifierNode || identifierNode.name.endsWith('ByType')) { return; }