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

@@ -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> {