Use Prettier JS (#5017)

* Adds prettier

* Run lint before tests
This commit is contained in:
Florent Vilmart
2018-09-01 13:58:06 -04:00
committed by GitHub
parent 189cd259ee
commit d83a0b6808
240 changed files with 41098 additions and 29020 deletions

View File

@@ -3,7 +3,13 @@ import logger from '../logger';
import type { FlattenedObjectData } from './Subscription';
export type Message = { [attr: string]: any };
const dafaultFields = ['className', 'objectId', 'updatedAt', 'createdAt', 'ACL'];
const dafaultFields = [
'className',
'objectId',
'updatedAt',
'createdAt',
'ACL',
];
class Client {
id: number;
@@ -42,13 +48,21 @@ class Client {
parseWebSocket.send(message);
}
static pushError(parseWebSocket: any, code: number, error: string, reconnect: boolean = true): void {
Client.pushResponse(parseWebSocket, JSON.stringify({
'op': 'error',
'error': error,
'code': code,
'reconnect': reconnect
}));
static pushError(
parseWebSocket: any,
code: number,
error: string,
reconnect: boolean = true
): void {
Client.pushResponse(
parseWebSocket,
JSON.stringify({
op: 'error',
error: error,
code: code,
reconnect: reconnect,
})
);
}
addSubscriptionInfo(requestId: number, subscriptionInfo: any): void {
@@ -66,8 +80,8 @@ class Client {
_pushEvent(type: string): Function {
return function(subscriptionId: number, parseObjectJSON: any): void {
const response: Message = {
'op' : type,
'clientId' : this.id
op: type,
clientId: this.id,
};
if (typeof subscriptionId !== 'undefined') {
response['requestId'] = subscriptionId;
@@ -80,7 +94,7 @@ class Client {
response['object'] = this._toJSONWithFields(parseObjectJSON, fields);
}
Client.pushResponse(this.parseWebSocket, JSON.stringify(response));
}
};
}
_toJSONWithFields(parseObjectJSON: any, fields: any): FlattenedObjectData {
@@ -100,6 +114,4 @@ class Client {
}
}
export {
Client
}
export { Client };