Skip to content

Commit

Permalink
fix: new eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Dec 20, 2024
1 parent 1b5e9d7 commit 9e660ba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/libs/actions/TransactionEdit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ function createDraftTransaction(transaction: OnyxEntry<Transaction>) {
Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transaction.transactionID}`, newTransaction);
}

function removeDraftTransaction(transactionID: string) {
function removeDraftTransaction(transactionID: string | undefined) {
if (!transactionID) {
return;
}

Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, null);
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/MoneyRequestAmountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function MoneyRequestAmountForm(
addBankAccountRoute={bankAccountRoute}
addDebitCardRoute={ROUTES.IOU_SEND_ADD_DEBIT_CARD}
currency={currency ?? CONST.CURRENCY.USD}
policyID={policyID ?? '-1'}
policyID={policyID}
style={[styles.w100, canUseTouchScreen ? styles.mt5 : styles.mt3]}
buttonSize={CONST.DROPDOWN_BUTTON_SIZE.LARGE}
kycWallAnchorAlignment={{
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/request/IOURequestStartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function IOURequestStartPage({
const [selectedTab = CONST.TAB_REQUEST.SCAN, selectedTabResult] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.IOU_REQUEST_TYPE}`);
const isLoadingSelectedTab = shouldUseTab ? isLoadingOnyxValue(selectedTabResult) : false;
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${route?.params.transactionID || -1}`);
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${route?.params.transactionID}`);
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
const {canUseCombinedTrackSubmit} = usePermissions();

Expand Down
10 changes: 5 additions & 5 deletions src/pages/iou/request/step/IOURequestStepAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ function IOURequestStepAmount({
const focusTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const isSaveButtonPressed = useRef(false);
const iouRequestType = getRequestType(transaction);
const policyID = report?.policyID ?? '-1';
const policyID = report?.policyID;

const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID ?? -1}`);
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const [draftTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`);
Expand Down Expand Up @@ -109,7 +109,7 @@ function IOURequestStepAmount({
if (isSaveButtonPressed.current) {
return;
}
TransactionEdit.removeDraftTransaction(transaction?.transactionID ?? '-1');
TransactionEdit.removeDraftTransaction(transaction?.transactionID);
};
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, []);
Expand Down Expand Up @@ -175,7 +175,7 @@ function IOURequestStepAmount({
if (report?.reportID && !ReportUtils.isArchivedRoom(report, reportNameValuePairs) && iouType !== CONST.IOU.TYPE.CREATE) {
const selectedParticipants = IOU.setMoneyRequestParticipantsFromReport(transactionID, report);
const participants = selectedParticipants.map((participant) => {
const participantAccountID = participant?.accountID ?? -1;
const participantAccountID = participant?.accountID;
return participantAccountID ? OptionsListUtils.getParticipantsOption(participant, personalDetails) : OptionsListUtils.getReportOption(participant);
});
const backendAmount = CurrencyUtils.convertToBackendAmount(Number.parseFloat(amount));
Expand Down Expand Up @@ -291,7 +291,7 @@ function IOURequestStepAmount({
amount={Math.abs(transactionAmount)}
skipConfirmation={shouldSkipConfirmation ?? false}
iouType={iouType}
policyID={policy?.id ?? '-1'}
policyID={policy?.id}
bankAccountRoute={ReportUtils.getBankAccountRoute(report)}
ref={(e) => (textInput.current = e)}
shouldKeepUserInput={transaction?.shouldShowOriginalAmount}
Expand Down

0 comments on commit 9e660ba

Please sign in to comment.