Setup eslint and enforce rules
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {Canonical} from "./Canonical";
|
||||
import {Singleton} from "../di";
|
||||
import {Canonical} from './Canonical'
|
||||
import {Singleton} from '../di'
|
||||
|
||||
/**
|
||||
* Error throw when a duplicate canonical key is registered.
|
||||
@@ -40,7 +40,9 @@ export class Canon {
|
||||
* @return Canonical
|
||||
*/
|
||||
resource<T>(key: string): Canonical<T> {
|
||||
if ( !this.resources[key] ) throw new NoSuchCanonicalResolverKeyError(key)
|
||||
if ( !this.resources[key] ) {
|
||||
throw new NoSuchCanonicalResolverKeyError(key)
|
||||
}
|
||||
return this.resources[key] as Canonical<T>
|
||||
}
|
||||
|
||||
@@ -48,9 +50,11 @@ export class Canon {
|
||||
* Register a canonical resource.
|
||||
* @param {Canonical} unit
|
||||
*/
|
||||
registerCanonical(unit: Canonical<any>) {
|
||||
registerCanonical(unit: Canonical<any>): void {
|
||||
const key = unit.canonicalItems
|
||||
if ( this.resources[key] ) throw new DuplicateResolverKeyError(key)
|
||||
if ( this.resources[key] ) {
|
||||
throw new DuplicateResolverKeyError(key)
|
||||
}
|
||||
this.resources[key] = unit
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user