Skip to content

Commit 7545c21

Browse files
committed
fix: replace uses of context.getDeclaredVariables
1 parent 78b80eb commit 7545c21

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/node-utils/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
TSESTree,
77
} from '@typescript-eslint/utils';
88

9-
import { getScope } from '../utils';
9+
import { getDeclaredVariables, getScope } from '../utils';
1010

1111
import {
1212
isArrayExpression,
@@ -289,7 +289,7 @@ export function getVariableReferences(
289289
): TSESLint.Scope.Reference[] {
290290
if (ASTUtils.isVariableDeclarator(node)) {
291291
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
292-
return context.getDeclaredVariables(node)[0]?.references?.slice(1) ?? [];
292+
return getDeclaredVariables(context, node)[0]?.references?.slice(1) ?? [];
293293
}
294294

295295
return [];

lib/rules/no-debugging-utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
isObjectPattern,
1212
isProperty,
1313
} from '../node-utils';
14-
import { DEBUG_UTILS } from '../utils';
14+
import { DEBUG_UTILS, getDeclaredVariables } from '../utils';
1515

1616
type DebugUtilsToCheckForConfig = Record<(typeof DEBUG_UTILS)[number], boolean>;
1717
type DebugUtilsToCheckFor = Partial<DebugUtilsToCheckForConfig>;
@@ -175,7 +175,7 @@ export default createTestingLibraryRule<Options, MessageIds>({
175175

176176
const isVariableFromBuiltInConsole = builtInConsoleNodes.some(
177177
(variableDeclarator) => {
178-
const variables = context.getDeclaredVariables(variableDeclarator);
178+
const variables = getDeclaredVariables(context, variableDeclarator);
179179
return variables.some(
180180
({ name }) =>
181181
name === callExpressionIdentifier.name &&

lib/rules/no-manual-cleanup.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
ImportModuleNode,
1212
isImportDeclaration,
1313
} from '../node-utils';
14+
import { getDeclaredVariables } from '../utils';
1415

1516
export const RULE_NAME = 'no-manual-cleanup';
1617
export type MessageIds = 'noManualCleanup';
@@ -64,7 +65,7 @@ export default createTestingLibraryRule<Options, MessageIds>({
6465
if (isImportDeclaration(moduleNode)) {
6566
// case: import utils from 'testing-library-module'
6667
if (isImportDefaultSpecifier(moduleNode.specifiers[0])) {
67-
const { references } = context.getDeclaredVariables(moduleNode)[0];
68+
const { references } = getDeclaredVariables(context, moduleNode)[0];
6869

6970
reportImportReferences(references);
7071
}

0 commit comments

Comments
 (0)