Skip to content

Commit

Permalink
format: fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Dec 13, 2023
1 parent 891a651 commit be9672f
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 69 deletions.
19 changes: 11 additions & 8 deletions apps/auth/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function bootstrap(): Promise<void> {
// bodyLimit: +process.env.MAX_PAYLOAD_SIZE || 5,
// maxParamLength: 100,
}),
{ bufferLogs: true, abortOnError: false }
{ bufferLogs: true, abortOnError: false },
);

const configService = app.get<AppConfigService>(ConfigService);
Expand All @@ -60,7 +60,7 @@ async function bootstrap(): Promise<void> {
// });

// Fastify
app.register(fastifyHelmet, {
await app.register(fastifyHelmet, {
contentSecurityPolicy: {
directives: {
defaultSrc: [`'self'`],
Expand All @@ -70,14 +70,14 @@ async function bootstrap(): Promise<void> {
},
},
});
app.register(fastifySecureSession, {
await app.register(fastifySecureSession, {
key: configService.get('SESSION_KEY'),
cookie: getCookieOptions(environment),
});
app.register(fastifyPassport.initialize());
app.register(fastifyPassport.secureSession());
await app.register(fastifyPassport.initialize());
await app.register(fastifyPassport.secureSession());
if (!proxyServerUrls.length) {
app.register(fastifyCors, {
await app.register(fastifyCors, {
origin: '*',
// allowedHeaders: ALLOWED_HEADERS,
// exposedHeaders: EXPOSED_HEADERS,
Expand Down Expand Up @@ -126,9 +126,12 @@ async function bootstrap(): Promise<void> {
await app.listen(port, '0.0.0.0', () => {
logger.log(`Listening at http://localhost:${port}/${GLOBAL_API_PREFIX}`);
logger.log(
`Access SwaggerUI at http://localhost:${port}/${swaggerUiPrefix}`
`Access SwaggerUI at http://localhost:${port}/${swaggerUiPrefix}`,
);
});
}

bootstrap();
bootstrap().catch((error) => {
console.error(error);
process.exit(1);
});
12 changes: 6 additions & 6 deletions apps/auth/test/users.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ describe('UsersController (e2e)', () => {
app = moduleFixture.createNestApplication(new FastifyAdapter());

const configService = app.get<AppConfigService>(ConfigService);
app.register(fastifySecureSession, {
await app.register(fastifySecureSession, {
key: configService.get('SESSION_KEY'),
cookie: {
secure: false,
signed: false,
},
});
app.register(fastifyPassport.initialize());
app.register(fastifyPassport.secureSession());
await app.register(fastifyPassport.initialize());
await app.register(fastifyPassport.secureSession());

await app.init();
});
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('UsersController (e2e)', () => {
expect(statusCode).toBe(400);
expect(body).toHaveProperty('errors');
expect(body.errors[0].message).toBe(
'password must be longer than or equal to 4 characters'
'password must be longer than or equal to 4 characters',
);
});

Expand Down Expand Up @@ -176,7 +176,7 @@ describe('UsersController (e2e)', () => {
expect.objectContaining({
name: 'session',
value: expect.any(String),
})
}),
);
});

Expand Down Expand Up @@ -252,7 +252,7 @@ describe('UsersController (e2e)', () => {
});
//
const sessionCookie = response.cookies.find(
(cookie) => (cookie as any).name === 'session'
(cookie) => (cookie as any).name === 'session',
);
expect(response.statusCode).toBe(200);
expect((sessionCookie as any)?.value).toBe('');
Expand Down
5 changes: 2 additions & 3 deletions apps/ng-client/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ export class AppComponent implements OnInit, OnDestroy {
constructor(
private store: Store<RootState>,
private router: Router,
private alertService: AlertService
private alertService: AlertService,
) {}

ngOnInit(): void {
this.alertService.clear();
this.error$ = this.store.select(RootStoreSelectors.selectError);
this.isLoading$ = this.store.select(RootStoreSelectors.selectIsLoading);
this.user$ = this.store.select(UserStoreSelectors.selectCurrentUser);
// TODO: only dispatch LoadCurrentUserAction if !!currentToken
this.store.dispatch(new UserStoreActions.LoadCurrentUserAction());
this.error$.pipe(takeUntil(this.destroy$)).subscribe({
next: (error) => {
Expand All @@ -54,6 +53,6 @@ export class AppComponent implements OnInit, OnDestroy {

logout(): void {
this.store.dispatch(new UserStoreActions.SignOutAction());
this.router.navigate(['/']);
void this.router.navigate(['/']);
}
}
6 changes: 3 additions & 3 deletions apps/ng-client/src/app/orders/list/list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ export class OrderListComponent implements OnInit {

constructor(
private store: Store<RootStoreState.RootState>,
private router: Router
private router: Router,
) {}

ngOnInit(): void {
this.orders$ = this.store.select(OrderStoreSelectors.selectAllOrderItems);
this.isLoading$ = this.store.select(
OrderStoreSelectors.selectOrderIsLoading
OrderStoreSelectors.selectOrderIsLoading,
);
this.store.dispatch(new OrderStoreActions.LoadOrdersAction());
}

onViewOrder(orderId: string): void {
this.router.navigate([`/${Resources.ORDERS}`, orderId]);
void this.router.navigate([`/${Resources.ORDERS}`, orderId]);
}

onCancelOrder(orderId: string): void {
Expand Down
17 changes: 10 additions & 7 deletions apps/ng-client/src/app/tickets/details/details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,39 @@ export class TicketDetailsComponent implements OnInit, OnDestroy {
private router: Router,
private actionsSubj: ActionsSubject,
private route: ActivatedRoute,
private alertService: AlertService
private alertService: AlertService,
) {}

ngOnInit(): void {
this.ticket$ = this.store.select(
TicketStoreSelectors.selectCurrentTicket()
TicketStoreSelectors.selectCurrentTicket(),
);

const ticketId = this.route.snapshot.paramMap.get('id');
if (ticketId) {
this.store.dispatch(
// new TicketStoreActions.LoadTicketAction({ ticketId })
new TicketStoreActions.SelectTicketAction({ ticketId })
new TicketStoreActions.SelectTicketAction({ ticketId }),
);
}

this.actionsSubj
.pipe(
takeUntil(this.destroy$),
ofType<OrderStoreActions.CreateOrderSuccessAction>(
OrderStoreActions.ActionTypes.CREATE_ORDER_SUCCESS
)
OrderStoreActions.ActionTypes.CREATE_ORDER_SUCCESS,
),
)
.subscribe({
next: ({ payload }) => {
this.alertService.success('Order created', {
keepAfterRouteChange: true,
autoClose: true,
});
this.router.navigate([`/${Resources.ORDERS}/`, payload.order.id]);
void this.router.navigate([
`/${Resources.ORDERS}/`,
payload.order.id,
]);
},
});
}
Expand All @@ -70,7 +73,7 @@ export class TicketDetailsComponent implements OnInit, OnDestroy {

purchaseTicket(ticket: Ticket): void {
this.store.dispatch(
new OrderStoreActions.CreateOrderAction({ ticketId: ticket.id })
new OrderStoreActions.CreateOrderAction({ ticketId: ticket.id }),
);
}

Expand Down
4 changes: 2 additions & 2 deletions apps/ng-client/src/app/tickets/list/list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export class TicketListComponent implements OnInit {
}

onViewTicket(ticketId: string): void {
this.router.navigate([`/${Resources.TICKETS}`, ticketId]);
void this.router.navigate([`/${Resources.TICKETS}`, ticketId]);
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
onUpdateTicket(ticketId: string): void {
onUpdateTicket(_ticketId: string): void {
// const modalRef = this.modalService.open(UpdateTicketModalComponent);
// modalRef.componentInstance.ticketId = ticketId;
}
Expand Down
10 changes: 5 additions & 5 deletions apps/ng-client/src/app/user/sign-in.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class SignInComponent implements OnInit, OnDestroy {
private route: ActivatedRoute,
private router: Router,
private store: Store<UserStoreState.State>,
private actionsSubj: ActionsSubject
private actionsSubj: ActionsSubject,
) {}

ngOnInit(): void {
Expand All @@ -45,21 +45,21 @@ export class SignInComponent implements OnInit, OnDestroy {
.select(UserStoreSelectors.selectCurrentUser)
.pipe(
takeUntil(this.destroy$),
filter((user) => !!user?.email)
filter((user) => !!user?.email),
)
.subscribe({
next: () => {
this.router.navigate([this.returnUrl]);
void this.router.navigate([this.returnUrl]);
},
});

this.actionsSubj
.pipe(
takeUntil(this.destroy$),
ofType<UserStoreActions.SignInSuccessAction>(
UserStoreActions.ActionTypes.SIGN_IN_SUCCESS
UserStoreActions.ActionTypes.SIGN_IN_SUCCESS,
),
take(1)
take(1),
)
.subscribe({
next: () => {
Expand Down
12 changes: 5 additions & 7 deletions apps/ng-client/src/app/user/sign-up.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class SignUpComponent implements OnInit, OnDestroy {
private router: Router,
private actionsSubj: ActionsSubject,
private store: Store<RootStoreState.RootState>,
private alertService: AlertService
private alertService: AlertService,
) {}

ngOnInit(): void {
Expand All @@ -45,24 +45,22 @@ export class SignUpComponent implements OnInit, OnDestroy {
.pipe(takeUntil(this.destroy$), first())
.subscribe({
next: (user) => {
if (user) {
this.router.navigate(['/']);
}
user && void this.router.navigate(['/']);
},
});

this.actionsSubj
.pipe(
takeUntil(this.destroy$),
ofType(UserStoreActions.ActionTypes.SIGN_UP_SUCCESS)
ofType(UserStoreActions.ActionTypes.SIGN_UP_SUCCESS),
)
.subscribe({
next: () => {
this.alertService.success('Registration successful', {
keepAfterRouteChange: true,
autoClose: true,
});
this.router.navigate(['../sign-in'], { relativeTo: this.route });
void this.router.navigate(['../sign-in'], { relativeTo: this.route });
},
});
}
Expand All @@ -87,7 +85,7 @@ export class SignUpComponent implements OnInit, OnDestroy {
this.store.dispatch(
new UserStoreActions.SignUpAction({
credentials: this.form.value,
})
}),
);
}
}
4 changes: 2 additions & 2 deletions apps/orders/src/app/orders/orders-ms.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('OrdersMSController', () => {
});

describe('onExpiration()', () => {
it('should call "OrdersService.expireById" and in case of success ack NATS message', async () => {
it('should call "OrdersService.expireById" and in case of success ack RMQ message', async () => {
// order coming from expiration-service
const order = { id: new Types.ObjectId().toHexString() };
const context = createRmqContext();
Expand All @@ -49,7 +49,7 @@ describe('OrdersMSController', () => {
expect(context.getChannelRef().ack).toBeCalled();
});

it('should call "OrdersService.expireById" and in case of error NOT ack NATS message', async () => {
it('should call "OrdersService.expireById" and in case of error NOT ack RMQ message', async () => {
// order coming from expiration-service
const order = { id: new Types.ObjectId().toHexString() };
const context = createRmqContext();
Expand Down
12 changes: 6 additions & 6 deletions libs/microservices/ory-client/src/lib/ory.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { OryService } from './ory.service';
export class OryModule {
static forRoot(
options: IOryModuleOptions,
isGlobal?: boolean
isGlobal?: boolean,
): DynamicModule {
return {
module: OryModule,
Expand All @@ -28,7 +28,7 @@ export class OryModule {

static forRootAsync(
options: OryModuleAsyncOptions,
isGlobal?: boolean
isGlobal?: boolean,
): DynamicModule {
return {
module: OryModule,
Expand All @@ -40,7 +40,7 @@ export class OryModule {
}

private static createAsyncProviders(
options: OryModuleAsyncOptions
options: OryModuleAsyncOptions,
): Provider[] {
if (options.useExisting || options.useFactory) {
return [this.createAsyncOptionsProvider(options)];
Expand All @@ -58,7 +58,7 @@ export class OryModule {
}

private static createAsyncOptionsProvider(
options: OryModuleAsyncOptions
options: OryModuleAsyncOptions,
): Provider {
if (options.useFactory) {
return {
Expand All @@ -72,8 +72,8 @@ export class OryModule {
}
return {
provide: OryModuleOptions,
useFactory: async (optionsFactory: OryModuleOptionsFactory) =>
await optionsFactory.createOryOptions(),
useFactory: (optionsFactory: OryModuleOptionsFactory) =>
optionsFactory.createOryOptions(),
inject: [
(options.useExisting ??
options.useClass) as Type<OryModuleOptionsFactory>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function createAuthGuard(type?: string | string[]): Type<IAuthGuard> {
const handler = passport.authenticate(
type,
options,
// eslint-disable-next-line require-await
async function (
_req: FastifyRequest,
_res: FastifyReply,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class PassportModule {
}

private static createAsyncProviders(
options: AuthModuleAsyncOptions
options: AuthModuleAsyncOptions,
): Provider[] {
if (options.useExisting || options.useFactory) {
return [this.createAsyncOptionsProvider(options)];
Expand All @@ -42,7 +42,7 @@ export class PassportModule {
}

private static createAsyncOptionsProvider(
options: AuthModuleAsyncOptions
options: AuthModuleAsyncOptions,
): Provider {
if (options.useFactory) {
return {
Expand All @@ -53,8 +53,8 @@ export class PassportModule {
}
return {
provide: AuthModuleOptions,
useFactory: async (optionsFactory: AuthOptionsFactory) =>
await optionsFactory.createAuthOptions(),
useFactory: (optionsFactory: AuthOptionsFactory) =>
optionsFactory.createAuthOptions(),
inject: [options.useExisting || options.useClass],
};
}
Expand Down
Loading

0 comments on commit be9672f

Please sign in to comment.