Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
fix(scope-manager): reconcile type-value distinction for implicit globals across libs#11715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
Thanks for the PR,@lilnasy! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint. |
netlifybot commentedOct 23, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview fortypescript-eslint ready!
To edit notification comments on pull requests, go to yourNetlify project configuration. |
nx-cloudbot commentedOct 23, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t lint | ❌ Failed | 3m 17s | View ↗ |
nx test eslint-plugin --coverage=false | ✅ Succeeded | 5m 17s | View ↗ |
nx run-many -t typecheck | ✅ Succeeded | 2m 7s | View ↗ |
nx run types:build | ✅ Succeeded | 5s | View ↗ |
nx run integration-tests:test | ✅ Succeeded | 5s | View ↗ |
nx test eslint-plugin-internal --coverage=false | ✅ Succeeded | 10s | View ↗ |
nx test typescript-estree --coverage=false | ✅ Succeeded | 2s | View ↗ |
nx run generate-configs | ✅ Succeeded | 6s | View ↗ |
Additional runs (29) | ✅ Succeeded | ... | View ↗ |
☁️Nx Cloud last updated this comment at2025-11-03 19:53:23 UTC
codecovbot commentedOct 23, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #11715 +/- ##======================================= Coverage 90.66% 90.66% ======================================= Files 518 518 Lines 52435 52445 +10 Branches 8686 8690 +4 =======================================+ Hits 47541 47551 +10- Misses 4880 4881 +1+ Partials 14 13 -1
Flags with carried forward coverage won't be shown.Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
instead of mutating the variable here -- could we instead do it higher.
eg:
In theGlobalScope class (which callsScopeBase.defineVariable):
typescript-eslint/packages/scope-manager/src/scope/GlobalScope.ts
Lines 68 to 79 inea2ee6b
| publicdefineImplicitVariable( | |
| name:string, | |
| options:ImplicitLibVariableOptions, | |
| ):void{ | |
| this.defineVariable( | |
| newImplicitLibVariable(this,name,options), | |
| this.set, | |
| this.variables, | |
| null, | |
| null, | |
| ); | |
| } |
Or in theReferencer class (which callsGlobalScope.defineImplicitVariable):
| // This loop is guaranteed to see each included lib exactly once | |
| for(const[name,variable]oflib.variables){ | |
| globalScope.defineImplicitVariable(name,variable); | |
| } |
I think the latter would be better as we could pre-aggregate the variable definitions to deduplicate and merge them before even callingdefineImplicitVariable.

PR Checklist
Overview
To fix the issue, implicit variables are mutated as the global scope is being populated.
I admittedly did not spend much time thinking of a proper solution. Though it was tricky to pinpoint, the fix is simple. I imagine the "correct" location for the fix is a matter of maintainer preference.
Direct commits from maintainers welcome.