Skip to content

Commit 8cc3676

Browse files
committed
fix: replace uses of context.getDeclaredVariables
1 parent 4944903 commit 8cc3676

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
@@ -12,6 +12,7 @@ import {
1212
isObjectPattern,
1313
isProperty,
1414
} from '../node-utils';
15+
import { getDeclaredVariables } from '../utils';
1516

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

7071
reportImportReferences(references);
7172
}

0 commit comments

Comments
 (0)