Skip to content

Commit

Permalink
fix: do not use context.getScope()
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Dec 6, 2023
1 parent 0fc074d commit be8f236
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/util/check-prefer-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ class Verifier {
*/
verifyToPreferModules() {
const { context, trackMap } = this
const tracker = new ReferenceTracker(context.getScope())
const sourceCode = context.sourceCode ?? context.getSourceCode()
const scope =
sourceCode.getScope?.(context.sourceCode.ast) ?? context.getScope()
const tracker = new ReferenceTracker(scope)

for (const { node } of tracker.iterateGlobalReferences(
trackMap.globals
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"builtins": "^5.0.1",
"eslint-plugin-es-x": "^7.1.0",
"eslint-plugin-es-x": "^7.5.0",
"get-tsconfig": "^4.7.0",
"ignore": "^5.2.4",
"is-builtin-module": "^3.2.1",
Expand Down

0 comments on commit be8f236

Please sign in to comment.