diff --git a/desktop/app/src/dispatcher/__tests__/plugins.node.js b/desktop/app/src/dispatcher/__tests__/plugins.node.js index cd538c866..2d02b1d41 100644 --- a/desktop/app/src/dispatcher/__tests__/plugins.node.js +++ b/desktop/app/src/dispatcher/__tests__/plugins.node.js @@ -33,7 +33,7 @@ beforeEach(() => { test('dispatcher dispatches REGISTER_PLUGINS', () => { dispatcher(mockStore, logger); const actions = mockStore.getActions(); - expect(actions.map((a) => a.type)).toContain('REGISTER_PLUGINS'); + expect(actions.map(a => a.type)).toContain('REGISTER_PLUGINS'); }); test('getDynamicPlugins returns empty array on errors', () => { diff --git a/desktop/app/src/utils/__tests__/Idler.node.js b/desktop/app/src/utils/__tests__/Idler.node.js index 4c9b7bd35..eff8efd1d 100644 --- a/desktop/app/src/utils/__tests__/Idler.node.js +++ b/desktop/app/src/utils/__tests__/Idler.node.js @@ -64,7 +64,7 @@ test('TestIdler can be controlled', async () => { expect(idler.shouldIdle()).toBe(true); let threw = false; - const p = idler.idle().catch((e) => { + const p = idler.idle().catch(e => { threw = true; expect(e).toMatchInlineSnapshot( `[CancelledPromiseError: Idler got killed]`, diff --git a/desktop/app/src/utils/__tests__/jsonFileStorage.node.js b/desktop/app/src/utils/__tests__/jsonFileStorage.node.js index a1412f75b..9f9500fe0 100644 --- a/desktop/app/src/utils/__tests__/jsonFileStorage.node.js +++ b/desktop/app/src/utils/__tests__/jsonFileStorage.node.js @@ -26,7 +26,7 @@ const storage = new JsonFileStorage( test('A valid settings file gets parsed correctly', () => { return storage .getItem('anykey') - .then((result) => expect(result).toEqual(validDeserializedData)); + .then(result => expect(result).toEqual(validDeserializedData)); }); test('deserialize works as expected', () => { diff --git a/desktop/app/src/utils/js-client/api.js b/desktop/app/src/utils/js-client/api.js index 7fbe4947a..f44fe83d5 100644 --- a/desktop/app/src/utils/js-client/api.js +++ b/desktop/app/src/utils/js-client/api.js @@ -72,7 +72,7 @@ export class FlipperConnection { } receive(method: FlipperMethodID, receiver: FlipperReceiver<*>) { - this._bridge.subscribe(this.pluginId, method, (data) => { + this._bridge.subscribe(this.pluginId, method, data => { receiver(data, new FlipperResponder(this.pluginId, method, this._bridge)); }); } diff --git a/desktop/app/src/utils/js-client/plugins/fury.js b/desktop/app/src/utils/js-client/plugins/fury.js index 7665262b1..cc792d848 100644 --- a/desktop/app/src/utils/js-client/plugins/fury.js +++ b/desktop/app/src/utils/js-client/plugins/fury.js @@ -83,7 +83,7 @@ export class FuryPlugin extends FlipperPlugin { id: reqContext.currentSeqId + '/' + eventType, time: new Date().getTime(), eventType: eventType, - callStack: stack.map((frame) => { + callStack: stack.map(frame => { return { className: frame.getTypeName() || '', methodName: frame.getFunctionName() || '', diff --git a/desktop/app/src/utils/js-client/webviewImpl.js b/desktop/app/src/utils/js-client/webviewImpl.js index 152dd1bf2..1b0a9c68d 100644 --- a/desktop/app/src/utils/js-client/webviewImpl.js +++ b/desktop/app/src/utils/js-client/webviewImpl.js @@ -39,7 +39,7 @@ class FlipperWebviewBridgeImpl extends FlipperBridge { subscribe = ( plugin: FlipperPluginID, method: FlipperMethodID, - handler: (any) => void, + handler: any => void, ) => { this._subscriptions.set(plugin + method, handler); }; diff --git a/desktop/doctor/package.json b/desktop/doctor/package.json index 1b3f95e9b..fe3e30fe5 100644 --- a/desktop/doctor/package.json +++ b/desktop/doctor/package.json @@ -18,7 +18,7 @@ "eslint-plugin-prettier": "^3.1.1", "eslint-plugin-react": "^7.16.0", "jest": "^24.9.0", - "prettier": "^2.0.0", + "prettier": "2.0.2", "ts-jest": "^24.1.0", "tslint-config-prettier": "^1.18.0", "typescript": "^3.7.2" diff --git a/desktop/headless-tests/__tests__/headlessIntegrationTests.js b/desktop/headless-tests/__tests__/headlessIntegrationTests.js index c9260ab78..b5674b1f6 100644 --- a/desktop/headless-tests/__tests__/headlessIntegrationTests.js +++ b/desktop/headless-tests/__tests__/headlessIntegrationTests.js @@ -60,13 +60,13 @@ const runHeadless = memoize((args: Array): Promise<{ console.info(`Running ${params.bin} ${args.join(' ')}`); const process = spawn(params.bin, args, {}); process.stdout.setEncoding('utf8'); - process.stdout.on('data', (chunk) => { + process.stdout.on('data', chunk => { stdoutChunks.push(chunk); }); - process.stderr.on('data', (chunk) => { + process.stderr.on('data', chunk => { stderrChunks.push(chunk); }); - process.stdout.on('end', (chunk) => { + process.stdout.on('end', chunk => { const stdout = stdoutChunks.join(''); const stderr = stderrChunks.join(''); try { @@ -89,7 +89,7 @@ const runHeadless = memoize((args: Array): Promise<{ }); function getPluginState(app: string, plugin: string): Promise { - return runHeadless(basicArgs).then((result) => { + return runHeadless(basicArgs).then(result => { const pluginStates = result.output.store.pluginStates; for (const pluginId of Object.keys(pluginStates)) { const matches = /([^#]+)#([^#]+)#([^#]+)#([^#]+)#([^#]+)/.exec(pluginId); @@ -110,10 +110,8 @@ function getPluginState(app: string, plugin: string): Promise { test( 'Flipper app appears in exported clients', () => { - return runHeadless(basicArgs).then((result) => { - expect(result.output.clients.map((c) => c.query.app)).toContain( - 'Flipper', - ); + return runHeadless(basicArgs).then(result => { + expect(result.output.clients.map(c => c.query.app)).toContain('Flipper'); }); }, TEST_TIMEOUT_MS, @@ -122,7 +120,7 @@ test( test( 'Output includes fileVersion', () => { - return runHeadless(basicArgs).then((result) => { + return runHeadless(basicArgs).then(result => { expect(result.output.fileVersion).toMatch(/[0-9]+\.[0-9]+\.[0-9]+/); }); }, @@ -132,7 +130,7 @@ test( test( 'Output includes device', () => { - return runHeadless(basicArgs).then((result) => { + return runHeadless(basicArgs).then(result => { expect(result.output.device).toBeTruthy(); }); }, @@ -142,7 +140,7 @@ test( test( 'Output includes flipperReleaseRevision', () => { - return runHeadless(basicArgs).then((result) => { + return runHeadless(basicArgs).then(result => { expect(result.output.flipperReleaseRevision).toBeTruthy(); }); }, @@ -152,7 +150,7 @@ test( test( 'Output includes store', () => { - return runHeadless(basicArgs).then((result) => { + return runHeadless(basicArgs).then(result => { expect(result.output.store).toBeTruthy(); }); }, @@ -174,7 +172,7 @@ function stripNode(node: any, path: Array) { } if (path[0] === '*') { if (Array.isArray(node)) { - return node.map((e) => stripNode(e, path.slice(1))); + return node.map(e => stripNode(e, path.slice(1))); } return Object.entries(node).reduce((acc, [key, val]) => { acc[key] = stripNode(val, path.slice(1)); @@ -228,12 +226,12 @@ test('test layout snapshot stripping', () => { }); test('Sample app layout hierarchy matches snapshot', () => { - return getPluginState('Flipper', 'Inspector').then((result) => { + return getPluginState('Flipper', 'Inspector').then(result => { const state = JSON.parse(result); expect(state.rootAXElement).toBe('com.facebook.flipper.sample'); expect(state.rootElement).toBe('com.facebook.flipper.sample'); const canonicalizedElements = Object.values(state.elements) - .map((e) => { + .map(e => { const stableizedElements = stripUnstableLayoutAttributes(e); return stringify(stableizedElements); }) diff --git a/desktop/package.json b/desktop/package.json index 1517b35bf..edeccb441 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -156,7 +156,7 @@ "jest-fetch-mock": "^3.0.0", "metro": "^0.58.0", "metro-resolver": "^0.58.0", - "prettier": "^2.0.0", + "prettier": "2.0.2", "react-async": "^10.0.0", "recursive-readdir": "^2.2.2", "redux-mock-store": "^1.5.3", diff --git a/desktop/pkg/package.json b/desktop/pkg/package.json index 8187be46b..ac8eb1aa1 100644 --- a/desktop/pkg/package.json +++ b/desktop/pkg/package.json @@ -31,8 +31,8 @@ "@types/node": "^13.7.5", "cli-ux": "^5.4.5", "fs-extra": "^8.1.0", - "metro": "^0.58.0", "inquirer": "^7.0.5", + "metro": "^0.58.0", "tslib": "^1" }, "devDependencies": { @@ -40,7 +40,7 @@ "@types/jest": "^24.0.21", "globby": "^10", "jest": "^24.9.0", - "prettier": "^2.0.0", + "prettier": "2.0.2", "ts-jest": "^24.1.0", "ts-node": "^8", "typescript": "^3.7.2" diff --git a/desktop/pkg/src/transforms/electron-requires.js b/desktop/pkg/src/transforms/electron-requires.js index de0df1029..fa765608b 100644 --- a/desktop/pkg/src/transforms/electron-requires.js +++ b/desktop/pkg/src/transforms/electron-requires.js @@ -80,7 +80,7 @@ module.exports = function (babel) { if ( BUILTINS.includes(source) || - BUILTINS.some((moduleName) => source.startsWith(`${moduleName}/`)) + BUILTINS.some(moduleName => source.startsWith(`${moduleName}/`)) ) { path.node.callee.name = 'electronRequire'; } diff --git a/desktop/pkg/src/transforms/fb-stubs.js b/desktop/pkg/src/transforms/fb-stubs.js index 2b9a42f5d..b69aabbce 100644 --- a/desktop/pkg/src/transforms/fb-stubs.js +++ b/desktop/pkg/src/transforms/fb-stubs.js @@ -12,7 +12,7 @@ const path = require('path'); const replaceFBStubs = fs.existsSync( path.join(__dirname, '..', '..', 'app', 'src', 'fb'), ); -const isFBFile = (filePath) => filePath.includes(`${path.sep}fb${path.sep}`); +const isFBFile = filePath => filePath.includes(`${path.sep}fb${path.sep}`); const requireFromFolder = (folder, path) => new RegExp(folder + '/[A-Za-z0-9.-_]+(.js)?$', 'g').test(path); diff --git a/desktop/plugins/crash_reporter/index.js b/desktop/plugins/crash_reporter/index.js index 145de8413..d7e9e1dec 100644 --- a/desktop/plugins/crash_reporter/index.js +++ b/desktop/plugins/crash_reporter/index.js @@ -378,7 +378,7 @@ function addFileWatcherForiOSCrashLogs( return; } const filepath = path.join(dir, filename); - promisify(fs.exists)(filepath).then((exists) => { + promisify(fs.exists)(filepath).then(exists => { if (!exists) { return; } @@ -572,7 +572,7 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin< static getActiveNotifications = ( persistedState: PersistedState, ): Array => { - const filteredCrashes = persistedState.crashes.filter((crash) => { + const filteredCrashes = persistedState.crashes.filter(crash => { const ignore = !crash.name && !crash.reason; const unknownCrashCause = crash.reason === UNKNOWN_CRASH_REASON; if (ignore || unknownCrashCause) { @@ -679,7 +679,7 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin< let deeplinkedCrash = null; if (this.props.deepLinkPayload) { const id = this.props.deepLinkPayload; - const index = this.props.persistedState.crashes.findIndex((elem) => { + const index = this.props.persistedState.crashes.findIndex(elem => { return elem.notificationID === id; }); if (index >= 0) { @@ -714,18 +714,18 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin< ); const orderedIDs = crashes.map( - (persistedCrash) => persistedCrash.notificationID, + persistedCrash => persistedCrash.notificationID, ); const selectedCrashID = crash.notificationID; - const onCrashChange = (id) => { + const onCrashChange = id => { const newSelectedCrash = crashes.find( - (element) => element.notificationID === id, + element => element.notificationID === id, ); this.setState({crash: newSelectedCrash}); }; const callstackString = crash.callstack || ''; - const children = callstackString.split('\n').map((str) => { + const children = callstackString.split('\n').map(str => { return {message: str}; }); const crashSelector: CrashSelectorProps = { @@ -767,7 +767,7 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin< }, ]}> - {children.map((child) => { + {children.map(child => { return ( = (Params) => Promise; +type ClientCall = Params => Promise; type DatabaseListRequest = {}; @@ -78,22 +78,24 @@ export class DatabaseClient { this.client = pluginClient; } - getDatabases: ClientCall = ( - params, - ) => this.client.call('databaseList', {}); + getDatabases: ClientCall< + DatabaseListRequest, + DatabaseListResponse, + > = params => this.client.call('databaseList', {}); - getTableData: ClientCall = (params) => + getTableData: ClientCall = params => this.client.call('getTableData', params); getTableStructure: ClientCall< GetTableStructureRequest, GetTableStructureResponse, - > = (params) => this.client.call('getTableStructure', params); + > = params => this.client.call('getTableStructure', params); - getExecution: ClientCall = (params) => + getExecution: ClientCall = params => this.client.call('execute', params); - getTableInfo: ClientCall = ( - params, - ) => this.client.call('getTableInfo', params); + getTableInfo: ClientCall< + GetTableInfoRequest, + GetTableInfoResponse, + > = params => this.client.call('getTableInfo', params); } diff --git a/desktop/plugins/databases/index.js b/desktop/plugins/databases/index.js index 3e2e5099f..183f51e79 100644 --- a/desktop/plugins/databases/index.js +++ b/desktop/plugins/databases/index.js @@ -250,7 +250,7 @@ function renderTable(page: ?Page, component: DatabasesPlugin) { ({ + columnOrder={page.columns.map(name => ({ key: name, visible: true, }))} @@ -281,7 +281,7 @@ function renderDatabaseColumns(structure: ?Structure) { ({ + columnOrder={structure.columns.map(name => ({ key: name, visible: true, }))} @@ -305,7 +305,7 @@ function renderDatabaseIndexes(structure: ?Structure) { ({ + columnOrder={structure.indexesColumns.map(name => ({ key: name, visible: true, }))} @@ -686,7 +686,7 @@ export default class DatabasesPlugin extends FlipperPlugin< databaseId: state.selectedDatabase, value: this.state.query.value, }) - .then((data) => { + .then(data => { this.setState({ error: null, executionTime: Date.now() - timeBefore, @@ -709,7 +709,7 @@ export default class DatabasesPlugin extends FlipperPlugin< }); } }) - .catch((e) => { + .catch(e => { this.setState({error: e}); }); } @@ -864,7 +864,7 @@ export default class DatabasesPlugin extends FlipperPlugin< table: table, start: newState.pageRowNumber, }) - .then((data) => { + .then(data => { this.dispatchAction({ type: 'UpdatePage', databaseId: databaseId, @@ -876,7 +876,7 @@ export default class DatabasesPlugin extends FlipperPlugin< total: data.total, }); }) - .catch((e) => { + .catch(e => { this.setState({error: e}); }); } @@ -891,7 +891,7 @@ export default class DatabasesPlugin extends FlipperPlugin< databaseId: databaseId, table: table, }) - .then((data) => { + .then(data => { this.dispatchAction({ type: 'UpdateStructure', databaseId: databaseId, @@ -902,7 +902,7 @@ export default class DatabasesPlugin extends FlipperPlugin< indexesValues: data.indexesValues, }); }) - .catch((e) => { + .catch(e => { this.setState({error: e}); }); } @@ -917,19 +917,19 @@ export default class DatabasesPlugin extends FlipperPlugin< databaseId: databaseId, table: table, }) - .then((data) => { + .then(data => { this.dispatchAction({ type: 'UpdateTableInfo', tableInfo: data.definition, }); }) - .catch((e) => { + .catch(e => { this.setState({error: e}); }); } if (!previousState.outdatedDatabaseList && newState.outdatedDatabaseList) { - this.databaseClient.getDatabases({}).then((databases) => { + this.databaseClient.getDatabases({}).then(databases => { this.dispatchAction({ type: 'UpdateDatabases', databases, @@ -940,7 +940,7 @@ export default class DatabasesPlugin extends FlipperPlugin< init() { this.databaseClient = new DatabaseClient(this.client); - this.databaseClient.getDatabases({}).then((databases) => { + this.databaseClient.getDatabases({}).then(databases => { this.dispatchAction({ type: 'UpdateDatabases', databases, @@ -987,7 +987,7 @@ export default class DatabasesPlugin extends FlipperPlugin< }; onDatabaseSelected = (selected: string) => { - const dbId = this.state.databases.find((x) => x.name === selected)?.id || 0; + const dbId = this.state.databases.find(x => x.name === selected)?.id || 0; this.dispatchAction({ database: dbId, type: 'UpdateSelectedDatabase', @@ -1164,7 +1164,7 @@ export default class DatabasesPlugin extends FlipperPlugin< ({ + columnOrder={columns.map(name => ({ key: name, visible: true, }))} @@ -1175,7 +1175,7 @@ export default class DatabasesPlugin extends FlipperPlugin< zebra={true} rows={rows} horizontallyScrollable={true} - onRowHighlighted={(highlightedRows) => { + onRowHighlighted={highlightedRows => { this.setState({ queryResult: { table: { @@ -1267,7 +1267,7 @@ export default class DatabasesPlugin extends FlipperPlugin< Database x.name) + .map(x => x.name) .reduce((obj, item) => { obj[item] = item; return obj; @@ -1343,7 +1343,7 @@ export default class DatabasesPlugin extends FlipperPlugin< /> {this.state.favorites !== null ? (