Skip to content

Commit f80c5eb

Browse files
committed
Moved to eslint, updated dependencies
1 parent 8a27e12 commit f80c5eb

File tree

103 files changed

+1078
-932
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1078
-932
lines changed

gateway/.eslintrc.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
project: 'tsconfig.json',
5+
sourceType: 'module',
6+
},
7+
plugins: ['@typescript-eslint/eslint-plugin'],
8+
extends: [
9+
'plugin:@typescript-eslint/recommended',
10+
'prettier/@typescript-eslint',
11+
'plugin:prettier/recommended',
12+
],
13+
root: true,
14+
env: {
15+
node: true,
16+
jest: true,
17+
},
18+
rules: {
19+
'@typescript-eslint/interface-name-prefix': 'off',
20+
'@typescript-eslint/explicit-function-return-type': 'off',
21+
'@typescript-eslint/explicit-module-boundary-types': 'off',
22+
'@typescript-eslint/no-explicit-any': 'off',
23+
},
24+
};

gateway/.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all"
4+
}

gateway/package.json

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,40 @@
99
"start:dev": "tsc-watch -p tsconfig.build.json --onSuccess \"node -r dotenv/config dist/main.js dotenv_config_path=../.env\"",
1010
"start:test": "tsc-watch -p tsconfig.build.json --onSuccess \"node -r dotenv/config dist/main.js dotenv_config_path=../.env.test\"",
1111
"start:prod": "node dist/main.js",
12-
"lint": "tslint -p tsconfig.json -c tslint.json",
12+
"lint": "eslint \"{src,test}/**/*.ts\" --fix",
1313
"test": "jest --config ./test/jest-e2e.json --detectOpenHandles"
1414
},
1515
"dependencies": {
16-
"@nestjs/common": "7.4.2",
17-
"@nestjs/core": "7.4.2",
18-
"@nestjs/microservices": "7.4.2",
19-
"@nestjs/platform-express": "7.4.2",
20-
"@nestjs/swagger": "4.5.12",
16+
"@nestjs/common": "7.5.1",
17+
"@nestjs/core": "7.5.1",
18+
"@nestjs/microservices": "7.5.1",
19+
"@nestjs/platform-express": "7.5.1",
20+
"@nestjs/swagger": "4.7.5",
2121
"reflect-metadata": "0.1.13",
2222
"rimraf": "3.0.2",
23-
"rxjs": "6.6.2",
23+
"rxjs": "6.6.3",
2424
"swagger-ui-express": "4.1.4"
2525
},
2626
"devDependencies": {
27-
"@nestjs/testing": "7.4.2",
27+
"@nestjs/testing": "7.5.1",
2828
"@types/express": "4.17.7",
2929
"@types/jest": "26.0.10",
3030
"@types/node": "14.0.27",
3131
"@types/supertest": "2.0.10",
3232
"dotenv": "8.2.0",
33-
"jest": "26.4.0",
3433
"mongoose": "5.10.0",
34+
"jest": "26.4.0",
3535
"supertest": "4.0.2",
3636
"ts-jest": "26.2.0",
37-
"ts-node": "8.10.2",
37+
"ts-node": "9.0.0",
3838
"tsc-watch": "4.2.9",
3939
"tsconfig-paths": "3.9.0",
40-
"tslint": "6.1.3",
41-
"typescript": "3.9.7"
40+
"typescript": "3.9.7",
41+
"prettier": "2.1.2",
42+
"eslint-config-prettier": "7.0.0",
43+
"eslint-plugin-prettier": "^3.1.4",
44+
"@typescript-eslint/eslint-plugin": "4.6.1",
45+
"@typescript-eslint/parser": "4.6.1",
46+
"eslint": "7.12.1"
4247
}
4348
}

gateway/src/app.module.ts

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ import { ConfigService } from './services/config/config.service';
1212

1313
@Module({
1414
imports: [],
15-
controllers: [
16-
UsersController,
17-
TasksController
18-
],
15+
controllers: [UsersController, TasksController],
1916
providers: [
2017
ConfigService,
2118
{
@@ -24,46 +21,40 @@ import { ConfigService } from './services/config/config.service';
2421
const tokenServiceOptions = configService.get('tokenService');
2522
return ClientProxyFactory.create(tokenServiceOptions);
2623
},
27-
inject: [
28-
ConfigService
29-
]
24+
inject: [ConfigService],
3025
},
3126
{
3227
provide: 'USER_SERVICE',
3328
useFactory: (configService: ConfigService) => {
3429
const userServiceOptions = configService.get('userService');
3530
return ClientProxyFactory.create(userServiceOptions);
3631
},
37-
inject: [
38-
ConfigService
39-
]
32+
inject: [ConfigService],
4033
},
4134
{
4235
provide: 'TASK_SERVICE',
4336
useFactory: (configService: ConfigService) => {
4437
return ClientProxyFactory.create(configService.get('taskService'));
4538
},
46-
inject: [
47-
ConfigService
48-
]
39+
inject: [ConfigService],
4940
},
5041
{
5142
provide: 'PERMISSION_SERVICE',
5243
useFactory: (configService: ConfigService) => {
53-
return ClientProxyFactory.create(configService.get('permissionService'));
44+
return ClientProxyFactory.create(
45+
configService.get('permissionService'),
46+
);
5447
},
55-
inject: [
56-
ConfigService
57-
]
48+
inject: [ConfigService],
5849
},
5950
{
6051
provide: APP_GUARD,
61-
useClass: AuthGuard
52+
useClass: AuthGuard,
6253
},
6354
{
6455
provide: APP_GUARD,
65-
useClass: PermissionGuard
66-
}
67-
]
56+
useClass: PermissionGuard,
57+
},
58+
],
6859
})
6960
export class AppModule {}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import { SetMetadata } from '@nestjs/common';
22

3-
export const Authorization = (secured: boolean) => SetMetadata('secured', secured);
3+
export const Authorization = (secured: boolean) =>
4+
SetMetadata('secured', secured);
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import { SetMetadata } from '@nestjs/common';
22

3-
export const Permission = (permission: string) => SetMetadata('permission', permission);
3+
export const Permission = (permission: string) =>
4+
SetMetadata('permission', permission);

gateway/src/interfaces/task/dto/create-task-response.dto.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ApiProperty } from '@nestjs/swagger';
22
import { ITask } from '../task.interface';
33

44
export class CreateTaskResponseDto {
5-
@ApiProperty({example: 'task_create_success'})
5+
@ApiProperty({ example: 'task_create_success' })
66
message: string;
77
@ApiProperty({
88
example: {
@@ -16,14 +16,14 @@ export class CreateTaskResponseDto {
1616
is_solved: false,
1717
created_at: +new Date(),
1818
updated_at: +new Date(),
19-
id: '5d987c3bfb881ec86b476bcc'
20-
}
19+
id: '5d987c3bfb881ec86b476bcc',
20+
},
2121
},
22-
nullable: true
22+
nullable: true,
2323
})
2424
data: {
2525
task: ITask;
2626
};
27-
@ApiProperty({example: null, nullable: true})
28-
errors: {[key: string]: any};
27+
@ApiProperty({ example: null, nullable: true })
28+
errors: { [key: string]: any };
2929
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { ApiProperty } from '@nestjs/swagger';
22

33
export class CreateTaskDto {
4-
@ApiProperty({example: 'test task'})
4+
@ApiProperty({ example: 'test task' })
55
name: string;
6-
@ApiProperty({example: 'test task description'})
6+
@ApiProperty({ example: 'test task description' })
77
description: string;
8-
@ApiProperty({example: +new Date()})
8+
@ApiProperty({ example: +new Date() })
99
start_time: number;
10-
@ApiProperty({example: 90000})
10+
@ApiProperty({ example: 90000 })
1111
duration: number;
1212
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { ApiProperty } from '@nestjs/swagger';
22

33
export class DeleteTaskResponseDto {
4-
@ApiProperty({example: 'task_delete_by_id_success'})
4+
@ApiProperty({ example: 'task_delete_by_id_success' })
55
message: string;
6-
@ApiProperty({example: null, nullable: true, type: 'null'})
6+
@ApiProperty({ example: null, nullable: true, type: 'null' })
77
data: null;
8-
@ApiProperty({example: null, nullable: true})
9-
errors: {[key: string]: any};
8+
@ApiProperty({ example: null, nullable: true })
9+
errors: { [key: string]: any };
1010
}

gateway/src/interfaces/task/dto/get-tasks-response.dto.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,30 @@ import { ApiProperty } from '@nestjs/swagger';
22
import { ITask } from '../task.interface';
33

44
export class GetTasksResponseDto {
5-
@ApiProperty({example: 'task_search_success'})
5+
@ApiProperty({ example: 'task_search_success' })
66
message: string;
77
@ApiProperty({
88
example: {
9-
tasks: [{
10-
notification_id: null,
11-
name: 'test task',
12-
description: 'test task description',
13-
start_time: +new Date(),
14-
duration: 90000,
15-
user_id: '5d987c3bfb881ec86b476bca',
16-
is_solved: false,
17-
created_at: +new Date(),
18-
updated_at: +new Date(),
19-
id: '5d987c3bfb881ec86b476bcc'
20-
}]
9+
tasks: [
10+
{
11+
notification_id: null,
12+
name: 'test task',
13+
description: 'test task description',
14+
start_time: +new Date(),
15+
duration: 90000,
16+
user_id: '5d987c3bfb881ec86b476bca',
17+
is_solved: false,
18+
created_at: +new Date(),
19+
updated_at: +new Date(),
20+
id: '5d987c3bfb881ec86b476bcc',
21+
},
22+
],
2123
},
22-
nullable: true
24+
nullable: true,
2325
})
2426
data: {
2527
tasks: ITask[];
2628
};
27-
@ApiProperty({example: 'null'})
28-
errors: {[key: string]: any};
29+
@ApiProperty({ example: 'null' })
30+
errors: { [key: string]: any };
2931
}

gateway/src/interfaces/task/dto/task-id.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { ApiProperty } from '@nestjs/swagger';
22

33
export class TaskIdDto {
44
@ApiProperty()
5-
id: string
5+
id: string;
66
}

gateway/src/interfaces/task/dto/update-task-response.dto.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ApiProperty } from '@nestjs/swagger';
22
import { ITask } from '../task.interface';
33

44
export class UpdateTaskResponseDto {
5-
@ApiProperty({example: 'task_update_by_id_success'})
5+
@ApiProperty({ example: 'task_update_by_id_success' })
66
message: string;
77
@ApiProperty({
88
example: {
@@ -16,14 +16,14 @@ export class UpdateTaskResponseDto {
1616
is_solved: false,
1717
created_at: +new Date(),
1818
updated_at: +new Date(),
19-
id: '5d987c3bfb881ec86b476bcc'
20-
}
19+
id: '5d987c3bfb881ec86b476bcc',
20+
},
2121
},
22-
nullable: true
22+
nullable: true,
2323
})
2424
data: {
2525
task: ITask;
2626
};
27-
@ApiProperty({example: null, nullable: true})
28-
errors: {[key: string]: any};
27+
@ApiProperty({ example: null, nullable: true })
28+
errors: { [key: string]: any };
2929
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { ApiProperty } from '@nestjs/swagger';
22

33
export class UpdateTaskDto {
4-
@ApiProperty({required: false, example: 'test task'})
4+
@ApiProperty({ required: false, example: 'test task' })
55
name: string;
6-
@ApiProperty({required: false, example: 'test task description'})
6+
@ApiProperty({ required: false, example: 'test task description' })
77
description: string;
8-
@ApiProperty({required: false, example: +new Date()})
8+
@ApiProperty({ required: false, example: +new Date() })
99
start_time: number;
10-
@ApiProperty({required: false, example: 90000})
10+
@ApiProperty({ required: false, example: 90000 })
1111
duration: number;
12-
@ApiProperty({required: false, example: true})
12+
@ApiProperty({ required: false, example: true })
1313
is_solved: boolean;
1414
}

gateway/src/interfaces/task/service-task-create-response.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export interface IServiceTaskCreateResponse {
44
status: number;
55
message: string;
66
task: ITask | null;
7-
errors: {[key: string]: any};
7+
errors: { [key: string]: any };
88
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export interface IServiceTaskDeleteResponse {
22
status: number;
33
message: string;
4-
errors: {[key: string]: any};
4+
errors: { [key: string]: any };
55
}

gateway/src/interfaces/task/service-task-update-by-id-response.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export interface IServiceTaskUpdateByIdResponse {
44
status: number;
55
message: string;
66
task: ITask | null;
7-
errors: {[key: string]: any};
7+
errors: { [key: string]: any };
88
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export interface IServiveTokenCreateResponse {
22
status: number;
3-
token: string|null;
3+
token: string | null;
44
message: string;
5-
errors: {[key: string]: any};
5+
errors: { [key: string]: any };
66
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export interface IServiceTokenDestroyResponse {
22
status: number;
33
message: string;
4-
errors: {[key: string]: any};
4+
errors: { [key: string]: any };
55
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { ApiProperty } from '@nestjs/swagger';
22

33
export class ConfirmUserResponseDto {
4-
@ApiProperty({example: 'user_confirm_success'})
4+
@ApiProperty({ example: 'user_confirm_success' })
55
message: string;
6-
@ApiProperty({example: null, nullable: true, type: 'null'})
6+
@ApiProperty({ example: null, nullable: true, type: 'null' })
77
data: null;
8-
@ApiProperty({example: null, nullable: true})
9-
errors: {[key: string]: any};
8+
@ApiProperty({ example: null, nullable: true })
9+
errors: { [key: string]: any };
1010
}

gateway/src/interfaces/user/dto/confirm-user.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { ApiProperty } from '@nestjs/swagger';
22

33
export class ConfirmUserDto {
44
@ApiProperty()
5-
link: string
5+
link: string;
66
}

0 commit comments

Comments
 (0)