Skip to content

Commit

Permalink
fix: Replace deprecated scope.resolve method (#70)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ertrzyiks authored Sep 28, 2020
1 parent d4263fb commit 9bcf51e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rules/no-unnecessary-waiting.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ function isIdentifierNumberConstArgument (node, scope) {

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

const resolvedIdentifier = scope.resolve(node.arguments[0]).resolved
const identifier = node.arguments[0]
const resolvedIdentifier = scope.references.find((ref) => ref.identifier === identifier).resolved
const definition = resolvedIdentifier.defs[0]
const isVariable = definition.type === 'Variable'

Expand Down

0 comments on commit 9bcf51e

Please sign in to comment.