From bc80ef60551531f405acc8f704b2d104c4aaefd0 Mon Sep 17 00:00:00 2001 From: "Micael Levi L. Cavalcante" Date: Sun, 21 Aug 2022 14:23:19 -0400 Subject: [PATCH] style: fix formatting on everything --- hooks/mocha-init-hook.ts | 2 +- integration/auto-mock/src/bar.service.ts | 3 +- .../auto-mock/test/bar.service.spec.ts | 17 ++++------ .../src/disconnected.controller.ts | 2 +- .../repl/src/users/users.controller.ts | 10 +++++- packages/common/constants.ts | 4 +-- .../lazy-module-loader-options.interface.ts | 2 +- .../repl/native-functions/methods-repl-fn.ts | 3 +- packages/core/repl/repl-context.ts | 6 +++- .../microservices/ctx-host/kafka.context.ts | 4 +-- .../test/ctx-host/kafka.context.spec.ts | 8 ++++- .../src/graphql.schema.ts | 33 ++++++++++--------- sample/30-event-emitter/test/app.e2e-spec.ts | 2 +- 13 files changed, 57 insertions(+), 39 deletions(-) diff --git a/hooks/mocha-init-hook.ts b/hooks/mocha-init-hook.ts index 4a774163f..82b14a111 100644 --- a/hooks/mocha-init-hook.ts +++ b/hooks/mocha-init-hook.ts @@ -2,6 +2,6 @@ export const mochaHooks = (): Mocha.RootHookObject => { return { async beforeAll(this: Mocha.Context) { await import('reflect-metadata'); - } + }, }; }; diff --git a/integration/auto-mock/src/bar.service.ts b/integration/auto-mock/src/bar.service.ts index d4224329a..5b75933f9 100644 --- a/integration/auto-mock/src/bar.service.ts +++ b/integration/auto-mock/src/bar.service.ts @@ -3,10 +3,9 @@ import { FooService } from './foo.service'; @Injectable() export class BarService { - constructor(private readonly foo: FooService) {} bar() { this.foo.foo(); } -} \ No newline at end of file +} diff --git a/integration/auto-mock/test/bar.service.spec.ts b/integration/auto-mock/test/bar.service.spec.ts index 754306ff3..5c8343167 100644 --- a/integration/auto-mock/test/bar.service.spec.ts +++ b/integration/auto-mock/test/bar.service.spec.ts @@ -36,7 +36,7 @@ describe('Auto-Mocking with token in factory', () => { const moduleRef = await Test.createTestingModule({ providers: [BarService], }) - .useMocker((token) => { + .useMocker(token => { if (token === FooService) { return { foo: sinon.stub }; } @@ -48,16 +48,13 @@ describe('Auto-Mocking with token in factory', () => { expect(fooServ.foo.called); }); it('cannot mock the dependencies', async () => { - const moduleRef = Test.createTestingModule({ providers: [BarService], - }) - .useMocker((token) => { - if (token === FooService.name + 'something that fails the token') { - return { foo: sinon.stub }; - } - }) - .compile; - expect(moduleRef()).to.eventually.throw() + }).useMocker(token => { + if (token === FooService.name + 'something that fails the token') { + return { foo: sinon.stub }; + } + }).compile; + expect(moduleRef()).to.eventually.throw(); }); }); diff --git a/integration/microservices/src/disconnected.controller.ts b/integration/microservices/src/disconnected.controller.ts index 0212ab1ce..a804614a7 100644 --- a/integration/microservices/src/disconnected.controller.ts +++ b/integration/microservices/src/disconnected.controller.ts @@ -3,7 +3,7 @@ import { Controller, InternalServerErrorException, Post, - RequestTimeoutException + RequestTimeoutException, } from '@nestjs/common'; import { ClientProxyFactory } from '@nestjs/microservices'; import { Observable, throwError } from 'rxjs'; diff --git a/integration/repl/src/users/users.controller.ts b/integration/repl/src/users/users.controller.ts index 3eca7ebde..d5db3a65e 100644 --- a/integration/repl/src/users/users.controller.ts +++ b/integration/repl/src/users/users.controller.ts @@ -1,4 +1,12 @@ -import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; +import { + Controller, + Get, + Post, + Body, + Patch, + Param, + Delete, +} from '@nestjs/common'; import { UsersService } from './users.service'; import { CreateUserDto } from './dto/create-user.dto'; import { UpdateUserDto } from './dto/update-user.dto'; diff --git a/packages/common/constants.ts b/packages/common/constants.ts index a31e5962d..7d618b01c 100644 --- a/packages/common/constants.ts +++ b/packages/common/constants.ts @@ -17,8 +17,8 @@ export const METHOD_METADATA = 'method'; export const ROUTE_ARGS_METADATA = '__routeArguments__'; export const CUSTOM_ROUTE_ARGS_METADATA = '__customRouteArgs__'; /** - * @deprecated Use `CUSTOM_ROUTE_ARGS_METADATA` instead - */ + * @deprecated Use `CUSTOM_ROUTE_ARGS_METADATA` instead + */ export const CUSTOM_ROUTE_AGRS_METADATA = CUSTOM_ROUTE_ARGS_METADATA; export const EXCEPTION_FILTERS_METADATA = '__exceptionFilters__'; export const FILTER_CATCH_EXCEPTIONS = '__filterCatchExceptions__'; diff --git a/packages/core/injector/lazy-module-loader-options.interface.ts b/packages/core/injector/lazy-module-loader-options.interface.ts index 2cd647864..db3a29575 100644 --- a/packages/core/injector/lazy-module-loader-options.interface.ts +++ b/packages/core/injector/lazy-module-loader-options.interface.ts @@ -1,5 +1,5 @@ export interface LazyModuleLoaderLoadOptions { - /** + /** * If `false`, no logs will be generated when loading some module lazily. */ logger?: boolean; diff --git a/packages/core/repl/native-functions/methods-repl-fn.ts b/packages/core/repl/native-functions/methods-repl-fn.ts index b8deb83fc..3fb38e6ec 100644 --- a/packages/core/repl/native-functions/methods-repl-fn.ts +++ b/packages/core/repl/native-functions/methods-repl-fn.ts @@ -7,7 +7,8 @@ import type { ReplFnDefinition } from '../repl.interfaces'; export class MethodsReplFn extends ReplFunction { public fnDefinition: ReplFnDefinition = { name: 'methods', - description: 'Display all public methods available on a given provider or controller.', + description: + 'Display all public methods available on a given provider or controller.', signature: '(token: ClassRef | string) => void', }; diff --git a/packages/core/repl/repl-context.ts b/packages/core/repl/repl-context.ts index ef48fce9b..bfc5ef234 100644 --- a/packages/core/repl/repl-context.ts +++ b/packages/core/repl/repl-context.ts @@ -1,4 +1,8 @@ -import { INestApplicationContext, InjectionToken, Logger } from '@nestjs/common'; +import { + INestApplicationContext, + InjectionToken, + Logger, +} from '@nestjs/common'; import { ApplicationConfig } from '../application-config'; import { ModuleRef, NestContainer } from '../injector'; import { InternalCoreModule } from '../injector/internal-core-module'; diff --git a/packages/microservices/ctx-host/kafka.context.ts b/packages/microservices/ctx-host/kafka.context.ts index bd0969d94..7d1f5e4a5 100644 --- a/packages/microservices/ctx-host/kafka.context.ts +++ b/packages/microservices/ctx-host/kafka.context.ts @@ -45,7 +45,7 @@ export class KafkaContext extends BaseRpcContext { /** * Returns the Kafka heartbeat callback. */ - getHeartbeat() { + getHeartbeat() { return this.args[4]; - } + } } diff --git a/packages/microservices/test/ctx-host/kafka.context.spec.ts b/packages/microservices/test/ctx-host/kafka.context.spec.ts index 26db4a868..9be85a12b 100644 --- a/packages/microservices/test/ctx-host/kafka.context.spec.ts +++ b/packages/microservices/test/ctx-host/kafka.context.spec.ts @@ -3,7 +3,13 @@ import { KafkaContext } from '../../ctx-host'; import { Consumer, KafkaMessage } from '../../external/kafka.interface'; describe('KafkaContext', () => { - const args = ['test', { test: true }, undefined, { test: 'consumer' }, () => {}]; + const args = [ + 'test', + { test: true }, + undefined, + { test: 'consumer' }, + () => {}, + ]; let context: KafkaContext; beforeEach(() => { diff --git a/sample/12-graphql-schema-first/src/graphql.schema.ts b/sample/12-graphql-schema-first/src/graphql.schema.ts index d93925312..47a938f40 100644 --- a/sample/12-graphql-schema-first/src/graphql.schema.ts +++ b/sample/12-graphql-schema-first/src/graphql.schema.ts @@ -1,4 +1,3 @@ - /* * ------------------------------------------------------- * THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY) @@ -8,36 +7,40 @@ /* tslint:disable */ /* eslint-disable */ export class CreateCatInput { - name?: Nullable; - age?: Nullable; + name?: Nullable; + age?: Nullable; } export abstract class IQuery { - abstract cats(): Nullable[]> | Promise[]>>; + abstract cats(): + | Nullable[]> + | Promise[]>>; - abstract cat(id: string): Nullable | Promise>; + abstract cat(id: string): Nullable | Promise>; } export abstract class IMutation { - abstract createCat(createCatInput?: Nullable): Nullable | Promise>; + abstract createCat( + createCatInput?: Nullable, + ): Nullable | Promise>; } export abstract class ISubscription { - abstract catCreated(): Nullable | Promise>; + abstract catCreated(): Nullable | Promise>; } export class Owner { - id: number; - name: string; - age?: Nullable; - cats?: Nullable; + id: number; + name: string; + age?: Nullable; + cats?: Nullable; } export class Cat { - id?: Nullable; - name?: Nullable; - age?: Nullable; - owner?: Nullable; + id?: Nullable; + name?: Nullable; + age?: Nullable; + owner?: Nullable; } type Nullable = T | null; diff --git a/sample/30-event-emitter/test/app.e2e-spec.ts b/sample/30-event-emitter/test/app.e2e-spec.ts index 1fac95f6b..0136f2d60 100644 --- a/sample/30-event-emitter/test/app.e2e-spec.ts +++ b/sample/30-event-emitter/test/app.e2e-spec.ts @@ -21,6 +21,6 @@ describe('AppController (e2e)', () => { .expect(200) .expect('Hello World!'); }); - + afterEach(() => app.close()); });