-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(scope-manager): add ESLint 10 globals opt-in and guard #11832
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 our terms of service and privacy 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?
feat(scope-manager): add ESLint 10 globals opt-in and guard #11832
Conversation
|
Thanks for the PR, @michaelgiraldo! 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 on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 7d9eba6
☁️ Nx Cloud last updated this comment at |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11832 +/- ##
==========================================
+ Coverage 90.53% 90.55% +0.01%
==========================================
Files 523 523
Lines 53096 53162 +66
Branches 8838 8864 +26
==========================================
+ Hits 48073 48140 +67
+ Misses 5010 5009 -1
Partials 13 13
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
👋 @michaelgiraldo thanks for the PR! The description you've written is very verbose. We have a very limited maintainer bandwidth and deeply reading through the whole thing would take up an unnecessarily large amount of time in it. We're working on docs in #11416 -> #11836. The tl;dr is: regardless of whether you use AI, excessively long descriptions actually harm understandability. Pithiness is good. @bradzacher and I each took a cursory look at the code and there are a lot more changes than either of us expected for this feature. I'm not sure yet whether this is necessary, but given that the PR description seems to be AI-generated and not well human-reviewed, I don't think we want to spend our limited bandwidth reviewing a PR that might be AI-generated and not well human-reviewed. I'm converting this to a draft for now. If you're still interested in this feature, please:
Feel free to re-request review & un-draft (you should have permissions to, ping me if not) once you've done those things. Cheers! |
|
@JoshuaKGoldberg is the write up is better? any other guidance, coding style, more tests? I want "stand by" my code with testing coverage. |

ESLint 10 changed how scope managers are supposed to work.
TypeScript-ESLint didn’t implement the new contract, which is why ESLint 10 crashes with the missing
addGlobalsmethod.This PR basically patches that gap:
Implements
scopeManager.addGlobals()This is the method ESLint 10 expects. Without it, ESLint blows up before running any rule.
Adds a flag:
resolveGlobalVarsInScript(default: false)ESLint 10 resolves globals differently in script mode.
They didn’t want to break everyone on ESLint 8/9, so this flag gates the new behavior.
Makes injected globals “value-only”
Prevents accidental type-binding, which would hide legit TS errors.
Adds cleanup logic for unresolved references
ESLint 10 requires tidying up script-mode references; TS-ESLint wasn’t doing that.
That’s it. It’s compatibility plumbing.
ESLint 10 changed the rules of the game, and TypeScript-ESLint wasn’t playing by them.
This PR just makes the scope manager stop crashing and behave the way ESLint 10 expects without screwing over people still on older ESLint versions.
If you're upgrading to ESLint 10, this PR is the missing piece that unbreaks the world.
When you move to ESLint 10, turn this on:
{ "parserOptions": { "resolveGlobalVarsInScript": true } }Otherwise script-mode globals won't resolve the way ESLint 10 expects.
🍊💾