Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Relevant Package
scope-manager
Playground Link
No response
Repro Code
undefined;globalThis;NaN;Object;Boolean;String;Math;Date;Array;Map;Set;varfoo;foo;
ESLint Config
Notrelevant
tsconfig
{"compilerOptions": {"lib": ["esnext"] }}Expected Result
All identifiers butfoo are analyzed to be determined references to implicit global variables.
Actual Result
OnlyString andObject are determined to be references to implicit global variables.
Additional Info
- I encountered this while working onfeat(linter/plugins): scope manager API oxc-project/oxc#14890.
What's going wrong?
- The generated code for ts libs may include multiple mentions of the same variable, in some cases indicating the variable is a
TYPE, andTYPE_VALUEin others. - When
Referencer.populateGlobalsFromLibcallsGlobalScope.defineImplicitVariablewhich callsScopeBase.defineVariableand the variable is already defined, it doesn't entertain the possibility that the variable may have different type/value attributes and simply moves on. - The result:
@typescript-eslint/scope-managerincorrectly indicates to the user project that a variable is a type, and the scope analysis does not pick up value identifiers as references to the variable.
Versions
| package | version |
|---|---|
@typescript-eslint/scope-manager | 8.46.1' |
TypeScript | 5.9.3 |
node | 24.10.0 |