lint: stricter linting rules

This commit is contained in:
Adhiraj Singh
2022-03-01 16:32:14 +05:30
parent c00c3da313
commit de7d1002a9
39 changed files with 534 additions and 526 deletions

View File

@@ -13,10 +13,10 @@ export type SignalIdentity = {
identifierKey: Uint8Array
}
export type LTHashState = {
export type LTHashState = {
version: number
hash: Buffer
indexValueMap: {
indexValueMap: {
[indexMacBase64: string]: { valueMac: Uint8Array | Buffer }
}
}
@@ -30,7 +30,7 @@ export type SignalCreds = {
export type AuthenticationCreds = SignalCreds & {
readonly noiseKey: KeyPair
readonly advSecretKey: string
me?: Contact
account?: proto.IADVSignedDeviceIdentity
signalIdentities?: SignalIdentity[]

View File

@@ -10,7 +10,7 @@ export interface PresenceData {
lastSeen?: number
}
export type ChatMutation = {
export type ChatMutation = {
syncAction: proto.ISyncActionData
index: string[]
}
@@ -32,14 +32,14 @@ export type Chat = Omit<proto.IConversation, 'messages'> & {
pin?: number | null
archive?: boolean
}
/**
/**
* the last messages in a chat, sorted reverse-chronologically
* for MD modifications, the last message in the array must be the last message recv in the chat
* */
export type LastMessageList = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>[]
export type ChatModification =
{
export type ChatModification =
{
archive: boolean
lastMessages: LastMessageList
} |
@@ -54,11 +54,11 @@ export type ChatModification =
clear: 'all' | { messages: {id: string, fromMe?: boolean}[] }
} |
{
star: {
star: {
messages: { id: string, fromMe?: boolean }[],
star: boolean
}
} |
} |
{
markRead: boolean
lastMessages: LastMessageList

View File

@@ -24,15 +24,15 @@ export type BaileysEventMap<T> = {
/** delete chats with given ID */
'chats.delete': string[]
/** presence of contact in a chat updated */
'presence.update': { id: string, presences: { [participant: string]: PresenceData } }
'presence.update': { id: string, presences: { [participant: string]: PresenceData } }
'contacts.upsert': Contact[]
'contacts.update': Partial<Contact>[]
'contacts.update': Partial<Contact>[]
'messages.delete': { keys: WAMessageKey[] } | { jid: string, all: true }
'messages.update': WAMessageUpdate[]
/**
* add/update the given messages. If they were received while the connection was online,
/**
* add/update the given messages. If they were received while the connection was online,
* the update will have type: "notify"
* */
'messages.upsert': { messages: WAMessage[], type: MessageUpdateType }

View File

@@ -25,7 +25,7 @@ export type MessageType = keyof proto.Message
export type DownloadableMessage = { mediaKey?: Uint8Array, directPath?: string, url?: string }
export type MediaConnInfo = {
auth: string
auth: string
ttl: number
hosts: { hostname: string, maxContentLengthBytes: number }[]
fetchDate: Date
@@ -77,7 +77,7 @@ export type AnyMediaMessageContent = (
image: WAMediaUpload
caption?: string
jpegThumbnail?: string
} & Mentionable & Buttonable & Templatable & WithDimensions) |
} & Mentionable & Buttonable & Templatable & WithDimensions) |
({
video: WAMediaUpload
caption?: string
@@ -95,22 +95,22 @@ export type AnyMediaMessageContent = (
document: WAMediaUpload
mimetype: string
fileName?: string
} & Buttonable & Templatable)) &
} & Buttonable & Templatable)) &
{ mimetype?: string }
export type AnyRegularMessageContent = (
({
text: string
}
& Mentionable & Buttonable & Templatable & Listable) |
AnyMediaMessageContent |
}
& Mentionable & Buttonable & Templatable & Listable) |
AnyMediaMessageContent |
{
contacts: {
displayName?: string
contacts: proto.IContactMessage[]
}
} |
{
} |
{
location: WALocationMessage
}
) & ViewOnce
@@ -120,7 +120,7 @@ export type AnyMessageContent = AnyRegularMessageContent | {
force?: boolean
} | {
delete: WAMessageKey
} | {
} | {
disappearingMessagesInChat: boolean | number
}

View File

@@ -1,8 +1,8 @@
export type CatalogResult = {
data: {
paging: { cursors: { before: string, after: string } },
data: any[]
data: {
paging: { cursors: { before: string, after: string } },
data: any[]
}
}

View File

@@ -12,7 +12,7 @@ export type CommonSocketConfig<T> = {
/** provide an auth state object to maintain the auth state */
auth?: T
/** the WS url to connect to WA */
waWebSocketUrl: string | URL
waWebSocketUrl: string | URL
/** Fails the connection if the socket times out in this interval */
connectTimeoutMs: number
/** Default timeout for queries, undefined for no timeout */

View File

@@ -21,5 +21,5 @@ export type ConnectionState = {
phoneConnected: boolean
user?: Contact
}
}

View File

@@ -19,8 +19,8 @@ export type SocketConfig = CommonSocketConfig<AuthenticationState> & {
userDevicesCache?: NodeCache
/** map to store the retry counts for failed messages */
msgRetryCounterMap?: { [msgId: string]: number }
/**
* fetch a message from your store
/**
* fetch a message from your store
* implement this so that messages failed to send (solves the "this message can take a while" issue) can be retried
* */
getMessage: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>
@@ -53,15 +53,15 @@ export type WABusinessHoursConfig = {
export type WABusinessProfile = {
description: string
email: string
business_hours: {
business_hours: {
timezone?: string
config?: WABusinessHoursConfig[]
config?: WABusinessHoursConfig[]
business_config?: WABusinessHoursConfig[]
}
website: string[]
categories: {
id: string
localized_display_name: string
localized_display_name: string
}[]
wid?: string
}