Skip to content

Commit c1c93ff

Browse files
committed
fix: only report rule when Testing Library or custom utils module is imported
1 parent 7812dae commit c1c93ff

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/rules/no-node-access.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ export default createTestingLibraryRule<Options, MessageIds>({
9090

9191
return {
9292
CallExpression(node: TSESTree.CallExpression) {
93+
// This rule is so aggressive that can cause tons of false positives outside test files when Aggressive Reporting
94+
// is enabled. Because of that, this rule will skip this mechanism and report only if some Testing Library package
95+
// or custom one (set in utils-module Shared Setting) is found.
96+
if (!helpers.isTestingLibraryImported(true)) {
97+
return;
98+
}
99+
93100
const { callee } = node;
94101
const property = isMemberExpression(callee) ? callee.property : null;
95102
const object = isMemberExpression(callee) ? callee.object : null;

0 commit comments

Comments
 (0)