diff --git a/.eslintrc.json b/.eslintrc.json index 8a9c485..6f59978 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -85,6 +85,13 @@ // ], "max-classes-per-file": "warn", "max-nested-callbacks": "warn", + "max-len": ["warn", { + "code": 140, + "ignoreComments": true, + "ignoreStrings": true, + "ignoreTemplateLiterals": true, + "ignoreRegExpLiterals": true + }], "new-parens": "warn", "no-alert": "warn", "no-array-constructor": "warn", diff --git a/src/controller/Controller.ts b/src/controller/Controller.ts index 13198f2..3ce0d57 100644 --- a/src/controller/Controller.ts +++ b/src/controller/Controller.ts @@ -8,8 +8,7 @@ import path from 'node:path'; // External import { MasterLogger } from '@navy.gif/logger'; -import { Parser } from '@navy.gif/commandparser'; -const CommandParser = Parser; +import { Parser as CommandParser } from '@navy.gif/commandparser'; import { Collection } from '@discordjs/collection'; // Local @@ -28,7 +27,7 @@ class Controller extends EventEmitter { #_options: ControllerOptions; #_built: boolean; #_logger: MasterLogger; - #_parser?: Parser; + #_parser?: CommandParser; #_serverFilePath: string; #_shards: Collection; @@ -91,7 +90,15 @@ class Controller extends EventEmitter { async init (): Promise { this.#_logger.info(`Initialising Controller`); - const { projectName, shardCount = 1, shardOptions = {}, serverOptions = {} as ServerOptions, logger = {}, discord = {}, databases = {} } = this.#_options; + const { + projectName, + shardCount = 1, + shardOptions = {}, + serverOptions = {} as ServerOptions, + logger = {}, + discord = {}, + databases = {} + } = this.#_options; this.#_logger.info(`Spawning ${shardCount} shards`); serverOptions.name = projectName; @@ -120,7 +127,14 @@ class Controller extends EventEmitter { const promises = []; for (let i = 0; i < shardCount; i++) { - const shard = new Shard(this, i, { serverOptions: { ...serverOptions, logger, discord, databases }, ...shardOptions, env: this.#_options.env, path: this.#_serverFilePath }); + const shard = new Shard(this, i, { + serverOptions: { + ...serverOptions, logger, discord, databases + }, + ...shardOptions, + env: this.#_options.env, + path: this.#_serverFilePath + }); this.#_logger.attach(shard); this._setListeners(shard); this.#_shards.set(i, shard); diff --git a/src/controller/Shard.ts b/src/controller/Shard.ts index 8124eb4..76b6406 100644 --- a/src/controller/Shard.ts +++ b/src/controller/Shard.ts @@ -93,7 +93,13 @@ class Shard extends EventEmitter { if (this.process) throw new Error(`[shard-${this.id}] A process for this shard already exists!`); - this.#_process = fork(this.#_filePath, this.#_args, { env: { ...this.#_env, SHARD_ID: this.id.toString() }, execArgv: this.#_execArgv }) + this.#_process = fork(this.#_filePath, this.#_args, { + env: { + ...this.#_env, + SHARD_ID: this.id.toString() + }, + execArgv: this.#_execArgv + }) .on('message', this._handleMessage.bind(this)) .on('exit', this._handleExit.bind(this)) .on('disconnect', this._handleDisconnect.bind(this)); // Don't know if this is going to help, but monitoring whether this gets called whenever a process on its own closes the IPC channel diff --git a/src/server/middleware/Authenticator.ts b/src/server/middleware/Authenticator.ts index 2628872..2483fcb 100644 --- a/src/server/middleware/Authenticator.ts +++ b/src/server/middleware/Authenticator.ts @@ -61,7 +61,11 @@ class Authenticator { * } * @memberof Authenticator */ - constructor (server: Server, users: UserDatabaseInterface, { sessionStorage, secret, name, cookie = { } }: {sessionStorage: MongoStore, secret: string, name: string, cookie: Cookie}) { + constructor ( + server: Server, + users: UserDatabaseInterface, + { sessionStorage, secret, name, cookie = {} }: { sessionStorage: MongoStore, secret: string, name: string, cookie: Cookie } + ) { // if (!(users instanceof UserDatabaseInterface)) // Util.fatal(new Error(`Expecting user database to be an instance inheriting UserDatabaseInterface`));