From cafa9d80ecc55c528d1c5c119f5c49b5f0af0ccb Mon Sep 17 00:00:00 2001 From: William Grant Date: Thu, 12 Oct 2023 14:38:29 +1100 Subject: [PATCH] fix: remove all unneeded tslint comments fixed some eslint errors --- .../header/ConversationHeaderTitle.tsx | 1 - .../overlay/OverlayRightPanelSettings.tsx | 4 ---- ts/components/dialog/DeleteAccountModal.tsx | 11 +++++----- ts/components/dialog/EditProfileDialog.tsx | 2 -- ts/models/conversation.ts | 1 - ts/receiver/queuedJob.ts | 7 +++--- ts/session/utils/calling/CallManager.ts | 22 +++++++++---------- ts/types/MessageAttachment.ts | 10 +++++---- ts/util/expiringMessages.ts | 9 ++++---- 9 files changed, 29 insertions(+), 38 deletions(-) diff --git a/ts/components/conversation/header/ConversationHeaderTitle.tsx b/ts/components/conversation/header/ConversationHeaderTitle.tsx index 47db01251..836ee5fc5 100644 --- a/ts/components/conversation/header/ConversationHeaderTitle.tsx +++ b/ts/components/conversation/header/ConversationHeaderTitle.tsx @@ -31,7 +31,6 @@ export type SubtitleStringsType = keyof Pick< 'notifications' | 'members' | 'disappearingMessages' >; -// tslint:disable: cyclomatic-complexity max-func-body-length export const ConversationHeaderTitle = () => { const dispatch = useDispatch(); const convoId = useSelectedConversationKey(); diff --git a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx index 598c92157..cd96706e0 100644 --- a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx +++ b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx @@ -1,7 +1,6 @@ import { compact, flatten, isEqual } from 'lodash'; import React, { useEffect, useState } from 'react'; -// tslint:disable-next-line: no-submodule-imports import { useDispatch } from 'react-redux'; import useInterval from 'react-use/lib/useInterval'; import styled from 'styled-components'; @@ -202,8 +201,6 @@ const StyledName = styled.h4` font-size: var(--font-size-md); `; -// tslint:disable: cyclomatic-complexity -// tslint:disable: max-func-body-length export const OverlayRightPanelSettings = () => { const [documents, setDocuments] = useState>([]); const [media, setMedia] = useState>([]); @@ -366,7 +363,6 @@ export const OverlayRightPanelSettings = () => { {isGroup && ( - // tslint:disable-next-line: use-simple-attributes { window?.log?.info('last message sent successfully. Deleting everything'); @@ -63,9 +63,10 @@ async function deleteEverythingAndNetworkData() { const allRoomInfos = await getAllValidOpenGroupV2ConversationRoomInfos(); if (allRoomInfos && allRoomInfos.size > 0) { // clear each inbox per sogs + // eslint-disable-next-line no-restricted-syntax for (const roomInfo of allRoomInfos.values()) { - // TODO CONTINUE testing - use a dummy account with some message requests and then if we restore from seed there should be no message requests. try { + // eslint-disable-next-line no-await-in-loop const success = await clearInbox(roomInfo); if (!success) { throw Error(`Failed to clear inbox for ${roomInfo.conversationId}`); diff --git a/ts/components/dialog/EditProfileDialog.tsx b/ts/components/dialog/EditProfileDialog.tsx index 197335f40..9ce30b02e 100644 --- a/ts/components/dialog/EditProfileDialog.tsx +++ b/ts/components/dialog/EditProfileDialog.tsx @@ -114,7 +114,6 @@ const ProfileHeader = (props: ProfileHeaderProps): ReactElement => { }; type ProfileDialogModes = 'default' | 'edit' | 'qr'; -// tslint:disable-next-line: max-func-body-length export const EditProfileDialog = (): ReactElement => { const dispatch = useDispatch(); @@ -211,7 +210,6 @@ export const EditProfileDialog = (): ReactElement => { return ( /* The
element has a child element that allows keyboard interaction */ - /* tslint:disable-next-line: react-a11y-event-has-role */
{ }); } - // tslint:disable: cyclomatic-complexity /** * Updates the disappearing message settings for this conversation and sends an ExpirationTimerUpdate message if required * @param providedDisappearingMode diff --git a/ts/receiver/queuedJob.ts b/ts/receiver/queuedJob.ts index 8e0c9b87a..29c82b534 100644 --- a/ts/receiver/queuedJob.ts +++ b/ts/receiver/queuedJob.ts @@ -11,6 +11,9 @@ import { ConversationTypeEnum } from '../models/conversationAttributes'; import { MessageDirection } from '../models/messageType'; import { SignalService } from '../protobuf'; import { ProfileManager } from '../session/profile_manager/ProfileManager'; +import { PubKey } from '../session/types'; +import { UserUtils } from '../session/utils'; +import { PropsForMessageWithoutConvoProps, lookupQuote } from '../state/ducks/conversations'; import { showMessageRequestBannerOutsideRedux } from '../state/ducks/userConfig'; import { getHideMessageRequestBannerOutsideRedux } from '../state/selectors/userConfig'; import { GoogleChrome } from '../util'; @@ -20,9 +23,6 @@ import { } from '../util/expiringMessages'; import { LinkPreviews } from '../util/linkPreviews'; import { ReleasedFeatures } from '../util/releaseFeature'; -import { PropsForMessageWithoutConvoProps, lookupQuote } from '../state/ducks/conversations'; -import { PubKey } from '../session/types'; -import { UserUtils } from '../session/utils'; function contentTypeSupported(type: string): boolean { const Chrome = GoogleChrome; @@ -369,7 +369,6 @@ async function markConvoAsReadIfOutgoingMessage( } } -// tslint:disable: max-func-body-length cyclomatic-complexity export async function handleMessageJob( messageModel: MessageModel, conversation: ConversationModel, diff --git a/ts/session/utils/calling/CallManager.ts b/ts/session/utils/calling/CallManager.ts index d7ac9ebc3..a580119b9 100644 --- a/ts/session/utils/calling/CallManager.ts +++ b/ts/session/utils/calling/CallManager.ts @@ -5,40 +5,38 @@ import { v4 as uuidv4 } from 'uuid'; import { MessageUtils, ToastUtils, UserUtils } from '..'; import { SignalService } from '../../../protobuf'; -import { openConversationWithMessages } from '../../../state/ducks/conversations'; import { + CallStatusEnum, answerCall, callConnected, callReconnecting, - CallStatusEnum, endCall, incomingCall, setFullScreenCall, startingCallWith, } from '../../../state/ducks/call'; +import { openConversationWithMessages } from '../../../state/ducks/conversations'; import { getConversationController } from '../../conversations'; import { CallMessage } from '../../messages/outgoing/controlMessage/CallMessage'; import { ed25519Str } from '../../onions/onionPath'; import { PubKey } from '../../types'; -import { getIsRinging } from '../RingingManager'; -import { getBlackSilenceMediaStream } from './Silence'; import { getMessageQueue } from '../..'; -import { MessageSender } from '../../sending'; -import { DURATION } from '../../constants'; -import { Data } from '../../../data/data'; import { getCallMediaPermissionsSettings } from '../../../components/settings/SessionSettings'; -import { PnServer } from '../../apis/push_notification_api'; +import { Data } from '../../../data/data'; import { approveConvoAndSendResponse } from '../../../interactions/conversationInteractions'; -import { GetNetworkTime } from '../../apis/snode_api/getNetworkTime'; -import { SnodeNamespaces } from '../../apis/snode_api/namespaces'; import { READ_MESSAGE_STATE } from '../../../models/conversationAttributes'; import { changeToDisappearingMessageType, setExpirationStartTimestamp, } from '../../../util/expiringMessages'; - -// tslint:disable: function-name +import { PnServer } from '../../apis/push_notification_api'; +import { GetNetworkTime } from '../../apis/snode_api/getNetworkTime'; +import { SnodeNamespaces } from '../../apis/snode_api/namespaces'; +import { DURATION } from '../../constants'; +import { MessageSender } from '../../sending'; +import { getIsRinging } from '../RingingManager'; +import { getBlackSilenceMediaStream } from './Silence'; export type InputItem = { deviceId: string; label: string }; diff --git a/ts/types/MessageAttachment.ts b/ts/types/MessageAttachment.ts index df6737038..1002c004f 100644 --- a/ts/types/MessageAttachment.ts +++ b/ts/types/MessageAttachment.ts @@ -1,11 +1,12 @@ import { ipcRenderer } from 'electron'; import { isArrayBuffer, isEmpty, isString, isUndefined, omit } from 'lodash'; +import { ConversationAttributes } from '../models/conversationAttributes'; +import { createDeleter, getAttachmentsPath } from '../shared/attachments/shared_attachments'; import { createAbsolutePathGetter, createReader, createWriterForNew, } from '../util/attachments_files'; -import { createDeleter, getAttachmentsPath } from '../shared/attachments/shared_attachments'; import { autoOrientJPEGAttachment, captureDimensionsAndScreenshot, @@ -13,7 +14,6 @@ import { loadData, replaceUnicodeV2, } from './attachments/migrations'; -import { ConversationAttributes } from '../models/conversationAttributes'; // I think this is only used on the renderer side, but how?! @@ -30,7 +30,8 @@ export const deleteExternalMessageFiles = async (message: { if (quote && quote.attachments && quote.attachments.length) { await Promise.all( - quote.attachments.map(async (attachment: { thumbnail: any }) => { + quote.attachments.map(async (_attachment: { thumbnail: any }) => { + const attachment = _attachment; const { thumbnail } = attachment; // To prevent spoofing, we copy the original image from the quoted message. @@ -48,7 +49,8 @@ export const deleteExternalMessageFiles = async (message: { if (preview && preview.length) { await Promise.all( - preview.map(async (item: { image: any }) => { + preview.map(async (_item: { image: any }) => { + const item = _item; const { image } = item; if (image && image.path) { diff --git a/ts/util/expiringMessages.ts b/ts/util/expiringMessages.ts index 095df5552..8585961a6 100644 --- a/ts/util/expiringMessages.ts +++ b/ts/util/expiringMessages.ts @@ -6,14 +6,14 @@ import { LocalizerKeys } from '../types/LocalizerKeys'; import { initWallClockListener } from './wallClockListener'; import { Data } from '../data/data'; -import { getConversationController } from '../session/conversations'; -import { ProtobufUtils, SignalService } from '../protobuf'; import { ConversationModel } from '../models/conversation'; import { MessageModel } from '../models/message'; -import { GetNetworkTime } from '../session/apis/snode_api/getNetworkTime'; -import { ReleasedFeatures } from './releaseFeature'; +import { ProtobufUtils, SignalService } from '../protobuf'; import { expireMessageOnSnode } from '../session/apis/snode_api/expireRequest'; +import { GetNetworkTime } from '../session/apis/snode_api/getNetworkTime'; +import { getConversationController } from '../session/conversations'; import { isValidUnixTimestamp } from '../session/utils/Timestamps'; +import { ReleasedFeatures } from './releaseFeature'; // NOTE this must match Content.ExpirationType in the protobuf // TODO double check this @@ -77,7 +77,6 @@ export async function destroyMessagesAndUpdateRedux( const messageIds = messages.map(m => m.messageId); // Delete any attachments - // tslint:disable-next-line: prefer-for-of for (let i = 0; i < messageIds.length; i++) { /* eslint-disable no-await-in-loop */ const message = await Data.getMessageById(messageIds[i]);