diff --git a/.eslintrc b/.eslintrc index 69c55982607b471bc955b2e30d3fcfd62e92de32..fe208ed36c7e569b610960cfaba69617d948f3ab 100644 --- a/.eslintrc +++ b/.eslintrc @@ -33,6 +33,7 @@ "@typescript-eslint/array-type": "error", "@typescript-eslint/promise-function-async": "error", "no-bitwise": "error", + "no-console": "error", "no-debugger": "error", "prefer-template": "error", // Disable these as they were introduced by @typescript-eslint/recommended diff --git a/src/discordas.ts b/src/discordas.ts index ad6c6cab94e8e5731770934648f884507d49be46..621ddcefb15efdaaec38ca31cad8834df25a70f8 100644 --- a/src/discordas.ts +++ b/src/discordas.ts @@ -106,7 +106,7 @@ function setupLogging(): void { async function run(): Promise<void> { const opts = cliArgs(commandOptions); if (opts.help) { - /* tslint:disable:no-console */ + // eslint-disable-next-line no-console console.log(usage([ { content: "The matrix appservice for discord", diff --git a/tools/addRoomsToDirectory.ts b/tools/addRoomsToDirectory.ts index 520a24774ddccb814c9c8451923e365cb6ca1828..6b06ac7b9324bd9d3fe3a2fde04edcc98b250db7 100644 --- a/tools/addRoomsToDirectory.ts +++ b/tools/addRoomsToDirectory.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -/* tslint:disable:no-console */ +/* eslint-disable no-console */ /** * Allows you to become an admin for a room the bot is in control of. */ @@ -53,30 +53,32 @@ const optionDefinitions = [ const options = args(optionDefinitions); if (options.help) { - /* tslint:disable:no-console */ + /* eslint-disable no-console */ console.log(usage([ - { - content: "A tool to set all the bridged rooms to visible in the directory.", - header: "Add rooms to directory", - }, - { - header: "Options", - optionList: optionDefinitions, - }, + { + content: "A tool to set all the bridged rooms to visible in the directory.", + header: "Add rooms to directory", + }, + { + header: "Options", + optionList: optionDefinitions, + }, ])); process.exit(0); } const {store, appservice} = ToolsHelper.getToolDependencies(options.config, options.registration); -async function run() { +async function run(): Promise<void> { try { await store!.init(); } catch (e) { log.error(`Failed to load database`, e); } let rooms = await store!.roomStore.getEntriesByRemoteRoomData({ + /* eslint-disable @typescript-eslint/camelcase */ discord_type: "text", + /* eslint-disable @typescript-eslint/camelcase */ }); rooms = rooms.filter((r) => r.remote && r.remote.get("plumbed") !== true ); log.info(`Got ${rooms.length} rooms to set`); diff --git a/tools/addbot.ts b/tools/addbot.ts index d505fddd9045036e4822aa37bf62889509803ec8..6fd4517f351edf4585b274d0a1ed8784b3a3b84f 100644 --- a/tools/addbot.ts +++ b/tools/addbot.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -/* tslint:disable:no-bitwise no-console no-var-requires */ +/* eslint-disable no-bitwise, no-console */ /** * Generates a URL you can use to authorize a bot with a guild. */ @@ -26,42 +26,42 @@ import { Util } from "../src/util"; import { DiscordBridgeConfig } from "../src/config"; const optionDefinitions = [ - { - alias: "h", - description: "Display this usage guide.", - name: "help", - type: Boolean, - }, - { - alias: "c", - defaultValue: "config.yaml", - description: "The AS config file.", - name: "config", - type: String, - typeLabel: "<config.yaml>", - }, + { + alias: "h", + description: "Display this usage guide.", + name: "help", + type: Boolean, + }, + { + alias: "c", + defaultValue: "config.yaml", + description: "The AS config file.", + name: "config", + type: String, + typeLabel: "<config.yaml>", + }, ]; const options = args(optionDefinitions); if (options.help) { - /* tslint:disable:no-console */ - console.log(usage([ - { - content: "A tool to obtain the Discord bot invitation URL.", - header: "Add bot", - }, - { - header: "Options", - optionList: optionDefinitions, - }, - ])); - process.exit(0); + // eslint-disable-next-line no-console + console.log(usage([ + { + content: "A tool to obtain the Discord bot invitation URL.", + header: "Add bot", + }, + { + header: "Options", + optionList: optionDefinitions, + }, + ])); + process.exit(0); } const yamlConfig = yaml.safeLoad(fs.readFileSync(options.config, "utf8")); if (yamlConfig === null || typeof yamlConfig !== "object") { - throw Error("You have an error in your discord config."); + throw Error("You have an error in your discord config."); } const url = Util.GetBotLink(yamlConfig as DiscordBridgeConfig); console.log(`Go to ${url} to invite the bot into a guild.`); diff --git a/tools/adminme.ts b/tools/adminme.ts index 1504d0ec5788c686a6e052f5c0bbaa99fbe14416..06e756da26241b9f5a589d5c66b76a44178041c8 100644 --- a/tools/adminme.ts +++ b/tools/adminme.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -/* tslint:disable:no-console */ +/* eslint-disable no-console */ /** * Allows you to become an admin for a room that the bot is in control of. */ @@ -71,7 +71,7 @@ const optionDefinitions = [ const options = args(optionDefinitions); if (options.help) { - /* tslint:disable:no-console */ + /* eslint-disable no-console */ console.log(usage([ { content: "A tool to give a user a power level in a bot user controlled room.", diff --git a/tools/chanfix.ts b/tools/chanfix.ts index 9b293e891b6457d3a08a1adc179abc7530963cf3..5c186c61419a99a0e5889b90925969f147fc8c99 100644 --- a/tools/chanfix.ts +++ b/tools/chanfix.ts @@ -51,7 +51,7 @@ const optionDefinitions = [ const options = args(optionDefinitions); if (options.help) { - /* tslint:disable:no-console */ + /* eslint-disable no-console */ console.log(usage([ { content: "A tool to fix channels of rooms already bridged " + diff --git a/tools/ghostfix.ts b/tools/ghostfix.ts index f542b2adccfc569e1f6a399d89ee087960722ab9..d5f6b40683e27d6910b6f24ffa68a6670dbfc12a 100644 --- a/tools/ghostfix.ts +++ b/tools/ghostfix.ts @@ -60,17 +60,17 @@ const optionDefinitions = [ const options = args(optionDefinitions); if (options.help) { - /* tslint:disable:no-console */ + /* eslint-disable no-console */ console.log(usage([ - { - content: "A tool to fix usernames of ghosts already in " + - "matrix rooms, to make sure they represent the correct discord usernames.", - header: "Fix usernames of joined ghosts", - }, - { - header: "Options", - optionList: optionDefinitions, - }, + { + content: "A tool to fix usernames of ghosts already in " + + "matrix rooms, to make sure they represent the correct discord usernames.", + header: "Fix usernames of joined ghosts", + }, + { + header: "Options", + optionList: optionDefinitions, + }, ])); process.exit(0); } @@ -130,4 +130,4 @@ async function run() { process.exit(0); } -run(); // tslint:disable-line no-floating-promises +run(); // eslint-disable no-floating-promises diff --git a/tools/userClientTools.ts b/tools/userClientTools.ts index a6d923f7899075f7ebb8eba544735d94f2ac87fa..a9591018ac5d4904ecf2d8ff4ad7142633df91ad 100644 --- a/tools/userClientTools.ts +++ b/tools/userClientTools.ts @@ -57,7 +57,7 @@ const optionDefinitions = [ const options = args(optionDefinitions); if (options.help || (options.add && options.remove) || !(options.add || options.remove)) { - /* tslint:disable:no-console */ + /* eslint-disable no-console */ console.log(usage([ { content: "A tool to give a user a power level in a bot user controlled room.",