Upgrade Prettier to 2.4.1

This commit is contained in:
Evan Hahn 2021-11-11 16:43:05 -06:00 committed by GitHub
parent f204784afe
commit 5619eeca83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
176 changed files with 1961 additions and 2465 deletions

View file

@ -970,13 +970,11 @@ const updateConversationBatcher = createBatcher<ConversationType>({
// We only care about the most recent update for each conversation
const byId = groupBy(items, item => item.id);
const ids = Object.keys(byId);
const mostRecent = ids.map(
(id: string): ConversationType => {
const maybeLast = last(byId[id]);
assert(maybeLast !== undefined, 'Empty array in `groupBy` result');
return maybeLast;
}
);
const mostRecent = ids.map((id: string): ConversationType => {
const maybeLast = last(byId[id]);
assert(maybeLast !== undefined, 'Empty array in `groupBy` result');
return maybeLast;
});
await updateConversations(mostRecent);
},
@ -1338,14 +1336,11 @@ async function getLastConversationMessages({
ourUuid: UUIDStringType;
Message: typeof MessageModel;
}): Promise<LastConversationMessagesType> {
const {
preview,
activity,
hasUserInitiatedMessages,
} = await channels.getLastConversationMessages({
conversationId,
ourUuid,
});
const { preview, activity, hasUserInitiatedMessages } =
await channels.getLastConversationMessages({
conversationId,
ourUuid,
});
return {
preview: preview ? new Message(preview) : undefined,

View file

@ -724,7 +724,7 @@ async function getAllItems(): Promise<AllItemsType> {
result[id] = value;
}
return (result as unknown) as AllItemsType;
return result as unknown as AllItemsType;
}
async function removeItemById(id: ItemKeyType): Promise<void> {
return removeById(getInstance(), ITEMS_TABLE, id);
@ -3215,16 +3215,8 @@ async function clearAllErrorStickerPackAttempts(): Promise<void> {
}
async function createOrUpdateSticker(sticker: StickerType): Promise<void> {
const db = getInstance();
const {
emoji,
height,
id,
isCoverOnly,
lastUsed,
packId,
path,
width,
} = sticker;
const { emoji, height, id, isCoverOnly, lastUsed, packId, path, width } =
sticker;
if (!isNumber(id)) {
throw new Error(

View file

@ -15,9 +15,7 @@ import { isIterable } from '../util/iterables';
*
* [0]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
*/
export function cleanDataForIpc(
data: unknown
): {
export function cleanDataForIpc(data: unknown): {
// `any`s are dangerous but it's difficult (impossible?) to type this with generics.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
cleaned: any;

View file

@ -98,10 +98,8 @@ export class MainSQL {
join(scriptDir, isBundled ? 'mainWorker.bundle.js' : 'mainWorker.js')
);
const {
promise: onCorruption,
resolve: resolveCorruption,
} = explodePromise<Error>();
const { promise: onCorruption, resolve: resolveCorruption } =
explodePromise<Error>();
this.onCorruption = onCorruption;
this.worker.on('message', (wrappedResponse: WrappedWorkerResponse) => {

View file

@ -76,7 +76,7 @@ export default function updateToSchemaVersion43(
);
const upgradeConversation = (convo: ConversationType) => {
const legacy = (convo as unknown) as LegacyConversationType;
const legacy = convo as unknown as LegacyConversationType;
let result = convo;
const logId = `(${legacy.id}) groupv2(${legacy.groupId})`;
@ -117,11 +117,10 @@ export default function updateToSchemaVersion43(
return updated;
}
const addedByUserId:
| UUIDStringType
| undefined = getConversationUuid.get({
conversationId: member.addedByUserId,
});
const addedByUserId: UUIDStringType | undefined =
getConversationUuid.get({
conversationId: member.addedByUserId,
});
if (!addedByUserId) {
return updated;
@ -221,12 +220,8 @@ export default function updateToSchemaVersion43(
};
const upgradeMessage = (message: MessageType): boolean => {
const {
id,
groupV2Change,
sourceUuid,
invitedGV2Members,
} = (message as unknown) as LegacyMessageType;
const { id, groupV2Change, sourceUuid, invitedGV2Members } =
message as unknown as LegacyMessageType;
let result = message;
if (groupV2Change) {