Skip to content

Change Request: Track implicit globals #653

@nzakas

Description

@nzakas

Which packages would you like to change?

  • espree
  • eslint-scope
  • eslint-visitor-keys

What problem do you want to solve?

Split off from: eslint/eslint#19695 (comment)

Right now, implicit globals aren't actually treated as globals. Instead, they're treated as unresolved. Example:

function test() {
  implicitGlobal = 123; // creates an implicit global in JS, unresolved in eslint-scope
  implicitGlobal;  // no relationship to implicitGlobal in the previous line in eslint-scope
}

That means we aren't able to track implicit globals like we do explicit globals.

What do you think is the correct solution?

We should consider whether assignment to an implicit global should create a global variable declaration in eslint-scope.

Participation

  • I am willing to submit a pull request for this change.

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions