Skip to content

Commit 8a3ecbf

Browse files
committed
Fix lint errors
1 parent 3b052c0 commit 8a3ecbf

6 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/CONST/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6482,6 +6482,7 @@ const CONST = {
64826482
mapping: 'report-fields-mapping',
64836483
},
64846484
},
6485+
DEFAULT_REPORT_METADATA: {isLoadingInitialReportActions: true},
64856486
get UPGRADE_FEATURE_INTRO_MAPPING() {
64866487
return {
64876488
reportFields: {

src/components/SettlementButton/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ import {approveMoneyRequest, savePreferredPaymentMethod as savePreferredPaymentM
3535
import CONST from '@src/CONST';
3636
import ONYXKEYS from '@src/ONYXKEYS';
3737
import ROUTES from '@src/ROUTES';
38-
import type {AccountData, BankAccount, LastPaymentMethodType, Policy} from '@src/types/onyx';
38+
import type {AccountData, BankAccount, BankAccountList, FundList, LastPaymentMethodType, Policy} from '@src/types/onyx';
3939
import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage';
40-
import {isEmptyObject} from '@src/types/utils/EmptyObject';
40+
import {getEmptyObject, isEmptyObject} from '@src/types/utils/EmptyObject';
4141
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
4242
import type SettlementButtonProps from './types';
4343

@@ -104,7 +104,7 @@ function SettlementButton({
104104
});
105105

106106
const lastBankAccountID = getLastPolicyBankAccountID(policyIDKey, iouReport?.type as keyof LastPaymentMethodType);
107-
const [fundList = {}] = useOnyx(ONYXKEYS.FUND_LIST, {canBeMissing: true});
107+
const [fundList = getEmptyObject<FundList>()] = useOnyx(ONYXKEYS.FUND_LIST, {canBeMissing: true});
108108
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
109109
const currentUserAccountID = getCurrentUserAccountID().toString();
110110
const activeAdminPolicies = getActiveAdminWorkspaces(policies, currentUserAccountID).sort((a, b) => (a.name || '').localeCompare(b.name || ''));
@@ -115,7 +115,7 @@ function SettlementButton({
115115
const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`];
116116
const isLastPaymentPolicy = !Object.values({...CONST.PAYMENT_METHODS, ...CONST.IOU.PAYMENT_TYPE}).includes(lastPaymentMethod as PaymentMethod);
117117
const lastPaymentPolicy = isLastPaymentPolicy ? policies?.[`${ONYXKEYS.COLLECTION.POLICY}${lastPaymentMethod}`] : undefined;
118-
const [bankAccountList = {}] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST, {canBeMissing: true});
118+
const [bankAccountList = getEmptyObject<BankAccountList>()] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST, {canBeMissing: true});
119119
const bankAccount = bankAccountList[lastBankAccountID ?? CONST.DEFAULT_NUMBER_ID];
120120
const isExpenseReport = isExpenseReportUtil(iouReport);
121121
// whether the user has single policy and the expense is p2p

src/pages/Search/SearchAdvancedFiltersPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {clearAdvancedFilters} from '@libs/actions/Search';
99
import CONST from '@src/CONST';
1010
import ONYXKEYS from '@src/ONYXKEYS';
1111
import type {SearchAdvancedFiltersForm} from '@src/types/form';
12+
import {getEmptyObject} from '@src/types/utils/EmptyObject';
1213
import AdvancedSearchFilters from './AdvancedSearchFilters';
1314

1415
function SearchAdvancedFiltersPage() {
1516
const styles = useThemeStyles();
1617
const {translate} = useLocalize();
1718

18-
const emptySearchFilters: SearchAdvancedFiltersForm = {} as SearchAdvancedFiltersForm;
19-
const [searchAdvancedFilters = emptySearchFilters] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
19+
const [searchAdvancedFilters = getEmptyObject<SearchAdvancedFiltersForm>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
2020

2121
const shouldShowResetFilters = Object.entries(searchAdvancedFilters)
2222
.filter(([key, value]) => {

src/pages/TransactionReceiptPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function TransactionReceipt({route}: TransactionReceiptProps) {
2525
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true});
2626
const [transactionMain] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {canBeMissing: true});
2727
const [transactionDraft] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {canBeMissing: true});
28-
const [reportMetadata = {isLoadingInitialReportActions: true}] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {canBeMissing: true});
28+
const [reportMetadata = CONST.DEFAULT_REPORT_METADATA] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {canBeMissing: true});
2929

3030
const isDraftTransaction = !!action;
3131
const transaction = isDraftTransaction ? transactionDraft : transactionMain;

src/pages/home/report/ReportActionItemMessageEdit.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ const shouldUseForcedSelectionRange = shouldUseEmojiPickerSelection();
8181
// video source -> video attributes
8282
const draftMessageVideoAttributeCache = new Map<string, string>();
8383

84+
const DEFAULT_MODAL_VALUE = {
85+
willAlertModalBecomeVisible: false,
86+
isVisible: false,
87+
};
88+
8489
function ReportActionItemMessageEdit(
8590
{action, draftMessage, reportID, policyID, index, isGroupPolicyReport, shouldDisableEmojiPicker = false}: ReportActionItemMessageEditProps,
8691
forwardedRef: ForwardedRef<TextInput | HTMLTextAreaElement | undefined>,
@@ -111,12 +116,7 @@ function ReportActionItemMessageEdit(
111116
const {hasExceededMaxCommentLength, validateCommentMaxLength} = useHandleExceedMaxCommentLength();
112117
const debouncedValidateCommentMaxLength = useMemo(() => lodashDebounce(validateCommentMaxLength, CONST.TIMING.COMMENT_LENGTH_DEBOUNCE_TIME), [validateCommentMaxLength]);
113118

114-
const [
115-
modal = {
116-
willAlertModalBecomeVisible: false,
117-
isVisible: false,
118-
},
119-
] = useOnyx(ONYXKEYS.MODAL, {canBeMissing: true});
119+
const [modal = DEFAULT_MODAL_VALUE] = useOnyx(ONYXKEYS.MODAL, {canBeMissing: true});
120120
const [onyxInputFocused = false] = useOnyx(ONYXKEYS.INPUT_FOCUSED, {canBeMissing: true});
121121

122122
const textInputRef = useRef<(HTMLTextAreaElement & TextInput) | null>(null);

src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function TransactionReceiptModalContent({navigation, route}: AttachmentModalScre
2121
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true});
2222
const [transactionMain] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {canBeMissing: true});
2323
const [transactionDraft] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {canBeMissing: true});
24-
const [reportMetadata = {isLoadingInitialReportActions: true}] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {canBeMissing: true});
24+
const [reportMetadata = CONST.DEFAULT_REPORT_METADATA] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {canBeMissing: true});
2525

2626
const isDraftTransaction = !!iouAction;
2727
const transaction = isDraftTransaction ? transactionDraft : transactionMain;

0 commit comments

Comments
 (0)