Skip to content

Commit

Permalink
Pre-suppress unused-promise lint errors in xplat/js (#36590)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/react-native#36590

Pre-suppress unused-promise lint errors in xplat/js. The next diff enables the lint.

See https://flow.org/en/docs/linting/rule-reference/#toc-unused-promise for more details.

Changelog: [Internal]

drop-conflicts
bypass-lint

Reviewed By: pieterv

Differential Revision: D43967290

fbshipit-source-id: f36242a732dbc18bf7482adfb46ca2b77e1b1493
  • Loading branch information
darichey authored and facebook-github-bot committed Mar 23, 2023
1 parent 75b3da4 commit 5ff1cf9
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/buck-worker-tool/src/worker-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function buckWorker(commands: Commands): any {

if (response.type === 'handshake') {
if (JS_WORKER_TOOL_CPU_PROFILE) {
// $FlowFixMe[unused-promise]
startProfiling().then(() => writer.write(response));
} else {
writer.write(response);
Expand Down Expand Up @@ -164,6 +165,7 @@ function buckWorker(commands: Commands): any {
return;
}
ended = true;
// $FlowFixMe[unused-promise]
stopProfilingAndWrite(JS_WORKER_TOOL_NAME).then(() => writer.end());
}
reader.on('data', handleHandshake);
Expand Down Expand Up @@ -222,6 +224,7 @@ function readArgsAndExecCommand(
if (commands.hasOwnProperty(commandName)) {
const command = commands[commandName];
const commandSpecificConsole = new Console(stdout, stderr);
// $FlowFixMe[unused-promise]
execCommand(
command,
commandName,
Expand Down
1 change: 1 addition & 0 deletions packages/metro-cache/src/__tests__/Cache-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ describe('Cache', () => {
store2.get.mockImplementation(() => 'hit!');

// Get and set. Set should only affect store 1, not 2 (hit) and 3 (after).
// $FlowFixMe[unused-promise]
cache.get(key);
cache.set(key);

Expand Down
1 change: 1 addition & 0 deletions packages/metro-file-map/src/Watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ export class Watcher extends EventEmitter {
this._pendingHealthChecks.delete(basename);
// Chain a deletion to the creation promise (which may not have even settled yet!),
// don't await it, and swallow errors. This is just best-effort cleanup.
// $FlowFixMe[unused-promise]
creationPromise.then(() =>
fs.promises.unlink(healthCheckPath).catch(() => {}),
);
Expand Down
2 changes: 2 additions & 0 deletions packages/metro-file-map/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ export default class HasteMap extends EventEmitter {
const worker = this._worker;

if (worker && typeof worker.end === 'function') {
// $FlowFixMe[unused-promise]
worker.end();
}

Expand Down Expand Up @@ -1085,6 +1086,7 @@ export default class HasteMap extends EventEmitter {
if (!this._watcher) {
return;
}
// $FlowFixMe[unused-promise]
this._watcher
.checkHealth(this._options.healthCheck.timeout)
.then(result => {
Expand Down
1 change: 1 addition & 0 deletions packages/metro-inspector-proxy/src/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ class Device {

if (this._debuggerConnection) {
// Wrapping just to make flow happy :)
// $FlowFixMe[unused-promise]
this._processMessageFromDevice(
parsedPayload,
this._debuggerConnection,
Expand Down
1 change: 1 addition & 0 deletions packages/metro-symbolicate/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@

'use strict';

// $FlowFixMe[unused-promise]
require('./symbolicate.js')().then(code => process.exit(code));
1 change: 1 addition & 0 deletions packages/metro/src/DeltaBundler/Transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class Transformer {
}

end(): void {
// $FlowFixMe[unused-promise]
this._workerFarm.kill();
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/metro/src/IncrementalBundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class IncrementalBundler {

end(): void {
this._deltaBundler.end();
// $FlowFixMe[unused-promise]
this._bundler.end();
}

Expand Down
1 change: 1 addition & 0 deletions packages/metro/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ try {
const {attachMetroCli} = require('./index');
const yargs = require('yargs');

// $FlowFixMe[unused-promise]
attachMetroCli(yargs.demandCommand(1)).argv;
3 changes: 3 additions & 0 deletions packages/metro/src/lib/__tests__/debounceAsyncQueue-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ describe('debounceAsyncQueue', () => {
it('debounces calls', async () => {
const fn = jest.fn();
const debounced = debounceAsyncQueue<void>(fn, 50);
// $FlowFixMe[unused-promise]
debounced();
// $FlowFixMe[unused-promise]
debounced();
// $FlowFixMe[unused-promise]
debounced();
expect(fn).toHaveBeenCalledTimes(0);
jest.runAllTimers();
Expand Down
1 change: 1 addition & 0 deletions packages/metro/src/node-haste/DependencyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ class DependencyGraph extends EventEmitter {
}

end() {
// $FlowFixMe[unused-promise]
this._haste.end();
}

Expand Down
1 change: 1 addition & 0 deletions packages/metro/src/shared/output/RamBundle/as-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function saveAsAssets(
writeMagicFlagFile(modulesDir),
]),
);
// $FlowFixMe[unused-promise]
writeUnbundle.then(() => log('Done writing unbundle output'));

if (sourcemapOutput) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function writeSourcemap(
}
log('Writing sourcemap output to:', fileName);
const writeMap = writeFile(fileName, contents, null);
// $FlowFixMe[unused-promise]
writeMap.then(() => log('Done writing sourcemap output'));
return writeMap;
}
Expand Down

0 comments on commit 5ff1cf9

Please sign in to comment.