From a5a64f354f886ed30bcb6dc00a44f12571123962 Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Mon, 26 Apr 2021 11:38:50 -0500 Subject: [PATCH] Upgrade Prettier from v2.1.2 to v2.2.1 --- package.json | 2 +- ts/components/CompositionInput.tsx | 7 ++-- ts/components/conversation/Message.tsx | 4 +-- .../conversation-details/PendingInvites.tsx | 7 ++-- .../media-gallery/groupMediaItemsByDate.ts | 8 ++--- .../leftPane/LeftPaneArchiveHelper.tsx | 8 ++--- .../LeftPaneChooseGroupMembersHelper.tsx | 4 +-- .../leftPane/LeftPaneComposeHelper.tsx | 4 +-- .../leftPane/LeftPaneInboxHelper.tsx | 12 ++----- .../leftPane/LeftPaneSearchHelper.tsx | 16 +++------- .../LeftPaneSetGroupMetadataHelper.tsx | 4 +-- ts/model-types.d.ts | 12 ++----- ts/models/conversations.ts | 9 ++---- ts/models/messages.ts | 4 ++- ts/textsecure.d.ts | 32 +++++-------------- ts/util/lint/exceptions.json | 8 ++--- yarn.lock | 10 +++--- 17 files changed, 50 insertions(+), 101 deletions(-) diff --git a/package.json b/package.json index 9a97e0e51..374bd18fc 100644 --- a/package.json +++ b/package.json @@ -262,7 +262,7 @@ "npm-run-all": "4.1.5", "nyc": "11.4.1", "patch-package": "6.1.2", - "prettier": "2.1.2", + "prettier": "^2.2.1", "react-docgen-typescript": "1.2.6", "sass-loader": "7.2.0", "sinon": "9.2.4", diff --git a/ts/components/CompositionInput.tsx b/ts/components/CompositionInput.tsx index a14ef25c1..473c41cdf 100644 --- a/ts/components/CompositionInput.tsx +++ b/ts/components/CompositionInput.tsx @@ -108,9 +108,10 @@ export const CompositionInput: React.ComponentType = props => { sortedGroupMembers, } = props; - const [emojiCompletionElement, setEmojiCompletionElement] = React.useState< - JSX.Element - >(); + const [ + emojiCompletionElement, + setEmojiCompletionElement, + ] = React.useState(); const [ lastSelectionRange, setLastSelectionRange, diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx index 070938152..17099d1fe 100644 --- a/ts/components/conversation/Message.tsx +++ b/ts/components/conversation/Message.tsx @@ -243,9 +243,7 @@ export class Message extends React.PureComponent { public audioButtonRef: React.RefObject = React.createRef(); - public reactionsContainerRef: React.RefObject< - HTMLDivElement - > = React.createRef(); + public reactionsContainerRef: React.RefObject = React.createRef(); public reactionsContainerRefMerger = createRefMerger(); diff --git a/ts/components/conversation/conversation-details/PendingInvites.tsx b/ts/components/conversation/conversation-details/PendingInvites.tsx index 135339d27..b14fc1c36 100644 --- a/ts/components/conversation/conversation-details/PendingInvites.tsx +++ b/ts/components/conversation/conversation-details/PendingInvites.tsx @@ -65,9 +65,10 @@ export const PendingInvites: React.ComponentType = ({ } const [selectedTab, setSelectedTab] = React.useState(Tab.Requests); - const [stagedMemberships, setStagedMemberships] = React.useState | null>(null); + const [ + stagedMemberships, + setStagedMemberships, + ] = React.useState | null>(null); const allPendingMemberships = conversation.pendingMemberships || []; const allRequestingMemberships = diff --git a/ts/components/conversation/media-gallery/groupMediaItemsByDate.ts b/ts/components/conversation/media-gallery/groupMediaItemsByDate.ts index e217b8bd8..d63e34be5 100644 --- a/ts/components/conversation/media-gallery/groupMediaItemsByDate.ts +++ b/ts/components/conversation/media-gallery/groupMediaItemsByDate.ts @@ -99,12 +99,8 @@ type GenericMediaItemWithSection = { type: T; mediaItem: MediaItemType; }; -type MediaItemWithStaticSection = GenericMediaItemWithSection< - StaticSectionType ->; -type MediaItemWithYearMonthSection = GenericMediaItemWithSection< - YearMonthSectionType -> & { +type MediaItemWithStaticSection = GenericMediaItemWithSection; +type MediaItemWithYearMonthSection = GenericMediaItemWithSection & { year: number; month: number; }; diff --git a/ts/components/leftPane/LeftPaneArchiveHelper.tsx b/ts/components/leftPane/LeftPaneArchiveHelper.tsx index 1a2715dd8..3d00f3dd0 100644 --- a/ts/components/leftPane/LeftPaneArchiveHelper.tsx +++ b/ts/components/leftPane/LeftPaneArchiveHelper.tsx @@ -16,12 +16,8 @@ export type LeftPaneArchivePropsType = { /* eslint-disable class-methods-use-this */ -export class LeftPaneArchiveHelper extends LeftPaneHelper< - LeftPaneArchivePropsType -> { - private readonly archivedConversations: ReadonlyArray< - ConversationListItemPropsType - >; +export class LeftPaneArchiveHelper extends LeftPaneHelper { + private readonly archivedConversations: ReadonlyArray; constructor({ archivedConversations }: Readonly) { super(); diff --git a/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx b/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx index 7b4aeb19e..5033bb213 100644 --- a/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx +++ b/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx @@ -31,9 +31,7 @@ export type LeftPaneChooseGroupMembersPropsType = { /* eslint-disable class-methods-use-this */ -export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper< - LeftPaneChooseGroupMembersPropsType -> { +export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper { private readonly candidateContacts: ReadonlyArray; private readonly cantAddContactForModal: diff --git a/ts/components/leftPane/LeftPaneComposeHelper.tsx b/ts/components/leftPane/LeftPaneComposeHelper.tsx index 72641cd57..ddcc77500 100644 --- a/ts/components/leftPane/LeftPaneComposeHelper.tsx +++ b/ts/components/leftPane/LeftPaneComposeHelper.tsx @@ -32,9 +32,7 @@ enum TopButton { /* eslint-disable class-methods-use-this */ -export class LeftPaneComposeHelper extends LeftPaneHelper< - LeftPaneComposePropsType -> { +export class LeftPaneComposeHelper extends LeftPaneHelper { private readonly composeContacts: ReadonlyArray; private readonly composeGroups: ReadonlyArray; diff --git a/ts/components/leftPane/LeftPaneInboxHelper.tsx b/ts/components/leftPane/LeftPaneInboxHelper.tsx index ba4d3ffee..954825633 100644 --- a/ts/components/leftPane/LeftPaneInboxHelper.tsx +++ b/ts/components/leftPane/LeftPaneInboxHelper.tsx @@ -19,18 +19,12 @@ export type LeftPaneInboxPropsType = { /* eslint-disable class-methods-use-this */ -export class LeftPaneInboxHelper extends LeftPaneHelper< - LeftPaneInboxPropsType -> { +export class LeftPaneInboxHelper extends LeftPaneHelper { private readonly conversations: ReadonlyArray; - private readonly archivedConversations: ReadonlyArray< - ConversationListItemPropsType - >; + private readonly archivedConversations: ReadonlyArray; - private readonly pinnedConversations: ReadonlyArray< - ConversationListItemPropsType - >; + private readonly pinnedConversations: ReadonlyArray; constructor({ conversations, diff --git a/ts/components/leftPane/LeftPaneSearchHelper.tsx b/ts/components/leftPane/LeftPaneSearchHelper.tsx index 9a38fe8c4..e18710186 100644 --- a/ts/components/leftPane/LeftPaneSearchHelper.tsx +++ b/ts/components/leftPane/LeftPaneSearchHelper.tsx @@ -24,9 +24,7 @@ type MaybeLoadedSearchResultsType = | { isLoading: false; results: Array }; export type LeftPaneSearchPropsType = { - conversationResults: MaybeLoadedSearchResultsType< - ConversationListItemPropsType - >; + conversationResults: MaybeLoadedSearchResultsType; contactResults: MaybeLoadedSearchResultsType; messageResults: MaybeLoadedSearchResultsType<{ id: string; @@ -40,16 +38,10 @@ const searchResultKeys: Array< 'conversationResults' | 'contactResults' | 'messageResults' > = ['conversationResults', 'contactResults', 'messageResults']; -export class LeftPaneSearchHelper extends LeftPaneHelper< - LeftPaneSearchPropsType -> { - private readonly conversationResults: MaybeLoadedSearchResultsType< - ConversationListItemPropsType - >; +export class LeftPaneSearchHelper extends LeftPaneHelper { + private readonly conversationResults: MaybeLoadedSearchResultsType; - private readonly contactResults: MaybeLoadedSearchResultsType< - ConversationListItemPropsType - >; + private readonly contactResults: MaybeLoadedSearchResultsType; private readonly messageResults: MaybeLoadedSearchResultsType<{ id: string; diff --git a/ts/components/leftPane/LeftPaneSetGroupMetadataHelper.tsx b/ts/components/leftPane/LeftPaneSetGroupMetadataHelper.tsx index 3d716f791..9d253f52b 100644 --- a/ts/components/leftPane/LeftPaneSetGroupMetadataHelper.tsx +++ b/ts/components/leftPane/LeftPaneSetGroupMetadataHelper.tsx @@ -23,9 +23,7 @@ export type LeftPaneSetGroupMetadataPropsType = { /* eslint-disable class-methods-use-this */ -export class LeftPaneSetGroupMetadataHelper extends LeftPaneHelper< - LeftPaneSetGroupMetadataPropsType -> { +export class LeftPaneSetGroupMetadataHelper extends LeftPaneHelper { private readonly groupAvatar: undefined | ArrayBuffer; private readonly groupName: string; diff --git a/ts/model-types.d.ts b/ts/model-types.d.ts index b0e824e21..dcd0ed7ac 100644 --- a/ts/model-types.d.ts +++ b/ts/model-types.d.ts @@ -32,9 +32,7 @@ type DeletesAttributesType = { targetSentTimestamp: number; }; -export declare class DeletesModelType extends Backbone.Model< - DeletesAttributesType -> { +export declare class DeletesModelType extends Backbone.Model { forMessage(message: MessageModel): Array; onDelete(doe: DeletesAttributesType): Promise; } @@ -318,12 +316,8 @@ export type VerificationOptions = { viaSyncMessage?: boolean; }; -export declare class ConversationModelCollectionType extends Backbone.Collection< - ConversationModel -> { +export declare class ConversationModelCollectionType extends Backbone.Collection { resetLookups(): void; } -export declare class MessageModelCollectionType extends Backbone.Collection< - MessageModel -> {} +export declare class MessageModelCollectionType extends Backbone.Collection {} diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index 91ae8e235..f91fa8f44 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -111,9 +111,8 @@ type CachedIdenticon = { readonly color: ColorType; }; -export class ConversationModel extends window.Backbone.Model< - ConversationAttributesType -> { +export class ConversationModel extends window.Backbone + .Model { static COLORS: string; cachedProps?: ConversationType | null; @@ -4398,9 +4397,7 @@ export class ConversationModel extends window.Backbone.Model< getProfiles(): Promise> { // request all conversation members' keys - const conversations = (this.getMembers() as unknown) as Array< - ConversationModel - >; + const conversations = (this.getMembers() as unknown) as Array; return Promise.all( window._.map(conversations, conversation => { this.getProfile(conversation.get('uuid'), conversation.get('e164')); diff --git a/ts/models/messages.ts b/ts/models/messages.ts index 5d44d7e1b..99b3cc1ae 100644 --- a/ts/models/messages.ts +++ b/ts/models/messages.ts @@ -3553,7 +3553,9 @@ export class MessageModel extends window.Backbone.Model { // GroupV1 if (!isGroupV2 && dataMessage.group) { const pendingGroupUpdate = []; - const memberConversations: Array = await Promise.all( + const memberConversations: Array< + typeof window.WhatIsThis + > = await Promise.all( dataMessage.group.membersE164.map((e164: string) => window.ConversationController.getOrCreateAndWait( e164, diff --git a/ts/textsecure.d.ts b/ts/textsecure.d.ts index 8b6f8a09b..fe0037bf9 100644 --- a/ts/textsecure.d.ts +++ b/ts/textsecure.d.ts @@ -309,33 +309,19 @@ export declare namespace GroupChangeClass { addMembers?: Array; deleteMembers?: Array; modifyMemberRoles?: Array; - modifyMemberProfileKeys?: Array< - GroupChangeClass.Actions.ModifyMemberProfileKeyAction - >; - addPendingMembers?: Array< - GroupChangeClass.Actions.AddMemberPendingProfileKeyAction - >; - deletePendingMembers?: Array< - GroupChangeClass.Actions.DeleteMemberPendingProfileKeyAction - >; - promotePendingMembers?: Array< - GroupChangeClass.Actions.PromoteMemberPendingProfileKeyAction - >; + modifyMemberProfileKeys?: Array; + addPendingMembers?: Array; + deletePendingMembers?: Array; + promotePendingMembers?: Array; modifyTitle?: GroupChangeClass.Actions.ModifyTitleAction; modifyAvatar?: GroupChangeClass.Actions.ModifyAvatarAction; modifyDisappearingMessagesTimer?: GroupChangeClass.Actions.ModifyDisappearingMessagesTimerAction; modifyAttributesAccess?: GroupChangeClass.Actions.ModifyAttributesAccessControlAction; modifyMemberAccess?: GroupChangeClass.Actions.ModifyMembersAccessControlAction; modifyAddFromInviteLinkAccess?: GroupChangeClass.Actions.ModifyAddFromInviteLinkAccessControlAction; - addMemberPendingAdminApprovals?: Array< - GroupChangeClass.Actions.AddMemberPendingAdminApprovalAction - >; - deleteMemberPendingAdminApprovals?: Array< - GroupChangeClass.Actions.DeleteMemberPendingAdminApprovalAction - >; - promoteMemberPendingAdminApprovals?: Array< - GroupChangeClass.Actions.PromoteMemberPendingAdminApprovalAction - >; + addMemberPendingAdminApprovals?: Array; + deleteMemberPendingAdminApprovals?: Array; + promoteMemberPendingAdminApprovals?: Array; modifyInviteLinkPassword?: GroupChangeClass.Actions.ModifyInviteLinkPasswordAction; } } @@ -1160,9 +1146,7 @@ export declare namespace SyncMessageClass { timestamp?: ProtoBigNumberType; message?: DataMessageClass; expirationStartTimestamp?: ProtoBigNumberType; - unidentifiedStatus?: Array< - SyncMessageClass.Sent.UnidentifiedDeliveryStatus - >; + unidentifiedStatus?: Array; isRecipientUpdate?: boolean; } class StickerPackOperation { diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 92161a6d3..7a1d8e106 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -16284,7 +16284,7 @@ "rule": "React-useRef", "path": "ts/components/CompositionInput.tsx", "line": " const callbacksRef = React.useRef(unstaleCallbacks);", - "lineNumber": 500, + "lineNumber": 501, "reasonCategory": "usageTrusted", "updated": "2021-04-21T21:35:38.757Z" }, @@ -16590,8 +16590,8 @@ { "rule": "React-createRef", "path": "ts/components/conversation/Message.tsx", - "line": " > = React.createRef();", - "lineNumber": 248, + "line": " public reactionsContainerRef: React.RefObject = React.createRef();", + "lineNumber": 246, "reasonCategory": "usageTrusted", "updated": "2021-03-05T19:57:01.431Z", "reasonDetail": "Used for detecting clicks outside reaction viewer" @@ -16927,4 +16927,4 @@ "updated": "2021-01-08T15:46:32.143Z", "reasonDetail": "Doesn't manipulate the DOM. This is just a function." } -] \ No newline at end of file +] diff --git a/yarn.lock b/yarn.lock index ff66d7eb9..1fbd27200 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13587,16 +13587,16 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5" - integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg== - prettier@^1.19.1: version "1.19.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== +prettier@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" + integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== + pretty-bytes@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-1.0.4.tgz#0a22e8210609ad35542f8c8d5d2159aff0751c84"