Skip to content

Commit 9bcf51e

Browse files
authored
fix: Replace deprecated scope.resolve method (#70)
As pointed out in the developer guide https://eslint.org/docs/developer-guide/scope-manager-interface#deprecated-members-2 scope.resolve method is deprecated. For that reason it was not implemented in typescript-eslint/typescript-eslint and no-unnecessary-waiting rule fails with version 4.x of the typescript eslint parser. The eslint developer guide suggest to use `scope.references.find` instead.
1 parent d4263fb commit 9bcf51e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/rules/no-unnecessary-waiting.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ function isIdentifierNumberConstArgument (node, scope) {
5656

5757
if (node.arguments[0].type !== 'Identifier') return false
5858

59-
const resolvedIdentifier = scope.resolve(node.arguments[0]).resolved
59+
const identifier = node.arguments[0]
60+
const resolvedIdentifier = scope.references.find((ref) => ref.identifier === identifier).resolved
6061
const definition = resolvedIdentifier.defs[0]
6162
const isVariable = definition.type === 'Variable'
6263

0 commit comments

Comments
 (0)