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:
committed by
Facebook GitHub Bot
parent
d9d3be33b4
commit
fc9ed65762
@@ -25,8 +25,8 @@ export default class AndroidDevice extends BaseDevice {
|
||||
super(serial, deviceType, title, 'Android');
|
||||
this.adb = adb;
|
||||
this.icon = 'icons/android.svg';
|
||||
this.adb.openLogcat(this.serial).then(reader => {
|
||||
reader.on('entry', entry => {
|
||||
this.adb.openLogcat(this.serial).then((reader) => {
|
||||
reader.on('entry', (entry) => {
|
||||
let type: LogLevel = 'unknown';
|
||||
if (entry.priority === Priority.VERBOSE) {
|
||||
type = 'verbose';
|
||||
@@ -69,7 +69,7 @@ export default class AndroidDevice extends BaseDevice {
|
||||
|
||||
reverse(ports: [number, number]): Promise<void> {
|
||||
return Promise.all(
|
||||
ports.map(port =>
|
||||
ports.map((port) =>
|
||||
this.adb.reverse(this.serial, `tcp:${port}`, `tcp:${port}`),
|
||||
),
|
||||
).then(() => {
|
||||
@@ -100,7 +100,7 @@ export default class AndroidDevice extends BaseDevice {
|
||||
|
||||
screenshot(): Promise<Buffer> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.adb.screencap(this.serial).then(stream => {
|
||||
this.adb.screencap(this.serial).then((stream) => {
|
||||
const chunks: Array<Buffer> = [];
|
||||
stream
|
||||
.on('data', (chunk: Buffer) => chunks.push(chunk))
|
||||
@@ -137,13 +137,8 @@ export default class AndroidDevice extends BaseDevice {
|
||||
const fileSize = await this.adb
|
||||
.shell(this.serial, `du "${filePath}"`)
|
||||
.then(adb.util.readAll)
|
||||
.then((output: Buffer) =>
|
||||
output
|
||||
.toString()
|
||||
.trim()
|
||||
.split('\t'),
|
||||
)
|
||||
.then(x => Number(x[0]));
|
||||
.then((output: Buffer) => output.toString().trim().split('\t'))
|
||||
.then((x) => Number(x[0]));
|
||||
|
||||
// 4 is what an empty file (touch file) already takes up, so it's
|
||||
// definitely not a valid video file.
|
||||
@@ -158,7 +153,7 @@ export default class AndroidDevice extends BaseDevice {
|
||||
this.recordingProcess = this.adb
|
||||
.shell(this.serial, `screenrecord --bugreport "${recordingLocation}"`)
|
||||
.then(adb.util.readAll)
|
||||
.then(async output => {
|
||||
.then(async (output) => {
|
||||
const isValid = await this.isValidFile(recordingLocation);
|
||||
if (!isValid) {
|
||||
const outputMessage = output.toString().trim();
|
||||
@@ -168,18 +163,18 @@ export default class AndroidDevice extends BaseDevice {
|
||||
}
|
||||
})
|
||||
.then(
|
||||
_ =>
|
||||
(_) =>
|
||||
new Promise((resolve, reject) => {
|
||||
this.adb.pull(this.serial, recordingLocation).then(stream => {
|
||||
this.adb.pull(this.serial, recordingLocation).then((stream) => {
|
||||
stream.on('end', resolve);
|
||||
stream.on('error', reject);
|
||||
stream.pipe(createWriteStream(destination));
|
||||
});
|
||||
}),
|
||||
)
|
||||
.then(_ => destination);
|
||||
.then((_) => destination);
|
||||
|
||||
return this.recordingProcess.then(_ => {});
|
||||
return this.recordingProcess.then((_) => {});
|
||||
}
|
||||
|
||||
async stopScreenCapture(): Promise<string> {
|
||||
|
||||
@@ -118,7 +118,7 @@ export default class BaseDevice {
|
||||
|
||||
_notifyLogListeners(entry: DeviceLogEntry) {
|
||||
if (this.logListeners.size > 0) {
|
||||
this.logListeners.forEach(listener => {
|
||||
this.logListeners.forEach((listener) => {
|
||||
// prevent breaking other listeners, if one listener doesn't work.
|
||||
try {
|
||||
listener(entry);
|
||||
@@ -176,8 +176,8 @@ export default class BaseDevice {
|
||||
|
||||
loadDevicePlugins(devicePlugins?: Map<string, typeof FlipperDevicePlugin>) {
|
||||
this.devicePlugins = Array.from(devicePlugins ? devicePlugins.values() : [])
|
||||
.filter(plugin => plugin.supportsDevice(this))
|
||||
.filter((plugin) => plugin.supportsDevice(this))
|
||||
.sort(sortPluginsByName)
|
||||
.map(plugin => plugin.id);
|
||||
.map((plugin) => plugin.id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export default class IOSDevice extends BaseDevice {
|
||||
const command = `xcrun simctl io booted screenshot ${tmpFilePath}`;
|
||||
return promisify(exec)(command)
|
||||
.then(() => promisify(fs.readFile)(tmpFilePath))
|
||||
.then(buffer => {
|
||||
.then((buffer) => {
|
||||
return promisify(fs.unlink)(tmpFilePath).then(() => buffer);
|
||||
});
|
||||
}
|
||||
@@ -213,7 +213,7 @@ export default class IOSDevice extends BaseDevice {
|
||||
this.recordingLocation = undefined;
|
||||
return recordingLocation!;
|
||||
})
|
||||
.catch(_e => {
|
||||
.catch((_e) => {
|
||||
this.recordingLocation = undefined;
|
||||
console.error(_e);
|
||||
return null;
|
||||
|
||||
@@ -162,7 +162,7 @@ export default class MetroDevice extends BaseDevice {
|
||||
type,
|
||||
tag: message.type,
|
||||
message: message.data
|
||||
.map(v =>
|
||||
.map((v) =>
|
||||
v && typeof v === 'object' ? JSON.stringify(v, null, 2) : v,
|
||||
)
|
||||
.join(' '),
|
||||
|
||||
Reference in New Issue
Block a user