diff --git a/src/command-line/install.ts b/src/command-line/install.ts index eb299e2a..161f7108 100644 --- a/src/command-line/install.ts +++ b/src/command-line/install.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import log from "../log"; import colors from "chalk"; import semver from "semver"; @@ -5,6 +6,13 @@ import Helper from "../helper"; import Config from "../config"; import Utils from "./utils"; import {Command} from "commander"; +import {FullMetadata} from "package-json"; + +type CustomMetadata = FullMetadata & { + thelounge: { + supports: string; + }; +}; const program = new Command("install"); program @@ -50,7 +58,7 @@ program } readFile - .then((json) => { + .then((json: CustomMetadata) => { const humanVersion = isLocalFile ? packageName : `${json.name} v${json.version}`; if (!("thelounge" in json)) { diff --git a/src/command-line/users/list.ts b/src/command-line/users/list.ts index 90e33787..d81bdb42 100644 --- a/src/command-line/users/list.ts +++ b/src/command-line/users/list.ts @@ -8,9 +8,8 @@ program .usage("list") .description("List all users") .on("--help", Utils.extraHelp) - .action(function () { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const ClientManager = require("../../clientManager"); + .action(async function () { + const ClientManager = (await import("../../clientManager")).default; const users = new ClientManager().getUsers(); if (users === undefined) { diff --git a/src/plugins/inputs/index.ts b/src/plugins/inputs/index.ts index 6d333b6a..6d210e7a 100644 --- a/src/plugins/inputs/index.ts +++ b/src/plugins/inputs/index.ts @@ -1,4 +1,5 @@ import Client from "../../client"; +import log from "../../log"; import Chan, {Channel} from "../../models/chan"; import Network, {NetworkWithIrcFramework} from "../../models/network"; import {PackageInfo} from "../packages"; @@ -59,19 +60,23 @@ const builtInInputs = [ ]; for (const input of builtInInputs) { - import(`./${input}`).then( - (plugin: { - default: { - commands: string[]; - input: (network: Network, chan: Chan, cmd: string, args: string[]) => void; - allowDisconnected?: boolean; - }; - }) => { - plugin.default.commands.forEach((command: string) => - userInputs.set(command, plugin.default) - ); - } - ); + import(`./${input}`) + .then( + (plugin: { + default: { + commands: string[]; + input: (network: Network, chan: Chan, cmd: string, args: string[]) => void; + allowDisconnected?: boolean; + }; + }) => { + plugin.default.commands.forEach((command: string) => + userInputs.set(command, plugin.default) + ); + } + ) + .catch((err) => { + log.error(err); + }); } // .reduce(async function (plugins, name) { diff --git a/test/fixtures/.thelounge/sts-policies.json b/test/fixtures/.thelounge/sts-policies.json index 528a227c..228b77d0 100644 --- a/test/fixtures/.thelounge/sts-policies.json +++ b/test/fixtures/.thelounge/sts-policies.json @@ -3,6 +3,6 @@ "host": "irc.example.com", "port": 7000, "duration": 3600, - "expires": 1654033556780 + "expires": 1654033745673 } ] diff --git a/test/models/network.ts b/test/models/network.ts index 264250c4..c5a21359 100644 --- a/test/models/network.ts +++ b/test/models/network.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-empty-function */ "use strict"; import {expect} from "chai";