Skip to content

Commit 840763d

Browse files
authored
fix(no-unnecessary-act): report everything that's reported in non-strict (#423)
* fix(no-unnecessary-act): report everything that's reported in non-strict * refactor: remove duplication in tests Co-authored-by: Michaël De Boey <[email protected]> Closes #416
1 parent a8cc355 commit 840763d

File tree

2 files changed

+514
-495
lines changed

2 files changed

+514
-495
lines changed

lib/rules/no-unnecessary-act.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const RULE_NAME = 'no-unnecessary-act';
1414
export type MessageIds =
1515
| 'noUnnecessaryActEmptyFunction'
1616
| 'noUnnecessaryActTestingLibraryUtil';
17-
type Options = [{ isStrict: boolean }];
17+
export type Options = [{ isStrict: boolean }];
1818

1919
export default createTestingLibraryRule<Options, MessageIds>({
2020
name: RULE_NAME,
@@ -144,8 +144,9 @@ export default createTestingLibraryRule<Options, MessageIds>({
144144
}
145145

146146
const shouldBeReported = isStrict
147-
? hasSomeNonTestingLibraryCall(blockStatementNode.body) &&
148-
hasTestingLibraryCall(blockStatementNode.body)
147+
? (hasSomeNonTestingLibraryCall(blockStatementNode.body) &&
148+
hasTestingLibraryCall(blockStatementNode.body)) ||
149+
!hasSomeNonTestingLibraryCall(blockStatementNode.body)
149150
: !hasSomeNonTestingLibraryCall(blockStatementNode.body);
150151

151152
if (shouldBeReported) {

0 commit comments

Comments
 (0)