Skip to content

Commit 575e313

Browse files
style(): run linter against integration tests and few others
1 parent 72551f3 commit 575e313

18 files changed

Lines changed: 109 additions & 83 deletions

File tree

integration/hello-world/e2e/interceptors.spec.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ describe('Interceptors', () => {
7272
let app: INestApplication;
7373

7474
it(`should transform response (sync)`, async () => {
75-
app = (await createTestModule(
76-
new OverrideInterceptor(),
77-
)).createNestApplication();
75+
app = (
76+
await createTestModule(new OverrideInterceptor())
77+
).createNestApplication();
7878

7979
await app.init();
8080
return request(app.getHttpServer())
@@ -83,9 +83,9 @@ describe('Interceptors', () => {
8383
});
8484

8585
it(`should map response`, async () => {
86-
app = (await createTestModule(
87-
new TransformInterceptor(),
88-
)).createNestApplication();
86+
app = (
87+
await createTestModule(new TransformInterceptor())
88+
).createNestApplication();
8989

9090
await app.init();
9191
return request(app.getHttpServer())
@@ -94,9 +94,9 @@ describe('Interceptors', () => {
9494
});
9595

9696
it(`should map response (async)`, async () => {
97-
app = (await createTestModule(
98-
new TransformInterceptor(),
99-
)).createNestApplication();
97+
app = (
98+
await createTestModule(new TransformInterceptor())
99+
).createNestApplication();
100100

101101
await app.init();
102102
return request(app.getHttpServer())
@@ -105,9 +105,9 @@ describe('Interceptors', () => {
105105
});
106106

107107
it(`should map response (stream)`, async () => {
108-
app = (await createTestModule(
109-
new TransformInterceptor(),
110-
)).createNestApplication();
108+
app = (
109+
await createTestModule(new TransformInterceptor())
110+
).createNestApplication();
111111

112112
await app.init();
113113
return request(app.getHttpServer())
@@ -116,9 +116,9 @@ describe('Interceptors', () => {
116116
});
117117

118118
it(`should modify response status`, async () => {
119-
app = (await createTestModule(
120-
new StatusInterceptor(400),
121-
)).createNestApplication();
119+
app = (
120+
await createTestModule(new StatusInterceptor(400))
121+
).createNestApplication();
122122

123123
await app.init();
124124
return request(app.getHttpServer())
@@ -131,9 +131,9 @@ describe('Interceptors', () => {
131131
Authorization: 'jwt',
132132
};
133133

134-
app = (await createTestModule(
135-
new HeaderInterceptor(customHeaders),
136-
)).createNestApplication();
134+
app = (
135+
await createTestModule(new HeaderInterceptor(customHeaders))
136+
).createNestApplication();
137137

138138
await app.init();
139139
return request(app.getHttpServer())

integration/hello-world/e2e/middleware-class.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ describe('Middleware (class)', () => {
4141
let app: INestApplication;
4242

4343
beforeEach(async () => {
44-
app = (await Test.createTestingModule({
45-
imports: [TestModule],
46-
}).compile()).createNestApplication();
44+
app = (
45+
await Test.createTestingModule({
46+
imports: [TestModule],
47+
}).compile()
48+
).createNestApplication();
4749

4850
await app.init();
4951
});

integration/hello-world/e2e/middleware-execute-order.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ describe('Middleware (execution order)', () => {
4040
let app: INestApplication;
4141

4242
beforeEach(async () => {
43-
app = (await Test.createTestingModule({
44-
imports: [TestModule],
45-
}).compile()).createNestApplication();
43+
app = (
44+
await Test.createTestingModule({
45+
imports: [TestModule],
46+
}).compile()
47+
).createNestApplication();
4648

4749
await app.init();
4850
});

integration/hello-world/e2e/middleware-fastify.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ describe('Middleware (FastifyAdapter)', () => {
3636
let app: NestFastifyApplication;
3737

3838
beforeEach(async () => {
39-
app = (await Test.createTestingModule({
40-
imports: [TestModule],
41-
}).compile()).createNestApplication<NestFastifyApplication>(
42-
new FastifyAdapter(),
43-
);
39+
app = (
40+
await Test.createTestingModule({
41+
imports: [TestModule],
42+
}).compile()
43+
).createNestApplication<NestFastifyApplication>(new FastifyAdapter());
4444

4545
await app.init();
4646
});

integration/hello-world/e2e/middleware.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ describe('Middleware', () => {
4646
let app: INestApplication;
4747

4848
beforeEach(async () => {
49-
app = (await Test.createTestingModule({
50-
imports: [TestModule],
51-
}).compile()).createNestApplication();
49+
app = (
50+
await Test.createTestingModule({
51+
imports: [TestModule],
52+
}).compile()
53+
).createNestApplication();
5254

5355
await app.init();
5456
});

integration/microservices/src/disconnected.controller.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@ export class DisconnectedClientController {
1414
@Post()
1515
call(@Body() options): Observable<number> {
1616
const client = ClientProxyFactory.create(options);
17-
return client.send<number, number[]>({ cmd: 'none' }, [1, 2, 3]).pipe(
18-
/*tap(
17+
return client
18+
.send<number, number[]>({ cmd: 'none' }, [1, 2, 3])
19+
.pipe(
20+
/*tap(
1921
console.log.bind(console, 'data'),
2022
console.error.bind(console, 'error'),
2123
),*/
22-
catchError(error => {
23-
const { code } = error || { code: 'CONN_ERR' };
24-
return throwError(
25-
code === 'ECONNREFUSED' || code === 'CONN_ERR'
26-
? new RequestTimeoutException('ECONNREFUSED')
27-
: new InternalServerErrorException(),
28-
);
29-
}),
30-
);
24+
catchError(error => {
25+
const { code } = error || { code: 'CONN_ERR' };
26+
return throwError(
27+
code === 'ECONNREFUSED' || code === 'CONN_ERR'
28+
? new RequestTimeoutException('ECONNREFUSED')
29+
: new InternalServerErrorException(),
30+
);
31+
}),
32+
);
3133
}
3234
}

packages/common/test/decorators/apply-decorators.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ describe('applyDecorators', () => {
2929

3030
const decoratedTarget = {};
3131
testDecorator1(testParams.decorator1.param)(decoratedTarget);
32-
testDecorator2(testParams.decorator2.param1, testParams.decorator2.param2)(
33-
decoratedTarget,
34-
);
32+
testDecorator2(
33+
testParams.decorator2.param1,
34+
testParams.decorator2.param2,
35+
)(decoratedTarget);
3536
testDecorator3()(decoratedTarget);
3637

3738
const customDecoratedTarget = {};

packages/core/injector/module.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ export class Module {
236236
| ClassProvider
237237
| FactoryProvider
238238
| ValueProvider
239-
| ExistingProvider) &
239+
| ExistingProvider
240+
) &
240241
ProviderName,
241242
collection: Map<string, any>,
242243
): string {
@@ -356,7 +357,7 @@ export class Module {
356357
}
357358

358359
public addExportedProvider(
359-
provider: Provider & ProviderName | string | symbol | DynamicModule,
360+
provider: (Provider & ProviderName) | string | symbol | DynamicModule,
360361
) {
361362
const addExportedUnit = (token: string | symbol) =>
362363
this._exports.add(this.validateExportedProvider(token));

packages/core/nest-application.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ const { SocketModule } = optionalRequire(
3131
'@nestjs/websockets/socket-module',
3232
() => require('@nestjs/websockets/socket-module'),
3333
);
34-
const { MicroservicesModule } = optionalRequire(
35-
'@nestjs/microservices/microservices-module',
36-
() => require('@nestjs/microservices/microservices-module'),
34+
const {
35+
MicroservicesModule,
36+
} = optionalRequire('@nestjs/microservices/microservices-module', () =>
37+
require('@nestjs/microservices/microservices-module'),
3738
);
3839

3940
/**

packages/core/scanner.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,10 @@ export class DependenciesScanner {
223223
component.prototype,
224224
method => Reflect.getMetadata(metadataKey, component, method),
225225
);
226-
const paramsInjectables = this.flatten(paramsMetadata).map(
227-
(param: Record<string, any>) =>
228-
flatten(Object.keys(param).map(k => param[k].pipes)).filter(isFunction),
226+
const paramsInjectables = this.flatten(
227+
paramsMetadata,
228+
).map((param: Record<string, any>) =>
229+
flatten(Object.keys(param).map(k => param[k].pipes)).filter(isFunction),
229230
);
230231
flatten(paramsInjectables).forEach((injectable: Type<Injectable>) =>
231232
this.insertInjectable(injectable, token, component),

0 commit comments

Comments
 (0)