From 34f8f60d319f9dcb84cc8707261b9fe6355db723 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Tue, 21 Feb 2023 11:49:59 +0530 Subject: [PATCH] chore: lint --- .eslintignore | 3 ++- jest.config.js | 12 ++++++------ package.json | 4 ++-- src/Types/Chat.ts | 2 +- src/Types/Events.ts | 2 +- src/Types/GroupMetadata.ts | 2 +- src/Types/Message.ts | 2 +- src/Types/Product.ts | 2 +- src/Types/Socket.ts | 12 ++++++------ src/Types/index.ts | 2 +- src/Utils/generics.ts | 2 +- 11 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.eslintignore b/.eslintignore index aa07640..8ad1369 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,4 +4,5 @@ coverage *.lock .eslintrc.json src/WABinary/index.ts -WAProto \ No newline at end of file +WAProto +WASignalGroup \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index af9e3d4..09eb9af 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,11 +1,11 @@ module.exports = { - "roots": [ - "/src" + 'roots': [ + '/src' ], - "testMatch": [ - "**/Tests/test.*.+(ts|tsx|js)", + 'testMatch': [ + '**/Tests/test.*.+(ts|tsx|js)', ], - "transform": { - "^.+\\.(ts|tsx)$": "ts-jest" + 'transform': { + '^.+\\.(ts|tsx)$': 'ts-jest' }, } \ No newline at end of file diff --git a/package.json b/package.json index 07f6235..88ade39 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "build:tsc": "tsc", "example": "node --inspect -r ts-node/register Example/example.ts", "gen:protobuf": "sh WAProto/GenerateStatics.sh", - "lint": "eslint ./src --ext .js,.ts,.jsx,.tsx", - "lint:fix": "eslint ./src --fix --ext .js,.ts,.jsx,.tsx" + "lint": "eslint . --ext .js,.ts,.jsx,.tsx", + "lint:fix": "eslint . --fix --ext .js,.ts,.jsx,.tsx" }, "author": "Adhiraj Singh", "license": "MIT", diff --git a/src/Types/Chat.ts b/src/Types/Chat.ts index cd29cba..ae21813 100644 --- a/src/Types/Chat.ts +++ b/src/Types/Chat.ts @@ -74,7 +74,7 @@ export type ChatModification = } | { star: { - messages: { id: string, fromMe?: boolean }[], + messages: { id: string, fromMe?: boolean }[] star: boolean } } diff --git a/src/Types/Events.ts b/src/Types/Events.ts index 4e1866e..e4fc942 100644 --- a/src/Types/Events.ts +++ b/src/Types/Events.ts @@ -73,7 +73,7 @@ export type BufferedEventData = { messageUpdates: { [key: string]: WAMessageUpdate } messageDeletes: { [key: string]: WAMessageKey } messageReactions: { [key: string]: { key: WAMessageKey, reactions: proto.IReaction[] } } - messageReceipts: { [key: string]: { key: WAMessageKey, userReceipt: proto.IUserReceipt[] } }, + messageReceipts: { [key: string]: { key: WAMessageKey, userReceipt: proto.IUserReceipt[] } } groupUpdates: { [jid: string]: Partial } } diff --git a/src/Types/GroupMetadata.ts b/src/Types/GroupMetadata.ts index 8a47fc7..15eb69b 100644 --- a/src/Types/GroupMetadata.ts +++ b/src/Types/GroupMetadata.ts @@ -1,6 +1,6 @@ import { Contact } from './Contact' -export type GroupParticipant = (Contact & { isAdmin?: boolean; isSuperAdmin?: boolean, admin?: 'admin' | 'superadmin' | null }) +export type GroupParticipant = (Contact & { isAdmin?: boolean, isSuperAdmin?: boolean, admin?: 'admin' | 'superadmin' | null }) export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' diff --git a/src/Types/Message.ts b/src/Types/Message.ts index df73695..1c26edf 100644 --- a/src/Types/Message.ts +++ b/src/Types/Message.ts @@ -146,7 +146,7 @@ export type AnyRegularMessageContent = ( listReply: Omit } | { - product: WASendableProduct, + product: WASendableProduct businessOwnerJid?: string body?: string footer?: string diff --git a/src/Types/Product.ts b/src/Types/Product.ts index 4fcb0fc..159416a 100644 --- a/src/Types/Product.ts +++ b/src/Types/Product.ts @@ -2,7 +2,7 @@ import { WAMediaUpload } from './Message' export type CatalogResult = { data: { - paging: { cursors: { before: string, after: string } }, + paging: { cursors: { before: string, after: string } } data: any[] } } diff --git a/src/Types/Socket.ts b/src/Types/Socket.ts index b43d539..1627f07 100644 --- a/src/Types/Socket.ts +++ b/src/Types/Socket.ts @@ -15,21 +15,21 @@ export type SocketConfig = { /** the WS url to connect to WA */ waWebSocketUrl: string | URL /** Fails the connection if the socket times out in this interval */ - connectTimeoutMs: number + connectTimeoutMs: number /** Default timeout for queries, undefined for no timeout */ defaultQueryTimeoutMs: number | undefined /** ping-pong interval for WS connection */ keepAliveIntervalMs: number /** proxy agent */ - agent?: Agent + agent?: Agent /** pino logger */ - logger: Logger + logger: Logger /** version to connect with */ version: WAVersion /** override browser config */ - browser: WABrowserDescription - /** agent used for fetch requests -- uploading/downloading media */ - fetchAgent?: Agent + browser: WABrowserDescription + /** agent used for fetch requests -- uploading/downloading media */ + fetchAgent?: Agent /** should the QR be printed in the terminal */ printQRInTerminal: boolean /** should events be emitted for actions done by this socket connection */ diff --git a/src/Types/index.ts b/src/Types/index.ts index 78ea6f4..57ca635 100644 --- a/src/Types/index.ts +++ b/src/Types/index.ts @@ -52,4 +52,4 @@ export type WABusinessProfile = { address?: string } -export type CurveKeyPair = { private: Uint8Array; public: Uint8Array } \ No newline at end of file +export type CurveKeyPair = { private: Uint8Array, public: Uint8Array } \ No newline at end of file diff --git a/src/Utils/generics.ts b/src/Utils/generics.ts index 7e5ee28..f195f09 100644 --- a/src/Utils/generics.ts +++ b/src/Utils/generics.ts @@ -136,7 +136,7 @@ export const delayCancellable = (ms: number) => { return { delay, cancel } } -export async function promiseTimeout(ms: number | undefined, promise: (resolve: (v?: T)=>void, reject: (error) => void) => void) { +export async function promiseTimeout(ms: number | undefined, promise: (resolve: (v?: T) => void, reject: (error) => void) => void) { if(!ms) { return new Promise(promise) }