diff --git a/package-lock.json b/package-lock.json index 69909af61a96e..5fe8b4c0bb98e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -207,7 +207,7 @@ "electron-builder": "24.13.2", "eslint": "^7.6.0", "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-config-expensify": "^2.0.49", + "eslint-config-expensify": "^2.0.50", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", @@ -19365,9 +19365,9 @@ } }, "node_modules/eslint-config-expensify": { - "version": "2.0.49", - "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.49.tgz", - "integrity": "sha512-3yGQuOsjvtWh/jYSJKIJgmwULhrVMCiYkWGzLOKpm/wCzdiP4l0T/gJMWOkvGhTtyqxsP7ZUTwPODgcE3extxA==", + "version": "2.0.50", + "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.50.tgz", + "integrity": "sha512-I+OMkEprqEWlSCZGJBJxpt2Wg4HQ41/QqpKVfcADiQ3xJ76bZ1mBueqz6DR4jfph1xC6XVRl4dqGNlwbeU/2Rg==", "dev": true, "dependencies": { "@lwc/eslint-plugin-lwc": "^1.7.2", diff --git a/package.json b/package.json index b26a10a6780ac..de112da971535 100644 --- a/package.json +++ b/package.json @@ -259,7 +259,7 @@ "electron-builder": "24.13.2", "eslint": "^7.6.0", "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-config-expensify": "^2.0.49", + "eslint-config-expensify": "^2.0.50", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", diff --git a/src/components/Attachments/AttachmentCarousel/extractAttachments.ts b/src/components/Attachments/AttachmentCarousel/extractAttachments.ts index fcec07a327a0a..f2325eda532d1 100644 --- a/src/components/Attachments/AttachmentCarousel/extractAttachments.ts +++ b/src/components/Attachments/AttachmentCarousel/extractAttachments.ts @@ -37,7 +37,7 @@ function extractAttachments( const splittedUrl = attribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE].split('/'); attachments.unshift({ source: tryResolveUrlFromApiRoot(attribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE]), - isAuthTokenRequired: Boolean(attribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE]), + isAuthTokenRequired: !!attribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE], file: {name: splittedUrl[splittedUrl.length - 1]}, duration: Number(attribs[CONST.ATTACHMENT_DURATION_ATTRIBUTE]), isReceipt: false, @@ -69,7 +69,7 @@ function extractAttachments( attachments.unshift({ reportActionID: attribs['data-id'], source, - isAuthTokenRequired: Boolean(expensifySource), + isAuthTokenRequired: !!expensifySource, file: {name: fileName}, isReceipt: false, hasBeenFlagged: attribs['data-flagged'] === 'true', diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index b72cda0de0115..88ae8d48a8713 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -227,7 +227,7 @@ function Button( large && styles.buttonLargeText, success && styles.buttonSuccessText, danger && styles.buttonDangerText, - Boolean(icon) && styles.textAlignLeft, + !!icon && styles.textAlignLeft, textStyles, ]} dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}} @@ -329,7 +329,7 @@ function Button( ]} style={[ styles.button, - StyleUtils.getButtonStyleWithIcon(styles, small, medium, large, Boolean(icon), Boolean(text?.length > 0), shouldShowRightIcon), + StyleUtils.getButtonStyleWithIcon(styles, small, medium, large, !!icon, !!(text?.length > 0), shouldShowRightIcon), success ? styles.buttonSuccess : undefined, danger ? styles.buttonDanger : undefined, isDisabled ? styles.buttonOpacityDisabled : undefined, diff --git a/src/components/ConfirmedRoute.tsx b/src/components/ConfirmedRoute.tsx index 745535f3f03fc..b6d6bb13213c9 100644 --- a/src/components/ConfirmedRoute.tsx +++ b/src/components/ConfirmedRoute.tsx @@ -104,7 +104,7 @@ function ConfirmedRoute({mapboxAccessToken, transaction, isSmallerIcon, shouldHa const shouldDisplayMap = !requireRouteToDisplayMap || !!coordinates.length; - return !isOffline && Boolean(mapboxAccessToken?.token) && shouldDisplayMap ? ( + return !isOffline && !!mapboxAccessToken?.token && shouldDisplayMap ? ( {({hovered, pressed}) => ( diff --git a/src/components/DisplayNames/DisplayNamesWithTooltip.tsx b/src/components/DisplayNames/DisplayNamesWithTooltip.tsx index 91b8b0fc44837..0b0c3ddf27caf 100644 --- a/src/components/DisplayNames/DisplayNamesWithTooltip.tsx +++ b/src/components/DisplayNames/DisplayNamesWithTooltip.tsx @@ -74,7 +74,7 @@ function DisplayNamesWithToolTip({shouldUseFullTitle, fullTitle, displayNamesWit ))} {renderAdditionalText?.()} - {Boolean(isEllipsisActive) && ( + {!!isEllipsisActive && ( {/* There is some Gap for real ellipsis so we are adding 4 `.` to cover */} diff --git a/src/components/FocusableMenuItem.tsx b/src/components/FocusableMenuItem.tsx index 7868e6e11b0e2..fc873196231d8 100644 --- a/src/components/FocusableMenuItem.tsx +++ b/src/components/FocusableMenuItem.tsx @@ -8,7 +8,7 @@ function FocusableMenuItem(props: MenuItemProps) { const ref = useRef(null); // Sync focus on an item - useSyncFocus(ref, Boolean(props.focused)); + useSyncFocus(ref, !!props.focused); return ( {/* If there's no subtitle then display a fragment to avoid an empty space which moves the main title */} {typeof subtitle === 'string' - ? Boolean(subtitle) && ( + ? !!subtitle && ( {typeof title === 'string' - ? Boolean(title) && ( + ? !!title && ( ( }, [directionCoordinates, currentPosition, mapPadding, waypoints]); const centerCoordinate = currentPosition ? [currentPosition.longitude, currentPosition.latitude] : initialState?.location; - return !isOffline && Boolean(accessToken) && Boolean(currentPosition) ? ( + return !isOffline && !!accessToken && !!currentPosition ? ( ( }); }, [directionCoordinates, currentPosition, mapRef, waypoints, mapPadding]); - return !isOffline && Boolean(accessToken) && Boolean(currentPosition) ? ( + return !isOffline && !!accessToken && !!currentPosition ? ( {styledHandle?.map( ({text, isColored}, i) => - Boolean(text) && ( + !!text && ( Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_DISTANCE_RATE.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRouteWithoutParams()))} disabled={didConfirm} - interactive={Boolean(rate) && !isReadOnly && isPolicyExpenseChat} + interactive={!!rate && !isReadOnly && isPolicyExpenseChat} /> ), shouldShow: isDistanceRequest && canUseP2PDistanceRequests, diff --git a/src/components/OptionListContextProvider.tsx b/src/components/OptionListContextProvider.tsx index c9bf5d7b9db26..fe7942f30024f 100644 --- a/src/components/OptionListContextProvider.tsx +++ b/src/components/OptionListContextProvider.tsx @@ -124,7 +124,7 @@ function OptionsListContextProvider({reports, children}: OptionsListProviderProp } Object.values(reports ?? {}) - .filter((report) => Boolean(Object.keys(report?.participants ?? {}).includes(accountID)) || (ReportUtils.isSelfDM(report) && report?.ownerAccountID === Number(accountID))) + .filter((report) => !!Object.keys(report?.participants ?? {}).includes(accountID) || (ReportUtils.isSelfDM(report) && report?.ownerAccountID === Number(accountID))) .forEach((report) => { if (!report) { return; diff --git a/src/components/ParentNavigationSubtitle.tsx b/src/components/ParentNavigationSubtitle.tsx index fc21d3d8b7801..b3b59fcb856a6 100644 --- a/src/components/ParentNavigationSubtitle.tsx +++ b/src/components/ParentNavigationSubtitle.tsx @@ -55,13 +55,13 @@ function ParentNavigationSubtitle({parentNavigationSubtitleData, parentReportAct style={[styles.optionAlternateText]} numberOfLines={1} > - {Boolean(reportName) && ( + {!!reportName && ( <> {`${translate('threads.from')} `} {reportName} )} - {Boolean(workspaceName) && {` ${translate('threads.in')} ${workspaceName}`}} + {!!workspaceName && {` ${translate('threads.in')} ${workspaceName}`}} ); diff --git a/src/components/Pressable/PressableWithFeedback.tsx b/src/components/Pressable/PressableWithFeedback.tsx index 74ea4596046e3..d50404873eebd 100644 --- a/src/components/Pressable/PressableWithFeedback.tsx +++ b/src/components/Pressable/PressableWithFeedback.tsx @@ -49,7 +49,7 @@ function PressableWithFeedback( return ( - {Boolean(label) && {label}} + {!!label && {label}} {!!LabelComponent && } diff --git a/src/components/ReportActionItem/MoneyReportView.tsx b/src/components/ReportActionItem/MoneyReportView.tsx index 673801f164d2c..1f4cab7ad5a84 100644 --- a/src/components/ReportActionItem/MoneyReportView.tsx +++ b/src/components/ReportActionItem/MoneyReportView.tsx @@ -43,7 +43,7 @@ function MoneyReportView({report, policy}: MoneyReportViewProps) { const formattedTotalAmount = CurrencyUtils.convertToDisplayString(totalDisplaySpend, report.currency); const formattedOutOfPocketAmount = CurrencyUtils.convertToDisplayString(reimbursableSpend, report.currency); const formattedCompanySpendAmount = CurrencyUtils.convertToDisplayString(nonReimbursableSpend, report.currency); - const isPartiallyPaid = Boolean(report?.pendingFields?.partial); + const isPartiallyPaid = !!report?.pendingFields?.partial; const subAmountTextStyles: StyleProp = [ styles.taskTitleMenuItem, @@ -121,7 +121,7 @@ function MoneyReportView({report, policy}: MoneyReportViewProps) { - {Boolean(shouldShowBreakdown) && ( + {!!shouldShowBreakdown && ( <> diff --git a/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx index c573b43ae79b5..32e085f229768 100644 --- a/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx @@ -89,11 +89,13 @@ function MoneyRequestPreviewContent({ const hasReceipt = TransactionUtils.hasReceipt(transaction); const isScanning = hasReceipt && TransactionUtils.isReceiptBeingScanned(transaction); const isOnHold = TransactionUtils.isOnHold(transaction); - const isSettlementOrApprovalPartial = Boolean(iouReport?.pendingFields?.partial); + const isSettlementOrApprovalPartial = !!iouReport?.pendingFields?.partial; const isPartialHold = isSettlementOrApprovalPartial && isOnHold; const hasViolations = TransactionUtils.hasViolation(transaction?.transactionID ?? '', transactionViolations); - const hasNoticeTypeViolations = Boolean( - TransactionUtils.hasNoticeTypeViolation(transaction?.transactionID ?? '', transactionViolations) && ReportUtils.isPaidGroupPolicy(iouReport) && canUseViolations, + const hasNoticeTypeViolations = !!( + TransactionUtils.hasNoticeTypeViolation(transaction?.transactionID ?? '', transactionViolations) && + ReportUtils.isPaidGroupPolicy(iouReport) && + canUseViolations ); const hasFieldErrors = TransactionUtils.hasMissingSmartscanFields(transaction); const isDistanceRequest = TransactionUtils.isDistanceRequest(transaction); diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 497e7fa3ff13e..12a325f6aa19b 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -340,7 +340,7 @@ function MoneyRequestView({ {shouldShowReceiptHeader && ( )} {(hasReceipt || errors) && ( diff --git a/src/components/SelectionList/BaseListItem.tsx b/src/components/SelectionList/BaseListItem.tsx index 591e2c294b837..b1c689b55afa4 100644 --- a/src/components/SelectionList/BaseListItem.tsx +++ b/src/components/SelectionList/BaseListItem.tsx @@ -42,7 +42,7 @@ function BaseListItem({ const pressableRef = useRef(null); // Sync focus on an item - useSyncFocus(pressableRef, Boolean(isFocused), shouldSyncFocus); + useSyncFocus(pressableRef, !!isFocused, shouldSyncFocus); const handleMouseUp = (e: React.MouseEvent) => { e.stopPropagation(); setMouseUp(); diff --git a/src/components/Switch.tsx b/src/components/Switch.tsx index 3d9b586b8b914..2e29008cd9ec0 100644 --- a/src/components/Switch.tsx +++ b/src/components/Switch.tsx @@ -63,7 +63,7 @@ function Switch({isOn, onToggle, accessibilityLabel, disabled, showLockIcon}: Sw pressDimmingValue={0.8} > - {(Boolean(disabled) || Boolean(showLockIcon)) && ( + {(!!disabled || !!showLockIcon) && ( !prevPasswordHidden); }, []); - const hasLabel = Boolean(label?.length); + const hasLabel = !!label?.length; const isReadOnly = inputProps.readOnly ?? inputProps.disabled; // Disabling this line for safeness as nullish coalescing works only if the value is undefined or null, and errorText can be an empty string // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/src/components/TextInput/BaseTextInput/index.tsx b/src/components/TextInput/BaseTextInput/index.tsx index 987890b9d16e6..3a1032ff7a438 100644 --- a/src/components/TextInput/BaseTextInput/index.tsx +++ b/src/components/TextInput/BaseTextInput/index.tsx @@ -239,7 +239,7 @@ function BaseTextInput( setPasswordHidden((prevPasswordHidden: boolean | undefined) => !prevPasswordHidden); }, []); - const hasLabel = Boolean(label?.length); + const hasLabel = !!label?.length; const isReadOnly = inputProps.readOnly ?? inputProps.disabled; // Disabling this line for safeness as nullish coalescing works only if the value is undefined or null, and errorText can be an empty string // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing @@ -328,7 +328,7 @@ function BaseTextInput( /> )} - {Boolean(prefixCharacter) && ( + {!!prefixCharacter && ( )} - {Boolean(inputProps.secureTextEntry) && ( + {!!inputProps.secureTextEntry && ( { - isLastSavedBeta = Boolean(value); + isLastSavedBeta = !!value; }, }); diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index b254303d17842..a826c668be12f 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -27,8 +27,8 @@ Onyx.connect({ if (!network) { return; } - shouldFailAllRequests = Boolean(network.shouldFailAllRequests); - shouldForceOffline = Boolean(network.shouldForceOffline); + shouldFailAllRequests = !!network.shouldFailAllRequests; + shouldForceOffline = !!network.shouldForceOffline; }, }); diff --git a/src/libs/Log.ts b/src/libs/Log.ts index c0bbbfd3f60a8..64271dee22653 100644 --- a/src/libs/Log.ts +++ b/src/libs/Log.ts @@ -24,7 +24,7 @@ Onyx.connect({ shouldCollectLogs = false; } - shouldCollectLogs = Boolean(val); + shouldCollectLogs = !!val; }, }); diff --git a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx index 7f26177eeb0fc..e875073d60dfa 100644 --- a/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar.tsx @@ -46,7 +46,7 @@ function BottomTabBar({isLoadingApp = false}: PurposeForUsingExpensifyModalProps const currentRoute = routes?.[navigationState?.index ?? 0]; // When we are redirected to the Settings tab from the OldDot, we don't want to call the Welcome.show() method. // To prevent this, the value of the bottomTabRoute?.name is checked here - if (Boolean(currentRoute && currentRoute.name !== NAVIGATORS.BOTTOM_TAB_NAVIGATOR && currentRoute.name !== NAVIGATORS.CENTRAL_PANE_NAVIGATOR) || Session.isAnonymousUser()) { + if (!!(currentRoute && currentRoute.name !== NAVIGATORS.BOTTOM_TAB_NAVIGATOR && currentRoute.name !== NAVIGATORS.CENTRAL_PANE_NAVIGATOR) || Session.isAnonymousUser()) { return; } diff --git a/src/libs/Navigation/linkTo/index.ts b/src/libs/Navigation/linkTo/index.ts index 424856c1fafcf..313f525f390be 100644 --- a/src/libs/Navigation/linkTo/index.ts +++ b/src/libs/Navigation/linkTo/index.ts @@ -71,7 +71,7 @@ export default function linkTo(navigation: NavigationContainerRef { - const isInternetReachable = Boolean(state.isInternetReachable); + const isInternetReachable = !!state.isInternetReachable; setOfflineStatus(isInternetReachable); Log.info( `[NetworkStatus] The force-offline mode was turned off. Getting the device network status from NetInfo. Network state: ${JSON.stringify( @@ -160,7 +160,7 @@ function subscribeToNetworkStatus(): () => void { return; } setOfflineStatus(state.isInternetReachable === false); - Log.info(`[NetworkStatus] NetInfo.addEventListener event coming, setting "offlineStatus" to ${Boolean(state.isInternetReachable)} with network state: ${JSON.stringify(state)}`); + Log.info(`[NetworkStatus] NetInfo.addEventListener event coming, setting "offlineStatus" to ${!!state.isInternetReachable} with network state: ${JSON.stringify(state)}`); setNetWorkStatus(state.isInternetReachable); }); diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 34ac834050499..7678de592a6f1 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -137,7 +137,7 @@ function getPolicyBrickRoadIndicatorStatus(policy: OnyxEntry): ValueOf, isOffline: boolean): boolean { return ( !!policy && - (policy?.isPolicyExpenseChatEnabled || Boolean(policy?.isJoinRequestPending)) && + (policy?.isPolicyExpenseChatEnabled || !!policy?.isJoinRequestPending) && (isOffline || policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || Object.keys(policy.errors ?? {}).length > 0) ); } @@ -357,10 +357,10 @@ function canEditTaxRate(policy: Policy, taxID: string): boolean { function isPolicyFeatureEnabled(policy: OnyxEntry | EmptyObject, featureName: PolicyFeatureName): boolean { if (featureName === CONST.POLICY.MORE_FEATURES.ARE_TAXES_ENABLED) { - return Boolean(policy?.tax?.trackingEnabled); + return !!policy?.tax?.trackingEnabled; } - return Boolean(policy?.[featureName]); + return !!policy?.[featureName]; } function getApprovalWorkflow(policy: OnyxEntry | EmptyObject): ValueOf { diff --git a/src/libs/Pusher/pusher.ts b/src/libs/Pusher/pusher.ts index d35d6122aff7b..6fe3eddb85d9d 100644 --- a/src/libs/Pusher/pusher.ts +++ b/src/libs/Pusher/pusher.ts @@ -65,7 +65,7 @@ Onyx.connect({ if (!network) { return; } - shouldForceOffline = Boolean(network.shouldForceOffline); + shouldForceOffline = !!network.shouldForceOffline; }, }); diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index a79d197d04d2c..1830edd91b68b 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -908,7 +908,7 @@ function getOneTransactionThreadReportID( // - they have an assocaited IOU transaction ID or // - they have visibile childActions (like comments) that we'd want to display // - the action is pending deletion and the user is offline - (Boolean(action.originalMessage.IOUTransactionID) || + (!!action.originalMessage.IOUTransactionID || // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing (isMessageDeleted(action) && action.childVisibleActionCount) || (action.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && (isOffline ?? isNetworkOffline))), @@ -1173,7 +1173,7 @@ function isReportActionUnread(reportAction: OnyxEntry, lastReadTim return !isCreatedAction(reportAction); } - return Boolean(reportAction && lastReadTime && reportAction.created && lastReadTime < reportAction.created); + return !!(reportAction && lastReadTime && reportAction.created && lastReadTime < reportAction.created); } /** diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index d85ee68da4689..6cee184c20ef5 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -787,7 +787,7 @@ function isCompletedTaskReport(report: OnyxEntry): boolean { * Checks if the current user is the manager of the supplied report */ function isReportManager(report: OnyxEntry): boolean { - return Boolean(report && report.managerID === currentUserAccountID); + return !!(report && report.managerID === currentUserAccountID); } /** @@ -853,7 +853,7 @@ function isCurrentUserSubmitter(reportID: string): boolean { return false; } const report = allReports[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; - return Boolean(report && report.ownerAccountID === currentUserAccountID); + return !!(report && report.ownerAccountID === currentUserAccountID); } /** @@ -1033,7 +1033,7 @@ function isWorkspaceTaskReport(report: OnyxEntry): boolean { * Returns true if report has a parent */ function isThread(report: OnyxEntry): boolean { - return Boolean(report?.parentReportID && report?.parentReportActionID); + return !!(report?.parentReportID && report?.parentReportActionID); } /** @@ -1678,13 +1678,13 @@ function canShowReportRecipientLocalTime(personalDetails: OnyxCollection | OptionData): bo // lastMentionedTime and lastReadTime are both datetime strings and can be compared directly const lastMentionedTime = reportOrOption.lastMentionedTime ?? ''; const lastReadTime = reportOrOption.lastReadTime ?? ''; - return Boolean('isUnreadWithMention' in reportOrOption && reportOrOption.isUnreadWithMention) || lastReadTime < lastMentionedTime; + return !!('isUnreadWithMention' in reportOrOption && reportOrOption.isUnreadWithMention) || lastReadTime < lastMentionedTime; } /** @@ -2734,15 +2734,15 @@ function canEditFieldOfMoneyRequest(reportAction: OnyxEntry, field function canEditReportAction(reportAction: OnyxEntry): boolean { const isCommentOrIOU = reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT || reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU; - return Boolean( + return !!( reportAction?.actorAccountID === currentUserAccountID && - isCommentOrIOU && - canEditMoneyRequest(reportAction) && // Returns true for non-IOU actions - !isReportMessageAttachment(reportAction?.message?.[0]) && - (isEmptyObject(reportAction.attachmentInfo) || !reportAction.isOptimisticAction) && - !ReportActionsUtils.isDeletedAction(reportAction) && - !ReportActionsUtils.isCreatedTaskReportAction(reportAction) && - reportAction?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, + isCommentOrIOU && + canEditMoneyRequest(reportAction) && // Returns true for non-IOU actions + !isReportMessageAttachment(reportAction?.message?.[0]) && + (isEmptyObject(reportAction.attachmentInfo) || !reportAction.isOptimisticAction) && + !ReportActionsUtils.isDeletedAction(reportAction) && + !ReportActionsUtils.isCreatedTaskReportAction(reportAction) && + reportAction?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ); } @@ -5485,14 +5485,14 @@ function canFlagReportAction(reportAction: OnyxEntry, reportID: st return false; } - return Boolean( + return !!( !isCurrentUserAction && - reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT && - !ReportActionsUtils.isDeletedAction(reportAction) && - !ReportActionsUtils.isCreatedTaskReportAction(reportAction) && - !isEmptyObject(report) && - report && - isAllowedToComment(report), + reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT && + !ReportActionsUtils.isDeletedAction(reportAction) && + !ReportActionsUtils.isCreatedTaskReportAction(reportAction) && + !isEmptyObject(report) && + report && + isAllowedToComment(report) ); } @@ -5647,7 +5647,7 @@ function canRequestMoney(report: OnyxEntry, policy: OnyxEntry, o let isOwnPolicyExpenseChat = report?.isOwnPolicyExpenseChat ?? false; if (isExpenseReport(report) && getParentReport(report)) { - isOwnPolicyExpenseChat = Boolean(getParentReport(report)?.isOwnPolicyExpenseChat); + isOwnPolicyExpenseChat = !!getParentReport(report)?.isOwnPolicyExpenseChat; } // In case there are no other participants than the current user and it's not user's own policy expense chat, they can't submit expenses from such report @@ -5872,7 +5872,7 @@ function canLeaveRoom(report: OnyxEntry, isPolicyEmployee: boolean): boo } function isCurrentUserTheOnlyParticipant(participantAccountIDs?: number[]): boolean { - return Boolean(participantAccountIDs?.length === 1 && participantAccountIDs?.[0] === currentUserAccountID); + return !!(participantAccountIDs?.length === 1 && participantAccountIDs?.[0] === currentUserAccountID); } /** @@ -6262,17 +6262,17 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, * */ function isDeprecatedGroupDM(report: OnyxEntry): boolean { - return Boolean( + return !!( report && - !isChatThread(report) && - !isTaskReport(report) && - !isInvoiceReport(report) && - !isMoneyRequestReport(report) && - !isArchivedRoom(report) && - !Object.values(CONST.REPORT.CHAT_TYPE).some((chatType) => chatType === getChatType(report)) && - Object.keys(report.participants ?? {}) - .map(Number) - .filter((accountID) => accountID !== currentUserAccountID).length > 1, + !isChatThread(report) && + !isTaskReport(report) && + !isInvoiceReport(report) && + !isMoneyRequestReport(report) && + !isArchivedRoom(report) && + !Object.values(CONST.REPORT.CHAT_TYPE).some((chatType) => chatType === getChatType(report)) && + Object.keys(report.participants ?? {}) + .map(Number) + .filter((accountID) => accountID !== currentUserAccountID).length > 1 ); } @@ -6287,7 +6287,7 @@ function isRootGroupChat(report: OnyxEntry): boolean { * Assume any report without a reportID is unusable. */ function isValidReport(report?: OnyxEntry): boolean { - return Boolean(report?.reportID); + return !!report?.reportID; } /** diff --git a/src/libs/SessionUtils.ts b/src/libs/SessionUtils.ts index 52521d5146cc3..e8854e158b487 100644 --- a/src/libs/SessionUtils.ts +++ b/src/libs/SessionUtils.ts @@ -50,7 +50,7 @@ function resetDidUserLogInDuringSession() { } function didUserLogInDuringSession() { - return Boolean(loggedInDuringSession); + return !!loggedInDuringSession; } export {isLoggingInAsNewUser, didUserLogInDuringSession, resetDidUserLogInDuringSession}; diff --git a/src/libs/TransactionUtils.ts b/src/libs/TransactionUtils.ts index 594d47f2d8dd0..10209adb3579b 100644 --- a/src/libs/TransactionUtils.ts +++ b/src/libs/TransactionUtils.ts @@ -58,7 +58,7 @@ function isScanRequest(transaction: OnyxEntry): boolean { return transaction?.iouRequestType === CONST.IOU.REQUEST_TYPE.SCAN; } - return Boolean(transaction?.receipt?.source) && transaction?.amount === 0; + return !!transaction?.receipt?.source && transaction?.amount === 0; } function getRequestType(transaction: OnyxEntry): IOURequestType { @@ -509,7 +509,7 @@ function didRceiptScanSucceed(transaction: OnyxEntry): boolean { * Check if the transaction has a non-smartscanning receipt and is missing required fields */ function hasMissingSmartscanFields(transaction: OnyxEntry): boolean { - return Boolean(transaction && !isDistanceRequest(transaction) && !isReceiptBeingScanned(transaction) && areRequiredFieldsEmpty(transaction)); + return !!(transaction && !isDistanceRequest(transaction) && !isReceiptBeingScanned(transaction) && areRequiredFieldsEmpty(transaction)); } /** @@ -523,9 +523,7 @@ function getTransactionViolations(transactionID: string, transactionViolations: * Check if there is pending rter violation in transactionViolations. */ function hasPendingRTERViolation(transactionViolations?: TransactionViolations | null): boolean { - return Boolean( - transactionViolations?.some((transactionViolation: TransactionViolation) => transactionViolation.name === CONST.VIOLATIONS.RTER && transactionViolation.data?.pendingPattern), - ); + return !!transactionViolations?.some((transactionViolation: TransactionViolation) => transactionViolation.name === CONST.VIOLATIONS.RTER && transactionViolation.data?.pendingPattern); } /** @@ -649,8 +647,8 @@ function isOnHoldByTransactionID(transactionID: string): boolean { * Checks if any violations for the provided transaction are of type 'violation' */ function hasViolation(transactionID: string, transactionViolations: OnyxCollection): boolean { - return Boolean( - transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some((violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.VIOLATION), + return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some( + (violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.VIOLATION, ); } @@ -658,7 +656,7 @@ function hasViolation(transactionID: string, transactionViolations: OnyxCollecti * Checks if any violations for the provided transaction are of type 'notice' */ function hasNoticeTypeViolation(transactionID: string, transactionViolations: OnyxCollection): boolean { - return Boolean(transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some((violation: TransactionViolation) => violation.type === 'notice')); + return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some((violation: TransactionViolation) => violation.type === 'notice'); } /** diff --git a/src/libs/ValidationUtils.ts b/src/libs/ValidationUtils.ts index 33afff36c7a6b..1dc5fa847d728 100644 --- a/src/libs/ValidationUtils.ts +++ b/src/libs/ValidationUtils.ts @@ -95,7 +95,7 @@ function isRequiredFulfilled(value?: FormValue | number[] | string[] | Record tag.name === selectedTag && Boolean(tag.enabled)); + const isTagInPolicy = Object.values(tags).some((tag) => tag.name === selectedTag && !!tag.enabled); if (!isTagInPolicy) { newTransactionViolations.push({ name: CONST.VIOLATIONS.TAG_OUT_OF_POLICY, diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index 3035175582061..d29dbf662d368 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -187,7 +187,7 @@ function isAnonymousUser(sessionParam?: OnyxEntry): boolean { } function hasStashedSession(): boolean { - return Boolean(stashedSession.authToken && stashedCredentials.autoGeneratedLogin && stashedCredentials.autoGeneratedLogin !== ''); + return !!(stashedSession.authToken && stashedCredentials.autoGeneratedLogin && stashedCredentials.autoGeneratedLogin !== ''); } /** diff --git a/src/libs/models/BankAccount.ts b/src/libs/models/BankAccount.ts index 44b2122d80913..a8dea594daa58 100644 --- a/src/libs/models/BankAccount.ts +++ b/src/libs/models/BankAccount.ts @@ -153,7 +153,7 @@ class BankAccount { * Return whether this bank account has been risk checked */ isRiskChecked() { - return Boolean(this.json.accountData?.riskChecked); + return !!this.json.accountData?.riskChecked; } /** diff --git a/src/pages/AddPersonalBankAccountPage.tsx b/src/pages/AddPersonalBankAccountPage.tsx index 5cd0f3ef80269..ac02cd26879bb 100644 --- a/src/pages/AddPersonalBankAccountPage.tsx +++ b/src/pages/AddPersonalBankAccountPage.tsx @@ -80,7 +80,7 @@ function AddPersonalBankAccountPage({personalBankAccount, plaidData}: AddPersona ) : ( diff --git a/src/pages/EnablePayments/OnfidoPrivacy.tsx b/src/pages/EnablePayments/OnfidoPrivacy.tsx index cf6e6837df160..ace91f315e328 100644 --- a/src/pages/EnablePayments/OnfidoPrivacy.tsx +++ b/src/pages/EnablePayments/OnfidoPrivacy.tsx @@ -72,7 +72,7 @@ function OnfidoPrivacy({walletOnfidoData = DEFAULT_WALLET_ONFIDO_DATA}: OnfidoPr { formRef.current?.scrollTo({y: 0, animated: true}); diff --git a/src/pages/EnablePayments/TermsPage/LongTermsForm.tsx b/src/pages/EnablePayments/TermsPage/LongTermsForm.tsx index e1b6a0ff3365c..760bd0c03b881 100644 --- a/src/pages/EnablePayments/TermsPage/LongTermsForm.tsx +++ b/src/pages/EnablePayments/TermsPage/LongTermsForm.tsx @@ -71,11 +71,11 @@ function LongTermsForm() { {section.title} - {Boolean(section.subTitle) && {section.subTitle}} + {!!section.subTitle && {section.subTitle}} {section.rightText} - {Boolean(section.subRightText) && {section.subRightText}} + {!!section.subRightText && {section.subRightText}} {section.details} diff --git a/src/pages/EnablePayments/TermsStep.tsx b/src/pages/EnablePayments/TermsStep.tsx index 916a5200a2e01..47b941108c43b 100644 --- a/src/pages/EnablePayments/TermsStep.tsx +++ b/src/pages/EnablePayments/TermsStep.tsx @@ -113,7 +113,7 @@ function TermsStep(props: TermsStepProps) { }); }} message={errorMessage} - isAlertVisible={error || Boolean(errorMessage)} + isAlertVisible={error || !!errorMessage} isLoading={!!props.walletTerms?.isLoading} containerStyles={[styles.mh0, styles.mv4]} /> diff --git a/src/pages/GroupChatNameEditPage.tsx b/src/pages/GroupChatNameEditPage.tsx index b3e5e9bb119ca..3f1ffe7609005 100644 --- a/src/pages/GroupChatNameEditPage.tsx +++ b/src/pages/GroupChatNameEditPage.tsx @@ -36,7 +36,7 @@ type GroupChatNameEditPageProps = GroupChatNameEditPageOnyxProps & function GroupChatNameEditPage({groupChatDraft, report}: GroupChatNameEditPageProps) { // If we have a report this means we are using this page to update an existing Group Chat name const reportID = report?.reportID ?? ''; - const isUpdatingExistingReport = Boolean(reportID); + const isUpdatingExistingReport = !!reportID; const styles = useThemeStyles(); const {translate} = useLocalize(); diff --git a/src/pages/InviteReportParticipantsPage.tsx b/src/pages/InviteReportParticipantsPage.tsx index d9172864143c1..a8bbedc6d9e39 100644 --- a/src/pages/InviteReportParticipantsPage.tsx +++ b/src/pages/InviteReportParticipantsPage.tsx @@ -186,7 +186,7 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen ) { return translate('messages.userIsAlreadyMember', {login: searchValue, name: reportName ?? ''}); } - return OptionsListUtils.getHeaderMessage(invitePersonalDetails.length !== 0, Boolean(userToInvite), searchValue); + return OptionsListUtils.getHeaderMessage(invitePersonalDetails.length !== 0, !!userToInvite, searchValue); }, [searchTerm, userToInvite, excludedUsers, invitePersonalDetails, translate, reportName]); const footerContent = useMemo( diff --git a/src/pages/NewChatConfirmPage.tsx b/src/pages/NewChatConfirmPage.tsx index 9d0f65860a116..2c94dbbc78400 100644 --- a/src/pages/NewChatConfirmPage.tsx +++ b/src/pages/NewChatConfirmPage.tsx @@ -149,7 +149,7 @@ function NewChatConfirmPage({newGroupDraft, allPersonalDetails}: NewChatConfirmP sections={[{title: translate('common.members'), data: sections}]} ListItem={InviteMemberListItem} onSelectRow={unselectOption} - showConfirmButton={Boolean(selectedOptions.length)} + showConfirmButton={!!selectedOptions.length} confirmButtonText={translate('newChatPage.startGroup')} onConfirm={createGroup} shouldHideListOnInitialRender={false} diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 9377ab60eda2f..2910ccadd7ee2 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -75,7 +75,7 @@ function useOptions({isGroupChat}: NewChatPageProps) { const headerMessage = OptionsListUtils.getHeaderMessage( filteredOptions.personalDetails.length + filteredOptions.recentReports.length !== 0, - Boolean(filteredOptions.userToInvite), + !!filteredOptions.userToInvite, debouncedSearchTerm.trim(), selectedOptions.some((participant) => participant?.searchText?.toLowerCase?.().includes(debouncedSearchTerm.trim().toLowerCase())), ); diff --git a/src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx b/src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx index 31ff883834ccf..5b186ccbe7a9a 100644 --- a/src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx +++ b/src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx @@ -154,7 +154,7 @@ function BaseOnboardingPurpose({shouldUseNativeStyles, shouldEnableMaxHeight, on saveAndNavigate(); }} message={errorMessage} - isAlertVisible={Boolean(errorMessage)} + isAlertVisible={!!errorMessage} containerStyles={[styles.w100, styles.mb5, styles.mh0, paddingHorizontal]} /> diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index 4f754fcc68397..fd2b7696a5b16 100755 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -84,7 +84,7 @@ function ProfilePage({route}: ProfilePageProps) { const accountID = Number(route.params?.accountID ?? 0); const reportID = ReportUtils.getChatByParticipants(session?.accountID ? [accountID, session.accountID] : [], reports)?.reportID ?? ''; - if ((Boolean(session) && Number(session?.accountID) === accountID) || SessionActions.isAnonymousUser() || !reportID) { + if ((!!session && Number(session?.accountID) === accountID) || SessionActions.isAnonymousUser() || !reportID) { return `${ONYXKEYS.COLLECTION.REPORT}0` as const; } return `${ONYXKEYS.COLLECTION.REPORT}${reportID}` as const; @@ -139,8 +139,8 @@ function ProfilePage({route}: ProfilePageProps) { const phoneNumber = getPhoneNumber(details); const phoneOrEmail = isSMSLogin ? getPhoneNumber(details) : login; - const hasAvatar = Boolean(details.avatar); - const isLoading = Boolean(personalDetailsMetadata?.[accountID]?.isLoading) || isEmptyObject(details); + const hasAvatar = !!details.avatar; + const isLoading = !!personalDetailsMetadata?.[accountID]?.isLoading || isEmptyObject(details); const shouldShowBlockingView = (!isValidAccountID && !isLoading) || CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID); const statusEmojiCode = details?.status?.emojiCode ?? ''; @@ -203,7 +203,7 @@ function ProfilePage({route}: ProfilePageProps) { /> - {Boolean(displayName) && ( + {!!displayName && ( ); diff --git a/src/pages/ReportParticipantDetailsPage.tsx b/src/pages/ReportParticipantDetailsPage.tsx index 86f787d2925bb..0e22901d8ff7c 100644 --- a/src/pages/ReportParticipantDetailsPage.tsx +++ b/src/pages/ReportParticipantDetailsPage.tsx @@ -90,7 +90,7 @@ function ReportParticipantDetails({personalDetails, report, route}: ReportPartic size={CONST.AVATAR_SIZE.XLARGE} fallbackIcon={fallbackIcon} /> - {Boolean(details.displayName ?? '') && ( + {!!(details.displayName ?? '') && ( { diff --git a/src/pages/Travel/TravelTerms.tsx b/src/pages/Travel/TravelTerms.tsx index 468ca9b8082a8..50df99d105814 100644 --- a/src/pages/Travel/TravelTerms.tsx +++ b/src/pages/Travel/TravelTerms.tsx @@ -95,7 +95,7 @@ function TravelTerms() { Navigation.resetToHome(); }} message={errorMessage} - isAlertVisible={error || Boolean(errorMessage)} + isAlertVisible={error || !!errorMessage} containerStyles={[styles.mh0, styles.mt5]} /> diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx index 6cb688ff2558a..a0e1d1bc50b9b 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx @@ -187,7 +187,7 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef((resolve) => { - if (Boolean(!pageX && !pageY && contextMenuAnchorRef.current) || isOverflowMenu) { + if (!!(!pageX && !pageY && contextMenuAnchorRef.current) || isOverflowMenu) { calculateAnchorPosition(contextMenuAnchorRef.current).then((position) => { popoverAnchorPosition.current = {horizontal: position.horizontal, vertical: position.vertical}; contextMenuDimensions.current = {width: position.vertical, height: position.height}; diff --git a/src/pages/home/report/ReactionList/PopoverReactionList/index.tsx b/src/pages/home/report/ReactionList/PopoverReactionList/index.tsx index 2cdcac65feaed..8d29fe3c52bd4 100644 --- a/src/pages/home/report/ReactionList/PopoverReactionList/index.tsx +++ b/src/pages/home/report/ReactionList/PopoverReactionList/index.tsx @@ -19,7 +19,7 @@ function PopoverReactionList(props: unknown, ref: ForwardedRef) innerReactionListRef.current?.hideReactionList(); }; - const isActiveReportAction = (actionID: number | string) => Boolean(actionID) && reactionListReportActionID === actionID; + const isActiveReportAction = (actionID: number | string) => !!actionID && reactionListReportActionID === actionID; useImperativeHandle(ref, () => ({showReactionList, hideReactionList, isActiveReportAction})); diff --git a/src/pages/home/report/ReportActionItemMessageEdit.tsx b/src/pages/home/report/ReportActionItemMessageEdit.tsx index 35830a030eba5..d22ef2167c4fb 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.tsx +++ b/src/pages/home/report/ReportActionItemMessageEdit.tsx @@ -107,11 +107,7 @@ function ReportActionItemMessageEdit( useEffect(() => { const parser = new ExpensiMark(); const originalMessage = parser.htmlToMarkdown(action.message?.[0]?.html ?? ''); - if ( - ReportActionsUtils.isDeletedAction(action) || - Boolean(action.message && draftMessage === originalMessage) || - Boolean(prevDraftMessage === draftMessage || isCommentPendingSaved.current) - ) { + if (ReportActionsUtils.isDeletedAction(action) || !!(action.message && draftMessage === originalMessage) || !!(prevDraftMessage === draftMessage || isCommentPendingSaved.current)) { return; } setDraft(draftMessage); diff --git a/src/pages/home/report/ReportActionItemParentAction.tsx b/src/pages/home/report/ReportActionItemParentAction.tsx index e97c513774760..dd4e35510ed99 100644 --- a/src/pages/home/report/ReportActionItemParentAction.tsx +++ b/src/pages/home/report/ReportActionItemParentAction.tsx @@ -101,7 +101,7 @@ function ReportActionItemParentAction({ {allAncestors.map((ancestor) => ( ))} - {Boolean(hasEmojiStatus) && ( + {!!hasEmojiStatus && ( Boolean(action.pendingAction)).length > 0) { + if (moneyRequestActions.filter((action) => !!action.pendingAction).length > 0) { createdAction.pendingAction = CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE; } diff --git a/src/pages/home/sidebar/AllSettingsScreen.tsx b/src/pages/home/sidebar/AllSettingsScreen.tsx index 8056d9bcc413c..c06b2464f5b13 100644 --- a/src/pages/home/sidebar/AllSettingsScreen.tsx +++ b/src/pages/home/sidebar/AllSettingsScreen.tsx @@ -82,7 +82,7 @@ function AllSettingsScreen({policies}: AllSettingsScreenProps) { iconRight: item.iconRight, onPress: item.action, shouldShowRightIcon: item.shouldShowRightIcon, - shouldBlockSelection: Boolean(item.link), + shouldBlockSelection: !!item.link, wrapperStyle: styles.sectionMenuItem, isPaneMenu: true, focused: item.focused, diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index 1e8e63ee2df39..f7507cc90c2d1 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -253,7 +253,7 @@ function MoneyRequestParticipantsSelector({participants = [], onFinish, onPartic () => OptionsListUtils.getHeaderMessage( ((newChatOptions as Options)?.personalDetails ?? []).length + ((newChatOptions as Options)?.recentReports ?? []).length !== 0, - Boolean((newChatOptions as Options)?.userToInvite), + !!(newChatOptions as Options)?.userToInvite, debouncedSearchTerm.trim(), participants.some((participant) => participant?.searchText?.toLowerCase().includes(debouncedSearchTerm.trim().toLowerCase())), ), diff --git a/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx b/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx index f8879a3f42504..750ec67a187be 100644 --- a/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx @@ -67,7 +67,7 @@ function IOURequestStepDistanceRate({ alternateText: rate.name ? rateForDisplay : '', keyForList: rate.customUnitRateID, value: rate.customUnitRateID, - isSelected: lastSelectedRateID ? lastSelectedRateID === rate.customUnitRateID : Boolean(rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE), + isSelected: lastSelectedRateID ? lastSelectedRateID === rate.customUnitRateID : !!(rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE), }; }); @@ -93,7 +93,7 @@ function IOURequestStepDistanceRate({ {translate('iou.chooseARate', {unit})} diff --git a/src/pages/iou/request/step/IOURequestStepMerchant.tsx b/src/pages/iou/request/step/IOURequestStepMerchant.tsx index 99606eb50e5c0..097a09bec529e 100644 --- a/src/pages/iou/request/step/IOURequestStepMerchant.tsx +++ b/src/pages/iou/request/step/IOURequestStepMerchant.tsx @@ -64,7 +64,8 @@ function IOURequestStepMerchant({ const merchant = ReportUtils.getTransactionDetails(isEditingSplitBill && !isEmptyObject(splitDraftTransaction) ? splitDraftTransaction : transaction)?.merchant; const isEmptyMerchant = merchant === '' || merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT; - const isMerchantRequired = ReportUtils.isReportInGroupPolicy(report) || isTypeInvoice || transaction?.participants?.some((participant) => Boolean(participant.isPolicyExpenseChat)); + const isMerchantRequired = ReportUtils.isReportInGroupPolicy(report) || isTypeInvoice || transaction?.participants?.some((participant) => !!participant.isPolicyExpenseChat); + const navigateBack = () => { Navigation.goBack(backTo); }; diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 51dfc20eb4304..639dc52ad585b 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -448,7 +448,7 @@ function IOURequestStepScan({ includeSafeAreaPaddingBottom headerTitle={translate('common.receipt')} onBackButtonPress={navigateBack} - shouldShowWrapper={Boolean(backTo)} + shouldShowWrapper={!!backTo} testID={IOURequestStepScan.displayName} > {cameraPermissionStatus !== RESULTS.GRANTED && ( diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 2dddae7512c29..4e29ab5b5f9ab 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -655,7 +655,7 @@ function IOURequestStepScan({ {(isDraggingOverWrapper) => ( diff --git a/src/pages/iou/request/step/IOURequestStepSplitPayer.tsx b/src/pages/iou/request/step/IOURequestStepSplitPayer.tsx index 48aa4789d6bbe..06bbe676326af 100644 --- a/src/pages/iou/request/step/IOURequestStepSplitPayer.tsx +++ b/src/pages/iou/request/step/IOURequestStepSplitPayer.tsx @@ -51,7 +51,7 @@ function IOURequestStepSplitPayer({ const participants = transaction?.participants ?? []; const participantOptions = [currentUserOption, ...participants] - ?.filter((participant) => Boolean(participant.accountID)) + ?.filter((participant) => !!participant.accountID) ?.map((participant) => OptionsListUtils.getParticipantsOption(participant, personalDetails)) ?? []; return [ { diff --git a/src/pages/iou/request/step/IOURequestStepTaxAmountPage.tsx b/src/pages/iou/request/step/IOURequestStepTaxAmountPage.tsx index 69430131c28e9..a8137352d4787 100644 --- a/src/pages/iou/request/step/IOURequestStepTaxAmountPage.tsx +++ b/src/pages/iou/request/step/IOURequestStepTaxAmountPage.tsx @@ -157,14 +157,14 @@ function IOURequestStepTaxAmountPage({ headerTitle={translate('iou.taxAmount')} onBackButtonPress={navigateBack} testID={IOURequestStepTaxAmountPage.displayName} - shouldShowWrapper={Boolean(backTo || isEditing)} + shouldShowWrapper={!!(backTo || isEditing)} includeSafeAreaPaddingBottom > (textInput.current = e)} onCurrencyButtonPress={navigateToCurrencySelectionPage} onSubmitButtonPress={updateTaxAmount} diff --git a/src/pages/iou/request/step/withWritableReportOrNotFound.tsx b/src/pages/iou/request/step/withWritableReportOrNotFound.tsx index 0a13bcd46a3e2..ced2b28bb1674 100644 --- a/src/pages/iou/request/step/withWritableReportOrNotFound.tsx +++ b/src/pages/iou/request/step/withWritableReportOrNotFound.tsx @@ -62,7 +62,7 @@ export default function { - if (Boolean(report?.reportID) || !route.params.reportID) { + if (!!report?.reportID || !route.params.reportID) { return; } diff --git a/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx b/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx index f2241e88897a6..fca23d1e1cb9c 100644 --- a/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx +++ b/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx @@ -42,7 +42,7 @@ function BaseShareLogList({onAttachLogToReport}: BaseShareLogListProps) { userToInvite: localUserToInvite, } = OptionsListUtils.getShareLogOptions(options, debouncedSearchValue.trim(), betas ?? []); - const header = OptionsListUtils.getHeaderMessage((localRecentReports?.length || 0) + (localPersonalDetails?.length || 0) !== 0, Boolean(localUserToInvite), debouncedSearchValue); + const header = OptionsListUtils.getHeaderMessage((localRecentReports?.length || 0) + (localPersonalDetails?.length || 0) !== 0, !!localUserToInvite, debouncedSearchValue); return { recentReports: localRecentReports, diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index 09f4ee356c538..57edacfee8471 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -323,7 +323,7 @@ function InitialSettingsPage({session, userWallet, bankAccountList, fundList, wa floatRightAvatarSize={item.avatarSize} ref={popoverAnchor} hoverAndPressStyle={styles.hoveredComponentBG} - shouldBlockSelection={Boolean(item.link)} + shouldBlockSelection={!!item.link} onSecondaryInteraction={item.link ? (event) => openPopover(item.link, event) : undefined} focused={ !!activeRoute?.name && !!item.routeName && !!(activeRoute?.name.toLowerCase().replaceAll('_', '') === item.routeName.toLowerCase().replaceAll('/', '')) @@ -433,7 +433,7 @@ function InitialSettingsPage({session, userWallet, bankAccountList, fundList, wa > {currentUserPersonalDetails.displayName ? currentUserPersonalDetails.displayName : formatPhoneNumber(session?.email ?? '')} - {Boolean(currentUserPersonalDetails.displayName) && ( + {!!currentUserPersonalDetails.displayName && ( - {Boolean(account?.recoveryCodes) && + {!!account?.recoveryCodes && account?.recoveryCodes?.split(', ').map((code) => ( - {Boolean(error) && ( + {!!error && ( {translate('twoFactorAuth.addKey')} - {Boolean(account?.twoFactorAuthSecretKey) && {splitSecretInChunks(account?.twoFactorAuthSecretKey ?? '')}} + {!!account?.twoFactorAuthSecretKey && {splitSecretInChunks(account?.twoFactorAuthSecretKey ?? '')}} {translate('reportFraudPage.description')} Card.reportVirtualExpensifyCardFraud(virtualCard.cardID)} message={virtualCardError} isLoading={formData?.isLoading} diff --git a/src/pages/settings/Wallet/TransferBalancePage.tsx b/src/pages/settings/Wallet/TransferBalancePage.tsx index c0f42fb9440db..b6246f29c051c 100644 --- a/src/pages/settings/Wallet/TransferBalancePage.tsx +++ b/src/pages/settings/Wallet/TransferBalancePage.tsx @@ -191,7 +191,7 @@ function TransferBalancePage({bankAccountList, fundList, userWallet, walletTrans ))} {translate('transferAmountPage.whichAccount')} - {Boolean(selectedAccount) && ( + {!!selectedAccount && ( Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.AUTO_SYNC, { enabled: !autoSync?.enabled, @@ -87,7 +87,7 @@ function QuickbooksAdvancedPage({policy}: WithPolicyConnectionsProps) { title: translate('workspace.qbo.advancedConfig.inviteEmployees'), subtitle: translate('workspace.qbo.advancedConfig.inviteEmployeesDescription'), switchAccessibilityLabel: translate('workspace.qbo.advancedConfig.inviteEmployeesDescription'), - isActive: Boolean(syncPeople), + isActive: !!syncPeople, onToggle: () => Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.SYNC_PEOPLE, !syncPeople), pendingAction: pendingFields?.syncPeople, errors: ErrorUtils.getLatestErrorField(qboConfig ?? {}, CONST.QUICK_BOOKS_CONFIG.SYNC_PEOPLE), @@ -98,7 +98,7 @@ function QuickbooksAdvancedPage({policy}: WithPolicyConnectionsProps) { title: translate('workspace.qbo.advancedConfig.createEntities'), subtitle: translate('workspace.qbo.advancedConfig.createEntitiesDescription'), switchAccessibilityLabel: translate('workspace.qbo.advancedConfig.createEntitiesDescription'), - isActive: Boolean(autoCreateVendor), + isActive: !!autoCreateVendor, onToggle: () => Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.AUTO_CREATE_VENDOR, !autoCreateVendor), pendingAction: pendingFields?.autoCreateVendor, errors: ErrorUtils.getLatestErrorField(qboConfig ?? {}, CONST.QUICK_BOOKS_CONFIG.AUTO_CREATE_VENDOR), diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage.tsx index c814fbfbb33bc..073927fe43768 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage.tsx @@ -70,7 +70,7 @@ function QuickbooksCompanyCardExpenseAccountPage({policy}: WithPolicyConnections errors={errorFields?.autoCreateVendor ?? undefined} title={translate('workspace.qbo.defaultVendor')} wrapperStyle={[styles.ph5, styles.mb3, styles.mt1]} - isActive={Boolean(autoCreateVendor)} + isActive={!!autoCreateVendor} onToggle={(isOn) => Connections.updateManyPolicyConnectionConfigs( policyID, diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectCardPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectCardPage.tsx index a40dc86c051d1..1ea118fafde14 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectCardPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectCardPage.tsx @@ -29,7 +29,7 @@ function QuickbooksCompanyCardExpenseAccountSelectCardPage({policy}: WithPolicyC const policyID = policy?.id ?? ''; const {nonReimbursableExpensesExportDestination, nonReimbursableExpensesAccount, syncLocations, nonReimbursableBillDefaultVendor} = policy?.connections?.quickbooksOnline?.config ?? {}; const {creditCards, bankAccounts, accountPayable, vendors} = policy?.connections?.quickbooksOnline?.data ?? {}; - const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const isLocationEnabled = !!(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const sections = useMemo(() => { const options: AccountListItem[] = [ diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index e49536c333060..9eb69b2be2dbe 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -54,7 +54,7 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyConnectionsProps) { description: translate('workspace.qbo.exportExpenses'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), - brickRoadIndicator: Boolean(errorFields?.exportEntity) || Boolean(errorFields?.reimbursableExpensesAccount) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + brickRoadIndicator: !!errorFields?.exportEntity || !!errorFields?.reimbursableExpensesAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: reimbursableExpensesExportDestination ? translate(`workspace.qbo.accounts.${reimbursableExpensesExportDestination}`) : undefined, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing pendingAction: pendingFields?.reimbursableExpensesExportDestination || pendingFields?.reimbursableExpensesAccount, diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index ad99dc8cd07d1..e7a1e3effecda 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -19,11 +19,11 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const {syncLocations, syncTax, reimbursableExpensesAccount, reimbursableExpensesExportDestination, errorFields, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; - const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); - const isTaxesEnabled = Boolean(syncTax); + const isLocationEnabled = !!(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const isTaxesEnabled = !!syncTax; const shouldShowTaxError = isTaxesEnabled && reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; const shouldShowLocationError = isLocationEnabled && reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; - const hasErrors = Boolean(errorFields?.reimbursableExpensesExportDestination) || shouldShowTaxError || shouldShowLocationError; + const hasErrors = !!errorFields?.reimbursableExpensesExportDestination || shouldShowTaxError || shouldShowLocationError; const [exportHintText, accountDescription] = useMemo(() => { let hintText: string | undefined; let description: string | undefined; diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 14007f81f6b8d..6010ddf29e2ef 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -46,8 +46,8 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec const styles = useThemeStyles(); const {reimbursableExpensesExportDestination, reimbursableExpensesAccount, syncTax, syncLocations} = policy?.connections?.quickbooksOnline?.config ?? {}; const {bankAccounts, accountPayable, journalEntryAccounts} = policy?.connections?.quickbooksOnline?.data ?? {}; - const isLocationsEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); - const isTaxesEnabled = Boolean(syncTax); + const isLocationsEnabled = !!(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const isTaxesEnabled = !!syncTax; const policyID = policy?.id ?? ''; const data: CardListItem[] = useMemo( diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksClassesPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksClassesPage.tsx index 4d9e2ff63dde4..900bbce30ae79 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksClassesPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksClassesPage.tsx @@ -21,7 +21,7 @@ function QuickbooksClassesPage({policy}: WithPolicyProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const {syncClasses, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; - const isSwitchOn = Boolean(syncClasses && syncClasses !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const isSwitchOn = !!(syncClasses && syncClasses !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isReportFieldsSelected = syncClasses === CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD; return ( diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksCustomersPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksCustomersPage.tsx index f93adcbe3cff2..e25b6aeb99841 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksCustomersPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksCustomersPage.tsx @@ -21,7 +21,7 @@ function QuickbooksCustomersPage({policy}: WithPolicyProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const {syncCustomers, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; - const isSwitchOn = Boolean(syncCustomers && syncCustomers !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const isSwitchOn = !!(syncCustomers && syncCustomers !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isReportFieldsSelected = syncCustomers === CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD; return ( Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS.getRoute(policyID)), - hasError: Boolean(policy?.errors?.enableNewCategories), + hasError: !!policy?.errors?.enableNewCategories, title: translate('workspace.accounting.importAsCategory'), pendingAction: pendingFields?.enableNewCategories, }, { description: translate('workspace.qbo.classes'), action: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_CLASSES.getRoute(policyID)), - hasError: Boolean(policy?.errors?.syncClasses), + hasError: !!policy?.errors?.syncClasses, title: translate(`workspace.accounting.importTypes.${syncClasses ?? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE}`), pendingAction: pendingFields?.syncClasses, }, { description: translate('workspace.qbo.customers'), action: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_CUSTOMERS.getRoute(policyID)), - hasError: Boolean(policy?.errors?.syncCustomers), + hasError: !!policy?.errors?.syncCustomers, title: translate(`workspace.accounting.importTypes.${syncCustomers ?? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE}`), pendingAction: pendingFields?.syncCustomers, }, { description: translate('workspace.qbo.locations'), action: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_LOCATIONS.getRoute(policyID)), - hasError: Boolean(policy?.errors?.syncLocations), + hasError: !!policy?.errors?.syncLocations, title: translate(`workspace.accounting.importTypes.${syncLocations ?? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE}`), pendingAction: pendingFields?.syncLocations, }, @@ -55,7 +55,7 @@ function QuickbooksImportPage({policy}: WithPolicyProps) { sections.push({ description: translate('workspace.accounting.taxes'), action: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_TAXES.getRoute(policyID)), - hasError: Boolean(policy?.errors?.syncTax), + hasError: !!policy?.errors?.syncTax, title: translate(syncTax ? 'workspace.accounting.imported' : 'workspace.accounting.notImported'), pendingAction: pendingFields?.syncTax, }); diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx index cabf81c8b470f..db9a8521398b1 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx @@ -21,7 +21,7 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const {syncLocations, pendingFields, reimbursableExpensesExportDestination, nonReimbursableExpensesExportDestination} = policy?.connections?.quickbooksOnline?.config ?? {}; - const isSwitchOn = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const isSwitchOn = !!(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const canImportLocation = reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY && nonReimbursableExpensesExportDestination !== CONST.QUICKBOOKS_NON_REIMBURSABLE_EXPORT_ACCOUNT_TYPE.VENDOR_BILL; diff --git a/src/pages/workspace/accounting/xero/advanced/XeroAdvancedPage.tsx b/src/pages/workspace/accounting/xero/advanced/XeroAdvancedPage.tsx index d337309473a83..22b0ec7a18eb5 100644 --- a/src/pages/workspace/accounting/xero/advanced/XeroAdvancedPage.tsx +++ b/src/pages/workspace/accounting/xero/advanced/XeroAdvancedPage.tsx @@ -56,7 +56,7 @@ function XeroAdvancedPage({policy}: WithPolicyConnectionsProps) { switchAccessibilityLabel={translate('workspace.xero.advancedConfig.autoSyncDescription')} shouldPlaceSubtitleBelowSwitch wrapperStyle={styles.mv3} - isActive={Boolean(autoSync?.enabled)} + isActive={!!autoSync?.enabled} onToggle={() => Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.XERO, CONST.XERO_CONFIG.AUTO_SYNC, { enabled: !autoSync?.enabled, @@ -73,7 +73,7 @@ function XeroAdvancedPage({policy}: WithPolicyConnectionsProps) { switchAccessibilityLabel={translate('workspace.xero.advancedConfig.reimbursedReportsDescription')} shouldPlaceSubtitleBelowSwitch wrapperStyle={styles.mv3} - isActive={Boolean(sync?.syncReimbursedReports)} + isActive={!!sync?.syncReimbursedReports} onToggle={() => Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.XERO, CONST.XERO_CONFIG.SYNC, { syncReimbursedReports: !sync?.syncReimbursedReports, diff --git a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx index 6ac03466b22cc..1239a9937fd3c 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx @@ -59,7 +59,7 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) { const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyId}`); const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyId}`); const isConnectedToAccounting = Object.keys(policy?.connections ?? {}).length > 0; - const isConnectedToQbo = Boolean(policy?.connections?.quickbooksOnline); + const isConnectedToQbo = !!policy?.connections?.quickbooksOnline; const fetchCategories = useCallback(() => { Category.openPolicyCategoriesPage(policyId); diff --git a/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx b/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx index 44540bc3ce176..185b9cd0cfa23 100644 --- a/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx +++ b/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx @@ -164,7 +164,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM fallbackIcon={fallbackIcon} /> - {Boolean(details.displayName ?? '') && ( + {!!(details.displayName ?? '') && ( 0; - const isConnectedToQbo = Boolean(policy?.connections?.quickbooksOnline); + const isConnectedToQbo = !!policy?.connections?.quickbooksOnline; const [policyTagLists, isMultiLevelTags] = useMemo(() => [PolicyUtils.getTagLists(policyTags), PolicyUtils.isMultiLevelTags(policyTags)], [policyTags]); const canSelectMultiple = !isMultiLevelTags; diff --git a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx index 608dfe2b26c81..af77a668264c3 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx @@ -58,7 +58,7 @@ function WorkspaceTaxesPage({ const hasAccountingConnections = PolicyUtils.hasAccountingConnections(policy); const isConnectedToAccounting = Object.keys(policy?.connections ?? {}).length > 0; - const isConnectedToQbo = Boolean(policy?.connections?.quickbooksOnline); + const isConnectedToQbo = !!policy?.connections?.quickbooksOnline; const fetchTaxes = useCallback(() => { openPolicyTaxesPage(policyID); diff --git a/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx b/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx index aa779e6b9ea10..25df6538bb017 100644 --- a/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx +++ b/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx @@ -275,7 +275,7 @@ function WorkspaceWorkflowsPage({policy, betas, route}: WorkspaceWorkflowsPagePr ); const isPaidGroupPolicy = PolicyUtils.isPaidGroupPolicy(policy); - const isLoading = Boolean(policy?.isLoading && policy?.reimbursementChoice === undefined); + const isLoading = !!(policy?.isLoading && policy?.reimbursementChoice === undefined); return ( { const boolArr: boolean[] = []; for (let j = AMOUNT_OF_VARIABLES - 1; j >= 0; j--) { // eslint-disable-next-line no-bitwise - boolArr.push(Boolean(i & (1 << j))); + boolArr.push(!!(i & (1 << j))); } // To test a failing set of conditions, comment out the for loop above and then use a hardcoded array @@ -666,7 +666,7 @@ xdescribe('Sidebar', () => { const boolArr: boolean[] = []; for (let j = AMOUNT_OF_VARIABLES - 1; j >= 0; j--) { // eslint-disable-next-line no-bitwise - boolArr.push(Boolean(i & (1 << j))); + boolArr.push(!!(i & (1 << j))); } // To test a failing set of conditions, comment out the for loop above and then use a hardcoded array diff --git a/tests/utils/getIsUsingFakeTimers.ts b/tests/utils/getIsUsingFakeTimers.ts index 52138276928c7..b5dda6a4bac14 100644 --- a/tests/utils/getIsUsingFakeTimers.ts +++ b/tests/utils/getIsUsingFakeTimers.ts @@ -1,3 +1,3 @@ type SetTimeout = typeof global.setTimeout & jest.Mock & typeof jasmine; -export default () => Boolean((global.setTimeout as SetTimeout).mock || (global.setTimeout as SetTimeout).clock); +export default () => !!((global.setTimeout as SetTimeout).mock || (global.setTimeout as SetTimeout).clock);