Skip to content

Commit 7491e99

Browse files
authored
Upgrade to Prettier major version 3 and run it to format everything (#223)
1 parent 47f773c commit 7491e99

28 files changed

+180
-171
lines changed

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"eslint-config-prettier": "^9.0.0",
8383
"eslint-plugin-import": "^2.28.0",
8484
"jest": "^27.5.1",
85-
"prettier": "^2.6.0",
85+
"prettier": "^3.0.1",
8686
"prisma": "^5.1.1",
8787
"supertest": "^6.2.2",
8888
"ts-jest": "^27.1.3",

src/app.service.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
import { Inject, Injectable, Logger, OnApplicationBootstrap } from '@nestjs/common';
2-
import { HttpAdapterHost } from '@nestjs/core';
3-
import { ConfigService } from '@nestjs/config';
4-
import { Server } from 'http';
5-
6-
@Injectable()
7-
export class AppService implements OnApplicationBootstrap {
8-
private readonly logger: Logger = new Logger(AppService.name);
9-
10-
constructor(
11-
private readonly refHost: HttpAdapterHost<any>,
12-
@Inject(ConfigService) private configService: ConfigService
13-
) {}
14-
15-
onApplicationBootstrap() {
16-
const server: Server = this.refHost.httpAdapter.getHttpServer();
17-
const { timeout, headersTimeout, keepAliveTimeout } = server;
18-
server.timeout = parseInt(this.configService.get('SERVER_TIMEOUT', timeout.toString()));
19-
this.logger.log(`server.timeout is ${server.timeout}`);
20-
server.headersTimeout = parseInt(this.configService.get('SERVER_HEADERS_TIMEOUT', headersTimeout.toString()));
21-
this.logger.log(`server.headersTimeout is ${server.headersTimeout}`);
22-
server.keepAliveTimeout = parseInt(this.configService.get('SERVER_KEEP_ALIVE_TIMEOUT', keepAliveTimeout.toString()));
23-
this.logger.log(`server.keepAliveTimeout is ${server.keepAliveTimeout}`);
24-
}
25-
}
1+
import { Inject, Injectable, Logger, OnApplicationBootstrap } from '@nestjs/common';
2+
import { HttpAdapterHost } from '@nestjs/core';
3+
import { ConfigService } from '@nestjs/config';
4+
import { Server } from 'http';
5+
6+
@Injectable()
7+
export class AppService implements OnApplicationBootstrap {
8+
private readonly logger: Logger = new Logger(AppService.name);
9+
10+
constructor(
11+
private readonly refHost: HttpAdapterHost<any>,
12+
@Inject(ConfigService) private configService: ConfigService
13+
) {}
14+
15+
onApplicationBootstrap() {
16+
const server: Server = this.refHost.httpAdapter.getHttpServer();
17+
const { timeout, headersTimeout, keepAliveTimeout } = server;
18+
server.timeout = parseInt(this.configService.get('SERVER_TIMEOUT', timeout.toString()));
19+
this.logger.log(`server.timeout is ${server.timeout}`);
20+
server.headersTimeout = parseInt(this.configService.get('SERVER_HEADERS_TIMEOUT', headersTimeout.toString()));
21+
this.logger.log(`server.headersTimeout is ${server.headersTimeout}`);
22+
server.keepAliveTimeout = parseInt(
23+
this.configService.get('SERVER_KEEP_ALIVE_TIMEOUT', keepAliveTimeout.toString())
24+
);
25+
this.logger.log(`server.keepAliveTimeout is ${server.keepAliveTimeout}`);
26+
}
27+
}

src/auth/auth.service.spec.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ describe('AuthService', () => {
99

1010
beforeEach(async () => {
1111
const module: TestingModule = await Test.createTestingModule({
12-
providers: [
13-
AuthService,
14-
{ provide: UsersService, useValue: {} },
15-
{ provide: JwtService, useValue: {} },
16-
],
12+
providers: [AuthService, { provide: UsersService, useValue: {} }, { provide: JwtService, useValue: {} }],
1713
}).compile();
1814

1915
service = module.get<AuthService>(AuthService);

src/auth/auth.service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ import { User } from '@prisma/client';
77

88
@Injectable()
99
export class AuthService {
10-
constructor(
11-
private jwtService: JwtService,
12-
) { }
10+
constructor(private jwtService: JwtService) {}
1311

1412
async encryptPassword(password): Promise<string> {
15-
const salt = await genSalt(10)
13+
const salt = await genSalt(10);
1614
return hash(password, salt);
1715
}
1816

src/auth/guards/mixed.guard.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import { JwtAuthGuard } from './auth.guard';
44

55
@Injectable()
66
export class MixedGuard implements CanActivate {
7-
constructor(private readonly apiGuard: ApiGuard, private readonly authGuard: JwtAuthGuard) {}
7+
constructor(
8+
private readonly apiGuard: ApiGuard,
9+
private readonly authGuard: JwtAuthGuard
10+
) {}
811

912
async canActivate(context: ExecutionContext): Promise<boolean> {
1013
let jwtAuth = false;

src/auth/guards/role.guard.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import { Reflector } from '@nestjs/core';
66

77
@Injectable()
88
export class RoleGuard implements CanActivate {
9-
constructor(private readonly prismaService: PrismaService, private reflector: Reflector) {}
9+
constructor(
10+
private readonly prismaService: PrismaService,
11+
private reflector: Reflector
12+
) {}
1013

1114
async canActivate(context: ExecutionContext): Promise<boolean> {
1215
const roles = this.reflector.get<Role[]>('roles', context.getHandler());

src/auth/jwt.strategy.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import { PrismaService } from '../prisma/prisma.service';
77

88
@Injectable()
99
export class JwtStrategy extends PassportStrategy(Strategy) {
10-
constructor(configService: ConfigService, private prismaService: PrismaService) {
10+
constructor(
11+
configService: ConfigService,
12+
private prismaService: PrismaService
13+
) {
1114
super({
1215
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
1316
ignoreExpiration: false,
@@ -17,7 +20,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
1720

1821
async validate(payload: JwtPayload, done: VerifiedCallback) {
1922
const user = await this.prismaService.user.findUnique({
20-
where: { email: payload.email }
23+
where: { email: payload.email },
2124
});
2225

2326
if (!user) {

src/builds/builds.controller.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('Builds Controller', () => {
5858
number: 12,
5959
};
6060

61-
beforeEach(async () => { });
61+
beforeEach(async () => {});
6262

6363
it('should be defined', async () => {
6464
controller = await initController({});

src/builds/dto/build-modify.dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export interface ModifyBuildDto {
2-
ciBuildId?: string;
3-
isRunning?: boolean;
2+
ciBuildId?: string;
3+
isRunning?: boolean;
44
}

0 commit comments

Comments
 (0)