From 6bb5d6480ab5ff17cbfd31c26823185d5f6c95bd Mon Sep 17 00:00:00 2001 From: courthive Date: Wed, 17 Apr 2024 21:12:12 -0400 Subject: [PATCH] refactor: :recycle: linting auto fixes --- src/query/matchUps/roundRobinTally/getGroupOrder.ts | 2 +- src/server/app.service.spec.ts | 4 ++-- src/server/auth/auth.module.ts | 10 +++++----- src/server/auth/auth.service.ts | 4 ++-- src/server/auth/guards/auth.guard.ts | 6 +++--- src/server/config/app/config.ts | 2 +- src/server/config/config.module.ts | 6 +++--- src/server/main.ts | 2 +- src/server/providers/factory/factory.module.ts | 2 +- src/server/providers/users/users.module.ts | 2 +- src/server/providers/users/users.service.spec.ts | 2 +- src/server/providers/users/users.service.ts | 4 ++-- src/validators/time.ts | 2 +- src/validators/validateSchedulingProfile.ts | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/query/matchUps/roundRobinTally/getGroupOrder.ts b/src/query/matchUps/roundRobinTally/getGroupOrder.ts index a39f11b170..50c5bb5256 100644 --- a/src/query/matchUps/roundRobinTally/getGroupOrder.ts +++ b/src/query/matchUps/roundRobinTally/getGroupOrder.ts @@ -304,7 +304,7 @@ function groupSubSort({ participantResults, disableHeadToHead, participantIds, m report.push(result.report); // return false if a rule has successfully broken the tie - return result.order ? false : true; + return !result.order; }); if (result.order) return { order: result.order, report }; diff --git a/src/server/app.service.spec.ts b/src/server/app.service.spec.ts index 10f1d5092c..5c75a66262 100644 --- a/src/server/app.service.spec.ts +++ b/src/server/app.service.spec.ts @@ -11,7 +11,7 @@ describe('AppService', () => { app = await Test.createTestingModule({ imports: [AuthModule, UsersModule], controllers: [AppController], - providers: [AppService] + providers: [AppService], }).compile(); }); @@ -19,7 +19,7 @@ describe('AppService', () => { it('should return "Factory server"', () => { const appController = app.get(AppController); expect(appController.factoryService()).toStrictEqual({ - message: 'Factory server' + message: 'Factory server', }); }); }); diff --git a/src/server/auth/auth.module.ts b/src/server/auth/auth.module.ts index 7e3ada5e4e..829d51cfef 100644 --- a/src/server/auth/auth.module.ts +++ b/src/server/auth/auth.module.ts @@ -12,17 +12,17 @@ import { Module } from '@nestjs/common'; JwtModule.register({ signOptions: { expiresIn: process.env.JWT_VALIDITY || '1d' }, secret: process.env.JWT_SECRET, - global: true - }) + global: true, + }), ], providers: [ AuthService, { provide: APP_GUARD, - useClass: AuthGuard - } + useClass: AuthGuard, + }, ], controllers: [AuthController], - exports: [AuthService] + exports: [AuthService], }) export class AuthModule {} diff --git a/src/server/auth/auth.service.ts b/src/server/auth/auth.service.ts index 62df7cd6e6..8b5d348c56 100644 --- a/src/server/auth/auth.service.ts +++ b/src/server/auth/auth.service.ts @@ -6,7 +6,7 @@ import { JwtService } from '@nestjs/jwt'; export class AuthService { constructor( private usersService: UsersService, - private jwtService: JwtService + private jwtService: JwtService, ) {} async signIn(email: string, pass: string) { @@ -16,7 +16,7 @@ export class AuthService { } const payload = { email: user.email, sub: user.userId, roles: user.roles }; return { - token: await this.jwtService.signAsync(payload) + token: await this.jwtService.signAsync(payload), }; } } diff --git a/src/server/auth/guards/auth.guard.ts b/src/server/auth/guards/auth.guard.ts index 001c1db4c5..f060d792ba 100644 --- a/src/server/auth/guards/auth.guard.ts +++ b/src/server/auth/guards/auth.guard.ts @@ -7,13 +7,13 @@ import { CanActivate, ExecutionContext, Injectable, UnauthorizedException } from export class AuthGuard implements CanActivate { constructor( private jwtService: JwtService, - private reflector: Reflector + private reflector: Reflector, ) {} async canActivate(context: ExecutionContext): Promise { const isPublic = this.reflector.getAllAndOverride(IS_PUBLIC_KEY, [ context.getHandler(), - context.getClass() + context.getClass(), ]); if (isPublic) { return true; @@ -27,7 +27,7 @@ export class AuthGuard implements CanActivate { try { const payload = await this.jwtService.verifyAsync(token, { - secret: process.env.JWT_SECRET + secret: process.env.JWT_SECRET, }); // assign payload to the request object for access in route handlers request['user'] = payload; diff --git a/src/server/config/app/config.ts b/src/server/config/app/config.ts index e780275806..f8b7bd9b12 100644 --- a/src/server/config/app/config.ts +++ b/src/server/config/app/config.ts @@ -5,5 +5,5 @@ export const APPConfig = registerAs(ConfigKey.App, () => ({ env: Environment[process.env.NODE_ENV as keyof typeof Environment] || Environment.Development, port: Number(process.env.APP_PORT) || 8383, name: String(process.env.APP_NAME), - appName: process.env.APP_NAME + appName: process.env.APP_NAME, })); diff --git a/src/server/config/config.module.ts b/src/server/config/config.module.ts index 8e0425c296..3e27b1e341 100644 --- a/src/server/config/config.module.ts +++ b/src/server/config/config.module.ts @@ -8,8 +8,8 @@ import { Module } from '@nestjs/common'; ConfigModule.forRoot({ load: [...configurations], validate: validateConfig, - isGlobal: true - }) - ] + isGlobal: true, + }), + ], }) export class ConfigsModule {} diff --git a/src/server/main.ts b/src/server/main.ts index b366292ebf..a6f712c6fd 100644 --- a/src/server/main.ts +++ b/src/server/main.ts @@ -10,7 +10,7 @@ async function bootstrap() { app.enableCors({ methods: ['GET', 'POST'], allowedHeaders: '*', - origin: '*' + origin: '*', }); // await app.register(cookieParser); diff --git a/src/server/providers/factory/factory.module.ts b/src/server/providers/factory/factory.module.ts index 2438423254..eab255cd17 100644 --- a/src/server/providers/factory/factory.module.ts +++ b/src/server/providers/factory/factory.module.ts @@ -3,6 +3,6 @@ import { Module } from '@nestjs/common'; @Module({ providers: [FactoryService], - exports: [FactoryService] + exports: [FactoryService], }) export class FactoryModule {} diff --git a/src/server/providers/users/users.module.ts b/src/server/providers/users/users.module.ts index 914e490419..1d91c8df3a 100644 --- a/src/server/providers/users/users.module.ts +++ b/src/server/providers/users/users.module.ts @@ -3,6 +3,6 @@ import { Module } from '@nestjs/common'; @Module({ providers: [UsersService], - exports: [UsersService] + exports: [UsersService], }) export class UsersModule {} diff --git a/src/server/providers/users/users.service.spec.ts b/src/server/providers/users/users.service.spec.ts index 454f33c168..62815ba641 100644 --- a/src/server/providers/users/users.service.spec.ts +++ b/src/server/providers/users/users.service.spec.ts @@ -6,7 +6,7 @@ describe('UsersService', () => { beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ - providers: [UsersService] + providers: [UsersService], }).compile(); service = module.get(UsersService); diff --git a/src/server/providers/users/users.service.ts b/src/server/providers/users/users.service.ts index 8d34394d42..31537ac901 100644 --- a/src/server/providers/users/users.service.ts +++ b/src/server/providers/users/users.service.ts @@ -15,8 +15,8 @@ export class UsersService { userId: 1, email: TEST_EMAIL, password: TEST_PASSWORD, - roles: ['admin', 'client'] - } + roles: ['admin', 'client'], + }, ]; async findOne(email: string): Promise { diff --git a/src/validators/time.ts b/src/validators/time.ts index a2729764df..634163fb5a 100644 --- a/src/validators/time.ts +++ b/src/validators/time.ts @@ -11,7 +11,7 @@ export function validTimePeriod({ startTime = '', endTime = '' } = {}) { const [endHour, endMinute] = endTime.split(':').map(getInt); if (endHour < startHour) return false; - return startHour === endHour && endMinute < startMinute ? false : true; + return !(startHour === endHour && endMinute < startMinute); } export function startTimeSort(a, b) { diff --git a/src/validators/validateSchedulingProfile.ts b/src/validators/validateSchedulingProfile.ts index 09b8949d48..c56b76b1ce 100644 --- a/src/validators/validateSchedulingProfile.ts +++ b/src/validators/validateSchedulingProfile.ts @@ -56,7 +56,7 @@ export function validateSchedulingProfile({ tournamentRecords, schedulingProfile return validRound && validSegment; }); - return !validRounds ? false : true; + return !!validRounds; }); });