-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(eslint-plugin): [no-misused-promises] perf: avoid getting types of variables/functions if the annotated type is obviously not a function #9656
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
Conversation
…f variables/functions if the annotated type is obviously not a function
Thanks for the PR, @bradzacher! 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 site configuration. |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 37b85c7. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v8 #9656 +/- ##
=======================================
Coverage 88.04% 88.05%
=======================================
Files 402 402
Lines 13639 13655 +16
Branches 3959 3966 +7
=======================================
+ Hits 12009 12024 +15
Misses 1322 1322
- Partials 308 309 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
(merge shenanigan)
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.
nah i added this cos I was running from the root with node --cpu-prof --max-old-space-size=10000 ./node_modules/.bin/eslint .
and our lint run was matching reporting on files in these two folders.
the /
should make eslint ignore the entire folder without globbing etc
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.
Awesome! ⚡
Overview
I sat down for a few minutes to try perf profiling our codebase (writeup coming slowly in #6366) to look for some obvious improvements.
One thing that immediately stood out was that almost 10% of our lint run was spent in
no-misused-promises
'checkVariableDeclaration
function. We can fix this easily by doing a quick syntactic check to filter out cases of (a) not-annotated variables and (b) annotated types that can never be function types.This completely removes the function from the left-heavy cpu profile flame graph.
It ultimately doesn't change the lint run performance, however, because types are lazily calculated - so it has only shifted the workload to another rule -- but if we can do this enough we can shift that needle.