-
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
[HOLD for payment 2024-01-05] [$500] Prohibit the use of defaultProps in ts functional components #33197
Comments
Job added to Upwork: https://www.upwork.com/jobs/~01e2d42d1ab75ab97a |
Triggered auto assignment to @abekkala ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov ( |
Upwork job price has been updated to $250 |
Adjusting the bounty for this to $250 |
ProposalPlease re-state the problem that we are trying to solve in this issue.Prohibit the use of defaultProps in ts functional components What is the root cause of that problem?Our TypeScript guidelines state that functional components should use prop destructuring instead of defaultProps. What changes do you think we should make in order to solve the problem?We should modify the file .eslintrc.js , adding a new rule like:
Then we can create a file/rule called eslint-rules/no-default-props.js with a content like:
Finally, we should include our rules in ESLint configuration file like:
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
ProposalPlease re-state the problem that we are trying to solve in this issue.Prohibit the use of defaultProps in ts functional components What is the root cause of that problem?N/a, not a bug more of dev experience improvement What changes do you think we should make in order to solve the problem?At present we suppressed the linter rule for default props 'react/require-default-props` for typescript files here, we just need to enable the rule and set option 'functions' to 'defaultArguments'. 'react/require-default-props': ['error', {functions: 'defaultArguments'}]` Note: Enabling this would mean if there are optional props without defaultArguments linter will throw error, we need to provide "undefined" as default |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
📣 @alitoshmatov 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @ishpaul777 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Thanks for assigning, I am working on the PR now, will raise shortly |
eslint-config-expensify PR merged, back to E/App PR now |
I'll open a Pr tomorrow (Monday). |
PR is reday for review @roryabraham |
PR merged |
I did not use any C+ services in the course of this issue, so I'm removing @alitoshmatov's assignment here |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.19-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-01-05. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
No regression tests needed here |
PAYMENTS FOR JAN 05
|
@abekkala no need payment for me since I did not review the PR |
@alitoshmatov ah yes, I do see that now. Thank you! |
@ishpaul777 $500 payment sent and contract ended - thank you! 🎉 |
Problem
Our TypeScript guidelines state that functional components should use prop destructuring instead of
defaultProps
, but it's still possible for developers who don't know that to try and usedefaultProps
. In the worst case, that means we'll have inconsistent patterns for default props in our TS functional components. In a more typical case, the development cycle is slowed because we have to request changes during review and wait for the developer to make those changes.Solution
Set up an ESLint rule that prohibits the use of
defaultProps
in TypeScript functional components, and directs developers to use prop destructuring instead. To be clear, this means thatdefaultProps
should be allowed:Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: