Skip to content

Commit ca765f6

Browse files
committed
Update for lint config changes
1 parent 30529ee commit ca765f6

16 files changed

+55
-45
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@
5858
"@types/node": "^8.0.19",
5959
"@types/node-json-db": "0.0.1",
6060
"@types/sequelize": "^4.0.68",
61-
"@typescript-eslint/eslint-plugin": "^2.4.0",
62-
"@typescript-eslint/parser": "^2.4.0",
6361
"cross-env": "^5.1.3",
6462
"del": "^6.0.0",
6563
"eslint": "^6.5.1",

src/client/Client.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ export class Client extends Discord.Client
8787
public readonly tsNode: boolean;
8888

8989
// Internals
90-
public readonly _middleware: MiddlewareFunction[];
91-
public readonly _customResolvers: ResolverConstructor[];
90+
public readonly middleware: MiddlewareFunction[];
91+
public readonly customResolvers: ResolverConstructor[];
9292

9393
// eslint-disable-next-line complexity
9494
public constructor(options: YAMDBFOptions, clientOptions?: ClientOptions)
@@ -245,7 +245,7 @@ export class Client extends Discord.Client
245245
this.plugins = new PluginLoader(this, this._plugins);
246246

247247
// Middleware function storage for the client instance
248-
this._middleware = [];
248+
this.middleware = [];
249249

250250
/**
251251
* Client-specific storage. Also contains a `guilds` Collection property containing
@@ -267,8 +267,8 @@ export class Client extends Discord.Client
267267
* @type {ResolverLoader}
268268
*/
269269
this.resolvers = new ResolverLoader(this);
270-
this._customResolvers = options.customResolvers ?? [];
271-
this.resolvers._loadResolvers();
270+
this.customResolvers = options.customResolvers ?? [];
271+
this.resolvers.loadResolvers();
272272

273273
/**
274274
* Whether or not compact mode is enabled
@@ -335,6 +335,7 @@ export class Client extends Discord.Client
335335
// #region Event handlers
336336

337337
// @ts-ignore - Handled via ListenerUtil
338+
// eslint-disable-next-line @typescript-eslint/naming-convention
338339
@once('ready') private async __onReadyEvent(): Promise<void>
339340
{
340341
// Set default owner (OAuth Application owner) if none exists
@@ -359,14 +360,15 @@ export class Client extends Discord.Client
359360
this.user!.setActivity(this.statusText);
360361
}
361362

363+
// eslint-disable-next-line @typescript-eslint/naming-convention
362364
@once('continue') private async __onContinueEvent(): Promise<void>
363365
{
364366
await this._guildStorageLoader.init();
365367
await this._guildStorageLoader.loadStorages();
366368
await this._guildStorageLoader.cleanGuilds();
367369

368370
this._logger.info('Loading plugins...');
369-
await this.plugins._loadPlugins();
371+
await this.plugins.loadPlugins();
370372

371373
if (!this.passive)
372374
{
@@ -376,11 +378,11 @@ export class Client extends Discord.Client
376378
this._commandLoader.loadCommandsFrom(this.commandsDir);
377379
}
378380

379-
this.commands._checkDuplicateAliases();
380-
this.commands._checkReservedCommandNames();
381+
this.commands.checkDuplicateAliases();
382+
this.commands.checkReservedCommandNames();
381383

382384
this._logger.info('Initializing commands...');
383-
const initSuccess: boolean = await this.commands._initCommands();
385+
const initSuccess: boolean = await this.commands.initCommands();
384386
this._logger.info(`Commands initialized${initSuccess ? '' : ' with errors'}.`);
385387

386388
Lang.loadCommandLocalizations();
@@ -413,6 +415,7 @@ export class Client extends Discord.Client
413415
}
414416

415417
// @ts-ignore - Handled via ListenerUtil
418+
// eslint-disable-next-line @typescript-eslint/naming-convention
416419
@on('guildCreate') private async __onGuildCreateEvent(guild: Guild): Promise<void>
417420
{
418421
if (this.storage.guilds.has(guild.id))
@@ -426,6 +429,7 @@ export class Client extends Discord.Client
426429
}
427430

428431
// @ts-ignore - Handled via ListenerUtil
432+
// eslint-disable-next-line @typescript-eslint/naming-convention
429433
@on('guildDelete') private __onGuildDeleteEvent(guild: Guild): void
430434
{
431435
if (this.storage.guilds.has(guild.id))
@@ -596,15 +600,15 @@ export class Client extends Discord.Client
596600
*/
597601
public use(func: MiddlewareFunction): this
598602
{
599-
this._middleware.push(func);
603+
this.middleware.push(func);
600604
return this;
601605
}
602606

603607
/**
604608
* Reload custom commands. Used internally by the `reload` command
605609
* @private
606610
*/
607-
public _reloadCustomCommands(): number
611+
public reloadCustomCommands(): number
608612
{
609613
if (!this.commandsDir)
610614
throw new Error('Client is missing `commandsDir`, cannot reload Commands');
@@ -616,7 +620,7 @@ export class Client extends Discord.Client
616620
* Reload Events from all registered event source directories
617621
* @private
618622
*/
619-
public _reloadEvents(): number
623+
public reloadEvents(): number
620624
{
621625
return this.eventLoader.loadFromSources();
622626
}

src/client/PluginLoader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class PluginLoader
4242
* Called internally by the YAMDBF Client at startup
4343
* @private
4444
*/
45-
public async _loadPlugins(): Promise<void>
45+
public async loadPlugins(): Promise<void>
4646
{
4747
await this._provider.init();
4848
this._logger.debug('Plugin storage provider initialized.');

src/command/Command.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ export abstract class Command<T extends Client = Client>
5252
public lockTimeout!: number;
5353

5454
// Internals
55-
public readonly _middleware: MiddlewareFunction[];
56-
public _classloc!: string;
57-
public _initialized: boolean;
55+
public readonly middleware: MiddlewareFunction[];
56+
public classloc!: string;
57+
public initialized: boolean;
5858

5959
public constructor(info?: CommandInfo)
6060
{
@@ -196,9 +196,9 @@ export abstract class Command<T extends Client = Client>
196196
*/
197197

198198
// Middleware function storage for the Command instance
199-
this._middleware = [];
199+
this.middleware = [];
200200

201-
this._initialized = false;
201+
this.initialized = false;
202202

203203
if (info) Object.assign(this, info);
204204
}
@@ -237,7 +237,7 @@ export abstract class Command<T extends Client = Client>
237237
* Called internally by the command loader
238238
* @private
239239
*/
240-
public _register(client: T): void
240+
public register(client: T): void
241241
{
242242
this.client = client;
243243

@@ -254,11 +254,11 @@ export abstract class Command<T extends Client = Client>
254254
if (typeof this.ownerOnly === 'undefined') this.ownerOnly = false;
255255
if (typeof this.external === 'undefined') this.external = false;
256256
if (typeof this._disabled === 'undefined') this._disabled = false;
257-
if (typeof this._classloc === 'undefined') this._classloc = '<External Command>';
257+
if (typeof this.classloc === 'undefined') this.classloc = '<External Command>';
258258
if (typeof this.lockTimeout === 'undefined') this.lockTimeout = 30e3;
259259

260260
// Make necessary asserts
261-
if (!this.name) throw new Error(`A command is missing a name:\n${this._classloc}`);
261+
if (!this.name) throw new Error(`A command is missing a name:\n${this.classloc}`);
262262
if (!this.desc) throw new Error(`A description must be provided for Command: ${this.name}`);
263263
if (!this.usage) throw new Error(`Usage information must be provided for Command: ${this.name}`);
264264
if (this.aliases && !Array.isArray(this.aliases))
@@ -349,7 +349,7 @@ export abstract class Command<T extends Client = Client>
349349
*/
350350
public use(func: MiddlewareFunction): this
351351
{
352-
this._middleware.push(func);
352+
this.middleware.push(func);
353353
return this;
354354
}
355355

src/command/CommandDecorators.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export function localizable(target: Command, key: string, descriptor: PropertyDe
147147
* Set an arbitrary value to an arbitrary key on a command class
148148
* @private
149149
*/
150+
// eslint-disable-next-line @typescript-eslint/naming-convention
150151
function _setMetaData(key: string, value: any): ClassDecorator
151152
{
152153
return function<T extends Function>(target: T): T
@@ -165,6 +166,7 @@ function _setMetaData(key: string, value: any): ClassDecorator
165166
* Set a boolean flag metadata on a command class
166167
* @private
167168
*/
169+
// eslint-disable-next-line @typescript-eslint/naming-convention
168170
function _setFlagMetaData<T extends Function>(target: T, flag: string): T
169171
{
170172
Object.defineProperty(target.prototype, flag, {

src/command/CommandDispatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export class CommandDispatcher
157157

158158
let commandResult!: CommandResult;
159159
let middlewarePassed: boolean = true;
160-
const middleware: MiddlewareFunction[] = this._client._middleware.concat(command!._middleware);
160+
const middleware: MiddlewareFunction[] = this._client.middleware.concat(command!.middleware);
161161

162162
// Function to send middleware result, utilizing compact mode if enabled
163163
const sendMiddlewareResult: (result: string, options?: MessageOptions) => Promise<any> =

src/command/CommandLoader.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export class CommandLoader
7272
continue;
7373
}
7474

75+
// eslint-disable-next-line @typescript-eslint/naming-convention
7576
for (const CommandClass of commandClasses)
7677
{
7778
const commandInstance: Command = new CommandClass();
@@ -82,14 +83,14 @@ export class CommandLoader
8283
continue;
8384

8485
this._logger.info(`Loaded command: ${commandInstance.name}`);
85-
commandInstance._classloc = file;
86+
commandInstance.classloc = file;
8687
loadedCommands.push(commandInstance);
8788
}
8889
}
8990

9091
// Register all of the loaded commands
9192
for (const command of loadedCommands)
92-
this._commands._registerInternal(command);
93+
this._commands.registerInternal(command);
9394

9495
return loadedCommands.length;
9596
}

src/command/CommandRegistry.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class CommandRegistry<
6262
public registerExternal(command: Command<any>): void
6363
{
6464
this._logger.info(`External command loaded: ${command.name}`);
65-
this._registerInternal(command as V, true);
65+
this.registerInternal(command as V, true);
6666
}
6767

6868
/**
@@ -85,7 +85,7 @@ export class CommandRegistry<
8585
* `registerExternal()` instead
8686
* @private
8787
*/
88-
public _registerInternal(command: V, external: boolean = false): void
88+
public registerInternal(command: V, external: boolean = false): void
8989
{
9090
if (this.has(command.name as K))
9191
{
@@ -97,15 +97,15 @@ export class CommandRegistry<
9797
this.delete(command.name as K);
9898
}
9999
this.set(command.name as K, command);
100-
command._register(this._client);
100+
command.register(this._client);
101101
if (external) command.external = true;
102102
}
103103

104104
/**
105105
* Check for duplicate aliases, erroring on any. Used internally
106106
* @private
107107
*/
108-
public _checkDuplicateAliases(): void
108+
public checkDuplicateAliases(): void
109109
{
110110
for (const command of this.values())
111111
for (const alias of command.aliases)
@@ -133,7 +133,7 @@ export class CommandRegistry<
133133
* Check for commands with reserved names. Used internally
134134
* @private
135135
*/
136-
public _checkReservedCommandNames(): void
136+
public checkReservedCommandNames(): void
137137
{
138138
const reserved: string[] = this._reserved.map(r => typeof r !== 'string' ? r() : r);
139139
for (const name of reserved)
@@ -151,17 +151,17 @@ export class CommandRegistry<
151151
* This is an internal method and should not be used
152152
* @private
153153
*/
154-
public async _initCommands(): Promise<boolean>
154+
public async initCommands(): Promise<boolean>
155155
{
156156
let success: boolean = true;
157157
for (const command of this.values())
158158
{
159-
if (command._initialized) continue;
159+
if (command.initialized) continue;
160160
try
161161
{
162162
// eslint-disable-next-line no-await-in-loop, @typescript-eslint/await-thenable
163163
await command.init();
164-
command._initialized = true;
164+
command.initialized = true;
165165
}
166166
catch (err)
167167
{

src/command/base/Reload.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ export default class extends Command
3030
const commandStart: number = Util.now();
3131

3232
const disabled: string[] = this.client.commands.filter(c => c.disabled).map(c => c.name);
33-
const reloaded: number = this.client._reloadCustomCommands();
33+
const reloaded: number = this.client.reloadCustomCommands();
3434

3535
this._logger.log('Re-initializing reloaded commands...');
36-
this.client.commands._initCommands();
36+
this.client.commands.initCommands();
3737

3838
const toDisable: Collection<string, Command> =
3939
this.client.commands.filter(c => disabled.includes(c.name));
@@ -47,7 +47,7 @@ export default class extends Command
4747

4848
// Reload events
4949
const eventStart: number = Util.now();
50-
const eventNumber: string = this.client._reloadEvents().toString();
50+
const eventNumber: string = this.client.reloadEvents().toString();
5151
const eventEnd: number = Util.now();
5252

5353
const commandTime: string = (commandEnd - commandStart).toFixed(3);

src/command/resolvers/ResolverLoader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ export class ResolverLoader
6262
* Used internally
6363
* @private
6464
*/
65-
public _loadResolvers(): void
65+
public loadResolvers(): void
6666
{
67-
for (const resolver of this._base.concat(this._client._customResolvers))
67+
for (const resolver of this._base.concat(this._client.customResolvers))
6868
{
6969
// eslint-disable-next-line new-cap
7070
const newResolver: Resolver = new resolver(this._client);

0 commit comments

Comments
 (0)