eslint-plugin-testing-library
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -33,3 +33,7 @@ 'use strict'; | ||
[`CallExpression > Identifier[name=${ASYNC_QUERIES_REGEXP}]`](node) { | ||
if (!isAwaited(node.parent.parent) && !isPromiseResolved(node)) { | ||
if ( | ||
!isAwaited(node.parent.parent) && | ||
!isPromiseResolved(node) && | ||
!hasClosestExpectResolvesRejects(node) | ||
) { | ||
testingLibraryQueryUsage.push(node); | ||
@@ -105,1 +109,17 @@ } | ||
} | ||
function hasClosestExpectResolvesRejects(node) { | ||
if (!node.parent) { | ||
return; | ||
} | ||
if (node.type === 'CallExpression' && node.callee.name === 'expect') { | ||
const expectMatcher = node.parent.property; | ||
return ( | ||
expectMatcher && | ||
(expectMatcher.name === 'resolves' || expectMatcher.name === 'rejects') | ||
); | ||
} else { | ||
return hasClosestExpectResolvesRejects(node.parent); | ||
} | ||
} |
{ | ||
"name": "eslint-plugin-testing-library", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "ESLint rules for Testing Library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35501
686