Skip to content

feat!: Resolve references to global var/function, add addGlobals()#682

Merged
nzakas merged 6 commits intomainfrom
issue665
Nov 7, 2025
Merged

feat!: Resolve references to global var/function, add addGlobals()#682
nzakas merged 6 commits intomainfrom
issue665

Conversation

@mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Sep 15, 2025

Prerequisites checklist

What is the purpose of this pull request?

Updates eslint-scope to resolve references to globally declared var and function variables, and adds a method to create predefined global variables.

What changes did you make? (Give an overview)

  • Updated global scope to resolve references to declared var and function variables.
  • Added ScopeManager#addGlobals() method that allows adding predefined globals.

Related Issues

Fixes #665

Is there anything you'd like reviewers to focus on?

It would probably be more elegant to pass a list of predefined globals in advance, as an option to analyze. But that doesn't fit the use of eslint-scope and other scope managers in ESLint, where the scope is analyzed in the parse step, whereas globals are added in SourceCode#finalize().

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Sep 15, 2025
@mdjermanovic mdjermanovic changed the title feat!: Close var and function references on global scope feat!: Resolve references to global var/function, add addGlobals() Sep 16, 2025
@mdjermanovic mdjermanovic moved this from Needs Triage to Blocked in Triage Sep 23, 2025
@mdjermanovic
Copy link
Member Author

This is ready for review. Related PR in eslint/eslint is eslint/eslint#20132.

Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Waiting for a second review.

@mdjermanovic mdjermanovic marked this pull request as ready for review November 6, 2025 18:21
@mdjermanovic mdjermanovic moved this from Blocked to Second Review Needed in Triage Nov 6, 2025
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Question: how come function references on the global scope are not closed

3 participants