Skip to content

Commit

Permalink
ci(@nestjs) update prettier options
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Dec 21, 2017
1 parent 52e0128 commit d7b0e05
Show file tree
Hide file tree
Showing 333 changed files with 1,160 additions and 1,137 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"singleQuote": true
"singleQuote": true,
"trailingComma": "all"
}
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## 4.5.2
- **core**: [feature] exception filters with empty `@Catch()` metadata handle each occurred exception

## 4.5.1
- **common**: `INestAplication` provides a `getHttpServer()` methodn ow
- **websockets**: `IoAdapter` bugfix
- **common**: [feature] `INestAplication` provides a `getHttpServer()` method now
- **websockets**: [bugfix] `IoAdapter` bugfix

## 4.5.0
- **common**: bugfix #286
Expand Down
4 changes: 2 additions & 2 deletions examples/01-cats-app/e2e/cats/cats.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Cats', () => {

beforeAll(async () => {
const module = await Test.createTestingModule({
modules: [CatsModule]
modules: [CatsModule],
})
.overrideComponent(CatsService)
.useValue(catsService)
Expand All @@ -29,7 +29,7 @@ describe('Cats', () => {
.get('/cats')
.expect(200)
.expect({
data: catsService.findAll()
data: catsService.findAll(),
});
});

Expand Down
2 changes: 1 addition & 1 deletion examples/01-cats-app/src/modules/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CatsModule } from './cats/cats.module';
import { CatsController } from './cats/cats.controller';

@Module({
modules: [CatsModule]
modules: [CatsModule],
})
export class ApplicationModule implements NestModule {
configure(consumer: MiddlewaresConsumer): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('CatsController', () => {
beforeEach(async () => {
const module = await Test.createTestingModule({
controllers: [CatsController],
components: [CatsService]
components: [CatsService],
}).compile();

catsService = module.get<CatsService>(CatsService);
Expand Down
4 changes: 2 additions & 2 deletions examples/01-cats-app/src/modules/cats/cats.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
UseGuards,
ReflectMetadata,
UseInterceptors,
Param
Param,
} from '@nestjs/common';
import { CreateCatDto } from './dto/create-cat.dto';
import { CatsService } from './cats.service';
Expand Down Expand Up @@ -37,7 +37,7 @@ export class CatsController {
@Get(':id')
findOne(
@Param('id', new ParseIntPipe())
id
id,
) {
// logic
}
Expand Down
2 changes: 1 addition & 1 deletion examples/01-cats-app/src/modules/cats/cats.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { CatsService } from './cats.service';

@Module({
controllers: [CatsController],
components: [CatsService]
components: [CatsService],
})
export class CatsModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class HttpExceptionFilter implements ExceptionFilter {

response.status(status).json({
statusCode: status,
message: `It's a message from the exception filter`
message: `It's a message from the exception filter`,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export abstract class CacheInterceptor implements NestInterceptor {
intercept(
dataOrRequest,
context: ExecutionContext,
stream$: Observable<any>
stream$: Observable<any>,
): Observable<any> {
if (this.isCached()) {
return Observable.of([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
Interceptor,
NestInterceptor,
ExecutionContext,
HttpStatus
HttpStatus,
} from '@nestjs/common';
import { HttpException } from '@nestjs/common';
import { Observable } from 'rxjs/Observable';
Expand All @@ -14,15 +14,15 @@ export class ExceptionInterceptor implements NestInterceptor {
intercept(
dataOrRequest,
context: ExecutionContext,
stream$: Observable<any>
stream$: Observable<any>,
): Observable<any> {
return stream$.catch(err =>
Observable.throw(
new HttpException(
'Exception interceptor message',
HttpStatus.BAD_GATEWAY
)
)
HttpStatus.BAD_GATEWAY,
),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class LoggingInterceptor implements NestInterceptor {
intercept(
dataOrRequest,
context: ExecutionContext,
stream$: Observable<any>
stream$: Observable<any>,
): Observable<any> {
console.log('Before...');
const now = Date.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export function mixinCacheInterceptor(isCached: () => boolean) {
return mixin(
class extends CacheInterceptor {
protected readonly isCached = isCached;
}
},
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class TransformInterceptor implements NestInterceptor {
intercept(
dataOrRequest,
context: ExecutionContext,
stream$: Observable<any>
stream$: Observable<any>,
): Observable<any> {
return stream$.map(data => ({ data }));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
PipeTransform,
Pipe,
ArgumentMetadata,
HttpStatus
HttpStatus,
} from '@nestjs/common';

@Pipe()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
PipeTransform,
Pipe,
ArgumentMetadata,
HttpStatus
HttpStatus,
} from '@nestjs/common';
import { validate } from 'class-validator';
import { plainToClass } from 'class-transformer';
Expand Down
2 changes: 1 addition & 1 deletion examples/02-gateways/src/modules/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { Module } from '@nestjs/common';
import { EventsModule } from './events/events.module';

@Module({
modules: [EventsModule]
modules: [EventsModule],
})
export class ApplicationModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class WsAdapter implements WebSocketAdapter {
public bindMessageHandlers(
client: WebSocket,
handlers: MessageMappingProperties[],
process: (data: any) => Observable<any>
process: (data: any) => Observable<any>,
) {
Observable.fromEvent(client, 'message')
.switchMap(buffer => this.bindMessageHandler(buffer, handlers, process))
Expand All @@ -30,11 +30,11 @@ export class WsAdapter implements WebSocketAdapter {
public bindMessageHandler(
buffer,
handlers: MessageMappingProperties[],
process: (data: any) => Observable<any>
process: (data: any) => Observable<any>,
): Observable<any> {
const data = JSON.parse(buffer.data);
const messageHandler = handlers.find(
handler => handler.message === data.type
handler => handler.message === data.type,
);
if (!messageHandler) {
return Observable.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class ExceptionFilter implements WsExceptionFilter {
catch(exception: WsException, client) {
client.emit('exception', {
status: 'error',
message: `It's a message from the exception filter`
message: `It's a message from the exception filter`,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class CacheInterceptor implements NestInterceptor {
intercept(
dataOrRequest,
context: ExecutionContext,
stream$: Observable<any>
stream$: Observable<any>,
): Observable<any> {
const isCached = true;
if (isCached) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class LoggingInterceptor implements NestInterceptor {
intercept(
dataOrRequest,
context: ExecutionContext,
stream$: Observable<any>
stream$: Observable<any>,
): Observable<any> {
console.log('Before...');
const now = Date.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class TransformInterceptor implements NestInterceptor {
intercept(
dataOrRequest,
context: ExecutionContext,
stream$: Observable<any>
stream$: Observable<any>,
): Observable<any> {
return stream$.map(data => ({ data }));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
PipeTransform,
Pipe,
ArgumentMetadata,
HttpStatus
HttpStatus,
} from '@nestjs/common';
import { validate } from 'class-validator';
import { plainToClass } from 'class-transformer';
Expand Down
2 changes: 1 addition & 1 deletion examples/02-gateways/src/modules/events/events.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
SubscribeMessage,
WsResponse,
WebSocketServer,
WsException
WsException,
} from '@nestjs/websockets';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/from';
Expand Down
2 changes: 1 addition & 1 deletion examples/02-gateways/src/modules/events/events.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { Module } from '@nestjs/common';
import { EventsGateway, EventsGatewayxD } from './events.gateway';

@Module({
components: [EventsGateway, EventsGatewayxD]
components: [EventsGateway, EventsGatewayxD],
})
export class EventsModule {}
2 changes: 1 addition & 1 deletion examples/03-microservices/src/modules/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { Module } from '@nestjs/common';
import { MathModule } from './math/math.module';

@Module({
modules: [MathModule]
modules: [MathModule],
})
export class ApplicationModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class RabbitMQClient extends ClientProxy {

protected async sendSingleMessage(
messageObj,
callback: (err, result, disposed?: boolean) => void
callback: (err, result, disposed?: boolean) => void,
) {
const server = await amqp.connect(this.host);
const channel = await server.createChannel();
Expand All @@ -20,15 +20,15 @@ export class RabbitMQClient extends ClientProxy {
channel.consume(
pub,
message => this.handleMessage(message, server, callback),
{ noAck: true }
{ noAck: true },
);
channel.sendToQueue(sub, Buffer.from(JSON.stringify(messageObj)));
}

private handleMessage(
message,
server,
callback: (err, result, disposed?: boolean) => void
callback: (err, result, disposed?: boolean) => void,
) {
const { content } = message;
const { err, response, disposed } = JSON.parse(content.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class RabbitMQServer extends Server implements CustomTransportStrategy {
public async listen(callback: () => void) {
await this.init();
this.channel.consume(`${this.queue}_sub`, this.handleMessage.bind(this), {
noAck: true
noAck: true,
});
}

Expand All @@ -34,7 +34,7 @@ export class RabbitMQServer extends Server implements CustomTransportStrategy {

const handler = this.messageHandlers[pattern];
const response$ = this.transformToObservable(
await handler(messageObj.data)
await handler(messageObj.data),
) as Observable<any>;
response$ && this.send(response$, data => this.sendMessage(data));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class CacheInterceptor implements NestInterceptor {
intercept(
dataOrRequest,
context: ExecutionContext,
stream$: Observable<any>
stream$: Observable<any>,
): Observable<any> {
const isCached = true;
if (isCached) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class LoggingInterceptor implements NestInterceptor {
intercept(
dataOrRequest,
context: ExecutionContext,
stream$: Observable<any>
stream$: Observable<any>,
): Observable<any> {
console.log('Before...');
const now = Date.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class TransformInterceptor implements NestInterceptor {
intercept(
dataOrRequest,
context: ExecutionContext,
stream$: Observable<any>
stream$: Observable<any>,
): Observable<any> {
return stream$.map(data => ({ data }));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ClientProxy,
Client,
Transport,
MessagePattern
MessagePattern,
} from '@nestjs/microservices';
import { Observable } from 'rxjs/Observable';
import { LoggingInterceptor } from '../common/interceptors/logging.interceptor';
Expand Down
2 changes: 1 addition & 1 deletion examples/03-microservices/src/modules/math/math.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { Module } from '@nestjs/common';
import { MathController } from './math.controller';

@Module({
controllers: [MathController]
controllers: [MathController],
})
export class MathModule {}
2 changes: 1 addition & 1 deletion examples/03-microservices/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Transport } from '@nestjs/microservices';
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule);
app.connectMicroservice({
transport: Transport.TCP
transport: Transport.TCP,
});

await app.startAllMicroservicesAsync();
Expand Down
2 changes: 1 addition & 1 deletion examples/04-injector/src/modules/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { CoreModule } from './core/core.module';
import { FeatureModule } from './feature/feature.module';

@Module({
modules: [FeatureModule]
modules: [FeatureModule],
})
export class ApplicationModule {}
2 changes: 1 addition & 1 deletion examples/04-injector/src/modules/common/common.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { CommonService } from './common.service';

@Module({
components: [CommonService],
exports: [CommonService]
exports: [CommonService],
})
export class CommonModule {}
2 changes: 1 addition & 1 deletion examples/04-injector/src/modules/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import { FeatureModule } from '../feature/feature.module';
@Module({
modules: [CommonModule],
components: [CoreService, ContextService],
exports: [CommonModule]
exports: [CommonModule],
})
export class CoreModule {}
Loading

0 comments on commit d7b0e05

Please sign in to comment.