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

@ -32,40 +32,44 @@ export const getBadgesById = createSelector(getBadgeState, state =>
export const getBadgesSelector = createSelector(
getBadgesById,
badgesById => (
conversationBadges: ReadonlyArray<Pick<BadgeType, 'id'>>
): Array<BadgeType> => {
const result: Array<BadgeType> = [];
badgesById =>
(
conversationBadges: ReadonlyArray<Pick<BadgeType, 'id'>>
): Array<BadgeType> => {
const result: Array<BadgeType> = [];
for (const { id } of conversationBadges) {
const badge = getOwn(badgesById, id);
if (!badge) {
log.error('getBadgesSelector: conversation badge was not found');
continue;
for (const { id } of conversationBadges) {
const badge = getOwn(badgesById, id);
if (!badge) {
log.error('getBadgesSelector: conversation badge was not found');
continue;
}
result.push(badge);
}
result.push(badge);
}
return result;
}
return result;
}
);
export const getPreferredBadgeSelector = createSelector(
getBadgesById,
badgesById => (
conversationBadges: ReadonlyArray<Pick<BadgeType, 'id'>>
): undefined | BadgeType => {
const firstId: undefined | string = conversationBadges[0]?.id;
if (!firstId) {
return undefined;
}
badgesById =>
(
conversationBadges: ReadonlyArray<Pick<BadgeType, 'id'>>
): undefined | BadgeType => {
const firstId: undefined | string = conversationBadges[0]?.id;
if (!firstId) {
return undefined;
}
const badge = getOwn(badgesById, firstId);
if (!badge) {
log.error('getPreferredBadgeSelector: conversation badge was not found');
return undefined;
}
const badge = getOwn(badgesById, firstId);
if (!badge) {
log.error(
'getPreferredBadgeSelector: conversation badge was not found'
);
return undefined;
}
return badge;
}
return badge;
}
);

View file

@ -35,9 +35,9 @@ export type CallSelectorType = (
) => CallStateType | undefined;
export const getCallSelector = createSelector(
getCallsByConversation,
(callsByConversation: CallsByConversationType): CallSelectorType => (
conversationId: string
) => getOwn(callsByConversation, conversationId)
(callsByConversation: CallsByConversationType): CallSelectorType =>
(conversationId: string) =>
getOwn(callsByConversation, conversationId)
);
export const getActiveCall = createSelector(

View file

@ -115,9 +115,9 @@ const getAllConversations = createSelector(
export const getConversationsByTitleSelector = createSelector(
getAllConversations,
(conversations): ((title: string) => Array<ConversationType>) => (
title: string
) => conversations.filter(conversation => conversation.title === title)
(conversations): ((title: string) => Array<ConversationType>) =>
(title: string) =>
conversations.filter(conversation => conversation.title === title)
);
export const getSelectedConversationId = createSelector(
@ -675,14 +675,16 @@ export const getConversationSelector = createSelector(
export const getConversationByIdSelector = createSelector(
getConversationLookup,
conversationLookup => (id: string): undefined | ConversationType =>
getOwn(conversationLookup, id)
conversationLookup =>
(id: string): undefined | ConversationType =>
getOwn(conversationLookup, id)
);
export const getConversationByUuidSelector = createSelector(
getConversationsByUuid,
conversationsByUuid => (uuid: UUIDStringType): undefined | ConversationType =>
getOwn(conversationsByUuid, uuid)
conversationsByUuid =>
(uuid: UUIDStringType): undefined | ConversationType =>
getOwn(conversationsByUuid, uuid)
);
// A little optimization to reset our selector cache whenever high-level application data
@ -749,9 +751,8 @@ export const getContactNameColorSelector = createSelector(
conversationId: string,
contactId: string
): ContactNameColorType => {
const contactNameColors = conversationMemberColorsSelector(
conversationId
);
const contactNameColors =
conversationMemberColorsSelector(conversationId);
const color = contactNameColors.get(contactId);
if (!color) {
log.warn(`No color generated for contact ${contactId}`);
@ -968,9 +969,11 @@ export const getGroupAdminsSelector = createSelector(
getConversationSelector,
(conversationSelector: GetConversationByIdType) => {
return (conversationId: string): Array<ConversationType> => {
const { groupId, groupVersion, memberships = [] } = conversationSelector(
conversationId
);
const {
groupId,
groupVersion,
memberships = [],
} = conversationSelector(conversationId);
if (
!isGroupV2({
@ -1001,25 +1004,27 @@ const getOutboundMessagesPendingConversationVerification = createSelector(
conversations.outboundMessagesPendingConversationVerification
);
const getConversationIdsStoppingMessageSendBecauseOfVerification = createSelector(
getOutboundMessagesPendingConversationVerification,
(outboundMessagesPendingConversationVerification): Array<string> =>
Object.keys(outboundMessagesPendingConversationVerification)
);
const getConversationIdsStoppingMessageSendBecauseOfVerification =
createSelector(
getOutboundMessagesPendingConversationVerification,
(outboundMessagesPendingConversationVerification): Array<string> =>
Object.keys(outboundMessagesPendingConversationVerification)
);
export const getConversationsStoppingMessageSendBecauseOfVerification = createSelector(
getConversationByIdSelector,
getConversationIdsStoppingMessageSendBecauseOfVerification,
(
conversationSelector: (id: string) => undefined | ConversationType,
conversationIds: ReadonlyArray<string>
): Array<ConversationType> => {
const conversations = conversationIds
.map(conversationId => conversationSelector(conversationId))
.filter(isNotNil);
return sortByTitle(conversations);
}
);
export const getConversationsStoppingMessageSendBecauseOfVerification =
createSelector(
getConversationByIdSelector,
getConversationIdsStoppingMessageSendBecauseOfVerification,
(
conversationSelector: (id: string) => undefined | ConversationType,
conversationIds: ReadonlyArray<string>
): Array<ConversationType> => {
const conversations = conversationIds
.map(conversationId => conversationSelector(conversationId))
.filter(isNotNil);
return sortByTitle(conversations);
}
);
export const getMessageIdsPendingBecauseOfVerification = createSelector(
getOutboundMessagesPendingConversationVerification,

View file

@ -473,7 +473,8 @@ export const getPropsForQuote = createSelectorCreator(memoizeByRoot, isEqual)(
const firstAttachment = quote.attachments && quote.attachments[0];
const conversation = getConversation(message, conversationSelector);
const defaultConversationColor = window.Events.getDefaultConversationColor();
const defaultConversationColor =
window.Events.getDefaultConversationColor();
return {
authorId,
@ -592,7 +593,8 @@ const getShallowPropsForMessage = createSelectorCreator(memoizeByRoot, isEqual)(
});
const contactNameColor = contactNameColorSelector(conversationId, authorId);
const defaultConversationColor = window.Events.getDefaultConversationColor();
const defaultConversationColor =
window.Events.getDefaultConversationColor();
return {
canDeleteForEveryone: canDeleteForEveryone(message),