-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[NoQA] feat: react-compiler healthcheck #44460
[NoQA] feat: react-compiler healthcheck #44460
Conversation
Looks awesome! Two questions:
|
Re 1. Stupid me, just seeing the script in the package.json, looks good 👍 |
Definitely! @adamgrzybowski @blazejkustra @mountiny I'm tagging you, because I'd like to discuss a further approach. I have next open questions:
|
Yes I think in this PR we should not be fixing the violations
I think that would be great, you can do that but also if you are getting stuck, maybe just try to log the upstream issuew with your findings and do not go the rabbithole for too long
Those are good points. I think, ideally, we could create a new ESLint rule that would prevent people from adding new I think we can wait a bit more with the CI approach; maybe at the end of next week or in two weeks, we will add a check that will verify that any new file is compatible, and it will throw an error if there is some new page that is not compatible. Then we can slowly get through the existing incompatible pages and fix them.
How many files is this roughly, do you know? We try to avoid big migrations as it takes lots of management overhead but I assume we could take a sweep at this to get it all sorted |
c5a201f
to
f1abccc
Compare
Yep, I think it's a great idea! 👍
I think ~300 (from 1200 total files). I'm also against big migrations, but I think for I think this PR is ready for review now. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
@kirillzyusko there seems to be conflicts now |
f1abccc
to
9945479
Compare
@mountiny resolved them! Thank you for the reminder 🙌 |
I think you meant to tag @adhorodyski here 😅
Yep, that sounds good 👍
Workflow is an overkill for this imo, I think we agreed that an eslint rule that warns whenever
Is this possible to create a rule that throws only for new imports and allow the old ones?
How many occurrences are there? Unfortunately it's a common approach to remove some of the deps to decrease number of rerenders. That might be a big refactor with possible regressions 😢 |
Shame on me 🤦♂️ Yeah, I meant to tag @adhorodyski thank you for raising this 🙌
I think the ideal approach is to:
I think it should be possible, yes.
In this PR where I disabled eslint The other thing is that Anyway, I think from these 150 files ~30% of files will be fixed later in the compiler itself. And other files we'll have to fix at some point of time 👀 |
Based on my understanding, ESLint doesn't inherently support distinct rules for 'new' vs 'old' imports, given that it evaluates files as they exist at a particular point in time without knowledge of their history. Can you confirm this? Or are there any workarounds to achieve a similar effect?
I agree, how about we move over to slack with this discussion? Let's showcase all possible approaches so that we have a clear way forward when it comes to adoption. |
Yeah, it doesn't track git history. My assumption was to scan for useMemo/useCallback usage in the file. If such usage is found (and it's used only one time), then we can show the error like "react-compiler optimizes everything for you". But if we have more occurrences, then we will not throw the error since we assume that the user understand what he is doing. Maybe not ideal rule, but will give a clear instructions for new contributors.
Yeah, let's do it! Feel free to start a new topic 😊 🙌 (I guess the old one was created a long time ago and it's hard to find it for most of the people). |
3e633c4
to
81de55d
Compare
@mountiny just a friendly ping to review these changes again 👀 |
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.
Sorry, been ooo, looks good to me but there is more conflicts now
a18f4d3
to
10e966c
Compare
@mountiny resolved all of them! Feel free to have a look again 😊 |
10e966c
to
75abab0
Compare
@mountiny just a friendly ping again 😅 Hopefully this PR will not get any conflicts in next several hours 😁 |
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.6-0 🚀
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.6-0 🚀
|
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 9.0.6-1 🚀
|
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 9.0.6-1 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.6-8 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.7-8 🚀
|
Details
Gives a list of components that can not be optimized with a reason why:
Also changes from this PR:
Most common mistakes
Agenda:
InvalidJS
/InvalidReact
/InvalidConfig
/CannotPreserveMemoization
/Invariant
ToDo
severityWarning
If error has
ToDo
severity, then most likely this will be handled in future compiler versions and the component will be optimized (but right now such files are not optimized).🔴 Ignored eslint rule
🔴 Modifying
SharedValue
(reactwg/react-compiler#14)🔴 Modifying
ref
?🔴
useNativeDriver
is treated as a hook 😅🔴 Props mutation (even if it's ref/SharedValue)
🔴 dependency list should be an array literal
🔴 mutating external variables
🔴 Writing to a variable defined outside
🔴 complex manual memoization
🔴 Inferred dependencies did not match manually specified dependencies
🔴 Invalid nesting in program blocks or scopes
Warning
There is no specific lines, it just complains about entire file.
ArrowFunctionExpression
cannot be safely reorderedTSAsExpression
cannot be safely reorderedCallExpression
cannot be safely reorderedoptional
for logical test blockNewExpression
cannot be safely reorderedoptional
for ternary test blockFixed Issues
$ #44384
PROPOSAL:
Tests
N/A
Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop