From 084dc0be08555891cad4c2bb984822a62ec5ec9f Mon Sep 17 00:00:00 2001
From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com>
Date: Fri, 20 Jan 2023 18:10:47 +1100
Subject: Add ESLint (#941)
* Add eslint, switch to lint-staged for precommit
* Fix all ESLint errors
* Update GH workflow to check prettier and eslint
---
src/gateway/util/Constants.ts | 1 +
src/gateway/util/Send.ts | 4 ++--
src/gateway/util/WebSocket.ts | 8 ++++----
3 files changed, 7 insertions(+), 6 deletions(-)
(limited to 'src/gateway/util')
diff --git a/src/gateway/util/Constants.ts b/src/gateway/util/Constants.ts
index cc67ed0f..cb60005c 100644
--- a/src/gateway/util/Constants.ts
+++ b/src/gateway/util/Constants.ts
@@ -64,6 +64,7 @@ export enum CLOSECODES {
export interface Payload {
op: OPCODES /* | VoiceOPCodes */;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
d?: any;
s?: number;
t?: string;
diff --git a/src/gateway/util/Send.ts b/src/gateway/util/Send.ts
index 1ca143b6..a89d92d7 100644
--- a/src/gateway/util/Send.ts
+++ b/src/gateway/util/Send.ts
@@ -16,7 +16,7 @@
along with this program. If not, see .
*/
-var erlpack: any;
+let erlpack: { pack: (data: Payload) => Buffer };
try {
erlpack = require("@yukikaze-bot/erlpack");
} catch (error) {
@@ -63,7 +63,7 @@ export function Send(socket: WebSocket, data: Payload) {
return;
}
- socket.send(buffer, (err: any) => {
+ socket.send(buffer, (err) => {
if (err) return rej(err);
return res(null);
});
diff --git a/src/gateway/util/WebSocket.ts b/src/gateway/util/WebSocket.ts
index d4a4b8b3..14917f21 100644
--- a/src/gateway/util/WebSocket.ts
+++ b/src/gateway/util/WebSocket.ts
@@ -16,7 +16,7 @@
along with this program. If not, see .
*/
-import { Intents, Permissions } from "@fosscord/util";
+import { Intents, ListenEventOpts, Permissions } from "@fosscord/util";
import WS from "ws";
import { Deflate, Inflate } from "fast-zlib";
// import { Client } from "@fosscord/webrtc";
@@ -37,8 +37,8 @@ export interface WebSocket extends WS {
intents: Intents;
sequence: number;
permissions: Record;
- events: Record;
- member_events: Record;
- listen_options: any;
+ events: Record unknown)>;
+ member_events: Record unknown>;
+ listen_options: ListenEventOpts;
// client?: Client;
}
--
cgit 1.5.1