Setup eslint and enforce rules
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-06-02 22:36:25 -05:00
parent 82e7a1f299
commit 1d5056b753
149 changed files with 6104 additions and 3114 deletions

View File

@@ -1,5 +1,5 @@
import {Application} from './Application';
import {Container, DependencyKey} from "../di";
import {Application} from './Application'
import {Container, DependencyKey} from '../di'
/**
* Base type for a class that supports binding methods by string.
@@ -13,12 +13,12 @@ export interface Bindable {
* @param what
* @return boolean
*/
export function isBindable(what: any): what is Bindable {
export function isBindable(what: unknown): what is Bindable {
return (
what
&& typeof what.getBoundMethod === 'function'
&& what.getBoundMethod.length === 1
&& typeof what.getBoundMethod('getBoundMethod') === 'function'
Boolean(what)
&& typeof (what as any).getBoundMethod === 'function'
&& (what as any).getBoundMethod.length === 1
&& typeof (what as any).getBoundMethod('getBoundMethod') === 'function'
)
}
@@ -30,17 +30,17 @@ export class AppClass {
private readonly appClassApplication!: Application;
constructor() {
this.appClassApplication = Application.getApplication();
this.appClassApplication = Application.getApplication()
}
/** Get the global Application. */
protected app(): Application {
return this.appClassApplication;
return this.appClassApplication
}
/** Get the global Container. */
protected container(): Container {
return this.appClassApplication;
return this.appClassApplication
}
/** Call the `make()` method on the global container. */
@@ -54,14 +54,12 @@ export class AppClass {
* @return function
*/
public getBoundMethod(methodName: string): (...args: any[]) => any {
// @ts-ignore
if ( typeof this[methodName] !== 'function' ) {
if ( typeof (this as any)[methodName] !== 'function' ) {
throw new TypeError(`Attempt to get bound method for non-function type: ${methodName}`)
}
return (...args: any[]): any => {
// @ts-ignore
return this[methodName](...args)
return (this as any)[methodName](...args)
}
}
}