prettier 2

Summary:
Quick notes:

- This looks worse than it is. It adds mandatory parentheses to single argument lambdas. Lots of outrage on Twitter about it, personally I'm {emoji:1f937_200d_2642} about it.
- Space before function, e.g. `a = function ()` is now enforced. I like this because both were fine before.
- I added `eslint-config-prettier` to the config because otherwise a ton of rules conflict with eslint itself.

Close https://github.com/facebook/flipper/pull/915

Reviewed By: jknoxville

Differential Revision: D20594929

fbshipit-source-id: ca1c65376b90e009550dd6d1f4e0831d32cbff03
This commit is contained in:
Pascal Hartig
2020-03-24 09:34:39 -07:00
committed by Facebook GitHub Bot
parent d9d3be33b4
commit fc9ed65762
204 changed files with 877 additions and 864 deletions

View File

@@ -116,7 +116,7 @@ export default class Client extends EventEmitter {
store: Store;
activePlugins: Set<string>;
device: Promise<BaseDevice>;
_deviceResolve: (device: BaseDevice) => void = _ => {};
_deviceResolve: (device: BaseDevice) => void = (_) => {};
_deviceSet: false | BaseDevice = false;
logger: Logger;
lastSeenDeviceList: Array<BaseDevice>;
@@ -194,7 +194,7 @@ export default class Client extends EventEmitter {
const device = this.store
.getState()
.connections.devices.find(
device => device.serial === this.query.device_id,
(device) => device.serial === this.query.device_id,
);
if (device) {
resolve(device);
@@ -214,7 +214,7 @@ export default class Client extends EventEmitter {
}
this.lastSeenDeviceList = this.store.getState().connections.devices;
const matchingDevice = newDeviceList.find(
device => device.serial === this.query.device_id,
(device) => device.serial === this.query.device_id,
);
if (matchingDevice) {
clearTimeout(timeout);
@@ -224,7 +224,7 @@ export default class Client extends EventEmitter {
});
}),
'client-setMatchingDevice',
).then(device => {
).then((device) => {
this._deviceSet = device;
this._deviceResolve(device);
});
@@ -244,10 +244,10 @@ export default class Client extends EventEmitter {
const plugins = await this.rawCall<{plugins: Plugins}>(
'getPlugins',
false,
).then(data => data.plugins);
).then((data) => data.plugins);
this.plugins = plugins;
const nativeplugins = plugins
.map(plugin => /_nativeplugin_([^_]+)_([^_]+)/.exec(plugin))
.map((plugin) => /_nativeplugin_([^_]+)_([^_]+)/.exec(plugin))
.filter(notNull)
.map(([id, type, title]) => {
// TODO put this in another component, and make the "types" registerable
@@ -318,7 +318,7 @@ export default class Client extends EventEmitter {
}: ${error.message} + \nDevice Stack Trace: ${error.stacktrace}`,
'deviceError',
);
this.device.then(device => handleError(this.store, device, error));
this.device.then((device) => handleError(this.store, device, error));
} else if (method === 'refreshPlugins') {
this.refreshPlugins();
} else if (method === 'execute') {
@@ -389,7 +389,7 @@ export default class Client extends EventEmitter {
reject(data.error);
const {error} = data;
if (error) {
this.device.then(device => handleError(this.store, device, error));
this.device.then((device) => handleError(this.store, device, error));
}
} else {
// ???
@@ -466,7 +466,7 @@ export default class Client extends EventEmitter {
this.connection
.requestResponse({data: JSON.stringify(data)})
.subscribe({
onComplete: payload => {
onComplete: (payload) => {
if (!fromPlugin || this.isAcceptingMessagesFromPlugin(plugin)) {
const logEventName = this.getLogEventName(data);
this.logger.trackTimeSince(mark, logEventName);
@@ -478,7 +478,7 @@ export default class Client extends EventEmitter {
}
},
// Open fresco then layout and you get errors because responses come back after deinit.
onError: e => {
onError: (e) => {
if (this.isAcceptingMessagesFromPlugin(plugin)) {
reject(e);
}
@@ -555,8 +555,9 @@ export default class Client extends EventEmitter {
send(api: string, method: string, params?: Object): void {
if (!isProduction()) {
console.warn(
`${api}:${method ||
''} client.send() is deprecated. Please use call() instead so you can handle errors.`,
`${api}:${
method || ''
} client.send() is deprecated. Please use call() instead so you can handle errors.`,
);
}
return this.rawSend('execute', {api, method, params});