mirror of
https://github.com/thelounge/thelounge.git
synced 2026-03-14 14:35:50 +01:00
client: fix all new linter errros
This commit is contained in:
parent
3fbbc39cd6
commit
3259ac596d
36 changed files with 76 additions and 78 deletions
|
|
@ -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}`);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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}`);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
import _ from "lodash";
|
||||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue