-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Due for payment 2025-04-14] Update style guide to require parameter objects for functions with many parameters #57260
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
Comments
@neil-marcellini for frontend, I think we can add //Users/krishna2323/Desktop/workspace/expensify/App/src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx
92:7 error Arrow function has too many parameters (7). Maximum allowed is 5 @typescript-eslint/max-params
//Users/krishna2323/Desktop/workspace/expensify/App/src/styles/utils/index.ts
367:1 error Function 'getZoomSizingStyle' has too many parameters (7). Maximum allowed is 5 @typescript-eslint/max-params
515:1 error Function 'getIconWidthAndHeightStyle' has too many parameters (6). Maximum allowed is 5 @typescript-eslint/max-params
529:1 error Function 'getButtonStyleWithIcon' has too many parameters (7). Maximum allowed is 5 @typescript-eslint/max-params The following functions have more than 5 params:Functions with more than 5 params - Total: 115 functions📂 src/libs/actions/IOU.ts
📂 src/libs/ReportUtils.ts
📂 src/libs/actions/Report.ts
📂 src/libs/actions/Policy/Policy.ts
📂 src/libs/actions/Task.ts
📂 src/libs/actions/App.ts
📂 src/libs/actions/PersonalDetails.ts
📂 src/libs/actions/CompanyCards.ts
📂 src/libs/actions/Card.ts
📂 src/libs/actions/EmojiPickerAction.ts
📂 src/libs/actions/connections/NetSuiteCommands.ts
📂 src/libs/actions/connections/SageIntacct.ts
📂 src/libs/API/index.ts
📂 src/libs/DistanceRequestUtils.ts
📂 src/libs/IOUUtils.ts
📂 src/libs/KeyboardShortcut/index.ts
📂 src/libs/ModifiedExpenseMessage.ts
📂 src/libs/Navigation/helpers/createNormalizedConfigs.ts
📂 src/libs/Notification/LocalNotification/BrowserNotifications.ts
📂 src/libs/OptionsListUtils.ts
📂 src/libs/Performance.tsx
📂 src/libs/SearchAutocompleteUtils.ts
📂 src/libs/SearchQueryUtils.ts
📂 src/libs/SearchUIUtils.ts
📂 src/libs/SidebarUtils.ts
📂 src/libs/Violations/ViolationsUtils.ts
📂 src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx
📂 src/pages/home/report/ContextMenu/ReportActionContextMenu.ts
📂 src/pages/settings/Wallet/InternationalDepositAccount/utils.ts
📂 src/pages/settings/Wallet/WalletPage/WalletPage.tsx
📂 src/pages/workspace/accounting/utils.tsx
📂 src/pages/workspace/companyCards/utils.tsx
📂 src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx
📂 src/styles/utils/index.ts
📂 src/libs/fileDownload/index.ts
📂 src/libs/fileDownload/index.android.ts
📂 src/libs/fileDownload/index.desktop.ts
📂 src/libs/fileDownload/index.ios.ts
📂 src/libs/fileDownload/DownloadUtils.ts
📂 src/components/EmojiPicker/EmojiPicker.tsx
📂 src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx
📂 src/components/SelectionList/BaseSelectionList.tsx
📂 src/components/ShowContextMenuContext.ts
📂 src/components/Tooltip/EducationalTooltip/measureTooltipCoordinate/index.android.ts
📂 src/libs/GithubUtils.ts
📂 src/ROUTES.ts
📂 tests/ui/LHNItemsPresence.tsx
Functions with 10+ Parameters - Total: 9 functions
Total: 9 functions |
I plan to work on this today |
I wrote out a conversation prompt in a Slack canvas and I'll post it tomorrow morning in #expensify-open-source |
I posted the conversation in Slack here |
This PR is a really good example showing the default and also how it cleans up having to pass a bunch of parameters as undefined 🙂 refactor buildOptimisticChatReport to use a params object |
I'm setting a reminder to work on this on Wednesday. |
Starting on this now |
Hi @Krishna2323 would you please implement your proposal to add the ES Lint rule? As we discussed in Slack here please make it only error at 10+ params and add it to the changed files es lint check only for now. |
If you're busy with higher priorities please let me know and I can open it up for others. |
@neil-marcellini, thanks for the assignment. I will open up a PR today. |
@neil-marcellini, the PR is ready for review. Do we need someone else to review it? BTW, I added the rule in |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.23-7 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 2025-04-14. 🎊 For reference, here are some details about the assignees on this issue:
|
Issue is ready for payment but no BZ is assigned. @slafortune you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks! |
Payment Summary
BugZero Checklist (@slafortune)
|
Triggered auto assignment to @sonialiap ( |
Unexpected OOO |
@neil-marcellini to confirm, I see that most of the sub-issues are priced at $125, is that the expected price here? |
Maybe $25? It was pretty easy |
Payment summary: |
@neil-marcellini, it was a relatively small task, but I did spend a bit of time running the rule, checking violations, and organizing the message + stats. Would $50 work for you? If not, I’m happy to settle at $25 this time since it was light — just wanted to highlight that it’s more than just a one-liner config change 🙂 |
@slafortune, @sonialiap, @neil-marcellini, @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Sure I understand, but let's stick with $25. All PRs require some time but this was about as small as they get. |
Payment made |
Uh oh!
There was an error while loading. Please reload this page.
Problem
In the parent tracking issue we identified a problem when functions have too many parameters, and we're working to refactor this. However, it's not enforced by our style guide yet. We need to come up with some recommendations and rules about this so we can stay consistent once the refactor is done.
Solution
Start a conversation in Slack with suggestions about what the style guide should say, then implement it for App. We can also consider whether we want to do something similar on the backend.
Issue Owner
Current Issue Owner: @sonialiapThe text was updated successfully, but these errors were encountered: