From 5d5e99cae30aeeeeb160cad470b557f32455da2b Mon Sep 17 00:00:00 2001 From: Christian Paul <christianp@matrix.org> Date: Wed, 2 Dec 2020 13:09:13 +0100 Subject: [PATCH] Remove tslint-disable for no-magic-numbers --- src/matrixcommandhandler.ts | 2 -- src/matrixroomhandler.ts | 2 -- src/metrics.ts | 2 -- test/test_channelsyncroniser.ts | 2 -- test/test_discordcommandhandler.ts | 1 - tools/ghostfix.ts | 2 -- 6 files changed, 11 deletions(-) diff --git a/src/matrixcommandhandler.ts b/src/matrixcommandhandler.ts index 2de594d..56fbc67 100644 --- a/src/matrixcommandhandler.ts +++ b/src/matrixcommandhandler.ts @@ -26,11 +26,9 @@ import { IRoomStoreEntry } from "./db/roomstore"; import * as markdown from "marked"; const log = new Log("MatrixCommandHandler"); -/* tslint:disable:no-magic-numbers */ const PROVISIONING_DEFAULT_POWER_LEVEL = 50; const PROVISIONING_DEFAULT_USER_POWER_LEVEL = 0; const ROOM_CACHE_MAXAGE_MS = 15 * 60 * 1000; -/* tslint:enable:no-magic-numbers */ export class MatrixCommandHandler { private botJoinedRooms: Set<string> = new Set(); // roomids diff --git a/src/matrixroomhandler.ts b/src/matrixroomhandler.ts index ecbc30a..b52ac31 100644 --- a/src/matrixroomhandler.ts +++ b/src/matrixroomhandler.ts @@ -26,7 +26,6 @@ import { DbRoomStore, MatrixStoreRoom, RemoteStoreRoom } from "./db/roomstore"; import { Appservice, Intent, IApplicationServiceProtocol } from "matrix-bot-sdk"; const ICON_URL = "https://matrix.org/_matrix/media/r0/download/matrix.org/mlxoESwIsTbJrfXyAAogrNxA"; -/* tslint:disable:no-magic-numbers */ const HTTP_UNSUPPORTED = 501; const ROOM_NAME_PARTS = 2; const PROVISIONING_DEFAULT_POWER_LEVEL = 50; @@ -43,7 +42,6 @@ const JOIN_ROOM_SCHEDULE = [ 300000, // 5 minutes 900000, // 15 minutes ]; -/* tslint:enable:no-magic-numbers */ export class MatrixRoomHandler { private botUserId: string; diff --git a/src/metrics.ts b/src/metrics.ts index 785096b..f11513b 100644 --- a/src/metrics.ts +++ b/src/metrics.ts @@ -73,11 +73,9 @@ export class PrometheusBridgeMetrics implements IBridgeMetrics { // TODO: Bind this for every user. this.httpServer = http.createServer((req, res) => { if (req.method !== "GET" || req.url !== "/metrics") { - // tslint:disable-next-line:no-magic-numbers res.writeHead(404, "Not found"); res.end(); } - // tslint:disable-next-line:no-magic-numbers res.writeHead(200, "OK", {"Content-Type": promClient.register.contentType}); res.write(promClient.register.metrics()); res.end(); diff --git a/test/test_channelsyncroniser.ts b/test/test_channelsyncroniser.ts index f75d6d2..a98045b 100644 --- a/test/test_channelsyncroniser.ts +++ b/test/test_channelsyncroniser.ts @@ -214,9 +214,7 @@ describe("ChannelSyncroniser", () => { const {channelSync} = CreateChannelSync(testStore); const chans = await channelSync.GetRoomIdsFromChannel(chan as any); - /* tslint:disable:no-magic-numbers */ expect(chans.length).equals(2); - /* tslint:enable:no-magic-numbers */ expect(chans[0]).equals("!1:localhost"); expect(chans[1]).equals("!2:localhost"); }); diff --git a/test/test_discordcommandhandler.ts b/test/test_discordcommandhandler.ts index 82aac32..99734af 100644 --- a/test/test_discordcommandhandler.ts +++ b/test/test_discordcommandhandler.ts @@ -97,7 +97,6 @@ describe("DiscordCommandHandler", () => { member, }; await handler.Process(message); - // tslint:disable-next-line:no-magic-numbers expect(bridge.botIntent.underlyingClient.wasCalled("kickUser")).to.equal(2); }); it("will deny permission", async () => { diff --git a/tools/ghostfix.ts b/tools/ghostfix.ts index 88dee43..f542b2a 100644 --- a/tools/ghostfix.ts +++ b/tools/ghostfix.ts @@ -24,7 +24,6 @@ import { ToolsHelper } from "./toolshelper"; const log = new Log("GhostFix"); // Note: The schedule must not have duplicate values to avoid problems in positioning. -/* tslint:disable:no-magic-numbers */ // Disabled because it complains about the values in the array const JOIN_ROOM_SCHEDULE = [ 0, // Right away 1000, // 1 second @@ -32,7 +31,6 @@ const JOIN_ROOM_SCHEDULE = [ 300000, // 5 minutes 900000, // 15 minutes ]; -/* tslint:enable:no-magic-numbers */ const optionDefinitions = [ { -- GitLab