Skip to content

Commit

Permalink
style: fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
micalevisk committed Sep 21, 2023
1 parent ec43dc8 commit 6bcb3bd
Show file tree
Hide file tree
Showing 41 changed files with 94 additions and 77 deletions.
2 changes: 1 addition & 1 deletion integration/nest-application/sse/src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class AppController {
@Sse('sse')
sse(): Observable<MessageEvent> {
return interval(1000).pipe(
map(_ => ({ data: { hello: 'world' } } as MessageEvent)),
map(_ => ({ data: { hello: 'world' } }) as MessageEvent),
);
}
}
3 changes: 2 additions & 1 deletion packages/common/module-utils/configurable-module.builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export interface ConfigurableModuleBuilderOptions {
export class ConfigurableModuleBuilder<
ModuleOptions,
StaticMethodKey extends string = typeof DEFAULT_METHOD_KEY,
FactoryClassMethodKey extends string = typeof DEFAULT_FACTORY_CLASS_METHOD_KEY,
FactoryClassMethodKey extends
string = typeof DEFAULT_FACTORY_CLASS_METHOD_KEY,
ExtraModuleDefinitionOptions = {},
> {
protected staticMethodKey: StaticMethodKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export type ConfigurableModuleOptionsFactory<
*/
export interface ConfigurableModuleAsyncOptions<
ModuleOptions,
FactoryClassMethodKey extends string = typeof DEFAULT_FACTORY_CLASS_METHOD_KEY,
FactoryClassMethodKey extends
string = typeof DEFAULT_FACTORY_CLASS_METHOD_KEY,
> extends Pick<ModuleMetadata, 'imports'> {
/**
* Injection token resolving to an existing provider. The provider must implement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import { ConfigurableModuleAsyncOptions } from './configurable-module-async-opti
export type ConfigurableModuleCls<
ModuleOptions,
MethodKey extends string = typeof DEFAULT_METHOD_KEY,
FactoryClassMethodKey extends string = typeof DEFAULT_FACTORY_CLASS_METHOD_KEY,
FactoryClassMethodKey extends
string = typeof DEFAULT_FACTORY_CLASS_METHOD_KEY,
ExtraModuleDefinitionOptions = {},
> = {
new (): any;
Expand Down
4 changes: 3 additions & 1 deletion packages/common/pipes/file/file-validator.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export abstract class FileValidator<
* Indicates if this file should be considered valid, according to the options passed in the constructor.
* @param file the file from the request object
*/
abstract isValid(file?: TFile | TFile[] | Record<string, TFile[]>): boolean | Promise<boolean>;
abstract isValid(
file?: TFile | TFile[] | Record<string, TFile[]>,
): boolean | Promise<boolean>;

/**
* Builds an error message in case the validation fails.
Expand Down
15 changes: 6 additions & 9 deletions packages/core/injector/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,8 @@ export class NestContainer {
if (!metatype) {
throw new UndefinedForwardRefException(scope);
}
const { type, dynamicMetadata, token } = await this.moduleCompiler.compile(
metatype,
);
const { type, dynamicMetadata, token } =
await this.moduleCompiler.compile(metatype);
if (this.modules.has(token)) {
return {
moduleRef: this.modules.get(token),
Expand Down Expand Up @@ -124,9 +123,8 @@ export class NestContainer {
}

const { token } = await this.moduleCompiler.compile(metatypeToReplace);
const { type, dynamicMetadata } = await this.moduleCompiler.compile(
newMetatype,
);
const { type, dynamicMetadata } =
await this.moduleCompiler.compile(newMetatype);

return {
moduleRef: await this.setModule(
Expand Down Expand Up @@ -220,9 +218,8 @@ export class NestContainer {
return;
}
const moduleRef = this.modules.get(token);
const { token: relatedModuleToken } = await this.moduleCompiler.compile(
relatedModule,
);
const { token: relatedModuleToken } =
await this.moduleCompiler.compile(relatedModule);
const related = this.modules.get(relatedModuleToken);
moduleRef.addImport(related);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/core/middleware/middleware-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import { RouteInfoPathExtractor } from './route-info-path-extractor';
import { RoutesMapper } from './routes-mapper';

export class MiddlewareModule<
TAppOptions extends NestApplicationContextOptions = NestApplicationContextOptions,
TAppOptions extends
NestApplicationContextOptions = NestApplicationContextOptions,
> {
private readonly routerProxy = new RouterProxy();
private readonly exceptionFiltersCache = new WeakMap();
Expand Down
3 changes: 2 additions & 1 deletion packages/core/nest-application-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import { Module } from './injector/module';
* @publicApi
*/
export class NestApplicationContext<
TOptions extends NestApplicationContextOptions = NestApplicationContextOptions,
TOptions extends
NestApplicationContextOptions = NestApplicationContextOptions,
>
extends AbstractInstanceResolver
implements INestApplicationContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('ExternalExceptionFilterContext', () => {
it('should return plain ExceptionHandler object', () => {
const filter = exceptionFilter.create(
new EmptyMetadata(),
() => ({} as any),
() => ({}) as any,
undefined,
);
expect((filter as any).filters).to.be.empty;
Expand All @@ -50,7 +50,7 @@ describe('ExternalExceptionFilterContext', () => {
it('should return ExceptionHandler object with exception filters', () => {
const filter = exceptionFilter.create(
new WithMetadata(),
() => ({} as any),
() => ({}) as any,
undefined,
);
expect((filter as any).filters).to.not.be.empty;
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('ExternalExceptionFilterContext', () => {
.callsFake(() => scopedFilterWrappers);
sinon
.stub(instanceWrapper, 'getInstanceByContextId')
.callsFake(() => ({ instance } as any));
.callsFake(() => ({ instance }) as any);

expect(exceptionFilter.getGlobalMetadata({ id: 3 })).to.contains(
instance,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/guards/guards-context-creator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe('GuardsContextCreator', () => {
.callsFake(() => scopedGuardWrappers);
sinon
.stub(instanceWrapper, 'getInstanceByContextId')
.callsFake(() => ({ instance } as any));
.callsFake(() => ({ instance }) as any);

expect(guardsContextCreator.getGlobalMetadata({ id: 3 })).to.contains(
instance,
Expand Down
7 changes: 5 additions & 2 deletions packages/core/test/injector/injector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ describe('Injector', () => {
class MainTest {
@Inject() property: DependencyOne;

constructor(public one: DependencyOne, public two: DependencyTwo) {}
constructor(
public one: DependencyOne,
public two: DependencyTwo,
) {}
}

let moduleDeps: Module;
Expand Down Expand Up @@ -743,7 +746,7 @@ describe('Injector', () => {

const loadInstanceStub = sinon
.stub(injector, 'loadInstance')
.callsFake(async () => ({} as any));
.callsFake(async () => ({}) as any);

await injector.loadEnhancersPerContext(wrapper, STATIC_CONTEXT);
expect(loadInstanceStub.calledTwice).to.be.true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe('InterceptorsContextCreator', () => {
.callsFake(() => scopedInterceptorWrappers);
sinon
.stub(instanceWrapper, 'getInstanceByContextId')
.callsFake(() => ({ instance } as any));
.callsFake(() => ({ instance }) as any);

expect(
interceptorsContextCreator.getGlobalMetadata({ id: 3 }),
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/pipes/pipes-context-creator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('PipesContextCreator', () => {
.callsFake(() => scopedPipeWrappers);
sinon
.stub(instanceWrapper, 'getInstanceByContextId')
.callsFake(() => ({ instance } as any));
.callsFake(() => ({ instance }) as any);

expect(creator.getGlobalMetadata({ id: 3 })).to.contains(
instance,
Expand Down
6 changes: 3 additions & 3 deletions packages/core/test/router/router-exception-filters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('RouterExceptionFilters', () => {
it('should return plain ExceptionHandler object', () => {
const filter = exceptionFilter.create(
new EmptyMetadata(),
() => ({} as any),
() => ({}) as any,
undefined,
);
expect((filter as any).filters).to.be.empty;
Expand All @@ -48,7 +48,7 @@ describe('RouterExceptionFilters', () => {
it('should return ExceptionHandler object with exception filters', () => {
const filter = exceptionFilter.create(
new WithMetadata(),
() => ({} as any),
() => ({}) as any,
undefined,
);
expect((filter as any).filters).to.not.be.empty;
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('RouterExceptionFilters', () => {
.callsFake(() => scopedFilterWrappers);
sinon
.stub(instanceWrapper, 'getInstanceByContextId')
.callsFake(() => ({ instance } as any));
.callsFake(() => ({ instance }) as any);

expect(exceptionFilter.getGlobalMetadata({ id: 3 })).to.contains(
instance,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/router/router-explorer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe('RouterExplorer', () => {
() =>
({
next: nextSpy,
} as any),
}) as any,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { Observable } from 'rxjs';
* @publicApi
*/
export interface MessageHandler<TInput = any, TContext = any, TResult = any> {
(data: TInput, ctx?: TContext):
| Promise<Observable<TResult>>
| Promise<TResult>;
(
data: TInput,
ctx?: TContext,
): Promise<Observable<TResult>> | Promise<TResult>;
next?: (
data: TInput,
ctx?: TContext,
Expand Down
3 changes: 2 additions & 1 deletion packages/microservices/microservices-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import { ListenersController } from './listeners-controller';
import { Server } from './server/server';

export class MicroservicesModule<
TAppOptions extends NestApplicationContextOptions = NestApplicationContextOptions,
TAppOptions extends
NestApplicationContextOptions = NestApplicationContextOptions,
> {
private readonly clientsContainer = new ClientsContainer();
private listenersController: ListenersController;
Expand Down
5 changes: 4 additions & 1 deletion packages/microservices/record-builders/rmq.record-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export interface RmqRecordOptions {
}

export class RmqRecord<TData = any> {
constructor(public readonly data: TData, public options?: RmqRecordOptions) {}
constructor(
public readonly data: TData,
public options?: RmqRecordOptions,
) {}
}

export class RmqRecordBuilder<TData> {
Expand Down
2 changes: 1 addition & 1 deletion packages/microservices/test/client/client-mqtt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe('ClientMqtt', () => {
({
addListener: () => ({}),
removeListener: () => ({}),
} as any),
}) as any,
);
handleErrorsSpy = sinon.spy(client, 'handleError');
connect$Stub = sinon.stub(client, 'connect$' as any).callsFake(() => ({
Expand Down
2 changes: 1 addition & 1 deletion packages/microservices/test/client/client-nats.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ describe('ClientNats', () => {
beforeEach(async () => {
createClientSpy = sinon
.stub(client, 'createClient')
.callsFake(() => ({} as any));
.callsFake(() => ({}) as any);
handleStatusUpdatesSpy = sinon.spy(client, 'handleStatusUpdates');

await client.connect();
Expand Down
2 changes: 1 addition & 1 deletion packages/microservices/test/client/client-redis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ describe('ClientRedis', () => {
({
addListener: () => null,
removeListener: () => null,
} as any),
}) as any,
);
handleErrorsSpy = sinon.spy(client, 'handleError');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('ExceptionFiltersContext', () => {
it('should return plain ExceptionHandler object', () => {
const filter = exceptionFilter.create(
new EmptyMetadata(),
() => ({} as any),
() => ({}) as any,
undefined,
);
expect((filter as any).filters).to.be.empty;
Expand All @@ -46,7 +46,7 @@ describe('ExceptionFiltersContext', () => {
it('should return ExceptionHandler object with exception filters', () => {
const filter = exceptionFilter.create(
new WithMetadata(),
() => ({} as any),
() => ({}) as any,
undefined,
);
expect((filter as any).filters).to.not.be.empty;
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('ExceptionFiltersContext', () => {
.callsFake(() => scopedFilterWrappers);
sinon
.stub(instanceWrapper, 'getInstanceByContextId')
.callsFake(() => ({ instance } as any));
.callsFake(() => ({ instance }) as any);

expect(exceptionFilter.getGlobalMetadata({ id: 3 })).to.contains(
instance,
Expand Down
6 changes: 3 additions & 3 deletions packages/microservices/test/listeners-controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('ListenersController', () => {
];

beforeEach(() => {
sinon.stub(container, 'getModuleByKey').callsFake(() => ({} as any));
sinon.stub(container, 'getModuleByKey').callsFake(() => ({}) as any);
});
it(`should call "addHandler" method of server for each pattern handler`, () => {
explorer.expects('explore').returns(handlers);
Expand Down Expand Up @@ -203,12 +203,12 @@ describe('ListenersController', () => {
() =>
({
handle: handleSpy,
} as any),
}) as any,
);

sinon
.stub((instance as any).container, 'registerRequestProvider')
.callsFake(() => ({} as any));
.callsFake(() => ({}) as any);
});

describe('when "loadPerContext" resolves', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/microservices/test/server/server-kafka.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('ServerKafka', () => {
it('should call "bindEvents"', async () => {
bindEventsStub = sinon
.stub(server, 'bindEvents')
.callsFake(() => ({} as any));
.callsFake(() => ({}) as any);
await server.listen(callback);
expect(bindEventsStub.called).to.be.true;
});
Expand Down
6 changes: 3 additions & 3 deletions packages/microservices/test/server/server-redis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ describe('ServerRedis', () => {
});
it('should call "handleEvent" if identifier is not present', async () => {
const handleEventSpy = sinon.spy(server, 'handleEvent');
sinon.stub(server, 'parseMessage').callsFake(() => ({ data } as any));
sinon.stub(server, 'parseMessage').callsFake(() => ({ data }) as any);

await server.handleMessage(channel, JSON.stringify({}), null, channel);
expect(handleEventSpy.called).to.be.true;
});
it(`should publish NO_MESSAGE_HANDLER if pattern not exists in messageHandlers object`, async () => {
sinon.stub(server, 'parseMessage').callsFake(() => ({ id, data } as any));
sinon.stub(server, 'parseMessage').callsFake(() => ({ id, data }) as any);
await server.handleMessage(
channel,
JSON.stringify({ id }),
Expand All @@ -160,7 +160,7 @@ describe('ServerRedis', () => {
(server as any).messageHandlers = objectToMap({
[channel]: handler,
});
sinon.stub(server, 'parseMessage').callsFake(() => ({ id, data } as any));
sinon.stub(server, 'parseMessage').callsFake(() => ({ id, data }) as any);

await server.handleMessage(channel, {}, null, channel);
expect(handler.calledWith(data)).to.be.true;
Expand Down
2 changes: 1 addition & 1 deletion packages/microservices/test/server/server-rmq.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('ServerRMQ', () => {
createChannelStub = sinon.stub().callsFake(({ setup }) => setup());
setupChannelStub = sinon
.stub(server, 'setupChannel')
.callsFake(() => ({} as any));
.callsFake(() => ({}) as any);

client = {
on: onStub,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { transformException } from '../multer/multer.utils';
type MulterInstance = any;

/**
* @param localOptions
*
* @param localOptions
*
* @publicApi
*/
export function AnyFilesInterceptor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { transformException } from '../multer/multer.utils';
type MulterInstance = any;

/**
* @param uploadFields
* @param localOptions
* @param uploadFields
* @param localOptions
* @publicApi
*/
export function FileFieldsInterceptor(
Expand Down
Loading

0 comments on commit 6bcb3bd

Please sign in to comment.