Skip to content

Commit

Permalink
refactor clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
jbpionnier committed Oct 3, 2018
1 parent f45021e commit 47a17e8
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions packages/common/http/http.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosRequestConfig } from 'axios';
import Axios, { AxiosRequestConfig } from 'axios';
import { Module } from '../decorators/modules/module.decorator';
import { DynamicModule } from '../interfaces';
import { randomStringGenerator } from '../utils/random-string-generator.util';
Expand All @@ -10,7 +10,7 @@ import { HttpService } from './http.service';
HttpService,
{
provide: AXIOS_INSTANCE_TOKEN,
useValue: axios,
useValue: Axios,
},
],
exports: [HttpService],
Expand All @@ -22,7 +22,7 @@ export class HttpModule {
providers: [
{
provide: AXIOS_INSTANCE_TOKEN,
useValue: axios.create(config),
useValue: Axios.create(config),
},
{
provide: HTTP_MODULE_ID,
Expand Down
4 changes: 2 additions & 2 deletions packages/common/http/http.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import Axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import { defer, Observable } from 'rxjs';
import { Inject } from '../decorators';
import { AXIOS_INSTANCE_TOKEN } from './http.constants';

export class HttpService {
constructor(
@Inject(AXIOS_INSTANCE_TOKEN)
private readonly instance: AxiosInstance = axios,
private readonly instance: AxiosInstance = Axios,
) {}

request<T = any>(config: AxiosRequestConfig): Observable<AxiosResponse<T>> {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/errors/exceptions/runtime.exception.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export declare class Error {
}

export class RuntimeException extends Error {
constructor(private msg = ``) {
constructor(private readonly msg = ``) {
super(msg);
}

Expand Down
10 changes: 5 additions & 5 deletions packages/core/injector/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export type ComponentMetatype =

export class Module {
private readonly _id: string;
private _relatedModules = new Set<Module>();
private _components = new Map<any, InstanceWrapper<Injectable>>();
private _injectables = new Map<any, InstanceWrapper<Injectable>>();
private _routes = new Map<string, InstanceWrapper<Controller>>();
private _exports = new Set<string>();
private readonly _relatedModules = new Set<Module>();
private readonly _components = new Map<any, InstanceWrapper<Injectable>>();
private readonly _injectables = new Map<any, InstanceWrapper<Injectable>>();
private readonly _routes = new Map<string, InstanceWrapper<Controller>>();
private readonly _exports = new Set<string>();

constructor(
private readonly _metatype: Type<any>,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/middleware/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class MiddlewareBuilder implements MiddlewareConsumer {
return [].concat(middleware).map(bindArgs);
}

private static ConfigProxy = class implements MiddlewareConfigProxy {
private static readonly ConfigProxy = class implements MiddlewareConfigProxy {
private contextParameters = null;
private excludedRoutes: RouteInfo[] = [];
private readonly includedRoutes: any[];
Expand Down
2 changes: 1 addition & 1 deletion packages/microservices/client/client-redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ClientRedis extends ClientProxy {
protected pubClient: RedisClient;
protected subClient: RedisClient;
protected connection: Promise<any>;
private isExplicitlyTerminated = false;
private readonly isExplicitlyTerminated = false;

constructor(protected readonly options: ClientOptions['options']) {
super();
Expand Down
5 changes: 4 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@
],
"one-variable-per-declaration": [
false
]
],
"no-return-await": true,
"match-default-export-name": true,
"prefer-readonly": true
},
"rulesDirectory": []
}

0 comments on commit 47a17e8

Please sign in to comment.