Skip to content

Conversation

@michaelgiraldo
Copy link

@michaelgiraldo michaelgiraldo commented Dec 9, 2025

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 addGlobals method.

This PR basically patches that gap:

  1. Implements scopeManager.addGlobals()
    This is the method ESLint 10 expects. Without it, ESLint blows up before running any rule.

  2. 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.

  3. Makes injected globals “value-only”
    Prevents accidental type-binding, which would hide legit TS errors.

  4. 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.


🍊💾

@typescript-eslint
Copy link
Contributor

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.

@netlify
Copy link

netlify bot commented Dec 9, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 7d9eba6
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/6937c0b14a931a000860deff
😎 Deploy Preview https://deploy-preview-11832--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 96 (🔴 down 1 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link

nx-cloud bot commented Dec 9, 2025

View your CI Pipeline Execution ↗ for commit 7d9eba6

Command Status Duration Result
nx test eslint-plugin --coverage=false ✅ Succeeded 5m 11s View ↗
nx run-many -t lint ✅ Succeeded 3m 13s View ↗
nx run-many -t typecheck ✅ Succeeded 2m 12s View ↗
nx test eslint-plugin-internal --coverage=false ✅ Succeeded 10s View ↗
nx run integration-tests:test ✅ Succeeded 5s View ↗
nx run types:build ✅ Succeeded 2s View ↗
nx test typescript-estree --coverage=false ✅ Succeeded 1s View ↗
nx run generate-configs ✅ Succeeded 6s View ↗
Additional runs (29) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-12-09 06:37:50 UTC

@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.55%. Comparing base (dd96947) to head (7d9eba6).

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              
Flag Coverage Δ
unittest 90.55% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/scope-manager/src/ScopeManager.ts 86.97% <100.00%> (+4.48%) ⬆️
packages/scope-manager/src/analyze.ts 100.00% <100.00%> (ø)
packages/scope-manager/src/scope/ScopeBase.ts 95.93% <100.00%> (+0.01%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JoshuaKGoldberg
Copy link
Member

👋 @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:

  • Reduce the PR description to something in line with what a human would normally write
  • Double-check the implementation to make sure it's something you can stand by

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 JoshuaKGoldberg marked this pull request as draft December 10, 2025 17:02
@michaelgiraldo
Copy link
Author

michaelgiraldo commented Dec 10, 2025

@JoshuaKGoldberg is the write up is better? any other guidance, coding style, more tests? I want "stand by" my code with testing coverage.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants