-
-
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 of component detection #3276
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3276 +/- ##
=======================================
Coverage 97.72% 97.72%
=======================================
Files 123 123
Lines 8744 8744
Branches 3165 3165
=======================================
Hits 8545 8545
Misses 199 199 Continue to review full report at Codecov.
|
Can you elaborate on how they're redundant? |
Our heuristics for detecting function components is checking if the function returns jsx or null ( This part is redundant eslint-plugin-react/lib/util/Components.js Lines 829 to 840 in 24621e4
, because checking eslint-plugin-react/lib/util/Components.js Lines 785 to 796 in 24621e4
|
Would it be simpler to memoize isReturningJSX? |
No, it wouldn't. Deleting redundant code is better than adding memoizing. |
Some node visitors for components detection are redundant.
Benchmark with
time npx eslint .
(mean of 5 runs):