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,10 +1,10 @@
import {Inject, Instantiable, Singleton} from "../../di"
import {Collection, HTTPStatus} from "../../util"
import {HTTPKernelModule} from "./HTTPKernelModule";
import {Logging} from "../../service/Logging";
import {AppClass} from "../../lifecycle/AppClass";
import {Request} from "../lifecycle/Request";
import {error} from "../response/ErrorResponseFactory";
import {Inject, Instantiable, Singleton} from '../../di'
import {Collection, HTTPStatus} from '../../util'
import {HTTPKernelModule} from './HTTPKernelModule'
import {Logging} from '../../service/Logging'
import {AppClass} from '../../lifecycle/AppClass'
import {Request} from '../lifecycle/Request'
import {error} from '../response/ErrorResponseFactory'
/**
* Interface for fluently registering kernel modules into the kernel.
@@ -105,7 +105,8 @@ export class HTTPKernel extends AppClass {
}
} catch (e: any) {
this.logging.error(e)
await error(e).status(HTTPStatus.INTERNAL_SERVER_ERROR).write(request)
await error(e).status(HTTPStatus.INTERNAL_SERVER_ERROR)
.write(request)
}
this.logging.verbose('Finished kernel lifecycle')
@@ -127,16 +128,16 @@ export class HTTPKernel extends AppClass {
return this
}
let found_index = this.preflight.find((mod: HTTPKernelModule) => mod instanceof other)
if ( typeof found_index !== 'undefined' ) {
this.preflight = this.preflight.put(found_index, this.app().make(module))
let foundIdx = this.preflight.find((mod: HTTPKernelModule) => mod instanceof other)
if ( typeof foundIdx !== 'undefined' ) {
this.preflight = this.preflight.put(foundIdx, this.app().make(module))
return this
} else {
found_index = this.postflight.find((mod: HTTPKernelModule) => mod instanceof other)
foundIdx = this.postflight.find((mod: HTTPKernelModule) => mod instanceof other)
}
if ( typeof found_index !== 'undefined' ) {
this.postflight = this.postflight.put(found_index, this.app().make(module))
if ( typeof foundIdx !== 'undefined' ) {
this.postflight = this.postflight.put(foundIdx, this.app().make(module))
} else {
throw new KernelModuleNotFoundError(other.name)
}
@@ -149,16 +150,16 @@ export class HTTPKernel extends AppClass {
return this
}
let found_index = this.preflight.find((mod: HTTPKernelModule) => mod instanceof other)
if ( typeof found_index !== 'undefined' ) {
this.preflight = this.preflight.put(found_index + 1, this.app().make(module))
let foundIdx = this.preflight.find((mod: HTTPKernelModule) => mod instanceof other)
if ( typeof foundIdx !== 'undefined' ) {
this.preflight = this.preflight.put(foundIdx + 1, this.app().make(module))
return this
} else {
found_index = this.postflight.find((mod: HTTPKernelModule) => mod instanceof other)
foundIdx = this.postflight.find((mod: HTTPKernelModule) => mod instanceof other)
}
if ( typeof found_index !== 'undefined' ) {
this.postflight = this.postflight.put(found_index + 1, this.app().make(module))
if ( typeof foundIdx !== 'undefined' ) {
this.postflight = this.postflight.put(foundIdx + 1, this.app().make(module))
} else {
throw new KernelModuleNotFoundError(other.name)
}