diff --git a/keyserver/src/creators/message-creator.js b/keyserver/src/creators/message-creator.js --- a/keyserver/src/creators/message-creator.js +++ b/keyserver/src/creators/message-creator.js @@ -625,7 +625,7 @@ return; } - return await createUpdates(readStatusUpdates); + await createUpdates(readStatusUpdates); } function updateLatestMessages(latestMessages: LatestMessages) { @@ -681,7 +681,7 @@ query.append(SQL`WHERE `); query.append(mergeOrConditions(conditions)); - return dbQuery(query); + dbQuery(query); } export default createMessages; diff --git a/keyserver/src/fetchers/message-fetchers.js b/keyserver/src/fetchers/message-fetchers.js --- a/keyserver/src/fetchers/message-fetchers.js +++ b/keyserver/src/fetchers/message-fetchers.js @@ -391,6 +391,8 @@ }; } +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function hasTimeFilterForThread( timeFilterData: TimeFilterData, threadID: string, diff --git a/keyserver/src/fetchers/update-fetchers.js b/keyserver/src/fetchers/update-fetchers.js --- a/keyserver/src/fetchers/update-fetchers.js +++ b/keyserver/src/fetchers/update-fetchers.js @@ -55,6 +55,8 @@ return fetchUpdateInfosWithQuery({ viewer, calendarQuery }, query); } +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function rawUpdateInfoFromRow(row: Object): RawUpdateInfo { const type = assertUpdateType(row.type); if (type === updateTypes.DELETE_ACCOUNT) { diff --git a/keyserver/src/scripts/set-last-read-messages.js b/keyserver/src/scripts/set-last-read-messages.js --- a/keyserver/src/scripts/set-last-read-messages.js +++ b/keyserver/src/scripts/set-last-read-messages.js @@ -19,7 +19,7 @@ async function createLastMessageColumn() { try { - return await dbQuery(SQL` + await dbQuery(SQL` ALTER TABLE memberships ADD last_read_message bigint(20) NOT NULL DEFAULT 0, ADD last_message bigint(20) NOT NULL DEFAULT 0 diff --git a/keyserver/src/scripts/soft-launch-migration.js b/keyserver/src/scripts/soft-launch-migration.js --- a/keyserver/src/scripts/soft-launch-migration.js +++ b/keyserver/src/scripts/soft-launch-migration.js @@ -57,7 +57,8 @@ if (genesisThreadInfo && genesisThreadInfo.type === threadTypes.GENESIS) { return; } else if (genesisThreadInfo) { - return await updateGenesisCommunityType(); + await updateGenesisCommunityType(); + return; } console.log('creating GENESIS community'); diff --git a/keyserver/src/socket/session-utils.js b/keyserver/src/socket/session-utils.js --- a/keyserver/src/socket/session-utils.js +++ b/keyserver/src/socket/session-utils.js @@ -235,7 +235,7 @@ const activityUpdatePromise = (async () => { if (activityUpdates.length === 0) { - return; + return undefined; } return await activityUpdater(viewer, { updates: activityUpdates }); })(); diff --git a/keyserver/src/updaters/activity-updaters.js b/keyserver/src/updaters/activity-updaters.js --- a/keyserver/src/updaters/activity-updaters.js +++ b/keyserver/src/updaters/activity-updaters.js @@ -375,7 +375,7 @@ AND user = ${viewer.userID} `); - return await dbQuery(query); + await dbQuery(query); } async function setThreadUnreadStatus( diff --git a/keyserver/src/utils/urls.js b/keyserver/src/utils/urls.js --- a/keyserver/src/utils/urls.js +++ b/keyserver/src/utils/urls.js @@ -60,6 +60,8 @@ return urlFacts; } +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function getAppURLFactsFromRequestURL(url: string): AppURLFacts { const commURLFacts = getCommAppURLFacts(); if (commURLFacts && url.startsWith(commURLFacts.baseRoutePath)) { diff --git a/landing/investor-profile-modal.react.js b/landing/investor-profile-modal.react.js --- a/landing/investor-profile-modal.react.js +++ b/landing/investor-profile-modal.react.js @@ -20,7 +20,7 @@ const selectedInvestor = React.useMemo(() => { const foundInvestor = keyedInvestorData[investorID]; if (!foundInvestor) { - return; + return undefined; } return ( diff --git a/landing/keyservers.react.js b/landing/keyservers.react.js --- a/landing/keyservers.react.js +++ b/landing/keyservers.react.js @@ -51,7 +51,7 @@ const [eyeNode, setEyeNode] = React.useState(null); useIsomorphicLayoutEffect(() => { if (!eyeNode) { - return; + return undefined; } eyeNode.addEventListener('load', onEyeIllustrationLoad); return () => eyeNode.removeEventListener('load', onEyeIllustrationLoad); @@ -60,7 +60,7 @@ const [cloudNode, setCloudNode] = React.useState(null); useIsomorphicLayoutEffect(() => { if (!cloudNode) { - return; + return undefined; } cloudNode.addEventListener('load', onCloudIllustrationLoad); return () => cloudNode.removeEventListener('load', onCloudIllustrationLoad); diff --git a/lib/hooks/child-threads.js b/lib/hooks/child-threads.js --- a/lib/hooks/child-threads.js +++ b/lib/hooks/child-threads.js @@ -69,7 +69,7 @@ React.useEffect(() => { if (!subchannelIDsNotInChatList.size) { - return; + return undefined; } subchannelIDsNotInChatList.forEach(tID => threadWatcher.watchID(tID)); diff --git a/lib/shared/messages/multimedia-message-spec.js b/lib/shared/messages/multimedia-message-spec.js --- a/lib/shared/messages/multimedia-message-spec.js +++ b/lib/shared/messages/multimedia-message-spec.js @@ -183,6 +183,7 @@ } return messageInfo; } + return undefined; }, rawMessageInfoFromMessageData( diff --git a/lib/shared/messages/update-relationship-message-spec.js b/lib/shared/messages/update-relationship-message-spec.js --- a/lib/shared/messages/update-relationship-message-spec.js +++ b/lib/shared/messages/update-relationship-message-spec.js @@ -106,6 +106,8 @@ return { ...messageData, id }; }, + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return robotext(messageInfo: UpdateRelationshipMessageInfo): EntityText { const creator = ET.user({ userInfo: messageInfo.creator }); if (messageInfo.operation === 'request_sent') { diff --git a/lib/shared/relationship-utils.js b/lib/shared/relationship-utils.js --- a/lib/shared/relationship-utils.js +++ b/lib/shared/relationship-utils.js @@ -55,6 +55,8 @@ ); } +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function getRelationshipDispatchAction( relationshipButton: RelationshipButton, ): RelationshipAction { @@ -77,6 +79,8 @@ invariant(false, 'relationshipButton conditions should be exhaustive'); } +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function getRelationshipActionText( relationshipButton: RelationshipButton, username: string, diff --git a/lib/shared/report-utils.js b/lib/shared/report-utils.js --- a/lib/shared/report-utils.js +++ b/lib/shared/report-utils.js @@ -14,6 +14,8 @@ function inconsistencyResponsesToReports( responses: $ReadOnlyArray, ): ClientReportCreationRequest[] { + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return return responses.map(response => { if (response.type === serverRequestTypes.THREAD_INCONSISTENCY) { const { type, ...rest } = response; diff --git a/lib/shared/update-utils.js b/lib/shared/update-utils.js --- a/lib/shared/update-utils.js +++ b/lib/shared/update-utils.js @@ -65,6 +65,8 @@ return null; } +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function rawUpdateInfoFromUpdateData( updateData: UpdateData, id: string, diff --git a/lib/utils/call-server-endpoint.js b/lib/utils/call-server-endpoint.js --- a/lib/utils/call-server-endpoint.js +++ b/lib/utils/call-server-endpoint.js @@ -204,7 +204,7 @@ type: forcePolicyAcknowledgmentActionType, payload, }); - return; + return undefined; } else if (error) { throw new ServerError(error, payload); } diff --git a/lib/utils/date-utils.js b/lib/utils/date-utils.js --- a/lib/utils/date-utils.js +++ b/lib/utils/date-utils.js @@ -30,6 +30,8 @@ } } +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function dateString( first: Date | number, month?: number, diff --git a/lib/utils/entity-text.js b/lib/utils/entity-text.js --- a/lib/utils/entity-text.js +++ b/lib/utils/entity-text.js @@ -123,6 +123,8 @@ +threadType?: ?ThreadType, +possessive?: ?boolean, }; +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return entityTextFunction.thread = (input: EntityTextThreadInput) => { if (input.display === 'uiName') { const { threadInfo } = input; @@ -308,6 +310,8 @@ entityText: EntityText, params?: ?EntityTextToRawStringParams, ): string { + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return const textParts = entityText.map(entity => { if (typeof entity === 'string') { return entity; @@ -338,6 +342,8 @@ renderFuncs: RenderFunctions, ): React.Node { const { renderText, renderThread, renderColor } = renderFuncs; + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return return entityText.map((entity, i) => { const key = `text${i}`; if (typeof entity === 'string') { diff --git a/native/avatars/avatar-hooks.js b/native/avatars/avatar-hooks.js --- a/native/avatars/avatar-hooks.js +++ b/native/avatars/avatar-hooks.js @@ -100,7 +100,7 @@ }); if (canceled || assets.length === 0) { - return; + return undefined; } const asset = assets.pop(); @@ -144,7 +144,7 @@ 'Media selection failed', 'Unable to select media from Media Library.', ); - return; + return undefined; } setProcessingOrUploadInProgress(true); @@ -158,7 +158,7 @@ 'Unable to process selected media.', ); setProcessingOrUploadInProgress(false); - return; + return undefined; } if (!processedMedia.success) { @@ -167,7 +167,7 @@ 'Unable to process selected media.', ); setProcessingOrUploadInProgress(false); - return; + return undefined; } let uploadedMedia: UploadMultimediaResult; @@ -179,7 +179,7 @@ 'Unable to upload selected media. Please try again.', ); setProcessingOrUploadInProgress(false); - return; + return undefined; } return uploadedMedia.id; @@ -240,8 +240,9 @@ setProcessingOrUploadInProgress(false); try { return await updateUserAvatarCall(imageAvatarUpdateRequest); - } catch { + } catch (e) { Alert.alert('Avatar update failed', 'Unable to update avatar.'); + throw e; } })(), ); @@ -308,8 +309,9 @@ setProcessingOrUploadInProgress(false); try { return await changeThreadSettingsCall(updateThreadRequest); - } catch { + } catch (e) { Alert.alert('Avatar update failed', 'Unable to update avatar.'); + throw e; } })(), { customKeyName: `${changeThreadSettingsActionTypes.started}:avatar` }, @@ -344,8 +346,9 @@ (async () => { try { return await updateUserAvatarCall(removeAvatarRequest); - } catch { + } catch (e) { Alert.alert('Avatar update failed', 'Unable to update avatar.'); + throw e; } })(), ); @@ -381,8 +384,9 @@ (async () => { try { return await changeThreadSettingsCall(updateThreadRequest); - } catch { + } catch (e) { Alert.alert('Avatar update failed', 'Unable to update avatar.'); + throw e; } })(), { customKeyName: `${changeThreadSettingsActionTypes.started}:avatar` }, @@ -413,8 +417,9 @@ (async () => { try { return await updateUserAvatarCall(ensAvatarRequest); - } catch { + } catch (e) { Alert.alert('Avatar update failed', 'Unable to update avatar.'); + throw e; } })(), ); diff --git a/native/calendar/calendar.react.js b/native/calendar/calendar.react.js --- a/native/calendar/calendar.react.js +++ b/native/calendar/calendar.react.js @@ -433,6 +433,8 @@ }); } + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return renderItem = (row: { item: CalendarItemWithHeight, ... }) => { const item = row.item; if (item.itemType === 'loader') { @@ -497,6 +499,8 @@ }); }; + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return static keyExtractor = (item: CalendarItemWithHeight | CalendarItem) => { if (item.itemType === 'loader') { return item.key; @@ -523,6 +527,8 @@ return { length, offset, index }; }; + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return static itemHeight = (item: CalendarItemWithHeight) => { if (item.itemType === 'loader') { return 56; diff --git a/native/chat/chat-item-height-measurer.react.js b/native/chat/chat-item-height-measurer.react.js --- a/native/chat/chat-item-height-measurer.react.js +++ b/native/chat/chat-item-height-measurer.react.js @@ -38,6 +38,8 @@ return null; }; +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return const heightMeasurerDummy = (item: NativeChatMessageItem) => { invariant( item.itemType === 'message', diff --git a/native/chat/inline-engagement.react.js b/native/chat/inline-engagement.react.js --- a/native/chat/inline-engagement.react.js +++ b/native/chat/inline-engagement.react.js @@ -1,6 +1,7 @@ // @flow import { useNavigation } from '@react-navigation/native'; +import invariant from 'invariant'; import * as React from 'react'; import { Text, View } from 'react-native'; import Animated, { @@ -283,6 +284,8 @@ initialCoordinates, positioning, } = props; + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return const inlineEngagementStyles = React.useMemo(() => { if (positioning === 'left') { return { @@ -307,6 +310,10 @@ top: inlineEngagementCenterStyle.topOffset, }; } + invariant( + false, + `${positioning} is not a valid positioning value for InlineEngagement`, + ); }, [positioning]); const inlineEngagementContainer = React.useMemo(() => { const opacity = isOpeningSidebar diff --git a/native/chat/message-list-container.react.js b/native/chat/message-list-container.react.js --- a/native/chat/message-list-container.react.js +++ b/native/chat/message-list-container.react.js @@ -272,7 +272,7 @@ const { setPendingThreadUpdateHandler } = inputState; React.useEffect(() => { if (!isFocused) { - return; + return undefined; } setPendingThreadUpdateHandler(threadInfo.id, setBaseThreadInfo); return () => { @@ -299,7 +299,7 @@ }, [setParams, threadInfo]); React.useEffect(() => { if (!isSearching) { - return; + return undefined; } inputState.registerSendCallback(hideSearch); return () => inputState.unregisterSendCallback(hideSearch); diff --git a/native/chat/settings/delete-thread.react.js b/native/chat/settings/delete-thread.react.js --- a/native/chat/settings/delete-thread.react.js +++ b/native/chat/settings/delete-thread.react.js @@ -160,6 +160,7 @@ cancelable: false, }); } + throw e; } } } diff --git a/native/chat/settings/thread-settings.react.js b/native/chat/settings/thread-settings.react.js --- a/native/chat/settings/thread-settings.react.js +++ b/native/chat/settings/thread-settings.react.js @@ -894,6 +894,8 @@ }); }; + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return renderItem = (row: { item: ChatSettingsItem, ... }) => { const item = row.item; if (item.itemType === 'header') { diff --git a/native/components/keyboard-avoiding-view.react.js b/native/components/keyboard-avoiding-view.react.js --- a/native/components/keyboard-avoiding-view.react.js +++ b/native/components/keyboard-avoiding-view.react.js @@ -143,6 +143,8 @@ this.waitingForLayout = []; }; + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return render() { const { behavior, diff --git a/native/ios/assign-build.js b/native/ios/assign-build.js --- a/native/ios/assign-build.js +++ b/native/ios/assign-build.js @@ -41,7 +41,7 @@ if (!IOS_APP_ID) { console.log('ERROR: No IOS_APP_ID found in env.'); process.exit(1); - return; + return undefined; } const res = await request({ @@ -64,7 +64,7 @@ if (!preReleaseVersions) { console.log('ERROR: No preReleaseVersions found.'); process.exit(1); - return; + return undefined; } return preReleaseVersions.filter( @@ -76,7 +76,7 @@ if (!currentVersionInfo || !currentVersionInfo.id) { console.log('ERROR: currentVersionID could not be determined.'); process.exit(1); - return; + return undefined; } return currentVersionInfo.id; }; @@ -85,7 +85,7 @@ if (!versionID) { console.log('ERROR: versionID is undefined.'); process.exit(1); - return; + return undefined; } const res = await request({ @@ -107,7 +107,7 @@ if (!buildInfo || !buildInfo.id) { console.log('ERROR: buildID could not be determined.'); process.exit(1); - return; + return undefined; } return buildInfo.id; }; diff --git a/native/media/multimedia.react.js b/native/media/multimedia.react.js --- a/native/media/multimedia.react.js +++ b/native/media/multimedia.react.js @@ -155,6 +155,8 @@ } }; + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return static sourceFromMediaInfo(mediaInfo: MediaInfo | AvatarMediaInfo): Source { if (mediaInfo.type === 'photo') { return { kind: 'uri', uri: mediaInfo.uri }; diff --git a/native/media/video-playback-modal.react.js b/native/media/video-playback-modal.react.js --- a/native/media/video-playback-modal.react.js +++ b/native/media/video-playback-modal.react.js @@ -89,7 +89,7 @@ React.useEffect(() => { // skip for unencrypted videos if (!holder || !encryptionKey) { - return; + return undefined; } let isMounted = true; diff --git a/native/profile/delete-account.react.js b/native/profile/delete-account.react.js --- a/native/profile/delete-account.react.js +++ b/native/profile/delete-account.react.js @@ -178,6 +178,7 @@ { cancelable: false }, ); } + throw e; } } diff --git a/native/profile/relationship-list.react.js b/native/profile/relationship-list.react.js --- a/native/profile/relationship-list.react.js +++ b/native/profile/relationship-list.react.js @@ -69,6 +69,8 @@ +verticalBounds: ?VerticalBounds, }; +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function keyExtractor(item: ListItem) { if (item.userInfo) { return item.userInfo.id; @@ -261,6 +263,8 @@ const { navigate } = navigation; const styles = useStyles(unboundStyles); const renderItem = React.useCallback( + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return ({ item }: { item: ListItem, ... }) => { if (item.type === 'empty') { const action = { diff --git a/native/redux/dev-tools.react.js b/native/redux/dev-tools.react.js --- a/native/redux/dev-tools.react.js +++ b/native/redux/dev-tools.react.js @@ -120,7 +120,7 @@ React.useEffect(() => { if (!devTools) { - return; + return undefined; } const unsubscribe = devTools.subscribe(handleActionFromMonitor); return unsubscribe; diff --git a/native/redux/dimensions-updater.react.js b/native/redux/dimensions-updater.react.js --- a/native/redux/dimensions-updater.react.js +++ b/native/redux/dimensions-updater.react.js @@ -71,7 +71,7 @@ }, []); React.useEffect(() => { if (!rnsacThinksAndroidKeyboardResizesFrame) { - return; + return undefined; } const showListener = addKeyboardShowListener(keyboardShow); const dismissListener = addKeyboardDismissListener(keyboardDismiss); diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -195,7 +195,7 @@ const navContainer = navContainerRef.current; React.useEffect(() => { if (!navContainer) { - return; + return undefined; } return navContainer.addListener('__unsafe_action__', event => { const { action, noop } = event.data; diff --git a/native/utils/url-utils.js b/native/utils/url-utils.js --- a/native/utils/url-utils.js +++ b/native/utils/url-utils.js @@ -17,6 +17,8 @@ const productionLandingURL = 'https://comm.app'; const devIsEmulator: boolean = __DEV__ && DeviceInfo.isEmulatorSync(); +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function getDevServerHostname(): string { if (!devIsEmulator) { checkForMissingNatDevHostname(); diff --git a/web/chat/chat-message-list-container.react.js b/web/chat/chat-message-list-container.react.js --- a/web/chat/chat-message-list-container.react.js +++ b/web/chat/chat-message-list-container.react.js @@ -132,7 +132,7 @@ React.useEffect(() => { const currentContainerRef = containerRef.current; if (!currentContainerRef) { - return; + return undefined; } currentContainerRef.addEventListener('paste', onPaste); return () => { diff --git a/web/chat/chat-thread-composer.react.js b/web/chat/chat-thread-composer.react.js --- a/web/chat/chat-thread-composer.react.js +++ b/web/chat/chat-thread-composer.react.js @@ -168,7 +168,7 @@ React.useEffect(() => { if (!inputState) { - return; + return undefined; } inputState.registerSendCallback(hideSearch); return () => inputState.unregisterSendCallback(hideSearch); diff --git a/web/components/avatar.react.js b/web/components/avatar.react.js --- a/web/components/avatar.react.js +++ b/web/components/avatar.react.js @@ -35,6 +35,7 @@ if (avatarInfo.type === 'emoji') { return { backgroundColor: `#${avatarInfo.color}` }; } + return undefined; }, [avatarInfo.color, avatarInfo.type]); const avatar = React.useMemo(() => { diff --git a/web/components/enum-settings-option.react.js b/web/components/enum-settings-option.react.js --- a/web/components/enum-settings-option.react.js +++ b/web/components/enum-settings-option.react.js @@ -69,6 +69,7 @@ } else if (type === 'radio') { return ; } + return undefined; }, [disabled, type, selected]); const optionContainerClasses = classnames(css.optionContainer, { diff --git a/web/database/worker/db-worker.js b/web/database/worker/db-worker.js --- a/web/database/worker/db-worker.js +++ b/web/database/worker/db-worker.js @@ -166,13 +166,13 @@ ) { const cryptoKey = await generateDatabaseCryptoKey(); await localforage.setItem(SQLITE_ENCRYPTION_KEY, cryptoKey); - return; + return undefined; } // database operations if (message.type === workerRequestMessageTypes.INIT) { await initDatabase(message.sqljsFilePath, message.sqljsFilename); - return; + return undefined; } if (!sqliteDb) { @@ -222,6 +222,7 @@ } throttledPersist(); + return undefined; } function connectHandler(event: SharedWorkerMessageEvent) { diff --git a/web/modals/threads/members/add-members-list-content.react.js b/web/modals/threads/members/add-members-list-content.react.js --- a/web/modals/threads/members/add-members-list-content.react.js +++ b/web/modals/threads/members/add-members-list-content.react.js @@ -31,7 +31,7 @@ const membersInParentThread = React.useMemo(() => { if (!groupedAvailableUsersList['undefined']) { - return; + return null; } const label = hasParentThread ? 'Users in parent channel' : null; return [label, groupedAvailableUsersList['undefined']]; diff --git a/web/modals/threads/settings/thread-settings-modal.react.js b/web/modals/threads/settings/thread-settings-modal.react.js --- a/web/modals/threads/settings/thread-settings-modal.react.js +++ b/web/modals/threads/settings/thread-settings-modal.react.js @@ -97,6 +97,8 @@ }, [otherUserInfo]); const hasPermissionForTab = React.useCallback( + // ESLint doesn't recognize that invariant always throws + // eslint-disable-next-line consistent-return (thread: ThreadInfo, tab: TabType) => { if (tab === 'general') { return ( diff --git a/web/modals/threads/settings/thread-settings-relationship-button.react.js b/web/modals/threads/settings/thread-settings-relationship-button.react.js --- a/web/modals/threads/settings/thread-settings-relationship-button.react.js +++ b/web/modals/threads/settings/thread-settings-relationship-button.react.js @@ -102,6 +102,7 @@ /> ); } + return undefined; }, [relationshipButton]); const dispatchActionPromise = useDispatchActionPromise(); diff --git a/web/navigation-panels/nav-state-info-bar.react.js b/web/navigation-panels/nav-state-info-bar.react.js --- a/web/navigation-panels/nav-state-info-bar.react.js +++ b/web/navigation-panels/nav-state-info-bar.react.js @@ -68,6 +68,7 @@ return () => clearTimeout(timeout); } } + return undefined; }, [threadInfoInput, threadInfo]); const content = React.useMemo(() => { diff --git a/web/push-notif/push-notifs-handler.js b/web/push-notif/push-notifs-handler.js --- a/web/push-notif/push-notifs-handler.js +++ b/web/push-notif/push-notifs-handler.js @@ -160,7 +160,7 @@ // Redirect to thread on notification click React.useEffect(() => { if (!navigator.serviceWorker || !supported) { - return; + return undefined; } const callback = (event: MessageEvent) => { diff --git a/web/redux/focus-handler.react.js b/web/redux/focus-handler.react.js --- a/web/redux/focus-handler.react.js +++ b/web/redux/focus-handler.react.js @@ -21,7 +21,7 @@ }, []); React.useEffect(() => { if (typeof window === 'undefined') { - return; + return undefined; } window.addEventListener('focus', onFocus); window.addEventListener('blur', onBlur); diff --git a/web/utils/device-id.js b/web/utils/device-id.js --- a/web/utils/device-id.js +++ b/web/utils/device-id.js @@ -28,6 +28,8 @@ // generateDeviceID has to be kept in sync with generate_device_id // which is defined in native/native_rust_library/src/crypto_tools.rs +// Next line is because ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function generateDeviceID(type: DeviceType): string { const suffix = generateRandomString(deviceIDCharLength, alphanumeric); diff --git a/web/utils/tooltip-action-utils.js b/web/utils/tooltip-action-utils.js --- a/web/utils/tooltip-action-utils.js +++ b/web/utils/tooltip-action-utils.js @@ -282,7 +282,7 @@ threadInfo, } = params; if (!tooltipMessagePosition) { - return; + return undefined; } const tooltipPosition = findTooltipPosition({ sourcePositionInfo: tooltipMessagePosition, @@ -292,7 +292,7 @@ preventDisplayingBelowSource: containsInlineEngagement, }); if (!tooltipPosition) { - return; + return undefined; } const tooltipPositionStyle = getMessageActionTooltipStyle({ diff --git a/web/utils/tooltip-utils.js b/web/utils/tooltip-utils.js --- a/web/utils/tooltip-utils.js +++ b/web/utils/tooltip-utils.js @@ -180,6 +180,8 @@ +tooltipPosition: TooltipPosition, }; +// ESLint doesn't recognize that invariant always throws +// eslint-disable-next-line consistent-return function getMessageActionTooltipStyle({ sourcePositionInfo, tooltipSize,