Skip to content

Commit 31c2b87

Browse files
committed
refactor clean code
1 parent 6193f50 commit 31c2b87

7 files changed

Lines changed: 17 additions & 14 deletions

File tree

packages/common/http/http.module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import axios, { AxiosRequestConfig } from 'axios';
1+
import Axios, { AxiosRequestConfig } from 'axios';
22
import { Module } from '../decorators/modules/module.decorator';
33
import { DynamicModule } from '../interfaces';
44
import { randomStringGenerator } from '../utils/random-string-generator.util';
@@ -10,7 +10,7 @@ import { HttpService } from './http.service';
1010
HttpService,
1111
{
1212
provide: AXIOS_INSTANCE_TOKEN,
13-
useValue: axios,
13+
useValue: Axios,
1414
},
1515
],
1616
exports: [HttpService],
@@ -22,7 +22,7 @@ export class HttpModule {
2222
providers: [
2323
{
2424
provide: AXIOS_INSTANCE_TOKEN,
25-
useValue: axios.create(config),
25+
useValue: Axios.create(config),
2626
},
2727
{
2828
provide: HTTP_MODULE_ID,

packages/common/http/http.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
1+
import Axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
22
import { defer, Observable } from 'rxjs';
33
import { Inject } from '../decorators';
44
import { AXIOS_INSTANCE_TOKEN } from './http.constants';
55

66
export class HttpService {
77
constructor(
88
@Inject(AXIOS_INSTANCE_TOKEN)
9-
private readonly instance: AxiosInstance = axios,
9+
private readonly instance: AxiosInstance = Axios,
1010
) {}
1111

1212
request<T = any>(config: AxiosRequestConfig): Observable<AxiosResponse<T>> {

packages/core/errors/exceptions/runtime.exception.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export declare class Error {
66
}
77

88
export class RuntimeException extends Error {
9-
constructor(private msg = ``) {
9+
constructor(private readonly msg = ``) {
1010
super(msg);
1111
}
1212

packages/core/injector/module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ export type ComponentMetatype =
4242

4343
export class Module {
4444
private readonly _id: string;
45-
private _relatedModules = new Set<Module>();
46-
private _components = new Map<any, InstanceWrapper<Injectable>>();
47-
private _injectables = new Map<any, InstanceWrapper<Injectable>>();
48-
private _routes = new Map<string, InstanceWrapper<Controller>>();
49-
private _exports = new Set<string>();
45+
private readonly _relatedModules = new Set<Module>();
46+
private readonly _components = new Map<any, InstanceWrapper<Injectable>>();
47+
private readonly _injectables = new Map<any, InstanceWrapper<Injectable>>();
48+
private readonly _routes = new Map<string, InstanceWrapper<Controller>>();
49+
private readonly _exports = new Set<string>();
5050

5151
constructor(
5252
private readonly _metatype: Type<any>,

packages/core/middleware/builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class MiddlewareBuilder implements MiddlewareConsumer {
3737
return [].concat(middleware).map(bindArgs);
3838
}
3939

40-
private static ConfigProxy = class implements MiddlewareConfigProxy {
40+
private static readonly ConfigProxy = class implements MiddlewareConfigProxy {
4141
private contextParameters = null;
4242
private excludedRoutes: RouteInfo[] = [];
4343
private readonly includedRoutes: any[];

packages/microservices/client/client-redis.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class ClientRedis extends ClientProxy {
2626
protected pubClient: RedisClient;
2727
protected subClient: RedisClient;
2828
protected connection: Promise<any>;
29-
private isExplicitlyTerminated = false;
29+
private readonly isExplicitlyTerminated = false;
3030

3131
constructor(protected readonly options: ClientOptions['options']) {
3232
super();

tslint.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@
5050
],
5151
"one-variable-per-declaration": [
5252
false
53-
]
53+
],
54+
"no-return-await": true,
55+
"match-default-export-name": true,
56+
"prefer-readonly": true
5457
},
5558
"rulesDirectory": []
5659
}

0 commit comments

Comments
 (0)