Update prettier to 3.3.3

This commit is contained in:
Fedor Indutny 2024-07-23 17:31:40 -07:00 committed by GitHub
parent 1773ad1e11
commit 24a22bf191
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
109 changed files with 452 additions and 392 deletions

View file

@ -1137,9 +1137,8 @@ export class ConversationController {
log.warn(
`${logId}: Ensure that all V1 groups have new conversationId instead of old`
);
const groups = await this.getAllGroupsInvolvingServiceId(
obsoleteServiceId
);
const groups =
await this.getAllGroupsInvolvingServiceId(obsoleteServiceId);
groups.forEach(group => {
const members = group.get('members');
const withoutObsolete = without(members, obsoleteId);

View file

@ -723,7 +723,7 @@ export function decryptProfile(data: Uint8Array, key: Uint8Array): Uint8Array {
export function encryptProfileItemWithPadding(
item: Uint8Array,
profileKey: Uint8Array,
paddedLengths: typeof PaddedLengths[keyof typeof PaddedLengths]
paddedLengths: (typeof PaddedLengths)[keyof typeof PaddedLengths]
): Uint8Array {
const paddedLength = paddedLengths.find(
(length: number) => item.byteLength <= length

View file

@ -136,7 +136,7 @@ const triggerEvents = function (
function trigger<
T extends Backbone.Events & {
_events: undefined | Record<string, ReadonlyArray<InternalBackboneEvent>>;
}
},
>(this: T, name: string, ...args: Array<unknown>): T {
if (!this._events) return this;
if (!eventsApi(this, name, args)) return this;

View file

@ -97,9 +97,8 @@ async function downloadBadgeImageFile(url: string): Promise<string> {
}
const imageFileData = await server.getBadgeImageFile(url);
const localPath = await window.Signal.Migrations.writeNewBadgeImageFileData(
imageFileData
);
const localPath =
await window.Signal.Migrations.writeNewBadgeImageFileData(imageFileData);
await DataWriter.badgeImageFileDownloaded(url, localPath);

View file

@ -92,7 +92,7 @@ const createActiveDirectCallProp = (
hasRemoteVideo: boolean;
presenting: boolean;
title: string;
}
},
],
});

View file

@ -174,8 +174,8 @@ export function CallingLobby({
const videoButtonType = hasLocalVideo
? CallingButtonType.VIDEO_ON
: availableCameras.length === 0
? CallingButtonType.VIDEO_DISABLED
: CallingButtonType.VIDEO_OFF;
? CallingButtonType.VIDEO_DISABLED
: CallingButtonType.VIDEO_OFF;
const audioButtonType = hasLocalAudio
? CallingButtonType.AUDIO_ON

View file

@ -397,9 +397,8 @@ function CustomColorBubble({
event.stopPropagation();
event.preventDefault();
const conversations = await getConversationsWithCustomColor(
colorId
);
const conversations =
await getConversationsWithCustomColor(colorId);
if (!conversations.length) {
onDelete();
} else {

View file

@ -506,7 +506,12 @@ export const CompositionArea = memo(function CompositionArea({
) {
inputApiRef.current.reset();
}
}, [messageCompositionId, sendCounter, previousMessageCompositionId, previousSendCounter]);
}, [
messageCompositionId,
sendCounter,
previousMessageCompositionId,
previousSendCounter,
]);
const insertEmoji = useCallback(
(e: EmojiPickDataType) => {

View file

@ -129,7 +129,7 @@ export const ConfirmationDialog = React.memo(function ConfirmationDialogInner({
<Button
key={
typeof action.text === 'string'
? action.id ?? action.text
? (action.id ?? action.text)
: action.id
}
disabled={action.disabled || isSpinning}

View file

@ -23,7 +23,7 @@ export type PropsType = Readonly<{
const UNITS = ['seconds', 'minutes', 'hours', 'days', 'weeks'] as const;
export type Unit = typeof UNITS[number];
export type Unit = (typeof UNITS)[number];
const UNIT_TO_SEC = new Map<Unit, number>([
['seconds', 1],

View file

@ -26,7 +26,7 @@ const createAttachment = (
contentType: stringToMIMEType(props.contentType ?? ''),
fileName: props.fileName ?? '',
screenshotPath: props.pending === false ? props.screenshotPath : undefined,
url: props.pending === false ? props.url ?? '' : '',
url: props.pending === false ? (props.url ?? '') : '',
size: 3433,
});

View file

@ -637,7 +637,7 @@ function stableParticipantComparator(
}
type ParticipantsInPageType<
T extends { videoAspectRatio: number } = ParticipantTileType
T extends { videoAspectRatio: number } = ParticipantTileType,
> = {
rows: Array<Array<T>>;
numParticipants: number;

View file

@ -320,7 +320,7 @@ export function MediaEditor({
const objectShortcuts: Array<
[
(ev: KeyboardEvent) => boolean,
(obj: fabric.Object, ev: KeyboardEvent) => unknown
(obj: fabric.Object, ev: KeyboardEvent) => unknown,
]
> = [
[
@ -1353,9 +1353,8 @@ export function MediaEditor({
let data: Uint8Array;
let blurHash: string;
try {
const renderFabricCanvas = await cloneFabricCanvas(
fabricCanvas
);
const renderFabricCanvas =
await cloneFabricCanvas(fabricCanvas);
renderFabricCanvas.remove(
...renderFabricCanvas

View file

@ -6,7 +6,7 @@ import React from 'react';
export abstract class PureComponentProfiler<
Props extends Record<string, unknown>,
State extends Record<string, unknown>
State extends Record<string, unknown>,
> extends React.Component<Props, State> {
public override shouldComponentUpdate(
nextProps: Props,

View file

@ -70,7 +70,7 @@ const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
i18n,
safetyNumber:
'safetyNumber' in overrideProps
? overrideProps.safetyNumber ?? null
? (overrideProps.safetyNumber ?? null)
: {
numberBlocks: generateNumberBlocks(),
qrData: generateQRData(),

View file

@ -7,7 +7,7 @@ import classNames from 'classnames';
import { getClassNamesFor } from '../util/getClassNamesFor';
export const SpinnerSvgSizes = ['small', 'normal'] as const;
export type SpinnerSvgSize = typeof SpinnerSvgSizes[number];
export type SpinnerSvgSize = (typeof SpinnerSvgSizes)[number];
export const SpinnerDirections = [
'outgoing',
@ -17,7 +17,7 @@ export const SpinnerDirections = [
'on-progress-dialog',
'on-avatar',
] as const;
export type SpinnerDirection = typeof SpinnerDirections[number];
export type SpinnerDirection = (typeof SpinnerDirections)[number];
export type Props = {
ariaLabel?: string;

View file

@ -5,7 +5,7 @@ import React from 'react';
import classNames from 'classnames';
export const SpinnerSvgSizes = ['small', 'normal'] as const;
export type SpinnerSvgSize = typeof SpinnerSvgSizes[number];
export type SpinnerSvgSize = (typeof SpinnerSvgSizes)[number];
export type Props = {
className?: string;

View file

@ -93,7 +93,8 @@ const BackgroundStyle = {
},
};
type BackgroundStyleType = typeof BackgroundStyle[keyof typeof BackgroundStyle];
type BackgroundStyleType =
(typeof BackgroundStyle)[keyof typeof BackgroundStyle];
function getBackground(
bgStyle: BackgroundStyleType

View file

@ -269,7 +269,7 @@ function createCanvasAndContext({
height,
}: CreateCanvasAndContextOptionsType): [
OffscreenCanvas,
OffscreenCanvasRenderingContext2D
OffscreenCanvasRenderingContext2D,
] {
const canvas = new OffscreenCanvas(
PRINT_PIXEL_RATIO * width,

View file

@ -456,7 +456,7 @@ function HeaderContent({
sharedGroupNames={sharedGroupNames}
size={AvatarSize.THIRTY_TWO}
// user may have stories, but we don't show that on Note to Self conversation
storyRing={conversation.isMe ? undefined : hasStories ?? undefined}
storyRing={conversation.isMe ? undefined : (hasStories ?? undefined)}
theme={theme}
title={conversation.title}
unblurredAvatarUrl={conversation.unblurredAvatarUrl ?? undefined}

View file

@ -162,10 +162,10 @@ export const MessageStatuses = [
'sent',
'viewed',
] as const;
export type MessageStatusType = typeof MessageStatuses[number];
export type MessageStatusType = (typeof MessageStatuses)[number];
export const Directions = ['incoming', 'outgoing'] as const;
export type DirectionType = typeof Directions[number];
export type DirectionType = (typeof Directions)[number];
export type AudioAttachmentProps = {
renderingContext: string;

View file

@ -34,7 +34,7 @@ export const MessageStatuses = [
'partial-sent',
] as const;
export type MessageStatusType = typeof MessageStatuses[number];
export type MessageStatusType = (typeof MessageStatuses)[number];
export type PropsData = Pick<
ConversationType,

View file

@ -8,7 +8,7 @@ import { emojiToImage, getImagePath } from './lib';
export const EmojiSizes = [16, 18, 20, 24, 28, 32, 48, 64, 66] as const;
export type EmojiSizeType = typeof EmojiSizes[number];
export type EmojiSizeType = (typeof EmojiSizes)[number];
export type OwnProps = {
emoji?: string;

View file

@ -76,7 +76,7 @@ const categories = [
'flag',
] as const;
type Category = typeof categories[number];
type Category = (typeof categories)[number];
export const EmojiPicker = React.memo(
React.forwardRef<HTMLDivElement, Props>(

View file

@ -23,7 +23,7 @@ export type SmartContactRendererType<T extends string | JSX.Element> = (
type StringRendererType<
T extends string | JSX.Element,
ParamsByKeyType extends SelectParamsByKeyType<T> = SelectParamsByKeyType<T>
ParamsByKeyType extends SelectParamsByKeyType<T> = SelectParamsByKeyType<T>,
> = <Key extends keyof ParamsByKeyType>(
id: Key,
i18n: LocalizerType,

View file

@ -2375,9 +2375,8 @@ export async function initiateMigrationToGroupV2(
const { avatar: currentAvatar } = conversation.attributes;
if (currentAvatar?.path) {
const avatarData = await window.Signal.Migrations.readAttachmentData(
currentAvatar
);
const avatarData =
await window.Signal.Migrations.readAttachmentData(currentAvatar);
const { hash, key } = await uploadAvatar({
logId,
publicParams,

View file

@ -24,7 +24,7 @@ import * as log from '../logging/log';
*/
export function useIntersectionObserver(): [
(el?: Element | null) => void,
IntersectionObserverEntry | null
IntersectionObserverEntry | null,
] {
const [intersectionObserverEntry, setIntersectionObserverEntry] =
useState<IntersectionObserverEntry | null>(null);

View file

@ -32,7 +32,7 @@ export const jobManagerJobSchema = z.object({
export type JobManagerParamsType<
CoreJobType,
JobType = CoreJobType & JobManagerJobType
JobType = CoreJobType & JobManagerJobType,
> = {
markAllJobsInactive: () => Promise<void>;
getNextJobs: (options: {

View file

@ -29,9 +29,8 @@ export async function addAttachmentToMessage(
try {
if (attachment.path) {
const loaded = await window.Signal.Migrations.loadAttachmentData(
attachment
);
const loaded =
await window.Signal.Migrations.loadAttachmentData(attachment);
attachmentData = loaded.data;
}

View file

@ -271,9 +271,8 @@ const deleteSentProtoBatcher = createWaitBatcher({
log.info(
`MessageReceipts: Batching ${items.length} sent proto recipients deletes`
);
const { successfulPhoneNumberShares } = await deleteSentProtoRecipient(
items
);
const { successfulPhoneNumberShares } =
await deleteSentProtoRecipient(items);
for (const serviceId of successfulPhoneNumberShares) {
const convo = window.ConversationController.get(serviceId);

View file

@ -3134,9 +3134,8 @@ export class ConversationModel extends window.Backbone
return;
}
const hadSession = await window.textsecure.storage.protocol.hasSessionWith(
originalPni
);
const hadSession =
await window.textsecure.storage.protocol.hasSessionWith(originalPni);
if (!hadSession) {
log.info(`${logId}: not adding, no PNI session`);
@ -3948,9 +3947,8 @@ export class ConversationModel extends window.Backbone
if (!sendHQImages) {
attachmentsToSend = await Promise.all(
attachmentsToSend.map(async attachment => {
const downscaledAttachment = await downscaleOutgoingAttachment(
attachment
);
const downscaledAttachment =
await downscaleOutgoingAttachment(attachment);
if (downscaledAttachment !== attachment && attachment.path) {
drop(deleteAttachmentData(attachment.path));
}

View file

@ -2072,9 +2072,8 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
if (!messaging) {
throw new Error(`${idLog}: messaging is not available`);
}
const response = await messaging.server.getSubscriptionConfiguration(
userLanguages
);
const response =
await messaging.server.getSubscriptionConfiguration(userLanguages);
const boostBadgesByLevel = parseBoostBadgeListFromServer(
response,
updatesUrl

View file

@ -266,7 +266,7 @@ async function main() {
}
const prettierConfig = await prettier.resolveConfig(destinationPath);
const output = prettier.format(unformattedOutput, {
const output = await prettier.format(unformattedOutput, {
...prettierConfig,
filepath: destinationPath,
});

View file

@ -87,7 +87,7 @@ async function main(): Promise<void> {
join(__dirname, '..', '..', 'build')
);
const output = prettier.format(JSON.stringify(resources, null, 2), {
const output = await prettier.format(JSON.stringify(resources, null, 2), {
...prettierConfig,
filepath: resourcesPath,
});

View file

@ -81,7 +81,7 @@ async function main(): Promise<void> {
);
{
const output = prettier.format(JSON.stringify(jumbomoji, null, 2), {
const output = await prettier.format(JSON.stringify(jumbomoji, null, 2), {
...prettierConfig,
filepath: manifestPath,
});
@ -89,7 +89,7 @@ async function main(): Promise<void> {
}
{
const output = prettier.format(JSON.stringify(resources, null, 2), {
const output = await prettier.format(JSON.stringify(resources, null, 2), {
...prettierConfig,
filepath: resourcesPath,
});

View file

@ -106,7 +106,7 @@ async function main() {
delete typedValue.description;
}
delete json.smartling;
const output = prettier.format(JSON.stringify(json, null, 2), {
const output = await prettier.format(JSON.stringify(json, null, 2), {
...prettierConfig,
filepath: targetFile,
});

View file

@ -153,9 +153,8 @@ export class MessageCache {
let messageAttributesFromDatabase: MessageAttributesType | undefined;
try {
messageAttributesFromDatabase = await DataReader.getMessageById(
messageId
);
messageAttributesFromDatabase =
await DataReader.getMessageById(messageId);
} catch (err: unknown) {
log.error(
`MessageCache.resolveAttributes(${messageId}): db error ${Errors.toLogFormat(

View file

@ -385,10 +385,9 @@ export class BackupExportStream extends Readable {
try {
while (!cursor?.done) {
// eslint-disable-next-line no-await-in-loop
const { messages, cursor: newCursor } = await DataReader.pageMessages(
cursor
);
const { messages, cursor: newCursor } =
// eslint-disable-next-line no-await-in-loop
await DataReader.pageMessages(cursor);
// eslint-disable-next-line no-await-in-loop
const items = await pMap(

View file

@ -3386,9 +3386,8 @@ export class CallingClass {
// https://bugs.chromium.org/p/chromium/issues/detail?id=1287628
private async enumerateMediaDevices(): Promise<void> {
try {
const microphoneStatus = await window.IPC.getMediaAccessStatus(
'microphone'
);
const microphoneStatus =
await window.IPC.getMediaAccessStatus('microphone');
if (microphoneStatus !== 'granted') {
return;
}

View file

@ -2054,9 +2054,12 @@ export const storageServiceUploadJob = debounce(() => {
return;
}
void storageJobQueue(async () => {
await upload();
}, `upload v${window.storage.get('manifestVersion')}`);
void storageJobQueue(
async () => {
await upload();
},
`upload v${window.storage.get('manifestVersion')}`
);
}, 500);
export const runStorageServiceSyncJob = debounce(() => {
@ -2066,24 +2069,30 @@ export const runStorageServiceSyncJob = debounce(() => {
}
ourProfileKeyService.blockGetWithPromise(
storageJobQueue(async () => {
await sync();
storageJobQueue(
async () => {
await sync();
// Notify listeners about sync completion
window.Whisper.events.trigger('storageService:syncComplete');
}, `sync v${window.storage.get('manifestVersion')}`)
// Notify listeners about sync completion
window.Whisper.events.trigger('storageService:syncComplete');
},
`sync v${window.storage.get('manifestVersion')}`
)
);
}, 500);
export const addPendingDelete = (item: ExtendedStorageID): void => {
void storageJobQueue(async () => {
const storedPendingDeletes = window.storage.get(
'storage-service-pending-deletes',
[]
);
await window.storage.put('storage-service-pending-deletes', [
...storedPendingDeletes,
item,
]);
}, `addPendingDelete(${redactExtendedStorageID(item)})`);
void storageJobQueue(
async () => {
const storedPendingDeletes = window.storage.get(
'storage-service-pending-deletes',
[]
);
await window.storage.put('storage-service-pending-deletes', [
...storedPendingDeletes,
item,
]);
},
`addPendingDelete(${redactExtendedStorageID(item)})`
);
};

View file

@ -1837,7 +1837,7 @@ export async function mergeStickerPackRecord(
position:
'position' in stickerPackRecord
? stickerPackRecord.position
: localStickerPack?.position ?? undefined,
: (localStickerPack?.position ?? undefined),
storageID,
storageVersion,
storageUnknownFields,

View file

@ -395,9 +395,8 @@ export async function resolveUsernameByLink({
strictAssert(window.textsecure.server, 'WebAPI must be available');
try {
const { usernameLinkEncryptedValue } = await server.resolveUsernameLink(
serverId
);
const { usernameLinkEncryptedValue } =
await server.resolveUsernameLink(serverId);
return usernames.decryptUsernameLink({
entropy: Buffer.from(entropy),

View file

@ -687,9 +687,8 @@ function handleMessageJSON(
async function getNewerMessagesByConversation(
options: AdjacentMessagesByConversationOptionsType
): Promise<Array<MessageType>> {
const messages = await readableChannel.getNewerMessagesByConversation(
options
);
const messages =
await readableChannel.getNewerMessagesByConversation(options);
return handleMessageJSON(messages);
}
@ -709,9 +708,8 @@ async function getRecentStoryReplies(
async function getOlderMessagesByConversation(
options: AdjacentMessagesByConversationOptionsType
): Promise<Array<MessageType>> {
const messages = await readableChannel.getOlderMessagesByConversation(
options
);
const messages =
await readableChannel.getOlderMessagesByConversation(options);
return handleMessageJSON(messages);
}
@ -719,9 +717,8 @@ async function getOlderMessagesByConversation(
async function getConversationRangeCenteredOnMessage(
options: AdjacentMessagesByConversationOptionsType
): Promise<GetConversationRangeCenteredOnMessageResultType<MessageType>> {
const result = await readableChannel.getConversationRangeCenteredOnMessage(
options
);
const result =
await readableChannel.getConversationRangeCenteredOnMessage(options);
return {
...result,

View file

@ -246,7 +246,7 @@ export const StickerPackStatuses = [
'error',
] as const;
export type StickerPackStatusType = typeof StickerPackStatuses[number];
export type StickerPackStatusType = (typeof StickerPackStatuses)[number];
export type StorageServiceFieldsType = Readonly<{
storageID?: string;

View file

@ -4896,10 +4896,8 @@ function getBackupCdnObjectMetadata(
db: ReadableDB,
mediaId: string
): BackupCdnMediaObjectType | undefined {
const [
query,
params,
] = sql`SELECT * from backup_cdn_object_metadata WHERE mediaId = ${mediaId}`;
const [query, params] =
sql`SELECT * from backup_cdn_object_metadata WHERE mediaId = ${mediaId}`;
return db.prepare(query).get(params);
}

View file

@ -95,10 +95,8 @@ export default function updateToSchemaVersion91(
// Grab PNI-specific count
const [
beforeQuery,
beforeParams,
] = sql`SELECT count(*) from preKeys WHERE ourServiceId = ${pni}`;
const [beforeQuery, beforeParams] =
sql`SELECT count(*) from preKeys WHERE ourServiceId = ${pni}`;
const beforeKeys = db.prepare(beforeQuery).pluck(true).get(beforeParams);
logger.info(`updateToSchemaVersion91: Found ${beforeKeys} preKeys for PNI`);

View file

@ -94,10 +94,8 @@ export function cleanKeys(
}
// Grab PNI-specific count
const [
beforeQuery,
beforeParams,
] = sql`SELECT count(*) from ${tableName} WHERE ${idField} = ${pni}`;
const [beforeQuery, beforeParams] =
sql`SELECT count(*) from ${tableName} WHERE ${idField} = ${pni}`;
const beforeKeys = db.prepare(beforeQuery).pluck(true).get(beforeParams);
logger.info(`${logId}: Found ${beforeKeys} keys for PNI`);

View file

@ -46,7 +46,7 @@ export type QueryFragmentValue = QueryFragment | QueryTemplateParam;
export type QueryFragment = [
{ fragment: string },
ReadonlyArray<QueryTemplateParam>
ReadonlyArray<QueryTemplateParam>,
];
/**

View file

@ -209,7 +209,9 @@ export type DBConversationType = ReadonlyDeep<{
}>;
export const InteractionModes = ['mouse', 'keyboard'] as const;
export type InteractionModeType = ReadonlyDeep<typeof InteractionModes[number]>;
export type InteractionModeType = ReadonlyDeep<
(typeof InteractionModes)[number]
>;
export type MessageTimestamps = ReadonlyDeep<
Pick<MessageAttributesType, 'sent_at' | 'received_at'>
@ -227,7 +229,7 @@ export type MessageWithUIFieldsType = MessageAttributesType & {
export const ConversationTypes = ['direct', 'group'] as const;
export type ConversationTypeType = ReadonlyDeep<
typeof ConversationTypes[number]
(typeof ConversationTypes)[number]
>;
export type LastMessageType = ReadonlyDeep<

View file

@ -112,9 +112,8 @@ function allowsRepliesChanged(
allowsReplies: boolean
): ThunkAction<void, RootStateType, null, AllowRepliesChangedActionType> {
return async dispatch => {
const storyDistribution = await DataReader.getStoryDistributionWithMembers(
listId
);
const storyDistribution =
await DataReader.getStoryDistributionWithMembers(listId);
if (!storyDistribution) {
log.warn(
@ -208,9 +207,8 @@ function deleteDistributionList(
return async (dispatch, getState) => {
const deletedAtTimestamp = Date.now();
const storyDistribution = await DataReader.getStoryDistributionWithMembers(
listId
);
const storyDistribution =
await DataReader.getStoryDistributionWithMembers(listId);
if (!storyDistribution) {
log.warn('No story distribution found for id', listId);
@ -268,9 +266,8 @@ function hideMyStoriesFrom(
memberServiceIds: Array<ServiceIdString>
): ThunkAction<void, RootStateType, null, HideMyStoriesFromActionType> {
return async dispatch => {
const myStories = await DataReader.getStoryDistributionWithMembers(
MY_STORY_ID
);
const myStories =
await DataReader.getStoryDistributionWithMembers(MY_STORY_ID);
if (!myStories) {
log.error(
@ -317,9 +314,8 @@ function removeMembersFromDistributionList(
return;
}
const storyDistribution = await DataReader.getStoryDistributionWithMembers(
listId
);
const storyDistribution =
await DataReader.getStoryDistributionWithMembers(listId);
if (!storyDistribution) {
log.warn(
@ -388,9 +384,8 @@ function setMyStoriesToAllSignalConnections(): ThunkAction<
ResetMyStoriesActionType
> {
return async dispatch => {
const myStories = await DataReader.getStoryDistributionWithMembers(
MY_STORY_ID
);
const myStories =
await DataReader.getStoryDistributionWithMembers(MY_STORY_ID);
if (!myStories) {
log.error(
@ -428,9 +423,8 @@ function updateStoryViewers(
memberServiceIds: Array<ServiceIdString>
): ThunkAction<void, RootStateType, null, ViewersChangedActionType> {
return async dispatch => {
const storyDistribution = await DataReader.getStoryDistributionWithMembers(
listId
);
const storyDistribution =
await DataReader.getStoryDistributionWithMembers(listId);
if (!storyDistribution) {
log.warn(

View file

@ -799,18 +799,18 @@ export const getMessagePropsSelector = createSelector(
getSelectedMessageIds,
getDefaultConversationColor,
(
conversationSelector,
ourConversationId,
ourAci,
ourPni,
ourNumber,
regionCode,
accountSelector,
cachedConversationMemberColorsSelector,
targetedMessage,
selectedMessageIds,
defaultConversationColor
) =>
conversationSelector,
ourConversationId,
ourAci,
ourPni,
ourNumber,
regionCode,
accountSelector,
cachedConversationMemberColorsSelector,
targetedMessage,
selectedMessageIds,
defaultConversationColor
) =>
(message: MessageWithUIFieldsType) => {
const contactNameColors = cachedConversationMemberColorsSelector(
message.conversationId

View file

@ -185,9 +185,8 @@ export const SmartCallsTab = memo(function SmartCallsTab() {
if (callHistoryFilter == null) {
return 0;
}
const count = await DataReader.getCallHistoryGroupsCount(
callHistoryFilter
);
const count =
await DataReader.getCallHistoryGroupsCount(callHistoryFilter);
return count;
},
[allCallLinks, allConversations, regionCode]

View file

@ -73,7 +73,13 @@ export const SmartChatsTab = memo(function SmartChatsTab() {
) {
scrollToMessage(selectedConversationId, targetedMessageId);
}
}, [onConversationOpened, selectedConversationId, scrollToMessage, targetedMessageId, targetedMessageSource]);
}, [
onConversationOpened,
selectedConversationId,
scrollToMessage,
targetedMessageId,
targetedMessageSource,
]);
const prevConversationId = usePrevious(
selectedConversationId,

View file

@ -104,9 +104,8 @@ export const SmartInstallScreen = memo(function SmartInstallScreen() {
const hasExpired = useSelector(hasExpiredSelector);
const chooseDeviceNamePromiseWrapperRef = useRef(explodePromise<string>());
const chooseBackupFilePromiseWrapperRef = useRef(
explodePromise<File | undefined>()
);
const chooseBackupFilePromiseWrapperRef =
useRef(explodePromise<File | undefined>());
const [state, setState] = useState<StateType>(INITIAL_STATE);
const [retryCounter, setRetryCounter] = useState(0);
@ -223,8 +222,8 @@ export const SmartInstallScreen = memo(function SmartInstallScreen() {
({ deviceName, backupData: backupFileData } = window.SignalCI);
} else {
deviceName = await chooseDeviceNamePromiseWrapperRef.current.promise;
const backupFile = await chooseBackupFilePromiseWrapperRef.current
.promise;
const backupFile =
await chooseBackupFilePromiseWrapperRef.current.promise;
backupFileData = backupFile ? await fileToBytes(backupFile) : undefined;
}

View file

@ -235,7 +235,10 @@ describe('cleanDataForIpc', () => {
class Person {
public toBeDiscarded = Symbol('to be discarded');
constructor(public firstName: string, public lastName: string) {}
constructor(
public firstName: string,
public lastName: string
) {}
get name() {
return this.getName();

View file

@ -107,9 +107,8 @@ describe('Attachments', () => {
'Attachments_createWriterForNew'
);
const outputPath = await Attachments.createWriterForNew(tempDirectory)(
input
);
const outputPath =
await Attachments.createWriterForNew(tempDirectory)(input);
const output = await fse.readFile(path.join(tempDirectory, outputPath));
assert.lengthOf(outputPath, PATH_LENGTH);

View file

@ -32,7 +32,7 @@ const createMockElement = (
({
classList: new FakeTokenList([className]),
dataset,
} as unknown as HTMLElement);
}) as unknown as HTMLElement;
const createMockAtMentionElement = (
dataset: Record<string, string>

View file

@ -147,10 +147,9 @@ export class ParseContactsTransform extends Transform {
);
const hash = computeHash(data);
// eslint-disable-next-line no-await-in-loop
const local = await window.Signal.Migrations.writeNewAttachmentData(
avatarData
);
const local =
// eslint-disable-next-line no-await-in-loop
await window.Signal.Migrations.writeNewAttachmentData(avatarData);
const prepared = prepareContact(this.activeContact, {
...this.activeContact.avatar,

View file

@ -436,9 +436,8 @@ export default class OutgoingMessage {
destinationDeviceId
);
const activeSession = await sessionStore.getSession(
protocolAddress
);
const activeSession =
await sessionStore.getSession(protocolAddress);
if (!activeSession) {
throw new Error(
'OutgoingMessage.doSendMessage: No active session!'

View file

@ -25,7 +25,10 @@ class SyncRequestInner extends EventTarget {
timeoutMillis: number;
constructor(private receiver: MessageReceiver, timeoutMillis?: number) {
constructor(
private receiver: MessageReceiver,
timeoutMillis?: number
) {
super();
if (!(receiver instanceof MessageReceiver)) {

View file

@ -2510,7 +2510,7 @@ export function initialize({
}
async function _withNewCredentials<
Result extends { uuid: AciString; deviceId?: number }
Result extends { uuid: AciString; deviceId?: number },
>(
{ username: newUsername, password: newPassword }: WebAPICredentials,
callback: () => Promise<Result>

View file

@ -243,7 +243,10 @@ export type WebSocketResourceOptions = {
};
export class CloseEvent extends Event {
constructor(public readonly code: number, public readonly reason: string) {
constructor(
public readonly code: number,
public readonly reason: string
) {
super('close');
}
}

View file

@ -28,7 +28,7 @@ export type CachedAuthType = Readonly<{
}>;
export abstract class CDSBase<
Options extends CDSBaseOptionsType = CDSBaseOptionsType
Options extends CDSBaseOptionsType = CDSBaseOptionsType,
> {
protected readonly logger: LoggerType;
protected proxyAgent?: ProxyAgent;

View file

@ -39,7 +39,7 @@ const E164_BYTE_SIZE = 8;
const TRIPLE_BYTE_SIZE = UUID_BYTE_SIZE * 2 + E164_BYTE_SIZE;
export abstract class CDSSocketBase<
Options extends CDSSocketBaseOptionsType = CDSSocketBaseOptionsType
Options extends CDSSocketBaseOptionsType = CDSSocketBaseOptionsType,
> extends EventEmitter {
protected state = CDSSocketState.Open;

View file

@ -39,11 +39,14 @@ export type CDSSocketManagerBaseOptionsType = Readonly<{
export abstract class CDSSocketManagerBase<
Socket extends CDSSocketBase,
Options extends CDSSocketManagerBaseOptionsType
Options extends CDSSocketManagerBaseOptionsType,
> extends CDSBase<Options> {
private retryAfter?: number;
constructor(private readonly libsignalNet: Net.Net, options: Options) {
constructor(
private readonly libsignalNet: Net.Net,
options: Options
) {
super(options);
}

View file

@ -113,7 +113,10 @@ export class EnvelopeQueuedEvent extends Event {
export type ConfirmCallback = () => void;
export class ConfirmableEvent extends Event {
constructor(type: string, public readonly confirm: ConfirmCallback) {
constructor(
type: string,
public readonly confirm: ConfirmCallback
) {
super(type);
}
}
@ -205,7 +208,10 @@ export type SentEventData = Readonly<{
}>;
export class SentEvent extends ConfirmableEvent {
constructor(public readonly data: SentEventData, confirm: ConfirmCallback) {
constructor(
public readonly data: SentEventData,
confirm: ConfirmCallback
) {
super('sent', confirm);
}
}

View file

@ -49,9 +49,9 @@ export type ContactAvatarType =
hash?: string;
};
type GroupAvatarIconType = typeof GroupAvatarIcons[number];
type GroupAvatarIconType = (typeof GroupAvatarIcons)[number];
type PersonalAvatarIconType = typeof PersonalAvatarIcons[number];
type PersonalAvatarIconType = (typeof PersonalAvatarIcons)[number];
export type AvatarIconType = GroupAvatarIconType | PersonalAvatarIconType;

View file

@ -84,7 +84,7 @@ export namespace BodyRange {
return ('url' as const) in node;
}
export function isDisplayOnly<
T extends Mention | Link | Formatting | DisplayOnly
T extends Mention | Link | Formatting | DisplayOnly,
>(node: T): node is T & DisplayOnly {
// satisfies keyof DisplayOnly
return ('displayStyle' as const) in node;

View file

@ -82,7 +82,7 @@ export type ActiveDirectCallType = ActiveCallBaseType & {
// GroupCallRemoteParticipantType below (which is based on
// ConversationType).
serviceId?: ServiceIdString;
}
},
];
};

View file

@ -156,7 +156,7 @@ export const ContactNameColors = [
'110',
];
export type ContactNameColorType = typeof ContactNameColors[number];
export type ContactNameColorType = (typeof ContactNameColors)[number];
export type CustomColorType = {
start: { hue: number; saturation: number };
@ -164,10 +164,10 @@ export type CustomColorType = {
deg?: number;
};
export type AvatarColorType = typeof AvatarColors[number];
export type AvatarColorType = (typeof AvatarColors)[number];
export type ConversationColorType =
| typeof ConversationColors[number]
| (typeof ConversationColors)[number]
| 'custom';
export type CustomColorDataType = {

View file

@ -40,7 +40,7 @@ export type LocalizerType = {
? [params?: undefined, options?: LocalizerOptions]
: [
params: ICUStringMessageParamsByKeyType[Key],
options?: LocalizerOptions
options?: LocalizerOptions,
]
): string;
getIntl(): IntlShape;
@ -69,13 +69,13 @@ export enum ScrollBehavior {
type InternalAssertProps<
Result,
Value,
Missing = Omit<Result, keyof Value>
Missing = Omit<Result, keyof Value>,
> = keyof Missing extends never
? Result
: Result & {
[key in keyof Required<Missing>]: [
never,
'AssertProps: missing property'
'AssertProps: missing property',
];
};
@ -87,21 +87,19 @@ export type BytesToStrings<Value> = Value extends Uint8Array
? string
: { [Key in keyof Value]: BytesToStrings<Value[Key]> };
export type JSONWithUnknownFields<Value> = Value extends Record<
string | symbol | number,
unknown
>
? Readonly<
{
[Key in keyof Value]: JSONWithUnknownFields<Value[Key]>;
} & {
// Make sure that rest property is required to handle.
__rest: never;
}
>
: Value extends Array<infer E>
? ReadonlyArray<JSONWithUnknownFields<E>>
: Value;
export type JSONWithUnknownFields<Value> =
Value extends Record<string | symbol | number, unknown>
? Readonly<
{
[Key in keyof Value]: JSONWithUnknownFields<Value[Key]>;
} & {
// Make sure that rest property is required to handle.
__rest: never;
}
>
: Value extends Array<infer E>
? ReadonlyArray<JSONWithUnknownFields<E>>
: Value;
export type WithRequiredProperties<T, P extends keyof T> = Omit<T, P> &
Required<Pick<T, P>>;

View file

@ -61,9 +61,8 @@ export async function updateConversationsWithUuidLookup({
// and if not - drop it.
let finalServiceId = finalConversation.getServiceId();
if (!pairFromServer && finalServiceId) {
const doesAccountExist = await server.checkAccountExistence(
finalServiceId
);
const doesAccountExist =
await server.checkAccountExistence(finalServiceId);
if (!doesAccountExist) {
finalConversation.updateServiceId(undefined);
finalServiceId = undefined;

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
export async function awaitObject<
Result extends { [key: string]: unknown }
Result extends { [key: string]: unknown },
>(settings: {
[key in keyof Result]: Promise<Result[key]>;
}): Promise<Result> {

View file

@ -106,9 +106,8 @@ export function createIdenticon(
}
const data = new Uint8Array(arrayBuffer);
const path = await window.Signal.Migrations.writeNewPlaintextTempData(
data
);
const path =
await window.Signal.Migrations.writeNewPlaintextTempData(data);
resolve({ url, path });
});
reader.readAsArrayBuffer(blob);

View file

@ -1,9 +1,8 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
export type NullToUndefined<T> = Extract<T, null> extends never
? T
: Exclude<T, null> | undefined;
export type NullToUndefined<T> =
Extract<T, null> extends never ? T : Exclude<T, null> | undefined;
export function dropNull<T>(
value: NonNullable<T> | null | undefined

View file

@ -26,7 +26,7 @@ export type EncryptLegacyAttachmentOptionsType = Readonly<{
}>;
export async function encryptLegacyAttachment<
T extends Partial<AddressableAttachmentType>
T extends Partial<AddressableAttachmentType>,
>(attachment: T, options: EncryptLegacyAttachmentOptionsType): Promise<T> {
// Not downloaded
if (!attachment.path) {

View file

@ -18,7 +18,7 @@
*/
export function makeEnumParser<
TEnumKey extends string,
TEnumValue extends string
TEnumValue extends string,
>(
enumToParse: Record<TEnumKey, TEnumValue>,
defaultValue: TEnumValue

View file

@ -95,9 +95,8 @@ export async function getSendOptions(
const { e164, serviceId } = conversationAttrs;
const senderCertificate = await getSenderCertificateForDirectConversation(
conversationAttrs
);
const senderCertificate =
await getSenderCertificateForDirectConversation(conversationAttrs);
// If we've never fetched user's profile, we default to what we have
if (sealedSender === SEALED_SENDER.UNKNOWN || story) {

View file

@ -313,7 +313,10 @@ class TakeIterable<T> implements Iterable<T> {
}
class TakeIterator<T> implements Iterator<T> {
constructor(private readonly iterator: Iterator<T>, private amount: number) {}
constructor(
private readonly iterator: Iterator<T>,
private amount: number
) {}
next(): IteratorResult<T> {
const nextIteration = this.iterator.next();

View file

@ -3333,14 +3333,14 @@
{
"rule": "React-useRef",
"path": "ts/state/smart/InstallScreen.tsx",
"line": " const chooseBackupFilePromiseWrapperRef = useRef(",
"line": " const chooseDeviceNamePromiseWrapperRef = useRef(explodePromise<string>());",
"reasonCategory": "testCode",
"updated": "2023-11-16T23:39:21.322Z"
},
{
"rule": "React-useRef",
"path": "ts/state/smart/InstallScreen.tsx",
"line": " const chooseDeviceNamePromiseWrapperRef = useRef(explodePromise<string>());",
"line": " useRef(explodePromise<File | undefined>());",
"reasonCategory": "usageTrusted",
"updated": "2021-12-06T23:07:28.947Z",
"reasonDetail": "Doesn't touch the DOM."

View file

@ -3,7 +3,7 @@
export function objectMap<T>(
obj: Record<string, T>,
f: (key: keyof typeof obj, value: typeof obj[keyof typeof obj]) => unknown
f: (key: keyof typeof obj, value: (typeof obj)[keyof typeof obj]) => unknown
): Array<unknown> {
const keys: Array<keyof typeof obj> = Object.keys(obj);
return keys.map(key => f(key, obj[key]));

View file

@ -70,7 +70,7 @@ function getUpdaterName<Key extends keyof EphemeralSettings>(
export function createSetting<
Name extends keyof SettingsValuesType,
Value extends SettingsValuesType[Name]
Value extends SettingsValuesType[Name],
>(name: Name, overrideOptions: SettingOptionsType = {}): SettingType<Value> {
const options = {
getter: true,
@ -96,12 +96,12 @@ export function createSetting<
type UnwrapReturn<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Callback extends (...args: Array<any>) => unknown
Callback extends (...args: Array<any>) => unknown,
> = UnwrapPromise<ReturnType<Callback>>;
export function createCallback<
Name extends keyof IPCEventsCallbacksType,
Callback extends IPCEventsCallbacksType[Name]
Callback extends IPCEventsCallbacksType[Name],
>(
name: Name
): (...args: Parameters<Callback>) => Promise<UnwrapReturn<Callback>> {

View file

@ -129,9 +129,8 @@ export async function sendToGroup({
// First, do the attachment upload and prepare the proto we'll be sending
const protoAttributes =
window.textsecure.messaging.getAttrsFromGroupOptions(groupSendOptions);
const contentMessage = await window.textsecure.messaging.getContentMessage(
protoAttributes
);
const contentMessage =
await window.textsecure.messaging.getContentMessage(protoAttributes);
// Attachment upload might take too long to succeed - we don't want to proceed
// with the send if the caller aborted this call.

View file

@ -64,7 +64,7 @@ export function createCachedIntl(
}
function normalizeSubstitutions<
Substitutions extends Record<string, string | number | Date> | undefined
Substitutions extends Record<string, string | number | Date> | undefined,
>(
substitutions?: Substitutions,
options?: LocalizerOptions
@ -122,7 +122,7 @@ export function setupI18n(
});
const localizer: LocalizerType = (<
Key extends keyof ICUStringMessageParamsByKeyType
Key extends keyof ICUStringMessageParamsByKeyType,
>(
key: Key,
substitutions: ICUStringMessageParamsByKeyType[Key],

View file

@ -40,7 +40,7 @@ const SignalRouteHostnames = [
* Type to help maintain {@link SignalRouteHostnames}, real hostnames should go there.
*/
type AllHostnamePatterns =
| typeof SignalRouteHostnames[number]
| (typeof SignalRouteHostnames)[number]
| 'verify'
| 'linkdevice'
| 'addstickers'
@ -66,7 +66,7 @@ type PatternInput = {
type URLMatcher = (input: URL) => URLPatternResult | null;
function _pattern(
protocol: typeof SignalRouteProtocols[number],
protocol: (typeof SignalRouteProtocols)[number],
hostname: AllHostnamePatterns,
pathname: PatternString,
init: PatternInput
@ -585,7 +585,7 @@ strictAssert(
* ```
*/
export type ParsedSignalRoute = NonNullable<
ReturnType<typeof _allSignalRoutes[number]['fromUrl']>
ReturnType<(typeof _allSignalRoutes)[number]['fromUrl']>
>;
/** @internal */