Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat(scope-manager): only populate implicit globals whose names appear in the file#10561
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?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for the PR,@dmichon-msft! 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 commentedDec 27, 2024 • 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 site configuration. |
nx-cloudbot commentedDec 27, 2024 • 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.
View yourCI Pipeline Execution ↗ for commit518da6b.
☁️Nx Cloud last updated this comment at |
As shown in the failed tests this doesn't work as written. I'm guessing that what's happening is that you're deferring the addition of the variables to after the scopes are closed - causing dangingling, unresolved references. When a scope is finalised we close off the references within the scope. This means we attempt to resolve any unresolved references created in the current or child scopes to variables defined in the current scope. If we don't find the right variable the reference is left as unresolved and we continue to the parent scope. So if you don't declare the implicit globals early enough then they can't be resolved and so the references are left dangling - which then causes the |
dmichon-msft commentedDec 28, 2024 • 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.
There's a reason this is a draft. One thing I know I'm doing wrong here is that if there two lib records define the nature of an implicit variable differently (type-only vs. value-only vs. value-and-type), one of them wins at effectively random. As written this theoreticallyshould run before the global scope is closed, but I'll need to dig into it a bit more. I just wanted to put this out there to get some eyes on the concept. Ah, I just realized that part of the change is missing here. The invocation of |
0ab2600
tocf9e2e5
CompareUh oh!
There was an error while loading.Please reload this page.
codecovbot commentedDec 28, 2024 • 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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #10561 +/- ##======================================= Coverage ? 86.95% ======================================= Files ? 446 Lines ? 15571 Branches ? 4532 ======================================= Hits ? 13540 Misses ? 1676 Partials ? 355
Flags with carried forward coverage won't be shown.Click here to find out more.
|
JoshuaKGoldberg commentedJan 13, 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.
This is really cool, thanks for sending@dmichon-msft! I'd love to dive in soon and see if we can get this shipped. But - we're a little swamped catching up on issues after the holiday & new year break, and this is a lot of very nuanced code in a not-very-often changed area of the project. So it'll probably be a little while till we can take a deep look. In the meantime, what would help us review more quickly:
Btw, you don't need to keep merging the latest |
I'm slicing out the easy perf win (caching of |
👍 in that case drafting this PR in the meantime. Let me know if it's actually ready for review and I misinterpreted. Exciting stuff! 🙂 |
JoshuaKGoldberg commentedApr 7, 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.
👋 Just checking in@dmichon-msft, do you still have time for this very exciting perf work? |
The PR with the bigger part of the performance win merged, so this hasn't been high on my priority list. This wouldn't be terribly difficult to get going again, I'd just largely forgotten about it. The new structure should make this pretty simple. |
Uh oh!
There was an error while loading.Please reload this page.
PR Checklist
Overview
This PR optimizes
populateGlobalsFromLib
by deduplicating work to calculate the set of variables available in the configuredlibs
array, and by only injecting implicit variable definitions for variables whose names appear in the file being analyzed.As a consequence of only injecting implicit variables that are actually used in the file, we can avoid the overhead of lint rules spending time processing irrelevant injected globals, for example in
typescript-eslint/no-redeclare
andtypescript-eslint/naming-convention
.Before
After