feature: Adds eslint rules.
This commit is contained in:
parent
57a82a15e9
commit
abc60691c6
26 changed files with 123 additions and 94 deletions
|
@ -55,7 +55,7 @@ function parseBackendProviderString(data: string): BackendParsedProviderString {
|
|||
|
||||
if (typeof jsonData.ip != "string")
|
||||
throw new Error("IP field is not a string");
|
||||
|
||||
|
||||
if (typeof jsonData.port != "number") throw new Error("Port is not a number");
|
||||
|
||||
if (
|
||||
|
@ -63,7 +63,7 @@ function parseBackendProviderString(data: string): BackendParsedProviderString {
|
|||
typeof jsonData.publicPort != "number"
|
||||
)
|
||||
throw new Error("(optional field) Proxied port is not a number");
|
||||
|
||||
|
||||
if (
|
||||
typeof jsonData.isProxied != "undefined" &&
|
||||
typeof jsonData.isProxied != "boolean"
|
||||
|
@ -216,7 +216,7 @@ export class PassyFireBackendProvider implements BackendBaseClass {
|
|||
static checkParametersBackendInstance(data: string): ParameterReturnedValue {
|
||||
try {
|
||||
parseBackendProviderString(data);
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error: We write the function, and we know we're returning an error
|
||||
} catch (e: Error) {
|
||||
return {
|
||||
success: false,
|
||||
|
|
|
@ -69,7 +69,7 @@ export function route(instance: PassyFireBackendProvider) {
|
|||
},
|
||||
},
|
||||
(req, res) => {
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error: Fastify routes schema parsing is trustworthy, so we can "assume" invalid types
|
||||
const body: {
|
||||
username: string;
|
||||
password: string;
|
||||
|
@ -115,7 +115,7 @@ export function route(instance: PassyFireBackendProvider) {
|
|||
},
|
||||
},
|
||||
async (req, res) => {
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error: Fastify routes schema parsing is trustworthy, so we can "assume" invalid types
|
||||
const body: {
|
||||
token: string;
|
||||
} = req.body;
|
||||
|
@ -132,8 +132,7 @@ export function route(instance: PassyFireBackendProvider) {
|
|||
req.hostname.indexOf(":") + 1,
|
||||
);
|
||||
|
||||
// @ts-expect-error
|
||||
// parseInt(...) can take a number just fine, at least in Node.JS
|
||||
// @ts-expect-error: parseInt(...) can take a number just fine, at least in Node.JS
|
||||
const port = parseInt(unparsedPort == "" ? proxiedPort : unparsedPort);
|
||||
|
||||
// This protocol is so confusing. I'm sorry.
|
||||
|
|
|
@ -14,7 +14,7 @@ function authenticateSocket(
|
|||
ws: WebSocket,
|
||||
message: string,
|
||||
state: ConnectedClientExt,
|
||||
): Boolean {
|
||||
): boolean {
|
||||
if (!message.startsWith("Accept: ")) {
|
||||
ws.send("400 Bad Request");
|
||||
return false;
|
||||
|
@ -57,8 +57,8 @@ export function requestHandler(
|
|||
let state: "authentication" | "data" = "authentication";
|
||||
let socket: dgram.Socket | net.Socket | undefined;
|
||||
|
||||
// @ts-expect-error
|
||||
let connectedClient: ConnectedClientExt = {};
|
||||
// @ts-expect-error: FIXME because this is a mess
|
||||
const connectedClient: ConnectedClientExt = {};
|
||||
|
||||
ws.on("close", () => {
|
||||
instance.clients.splice(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue