client: fix all new linter errros

This commit is contained in:
Reto Brunner 2024-05-02 08:21:51 +02:00
commit 3259ac596d
36 changed files with 76 additions and 78 deletions

View file

@ -7,7 +7,6 @@ import path from "path";
import Auth from "./plugins/auth";
import Client, {UserConfig} from "./client";
import Config from "./config";
import {NetworkConfig} from "./models/network";
import WebPush from "./plugins/webpush";
import log from "./log";
import {Server} from "./server";
@ -185,7 +184,6 @@ class ClientManager {
mode: 0o600,
});
} catch (e: any) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
log.error(`Failed to create user ${colors.green(name)} (${e})`);
throw e;
}
@ -253,7 +251,6 @@ class ClientManager {
return callback ? callback() : true;
} catch (e: any) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
log.error(`Failed to update user ${colors.green(client.name)} (${e})`);
if (callback) {
@ -287,7 +284,6 @@ class ClientManager {
const data = fs.readFileSync(userPath, "utf-8");
return JSON.parse(data) as UserConfig;
} catch (e: any) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
log.error(`Failed to read user ${colors.bold(name)}: ${e}`);
}

View file

@ -3,7 +3,7 @@ import log from "../../log";
import Helper from "../../helper";
import type {AuthHandler} from "../auth";
const localAuth: AuthHandler = (manager, client, user, password, callback) => {
const localAuth: AuthHandler = (_manager, client, user, password, callback) => {
// If no user is found, or if the client has not provided a password,
// fail the authentication straight away
if (!client || !password) {
@ -40,7 +40,6 @@ const localAuth: AuthHandler = (manager, client, user, password, callback) => {
callback(matching);
})
.catch((error) => {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
log.error(`Error while checking users password. Error: ${error}`);
});
};

View file

@ -95,7 +95,6 @@ function generate() {
// Set notAfter 100 years into the future just in case
// the server actually validates this field
cert.validity.notAfter = new Date();
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 100);
const attrs = [

View file

@ -29,6 +29,7 @@ export default (app: express.Application) => {
const compiler = webpack(webpackConfig);
app.use(
// eslint-disable-next-line @typescript-eslint/no-misused-promises
webpackDevMiddleware(compiler, {
index: "/",
publicPath: webpackConfig.output?.publicPath,

View file

@ -6,6 +6,7 @@ import Msg from "../../models/msg";
import Client from "../../client";
import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["mute", "unmute"];
const allowDisconnected = true;
@ -25,7 +26,7 @@ function args_to_channels(network: Network, args: string[]) {
}
function change_mute_state(client: Client, target: Chan, valueToSet: boolean) {
if (target.type === "special") {
if (target.type === ChanType.SPECIAL) {
return;
}

View file

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/restrict-plus-operands */
import _ from "lodash";
import {IrcEventHandler} from "../../client";

View file

@ -79,7 +79,6 @@ export default <IrcEventHandler>function (irc, network) {
type: MessageType.CTCP_REQUEST,
time: data.time,
from: new User({nick: target}),
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
hostmask: data.ident + "@" + data.hostname,
ctcpMessage: data.message,
});

View file

@ -58,7 +58,6 @@ export default <IrcEventHandler>function (irc, network) {
if (irc.connection.registered === false) {
const nickLen = parseInt(network.irc.network.options.NICKLEN, 10) || 16;
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
const random = (data.nick || irc.user.nick) + Math.floor(Math.random() * 10);
// Safeguard nick changes up to allowed length

View file

@ -35,7 +35,6 @@ export default <IrcEventHandler>function (irc, network) {
const msg = new Msg({
type: MessageType.MODE_CHANNEL,
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
text: `${data.raw_modes} ${data.raw_params.join(" ")}`,
});
targetChan.pushMessage(client, msg);

View file

@ -14,7 +14,6 @@ export default <IrcEventHandler>function (irc, network) {
const lobby = network.getLobby();
const msg = new Msg({
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
text: `You're now known as ${data.new_nick}`,
});
lobby.pushMessage(client, msg, true);

View file

@ -11,7 +11,6 @@ export default <IrcEventHandler>function (irc, network) {
const msg = new Msg({
type: MessageType.LOGIN,
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
text: "Logged in as: " + data.account,
});
lobby.pushMessage(client, msg, true);

View file

@ -44,7 +44,6 @@ export default <IrcEventHandler>function (irc, network) {
if (data.error) {
msg = new Msg({
type: MessageType.ERROR,
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
text: "No such nick: " + data.nick,
});
} else {

View file

@ -223,7 +223,6 @@ class Uploader {
try {
fs.mkdirSync(destDir, {recursive: true});
} catch (err: any) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
log.error(`Error ensuring ${destDir} exists for uploads: ${err.message}`);
return abortWithError(err);
@ -324,7 +323,6 @@ class Uploader {
return "application/octet-stream";
} catch (e: any) {
if (e.code !== "ENOENT") {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
log.warn(`Failed to read ${filePath}: ${e.message}`);
}
}