chore: remove () => void for misused promises

pull/2840/head
Audric Ackermann 2 years ago
parent ab946e69b1
commit 41ca0666ce

@ -4,6 +4,7 @@ import styled from 'styled-components';
import { getShowScrollButton } from '../state/selectors/conversations'; import { getShowScrollButton } from '../state/selectors/conversations';
import { SessionIconButton } from './icon'; import { SessionIconButton } from './icon';
import { Noop } from '../types/Util';
const SessionScrollButtonDiv = styled.div` const SessionScrollButtonDiv = styled.div`
position: fixed; position: fixed;
@ -17,7 +18,7 @@ const SessionScrollButtonDiv = styled.div`
} }
`; `;
export const SessionScrollButton = (props: { onClickScrollBottom: () => void }) => { export const SessionScrollButton = (props: { onClickScrollBottom: Noop }) => {
const show = useSelector(getShowScrollButton); const show = useSelector(getShowScrollButton);
return ( return (

@ -2,6 +2,7 @@ import React, { useState } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { SessionIconButton } from '../icon'; import { SessionIconButton } from '../icon';
import { Noop } from '../../types/Util';
type Props = { type Props = {
label?: string; label?: string;
@ -44,7 +45,7 @@ const ErrorItem = (props: { error: string | undefined }) => {
); );
}; };
const ShowHideButton = (props: { toggleForceShow: () => void }) => { const ShowHideButton = (props: { toggleForceShow: Noop }) => {
return <SessionIconButton iconType="eye" iconSize="medium" onClick={props.toggleForceShow} />; return <SessionIconButton iconType="eye" iconSize="medium" onClick={props.toggleForceShow} />;
}; };

@ -282,7 +282,8 @@ export const HangUpButton = ({ isFullScreen }: { isFullScreen: boolean }) => {
iconType="hangup" iconType="hangup"
iconColor="var(--danger-color)" iconColor="var(--danger-color)"
borderRadius="50%" borderRadius="50%"
onClick={() => void handleEndCall()} // eslint-disable-next-line @typescript-eslint/no-misused-promises
onClick={handleEndCall}
margin="10px" margin="10px"
dataTestId="end-call" dataTestId="end-call"
/> />

@ -35,14 +35,15 @@ export const IncomingCallDialog = () => {
useEffect(() => { useEffect(() => {
let timeout: NodeJS.Timeout; let timeout: NodeJS.Timeout;
if (incomingCallFromPubkey) { if (incomingCallFromPubkey) {
timeout = global.setTimeout(() => { // eslint-disable-next-line @typescript-eslint/no-misused-promises
timeout = global.setTimeout(async () => {
if (incomingCallFromPubkey) { if (incomingCallFromPubkey) {
window.log.info( window.log.info(
`call missed with ${ed25519Str( `call missed with ${ed25519Str(
incomingCallFromPubkey incomingCallFromPubkey
)} as the dialog was not interacted with for ${callTimeoutMs} ms` )} as the dialog was not interacted with for ${callTimeoutMs} ms`
); );
void CallManager.USER_rejectIncomingCallRequest(incomingCallFromPubkey); await CallManager.USER_rejectIncomingCallRequest(incomingCallFromPubkey);
} }
}, callTimeoutMs); }, callTimeoutMs);
} }

@ -144,7 +144,8 @@ class SessionMessagesListContainerInner extends React.Component<Props> {
</ScrollToLoadedMessageContext.Provider> </ScrollToLoadedMessageContext.Provider>
<SessionScrollButton <SessionScrollButton
onClickScrollBottom={() => void this.props.scrollToNow()} // eslint-disable-next-line @typescript-eslint/no-misused-promises
onClickScrollBottom={this.props.scrollToNow}
key="scroll-down-button" key="scroll-down-button"
/> />
</StyledMessagesContainer> </StyledMessagesContainer>

@ -301,8 +301,9 @@ export const SessionRightPanelWithDetails = () => {
<StyledGroupSettingsItem <StyledGroupSettingsItem
className="group-settings-item" className="group-settings-item"
role="button" role="button"
onClick={() => { // eslint-disable-next-line @typescript-eslint/no-misused-promises
void showUpdateGroupNameByConvoId(selectedConvoKey); onClick={async () => {
await showUpdateGroupNameByConvoId(selectedConvoKey);
}} }}
> >
{isPublic ? window.i18n('editGroup') : window.i18n('editGroupName')} {isPublic ? window.i18n('editGroup') : window.i18n('editGroupName')}
@ -335,8 +336,9 @@ export const SessionRightPanelWithDetails = () => {
<StyledGroupSettingsItem <StyledGroupSettingsItem
className="group-settings-item" className="group-settings-item"
role="button" role="button"
onClick={() => { // eslint-disable-next-line @typescript-eslint/no-misused-promises
void showUpdateGroupMembersByConvoId(selectedConvoKey); onClick={async () => {
await showUpdateGroupMembersByConvoId(selectedConvoKey);
}} }}
> >
{window.i18n('groupMembers')} {window.i18n('groupMembers')}

@ -404,7 +404,8 @@ class CompositionBoxInner extends React.Component<Props, State> {
return ( return (
<SessionRecording <SessionRecording
sendVoiceMessage={this.sendVoiceMessage} sendVoiceMessage={this.sendVoiceMessage}
onLoadVoiceNoteView={() => void this.onLoadVoiceNoteView()} // eslint-disable-next-line @typescript-eslint/no-misused-promises
onLoadVoiceNoteView={this.onLoadVoiceNoteView}
onExitVoiceNoteView={this.onExitVoiceNoteView} onExitVoiceNoteView={this.onExitVoiceNoteView}
/> />
); );
@ -413,22 +414,20 @@ class CompositionBoxInner extends React.Component<Props, State> {
private renderCompositionView() { private renderCompositionView() {
const { showEmojiPanel } = this.state; const { showEmojiPanel } = this.state;
const { typingEnabled } = this.props; const { typingEnabled } = this.props;
/* eslint-disable @typescript-eslint/no-misused-promises */
return ( return (
<> <>
{typingEnabled && <AddStagedAttachmentButton onClick={this.onChooseAttachment} />} {typingEnabled && <AddStagedAttachmentButton onClick={this.onChooseAttachment} />}
<input <input
className="hidden" className="hidden"
placeholder="Attachment" placeholder="Attachment"
multiple={true} multiple={true}
ref={this.fileInput} ref={this.fileInput}
type="file" type="file"
onChange={() => void this.onChoseAttachment()} onChange={this.onChoseAttachment}
/> />
{typingEnabled && <StartRecordingButton onClick={this.onLoadVoiceNoteView} />}
{typingEnabled && <StartRecordingButton onClick={() => void this.onLoadVoiceNoteView()} />}
<StyledSendMessageInput <StyledSendMessageInput
role="main" role="main"
onClick={this.focusCompositionBox} // used to focus on the textarea when clicking in its container onClick={this.focusCompositionBox} // used to focus on the textarea when clicking in its container
@ -439,25 +438,24 @@ class CompositionBoxInner extends React.Component<Props, State> {
> >
{this.renderTextArea()} {this.renderTextArea()}
</StyledSendMessageInput> </StyledSendMessageInput>
{typingEnabled && ( {typingEnabled && (
<ToggleEmojiButton ref={this.emojiPanelButton} onClick={this.toggleEmojiPanel} /> <ToggleEmojiButton ref={this.emojiPanelButton} onClick={this.toggleEmojiPanel} />
)} )}
<SendMessageButton onClick={() => void this.onSendMessage()} /> <SendMessageButton onClick={this.onSendMessage} />
{typingEnabled && showEmojiPanel && ( {typingEnabled && showEmojiPanel && (
<StyledEmojiPanelContainer role="button"> <StyledEmojiPanelContainer role="button">
<SessionEmojiPanel <SessionEmojiPanel
ref={this.emojiPanel} ref={this.emojiPanel}
show={showEmojiPanel} show={showEmojiPanel}
onEmojiClicked={this.onEmojiClick} onEmojiClicked={this.onEmojiClick}
onKeyDown={e => void this.onKeyDown(e)} onKeyDown={this.onKeyDown}
/> />
</StyledEmojiPanelContainer> </StyledEmojiPanelContainer>
)} )}
</> </>
); );
} }
/* eslint-enable @typescript-eslint/no-misused-promises */
private renderTextArea() { private renderTextArea() {
const { i18n } = window; const { i18n } = window;
@ -492,8 +490,10 @@ class CompositionBoxInner extends React.Component<Props, State> {
<MentionsInput <MentionsInput
value={draft} value={draft}
onChange={this.onChange} onChange={this.onChange}
onKeyDown={e => void this.onKeyDown(e)} // eslint-disable-next-line @typescript-eslint/no-misused-promises
onKeyUp={() => void this.onKeyUp()} onKeyDown={this.onKeyDown}
// eslint-disable-next-line @typescript-eslint/no-misused-promises
onKeyUp={this.onKeyUp}
placeholder={messagePlaceHolder} placeholder={messagePlaceHolder}
spellCheck={true} spellCheck={true}
inputRef={this.textarea} inputRef={this.textarea}

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { SessionIconButton } from '../../icon'; import { SessionIconButton } from '../../icon';
import { Noop } from '../../../types/Util';
const StyledChatButtonContainer = styled.div` const StyledChatButtonContainer = styled.div`
.session-icon-button { .session-icon-button {
@ -14,7 +15,7 @@ const StyledChatButtonContainer = styled.div`
} }
`; `;
export const AddStagedAttachmentButton = (props: { onClick: () => void }) => { export const AddStagedAttachmentButton = (props: { onClick: Noop }) => {
return ( return (
<StyledChatButtonContainer> <StyledChatButtonContainer>
<SessionIconButton <SessionIconButton
@ -31,7 +32,7 @@ export const AddStagedAttachmentButton = (props: { onClick: () => void }) => {
); );
}; };
export const StartRecordingButton = (props: { onClick: () => void }) => { export const StartRecordingButton = (props: { onClick: Noop }) => {
return ( return (
<StyledChatButtonContainer> <StyledChatButtonContainer>
<SessionIconButton <SessionIconButton
@ -49,7 +50,7 @@ export const StartRecordingButton = (props: { onClick: () => void }) => {
}; };
// eslint-disable-next-line react/display-name // eslint-disable-next-line react/display-name
export const ToggleEmojiButton = React.forwardRef<HTMLDivElement, { onClick: () => void }>( export const ToggleEmojiButton = React.forwardRef<HTMLDivElement, { onClick: Noop }>(
(props, ref) => { (props, ref) => {
return ( return (
<StyledChatButtonContainer> <StyledChatButtonContainer>
@ -69,7 +70,7 @@ export const ToggleEmojiButton = React.forwardRef<HTMLDivElement, { onClick: ()
} }
); );
export const SendMessageButton = (props: { onClick: () => void }) => { export const SendMessageButton = (props: { onClick: Noop }) => {
return ( return (
<StyledChatButtonContainer className="send-message-button"> <StyledChatButtonContainer className="send-message-button">
<SessionIconButton <SessionIconButton

@ -111,7 +111,8 @@ export const ClickToTrustSender = (props: { messageId: string }) => {
}; };
return ( return (
<StyledTrustSenderUI onClick={e => void openConfirmationModal(e)}> // eslint-disable-next-line @typescript-eslint/no-misused-promises
<StyledTrustSenderUI onClick={openConfirmationModal}>
<SessionIcon iconSize="small" iconType="gallery" /> <SessionIcon iconSize="small" iconType="gallery" />
<ClickToDownload>{window.i18n('clickToTrustContact')}</ClickToDownload> <ClickToDownload>{window.i18n('clickToTrustContact')}</ClickToDownload>
</StyledTrustSenderUI> </StyledTrustSenderUI>

@ -131,6 +131,7 @@ export const MessageAvatar = (props: Props) => {
if (!lastMessageOfSeries) { if (!lastMessageOfSeries) {
return <div style={{ marginInlineEnd: '60px' }} key={`msg-avatar-${sender}`} />; return <div style={{ marginInlineEnd: '60px' }} key={`msg-avatar-${sender}`} />;
} }
/* eslint-disable @typescript-eslint/no-misused-promises */
return ( return (
<StyledAvatar <StyledAvatar
@ -139,11 +140,7 @@ export const MessageAvatar = (props: Props) => {
visibility: hideAvatar ? 'hidden' : undefined, visibility: hideAvatar ? 'hidden' : undefined,
}} }}
> >
<Avatar <Avatar size={AvatarSize.S} onAvatarClick={onMessageAvatarClick} pubkey={sender} />
size={AvatarSize.S}
onAvatarClick={() => void onMessageAvatarClick()}
pubkey={sender}
/>
{isSenderAdmin && <CrownIcon />} {isSenderAdmin && <CrownIcon />}
</StyledAvatar> </StyledAvatar>
); );

@ -147,7 +147,8 @@ export const MessageContentWithStatuses = (props: Props) => {
{enableReactions && ( {enableReactions && (
<MessageReactions <MessageReactions
messageId={messageId} messageId={messageId}
onClick={emoji => void handleMessageReaction(emoji)} // eslint-disable-next-line @typescript-eslint/no-misused-promises
onClick={handleMessageReaction}
popupReaction={popupReaction} popupReaction={popupReaction}
setPopupReaction={setPopupReaction} setPopupReaction={setPopupReaction}
onPopupClick={handlePopupClick} onPopupClick={handlePopupClick}

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-misused-promises */
import React, { useCallback, useEffect, useRef, useState } from 'react'; import React, { useCallback, useEffect, useRef, useState } from 'react';
import { animation, Item, Menu, useContextMenu } from 'react-contexify'; import { animation, Item, Menu, useContextMenu } from 'react-contexify';
@ -200,7 +201,7 @@ const RetryItem = ({ messageId }: MessageId) => {
await found.retrySend(); await found.retrySend();
} }
}, [messageId]); }, [messageId]);
return showRetry ? <Item onClick={() => void onRetry()}>{window.i18n('resend')}</Item> : null; return showRetry ? <Item onClick={onRetry}>{window.i18n('resend')}</Item> : null;
}; };
export const MessageContextMenu = (props: Props) => { export const MessageContextMenu = (props: Props) => {
@ -349,7 +350,8 @@ export const MessageContextMenu = (props: Props) => {
<StyledEmojiPanelContainer role="button" x={mouseX} y={mouseY}> <StyledEmojiPanelContainer role="button" x={mouseX} y={mouseY}>
<SessionEmojiPanel <SessionEmojiPanel
ref={emojiPanelRef} ref={emojiPanelRef}
onEmojiClicked={e => void onEmojiClick(e)} // eslint-disable-next-line @typescript-eslint/no-misused-promises
onEmojiClicked={onEmojiClick}
show={showEmojiPanel} show={showEmojiPanel}
isModal={true} isModal={true}
onKeyDown={onEmojiKeyDown} onKeyDown={onEmojiKeyDown}
@ -364,7 +366,8 @@ export const MessageContextMenu = (props: Props) => {
animation={animation.fade} animation={animation.fade}
> >
{enableReactions && ( {enableReactions && (
<MessageReactBar action={e => void onEmojiClick(e)} additionalAction={onShowEmoji} /> // eslint-disable-next-line @typescript-eslint/no-misused-promises
<MessageReactBar action={onEmojiClick} additionalAction={onShowEmoji} />
)} )}
<SaveAttachment messageId={messageId} /> <SaveAttachment messageId={messageId} />
@ -373,7 +376,7 @@ export const MessageContextMenu = (props: Props) => {
<Item onClick={onReply}>{window.i18n('replyToMessage')}</Item> <Item onClick={onReply}>{window.i18n('replyToMessage')}</Item>
)} )}
{(!isPublic || isOutgoing) && ( {(!isPublic || isOutgoing) && (
<Item onClick={() => void onShowDetail()}>{window.i18n('moreInformation')}</Item> <Item onClick={onShowDetail}>{window.i18n('moreInformation')}</Item>
)} )}
<RetryItem messageId={messageId} /> <RetryItem messageId={messageId} />
{isDeletable ? <Item onClick={onSelect}>{selectMessageText}</Item> : null} {isDeletable ? <Item onClick={onSelect}>{selectMessageText}</Item> : null}

@ -98,7 +98,8 @@ export const MessageQuote = (props: Props) => {
return ( return (
<Quote <Quote
onClick={e => void onQuoteClick(e)} // eslint-disable-next-line @typescript-eslint/no-misused-promises
onClick={onQuoteClick}
text={quote?.text} text={quote?.text}
attachment={quote?.attachment} attachment={quote?.attachment}
isIncoming={direction === 'incoming'} isIncoming={direction === 'incoming'}

@ -163,7 +163,8 @@ export class EditProfileDialog extends React.Component<object, State> {
<div <div
className="image-upload-section" className="image-upload-section"
role="button" role="button"
onClick={() => void this.fireInputEvent()} // eslint-disable-next-line @typescript-eslint/no-misused-promises
onClick={this.fireInputEvent}
data-testid="image-upload-section" data-testid="image-upload-section"
/> />
<div <div

@ -148,7 +148,8 @@ const AtSymbol = ({ convoId }: { convoId: string }) => {
return hasMentionedUs && hasUnread ? ( return hasMentionedUs && hasUnread ? (
<MentionAtSymbol <MentionAtSymbol
title="Open to latest mention" title="Open to latest mention"
onMouseDown={e => void openConvoToLastMention(e, convoId)} // eslint-disable-next-line @typescript-eslint/no-misused-promises
onMouseDown={async e => openConvoToLastMention(e, convoId)}
> >
@ @
</MentionAtSymbol> </MentionAtSymbol>

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-misused-promises */
import React, { useState } from 'react'; import React, { useState } from 'react';
import useKey from 'react-use/lib/useKey'; import useKey from 'react-use/lib/useKey';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
@ -86,7 +87,6 @@ export const OverlayCommunity = () => {
return ( return (
<div className="module-left-pane-overlay"> <div className="module-left-pane-overlay">
<OverlayHeader title={title} subtitle={subtitle} /> <OverlayHeader title={title} subtitle={subtitle} />
<div className="create-group-name-input"> <div className="create-group-name-input">
<SessionIdEditable <SessionIdEditable
editable={true} editable={true}
@ -98,11 +98,9 @@ export const OverlayCommunity = () => {
onPressEnter={onTryJoinRoom} onPressEnter={onTryJoinRoom}
/> />
</div> </div>
<SessionButton text={buttonText} disabled={!groupUrl} onClick={onTryJoinRoom} /> <SessionButton text={buttonText} disabled={!groupUrl} onClick={onTryJoinRoom} />
<SessionSpinner loading={loading} /> <SessionSpinner loading={loading} />
<SessionJoinableRooms onJoinClick={url => void onTryJoinRoom(url)} alreadyJoining={loading} /> <SessionJoinableRooms onJoinClick={onTryJoinRoom} alreadyJoining={loading} />
</div> </div>
); );
}; };

@ -86,7 +86,8 @@ export const ContactRow = (props: Props) => {
return ( return (
<StyledRowContainer <StyledRowContainer
style={style} style={style}
onClick={() => void openConversationWithMessages({ conversationKey: id, messageId: null })} // eslint-disable-next-line @typescript-eslint/no-misused-promises
onClick={async () => openConversationWithMessages({ conversationKey: id, messageId: null })}
> >
<AvatarItem id={id} displayName={displayName} /> <AvatarItem id={id} displayName={displayName} />
<StyledContactRowName data-testid="module-conversation__user__profile-name"> <StyledContactRowName data-testid="module-conversation__user__profile-name">

@ -357,7 +357,10 @@ export const MarkAllReadMenuItem = (): JSX.Element | null => {
const isIncomingRequest = useIsIncomingRequest(convoId); const isIncomingRequest = useIsIncomingRequest(convoId);
if (!isIncomingRequest && !PubKey.isBlinded(convoId)) { if (!isIncomingRequest && !PubKey.isBlinded(convoId)) {
return ( return (
<Item onClick={() => void markAllReadByConvoId(convoId)}>{window.i18n('markAllAsRead')}</Item> // eslint-disable-next-line @typescript-eslint/no-misused-promises
<Item onClick={async () => markAllReadByConvoId(convoId)}>
{window.i18n('markAllAsRead')}
</Item>
); );
} }
return null; return null;
@ -379,8 +382,9 @@ export const BlockMenuItem = (): JSX.Element | null => {
if (!isMe && isPrivate && !isIncomingRequest && !PubKey.isBlinded(convoId)) { if (!isMe && isPrivate && !isIncomingRequest && !PubKey.isBlinded(convoId)) {
const blockTitle = isBlocked ? window.i18n('unblock') : window.i18n('block'); const blockTitle = isBlocked ? window.i18n('unblock') : window.i18n('block');
const blockHandler = isBlocked const blockHandler = isBlocked
? () => void unblockConvoById(convoId) ? async () => unblockConvoById(convoId)
: () => void blockConvoById(convoId); : async () => blockConvoById(convoId);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
return <Item onClick={blockHandler}>{blockTitle}</Item>; return <Item onClick={blockHandler}>{blockTitle}</Item>;
} }
return null; return null;
@ -398,7 +402,10 @@ export const ClearNicknameMenuItem = (): JSX.Element | null => {
} }
return ( return (
<Item onClick={() => void clearNickNameByConvoId(convoId)}>{window.i18n('clearNickname')}</Item> // eslint-disable-next-line @typescript-eslint/no-misused-promises
<Item onClick={async () => clearNickNameByConvoId(convoId)}>
{window.i18n('clearNickname')}
</Item>
); );
}; };

@ -7,6 +7,7 @@ import { RegistrationContext, RegistrationPhase, signUp } from './RegistrationSt
import { RegistrationUserDetails } from './RegistrationUserDetails'; import { RegistrationUserDetails } from './RegistrationUserDetails';
import { sanitizeDisplayNameOrToast, SignInMode } from './SignInTab'; import { sanitizeDisplayNameOrToast, SignInMode } from './SignInTab';
import { TermsAndConditions } from './TermsAndConditions'; import { TermsAndConditions } from './TermsAndConditions';
import { Noop } from '../../types/Util';
export enum SignUpMode { export enum SignUpMode {
Default, Default,
@ -22,7 +23,7 @@ const ContinueSignUpButton = ({ continueSignUp }: { continueSignUp: any }) => {
return <SessionButton onClick={continueSignUp} text={window.i18n('continue')} />; return <SessionButton onClick={continueSignUp} text={window.i18n('continue')} />;
}; };
const SignUpDefault = (props: { createSessionID: () => void }) => { const SignUpDefault = (props: { createSessionID: Noop }) => {
return ( return (
<div className="session-registration__content"> <div className="session-registration__content">
<CreateSessionIdButton createSessionID={props.createSessionID} /> <CreateSessionIdButton createSessionID={props.createSessionID} />
@ -46,7 +47,7 @@ export const GoBackMainMenuButton = () => {
); );
}; };
const SignUpSessionIDShown = (props: { continueSignUp: () => void }) => { const SignUpSessionIDShown = (props: { continueSignUp: Noop }) => {
return ( return (
<div className="session-registration__content"> <div className="session-registration__content">
<Flex flexDirection="row" container={true} alignItems="center"> <Flex flexDirection="row" container={true} alignItems="center">

@ -10,6 +10,7 @@ import {
import { SessionToggle } from '../basic/SessionToggle'; import { SessionToggle } from '../basic/SessionToggle';
import { SessionConfirmDialogProps } from '../dialog/SessionConfirm'; import { SessionConfirmDialogProps } from '../dialog/SessionConfirm';
import { SessionIconButton } from '../icon'; import { SessionIconButton } from '../icon';
import { Noop } from '../../types/Util';
type ButtonSettingsProps = { type ButtonSettingsProps = {
title?: string; title?: string;
@ -112,7 +113,7 @@ export const SessionSettingsItemWrapper = (props: {
); );
}; };
export const SessionSettingsTitleWithLink = (props: { title: string; onClick: () => void }) => { export const SessionSettingsTitleWithLink = (props: { title: string; onClick: Noop }) => {
const { onClick, title } = props; const { onClick, title } = props;
return ( return (
<StyledSettingItemClickable onClick={onClick}> <StyledSettingItemClickable onClick={onClick}>

@ -1,5 +1,6 @@
import { isString } from 'lodash'; import { isString } from 'lodash';
import { LocaleMessagesType } from './locale'; import { LocaleMessagesType } from './locale';
import { Noop } from '../types/Util';
export const createTemplate = ( export const createTemplate = (
options: { options: {
@ -162,7 +163,7 @@ export const createTemplate = (
function updateForMac( function updateForMac(
template: any, template: any,
messages: LocaleMessagesType, messages: LocaleMessagesType,
options: { showAbout: () => void; showWindow: () => void } options: { showAbout: Noop; showWindow: Noop }
) { ) {
const { showAbout, showWindow } = options; const { showAbout, showWindow } = options;

@ -1,6 +1,7 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { SessionConfirmDialogProps } from '../../components/dialog/SessionConfirm'; import { SessionConfirmDialogProps } from '../../components/dialog/SessionConfirm';
import { PasswordAction } from '../../components/dialog/SessionPasswordDialog'; import { PasswordAction } from '../../components/dialog/SessionPasswordDialog';
import { Noop } from '../../types/Util';
export type BanType = 'ban' | 'unban'; export type BanType = 'ban' | 'unban';
@ -22,7 +23,7 @@ export type OnionPathModalState = EditProfileModalState;
export type RecoveryPhraseModalState = EditProfileModalState; export type RecoveryPhraseModalState = EditProfileModalState;
export type DeleteAccountModalState = EditProfileModalState; export type DeleteAccountModalState = EditProfileModalState;
export type SessionPasswordModalState = { passwordAction: PasswordAction; onOk: () => void } | null; export type SessionPasswordModalState = { passwordAction: PasswordAction; onOk: Noop } | null;
export type UserDetailsModalState = { export type UserDetailsModalState = {
conversationId: string; conversationId: string;

@ -7,3 +7,5 @@ export type RenderTextCallbackType = (options: {
}) => JSX.Element; }) => JSX.Element;
export type LocalizerType = (key: LocalizerKeys, values?: Array<string>) => string; export type LocalizerType = (key: LocalizerKeys, values?: Array<string>) => string;
export type Noop = () => void;

@ -98,7 +98,8 @@ async function checkExpiringMessages() {
if (timeout) { if (timeout) {
global.clearTimeout(timeout); global.clearTimeout(timeout);
} }
timeout = global.setTimeout(() => void destroyExpiredMessages(), wait); // eslint-disable-next-line @typescript-eslint/no-misused-promises
timeout = global.setTimeout(async () => destroyExpiredMessages(), wait);
} }
const throttledCheckExpiringMessages = throttle(checkExpiringMessages, 1000); const throttledCheckExpiringMessages = throttle(checkExpiringMessages, 1000);
@ -111,7 +112,8 @@ const initExpiringMessageListener = () => {
void checkExpiringMessages(); void checkExpiringMessages();
initWallClockListener(() => void throttledCheckExpiringMessages()); // eslint-disable-next-line @typescript-eslint/no-misused-promises
initWallClockListener(async () => throttledCheckExpiringMessages());
isInit = true; isInit = true;
}; };

Loading…
Cancel
Save