Skip to content

Commit bbe0130

Browse files
authoredMar 25, 2024
fix: support ESLint v9 getScope() (#399)
1 parent 975c983 commit bbe0130

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed
 

‎src/rules/no-disabled-tests.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ export default createEslintRule<Options, MESSAGE_ID>({
6969
testDepth--
7070
},
7171
'CallExpression[callee.name="pending"]'(node) {
72-
if (resolveScope(context.getScope(), 'pending'))
72+
const scope = context.sourceCode.getScope
73+
? context.sourceCode.getScope(node)
74+
: context.getScope()
75+
76+
if (resolveScope(scope, 'pending'))
7377
return
7478

7579
if (testDepth > 0)

‎src/utils/parseVitestFnCall.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ const parseVitestFnCallWithReasonInner = (
242242
if (node.callee.type === AST_NODE_TYPES.TaggedTemplateExpression && lastLink !== 'each')
243243
return null
244244

245-
const resolved = resolveVitestFn(context, getAccessorValue(first))
245+
const resolved = resolveVitestFn(context, node, getAccessorValue(first))
246246

247247
if (!resolved)
248248
return null
@@ -316,9 +316,13 @@ interface ResolvedVitestFnType {
316316

317317
const resolveVitestFn = (
318318
context: TSESLint.RuleContext<string, unknown[]>,
319+
node: TSESTree.Node,
319320
identifier: string
320321
): ResolvedVitestFnType | null => {
321-
const maybeImport = resolveScope(context.getScope(), identifier)
322+
const scope = context.sourceCode.getScope
323+
? context.sourceCode.getScope(node)
324+
: context.getScope()
325+
const maybeImport = resolveScope(scope, identifier)
322326

323327
if (maybeImport === 'local')
324328
return null

0 commit comments

Comments
 (0)
Please sign in to comment.