Skip to content
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
"electron-builder": "26.0.19",
"eslint": "^9.36.0",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-expensify": "2.0.94",
"eslint-config-expensify": "2.0.95",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^29.0.1",
"eslint-plugin-jsdoc": "^60.7.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/CategoryPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function CategoryPicker({selectedCategory, policyID, onSubmit, addBottomSafeArea
return [categoryOptions, header, showInput];
}, [policyCategories, policyCategoriesDraft, policyRecentlyUsedCategories, debouncedSearchValue, selectedOptions, localeCompare, translate]);

const selectedOptionKey = useMemo(() => (sections?.at(0)?.data ?? []).filter((category) => category.searchText === selectedCategory).at(0)?.keyForList, [sections, selectedCategory]);
const selectedOptionKey = useMemo(() => (sections?.at(0)?.data ?? []).find((category) => category.searchText === selectedCategory)?.keyForList, [sections, selectedCategory]);

return (
<SelectionList
Expand Down
5 changes: 1 addition & 4 deletions src/components/DestinationPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ function DestinationPicker({selectedDestination, policyID, onSubmit}: Destinatio
return [destinationOptions, header, showInput];
}, [debouncedSearchValue, selectedOptions, customUnit?.rates, policyRecentlyUsedDestinations, translate]);

const selectedOptionKey = useMemo(
() => (sections?.at(0)?.data ?? []).filter((destination) => destination.keyForList === selectedDestination).at(0)?.keyForList,
[sections, selectedDestination],
);
const selectedOptionKey = useMemo(() => (sections?.at(0)?.data ?? []).find((destination) => destination.keyForList === selectedDestination)?.keyForList, [sections, selectedDestination]);

return (
<SelectionList
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/TripDetailsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function TripDetailsView({tripRoomReport, shouldShowHorizontalRule, tripTransact

switch (firstReservation?.type) {
case CONST.RESERVATION_TYPE.FLIGHT: {
const destinationReservation = reservations.filter((reservation) => reservation.reservation.legId === firstReservation.legId).at(-1);
const destinationReservation = reservations.findLast((reservation) => reservation.reservation.legId === firstReservation.legId);
if (!destinationReservation) {
return '';
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/SidePanel/HelpComponents/HelpContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ function HelpContent({closeSidePanel}: HelpContentProps) {
(actions: OnyxEntry<ReportActions>): OnyxEntry<ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.IOU>> => {
return Object.values(actions ?? {})
.filter((action) => action.reportActionID === report?.parentReportActionID)
.filter(isMoneyRequestAction)
.at(0);
.find(isMoneyRequestAction);
},
[report?.parentReportActionID],
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/TagPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function TagPicker({

const headerMessage = getHeaderMessageForNonUserList((sections?.at(0)?.data?.length ?? 0) > 0, searchValue);

const selectedOptionKey = sections.at(0)?.data?.filter((policyTag) => policyTag.searchText === selectedTag)?.[0]?.keyForList;
const selectedOptionKey = sections.at(0)?.data?.find((policyTag) => policyTag.searchText === selectedTag)?.keyForList;

return (
<SelectionList
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ComposerFocusManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function focus(input: InputElement, shouldIgnoreFocused = false) {
}

function tryRestoreTopmostFocus(shouldIgnoreFocused: boolean, isInUploadingContext = false) {
const topmost = [...focusMap].filter(([, v]) => v.input && v.isInUploadingContext === isInUploadingContext).at(-1);
const topmost = [...focusMap].findLast(([, v]) => v.input && v.isInUploadingContext === isInUploadingContext);
if (topmost === undefined) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/libs/Navigation/helpers/getTopmostReportParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ function getTopmostReportParams(state: State): ReportsSplitNavigatorParamList[ty
return;
}

const topmostReportsSplitNavigator = state.routes?.filter((route) => route.name === NAVIGATORS.REPORTS_SPLIT_NAVIGATOR).at(-1);
const topmostReportsSplitNavigator = state.routes?.findLast((route) => route.name === NAVIGATORS.REPORTS_SPLIT_NAVIGATOR);

if (!topmostReportsSplitNavigator) {
return;
}

const topmostReport = topmostReportsSplitNavigator.state?.routes.filter((route) => route.name === SCREENS.REPORT).at(-1);
const topmostReport = topmostReportsSplitNavigator.state?.routes.findLast((route) => route.name === SCREENS.REPORT);

if (!topmostReport) {
return;
Expand Down
8 changes: 4 additions & 4 deletions src/libs/SearchQueryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,9 @@ function buildFilterFormValuesFromQuery(
}
if (filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_TYPE) {
const validWithdrawalTypes = new Set(Object.values(CONST.SEARCH.WITHDRAWAL_TYPE));
filtersForm[key as typeof filterKey] = filterValues
.filter((withdrawalType): withdrawalType is SearchWithdrawalType => validWithdrawalTypes.has(withdrawalType as ValueOf<typeof CONST.SEARCH.WITHDRAWAL_TYPE>))
.at(0);
filtersForm[key as typeof filterKey] = filterValues.find((withdrawalType): withdrawalType is SearchWithdrawalType =>
validWithdrawalTypes.has(withdrawalType as ValueOf<typeof CONST.SEARCH.WITHDRAWAL_TYPE>),
);
}
if (filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.CARD_ID) {
filtersForm[key as typeof filterKey] = filterValues.filter((card) => cardList[card]);
Expand Down Expand Up @@ -738,7 +738,7 @@ function buildFilterFormValuesFromQuery(
}
if (filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.GROUP_CURRENCY) {
const validCurrency = new Set(Object.keys(currencyList));
filtersForm[filterKey] = filterValues.filter((currency) => validCurrency.has(currency)).at(0);
filtersForm[filterKey] = filterValues.find((currency) => validCurrency.has(currency));
}
if (filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.TAG) {
const tags = policyID
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Debug/ConstantPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function ConstantPicker({formType, fieldName, fieldValue, onSubmit}: ConstantPic
}),
[fieldName, fieldValue, formType, searchValue],
);
const selectedOptionKey = useMemo(() => sections.filter((option) => option.searchText === fieldValue).at(0)?.keyForList, [sections, fieldValue]);
const selectedOptionKey = useMemo(() => sections.find((option) => option.searchText === fieldValue)?.keyForList, [sections, fieldValue]);

return (
<SelectionList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ function WorkspaceCompanyCardsErrorConfirmation({policyID, newFeed}: WorkspaceCo
}
const {cardList, ...cards} = cardsList ?? {};
const cardIDs = Object.keys(cards);
const feedToOpen = (Object.keys(companyFeeds) as CompanyCardFeed[])
.filter((feed) => feed !== newFeed && companyFeeds[feed]?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE)
.at(0);
const feedToOpen = (Object.keys(companyFeeds) as CompanyCardFeed[]).find(
(feed) => feed !== newFeed && companyFeeds[feed]?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
);
deleteWorkspaceCompanyCardFeed(policyID, domainOrWorkspaceAccountID, newFeed, cardIDs, feedToOpen);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ function WorkspaceCompanyCardsSettingsPage({
if (selectedFeed) {
const {cardList, ...cards} = cardsList ?? {};
const cardIDs = Object.keys(cards);
const feedToOpen = (Object.keys(companyFeeds) as CompanyCardFeed[])
.filter((feed) => feed !== selectedFeed && companyFeeds[feed]?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE)
.at(0);
const feedToOpen = (Object.keys(companyFeeds) as CompanyCardFeed[]).find(
(feed) => feed !== selectedFeed && companyFeeds[feed]?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
);
// eslint-disable-next-line @typescript-eslint/no-deprecated
InteractionManager.runAfterInteractions(() => {
deleteWorkspaceCompanyCardFeed(policyID, domainOrWorkspaceAccountID, selectedFeed, cardIDs, feedToOpen);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function ApprovalWorkflowEditor({approvalWorkflow, removeApprovalWorkflow, polic

const approverErrorMessage = useCallback(
(approver: Approver | undefined, approverIndex: number) => {
const previousApprover = approvalWorkflow.approvers.slice(0, approverIndex).filter(Boolean).at(-1);
const previousApprover = approvalWorkflow.approvers.slice(0, approverIndex).findLast(Boolean);
const error = approvalWorkflow?.errors?.[`approver-${approverIndex}`];

if (!error) {
Expand Down