-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[Refactor] improve performance by avoiding unnecessary component detect #3273
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3273 +/- ##
==========================================
+ Coverage 97.68% 97.69% +0.01%
==========================================
Files 121 122 +1
Lines 8592 8634 +42
Branches 3127 3135 +8
==========================================
+ Hits 8393 8435 +42
Misses 199 199
Continue to review full report at Codecov.
|
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.
Before I review the whole thing - this seems like a very scary change to me. I'd much rather make component detection faster, and have every rule unconditionally be wrapped with component detection logic, than risk false positive warnings just to eke out a bit more performance from an eslint run (something that even without jest-eslint-runner is pretty fast already)
This change does not cause more reports or less reports. This change is a safe refactoring that does not change ouput. The |
My expectation would be that using Components.detect would restrict the AST node visitors to only applying within components. If that's not how it works, then I clearly misunderstand the abstraction. |
Yes some rules uses |
Fair enough; I'll rereview. |
cbaf278
to
18de0a6
Compare
Rules using
Component.detect()
are generally slow. Some rules usesComponent.detect(context, components, utils)
solely for theutils
it provided. TheseComponent.detect
s can be avoided by extracting someutils
functions into a module.Benchmark with config
plugin:react/all
: