Skip to content

Commit 34f575c

Browse files
committedJul 13, 2020
chore(flow): Update the old flowtype supress_comment to the new syntax
1 parent 31435c3 commit 34f575c

15 files changed

+41
-43
lines changed
 

‎.flowconfig

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
[options]
66
module.system=node
77
log.file=./artifacts/flow.log
8-
suppress_comment= \\(.\\|\n\\)*\\$FLOW_FIXME
9-
suppress_comment= \\(.\\|\n\\)*\\$FLOW_IGNORE
108

119
[ignore]
1210
<PROJECT_ROOT>/dist/.*

‎src/extension-runners/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class MultiExtensionRunner {
168168
promises.push(reloadPromise);
169169
}
170170

171-
// $FLOW_FIXME: When upgrading to Flow 0.61.0, it could not follow the type of sourceDir in the array of promises.
171+
// $FlowFixMe: When upgrading to Flow 0.61.0, it could not follow the type of sourceDir in the array of promises.
172172
return await Promise.all(promises).then((results) => {
173173
this.handleReloadResults(results);
174174
return results;

‎src/firefox/remote.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ export async function connectWithMaxRetries(
274274
export function findFreeTcpPort(): Promise<number> {
275275
return new Promise((resolve) => {
276276
const srv = net.createServer();
277-
// $FLOW_FIXME: signature for listen() is missing - see https://github.com/facebook/flow/pull/8290
277+
// $FlowFixMe: signature for listen() is missing - see https://github.com/facebook/flow/pull/8290
278278
srv.listen(0, '127.0.0.1', () => {
279279
const freeTcpPort = srv.address().port;
280280
srv.close(() => resolve(freeTcpPort));

‎src/util/promisify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {promisify} from 'util';
77
// By using the value exported here, flow-check passes successfully
88
// using a single FLOW_IGNORE suppress comment.
99

10-
// $FLOW_IGNORE: promisify.custom is missing in flow type signatures.
10+
// $FlowIgnore: promisify.custom is missing in flow type signatures.
1111
export const promisifyCustom = promisify.custom;
1212

1313
/*

‎src/util/stdin.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import type {Readable} from 'stream';
44

55
export function isTTY(stream: Readable): boolean {
6-
// $FLOW_FIXME: flow complains that stream may not provide isTTY as a property.
6+
// $FlowFixMe: flow complains that stream may not provide isTTY as a property.
77
return stream.isTTY;
88
}
99

1010
export function setRawMode(stream: Readable, rawMode: boolean) {
11-
// $FLOW_FIXME: flow complains that stdin may not provide setRawMode.
11+
// $FlowFixMe: flow complains that stdin may not provide setRawMode.
1212
stream.setRawMode(rawMode);
1313
}

‎tests/unit/helpers.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export function makeSureItFails(): Function {
154154
*
155155
*/
156156

157-
// $FLOW_IGNORE: fake can return any kind of object and fake a defined set of methods for testing.
157+
// $FlowIgnore: fake can return any kind of object and fake a defined set of methods for testing.
158158
export function fake<T>(
159159
original: Object, methods: Object = {}, skipProperties: Array<string> = []
160160
): T {
@@ -189,7 +189,7 @@ export function fake<T>(
189189
stub[key] = sinon.spy(stub[key]);
190190
});
191191

192-
// $FLOW_IGNORE: fake can return any kind of object for testing.
192+
// $FlowIgnore: fake can return any kind of object for testing.
193193
return stub;
194194
}
195195

@@ -349,6 +349,6 @@ class FakeStdin extends stream.Readable {
349349
}
350350

351351
export function createFakeStdin(): tty.ReadStream {
352-
// $FLOW_IGNORE: flow complains that the return value is incompatible with tty.ReadStream
352+
// $FlowIgnore: flow complains that the return value is incompatible with tty.ReadStream
353353
return new FakeStdin();
354354
}

‎tests/unit/test-extension-runners/test.extension-runners.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function exitKeypressLoop(stdin) {
6161
describe('util/extension-runners', () => {
6262
describe('createExtensionRunner', () => {
6363
it('requires a valid target', async () => {
64-
// $FLOW_IGNORE: Want to pass invalid argument and check the error.
64+
// $FlowIgnore: Want to pass invalid argument and check the error.
6565
const promise = createExtensionRunner({});
6666
await assert.isRejected(promise, /Unknown target: "undefined"/);
6767
});

‎tests/unit/test-extension-runners/test.firefox-android.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function prepareExtensionRunnerParams({
7474
});
7575
remoteFirefox.client = fakeRemoteFirefoxClient;
7676

77-
// $FLOW_IGNORE: allow overriden params for testing purpose.
77+
// $FlowIgnore: allow overriden params for testing purpose.
7878
const runnerParams: FirefoxAndroidExtensionRunnerParams = {
7979
extensions: [{
8080
sourceDir: '/fake/sourceDir',
@@ -930,7 +930,7 @@ describe('util/extension-runners/firefox-android', () => {
930930
];
931931

932932
for (const testCase of optionsWarningTestCases) {
933-
// $FLOW_IGNORE: allow overriden params for testing purpose.
933+
// $FlowIgnore: allow overriden params for testing purpose.
934934
new FirefoxAndroidExtensionRunner({ // eslint-disable-line no-new
935935
...params,
936936
...(testCase.params),

‎tests/unit/test-extension-runners/test.firefox-desktop.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function prepareExtensionRunnerParams({
5252
});
5353
const firefoxProcess = new StubChildProcess();
5454

55-
// $FLOW_IGNORE: allow overriden params for testing purpose.
55+
// $FlowIgnore: allow overriden params for testing purpose.
5656
const runnerParams: FirefoxDesktopExtensionRunnerParams = {
5757
extensions: [{
5858
sourceDir: '/fake/sourceDir',
@@ -279,7 +279,7 @@ describe('util/extension-runners/firefox-desktop', () => {
279279
extensionPath: sourceDir,
280280
})
281281
);
282-
// $FLOW_IGNORE: ignored 'property not found' on sinon spy.
282+
// $FlowIgnore: ignored 'property not found' on sinon spy.
283283
const install = params.firefoxApp.installExtension.firstCall.args[0];
284284

285285
assert.equal(install.asProxy, true);

‎tests/unit/test-firefox/test.preferences.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('firefox/preferences', () => {
3232
});
3333

3434
it('throws an error for unsupported apps', () => {
35-
// $FLOW_IGNORE: ignore type errors on testing nonexistent 'thunderbird' prefs
35+
// $FlowIgnore: ignore type errors on testing nonexistent 'thunderbird' prefs
3636
assert.throws(() => getPrefs('thunderbird'),
3737
WebExtError, /Unsupported application: thunderbird/);
3838
});

‎tests/unit/test-firefox/test.remote.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ describe('firefox.remote', () => {
180180
const stubResponse = {requestTypes: ['reload']};
181181
const conn = makeInstance();
182182

183-
// $FLOW_IGNORE: allow overwrite not writable property for testing purpose.
183+
// $FlowIgnore: allow overwrite not writable property for testing purpose.
184184
conn.addonRequest = sinon.spy(() => Promise.resolve(stubResponse));
185185

186186
const returnedAddon = await conn.checkForAddonReloading(addon);
@@ -198,7 +198,7 @@ describe('firefox.remote', () => {
198198
const stubResponse = {requestTypes: ['install']};
199199
const conn = makeInstance();
200200

201-
// $FLOW_IGNORE: allow overwrite not writable property for testing purpose.
201+
// $FlowIgnore: allow overwrite not writable property for testing purpose.
202202
conn.addonRequest = () => Promise.resolve(stubResponse);
203203

204204
await conn.checkForAddonReloading(addon)
@@ -212,7 +212,7 @@ describe('firefox.remote', () => {
212212
const addon = fakeAddon();
213213
const conn = makeInstance();
214214

215-
// $FLOW_IGNORE: allow overwrite not writable property for testing purpose.
215+
// $FlowIgnore: allow overwrite not writable property for testing purpose.
216216
conn.addonRequest =
217217
sinon.spy(() => Promise.resolve({requestTypes: ['reload']}));
218218
const checkedAddon = await conn.checkForAddonReloading(addon);
@@ -356,12 +356,12 @@ describe('firefox.remote', () => {
356356
const addon = fakeAddon();
357357
const conn = makeInstance();
358358

359-
// $FLOW_IGNORE: allow overwrite not writable property for testing purpose.
359+
// $FlowIgnore: allow overwrite not writable property for testing purpose.
360360
conn.getInstalledAddon = sinon.spy(() => Promise.resolve(addon));
361-
// $FLOW_IGNORE: allow overwrite not writable property for testing purpose.
361+
// $FlowIgnore: allow overwrite not writable property for testing purpose.
362362
conn.checkForAddonReloading =
363363
(addonToCheck) => Promise.resolve(addonToCheck);
364-
// $FLOW_IGNORE: allow overwrite not writable property for testing purpose.
364+
// $FlowIgnore: allow overwrite not writable property for testing purpose.
365365
conn.addonRequest = sinon.spy(() => Promise.resolve({}));
366366

367367
await conn.reloadAddon('some-id');
@@ -378,9 +378,9 @@ describe('firefox.remote', () => {
378378
const addon = fakeAddon();
379379
const conn = makeInstance();
380380

381-
// $FLOW_IGNORE: allow overwrite not writable property for testing purpose.
381+
// $FlowIgnore: allow overwrite not writable property for testing purpose.
382382
conn.getInstalledAddon = () => Promise.resolve(addon);
383-
// $FLOW_IGNORE: allow overwrite not writable property for testing purpose.
383+
// $FlowIgnore: allow overwrite not writable property for testing purpose.
384384
conn.checkForAddonReloading =
385385
sinon.spy((addonToCheck) => Promise.resolve(addonToCheck));
386386

@@ -451,7 +451,7 @@ describe('firefox.remote', () => {
451451
async function promiseServerOnPort(port): Promise<net.Server> {
452452
return new Promise((resolve) => {
453453
const srv = net.createServer();
454-
// $FLOW_FIXME: signature for listen() is missing - see https://github.com/facebook/flow/pull/8290
454+
// $FlowFixMe: signature for listen() is missing - see https://github.com/facebook/flow/pull/8290
455455
srv.listen(port, '127.0.0.1', () => {
456456
resolve(srv);
457457
});

‎tests/unit/test-util/test.adb.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function getFakeADBKit(
6868
forward: sinon.spy(() => {}),
6969
push: sinon.spy(() => {
7070
const originalOn = fakeTransfer.on.bind(fakeTransfer);
71-
// $FLOW_IGNORE: ignore flow errors on this testing hack
71+
// $FlowIgnore: ignore flow errors on this testing hack
7272
fakeTransfer.on = (event, cb) => {
7373
originalOn(event, cb);
7474
fakeTransfer.emit('end');
@@ -94,7 +94,7 @@ function getFakeADBKit(
9494
function createSpawnADBErrorSpy() {
9595
return sinon.spy(() => {
9696
const fakeADBError = new Error('spawn adb');
97-
// $FLOW_FIXME: reuse ErrorWithCode from other tests
97+
// $FlowFixMe: reuse ErrorWithCode from other tests
9898
fakeADBError.code = 'ENOENT';
9999
return Promise.reject(fakeADBError);
100100
});

‎tests/unit/test-util/test.logger.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -78,42 +78,42 @@ describe('logger', () => {
7878
it('does not log debug packets unless verbose', () => {
7979
const log = new ConsoleStream({verbose: false});
8080
const localProcess = fakeProcess();
81-
// $FLOW_IGNORE: fake process for testing reasons.
81+
// $FlowIgnore: fake process for testing reasons.
8282
log.write(packet({level: bunyan.DEBUG}), {localProcess});
8383
sinon.assert.notCalled(localProcess.stdout.write);
8484
});
8585

8686
it('does not log trace packets unless verbose', () => {
8787
const log = new ConsoleStream({verbose: false});
8888
const localProcess = fakeProcess();
89-
// $FLOW_IGNORE: fake process for testing reasons.
89+
// $FlowIgnore: fake process for testing reasons.
9090
log.write(packet({level: bunyan.TRACE}), {localProcess});
9191
sinon.assert.notCalled(localProcess.stdout.write);
9292
});
9393

9494
it('logs debug packets when verbose', () => {
9595
const log = new ConsoleStream({verbose: true});
9696
const localProcess = fakeProcess();
97-
// $FLOW_IGNORE: fake process for testing reasons.
97+
// $FlowIgnore: fake process for testing reasons.
9898
log.write(packet({level: bunyan.DEBUG}), {localProcess});
9999
sinon.assert.called(localProcess.stdout.write);
100100
});
101101

102102
it('logs trace packets when verbose', () => {
103103
const log = new ConsoleStream({verbose: true});
104104
const localProcess = fakeProcess();
105-
// $FLOW_IGNORE: fake process for testing reasons.
105+
// $FlowIgnore: fake process for testing reasons.
106106
log.write(packet({level: bunyan.TRACE}), {localProcess});
107107
sinon.assert.called(localProcess.stdout.write);
108108
});
109109

110110
it('logs info packets when verbose or not', () => {
111111
const log = new ConsoleStream({verbose: false});
112112
const localProcess = fakeProcess();
113-
// $FLOW_IGNORE: fake process for testing reasons.
113+
// $FlowIgnore: fake process for testing reasons.
114114
log.write(packet({level: bunyan.INFO}), {localProcess});
115115
log.makeVerbose();
116-
// $FLOW_IGNORE: fake process for testing reasons.
116+
// $FlowIgnore: fake process for testing reasons.
117117
log.write(packet({level: bunyan.INFO}), {localProcess});
118118
sinon.assert.callCount(localProcess.stdout.write, 2);
119119
});
@@ -123,10 +123,10 @@ describe('logger', () => {
123123
const localProcess = fakeProcess();
124124

125125
log.startCapturing();
126-
// $FLOW_IGNORE: fake process for testing reasons.
126+
// $FlowIgnore: fake process for testing reasons.
127127
log.write(packet({msg: 'message'}), {localProcess});
128128
sinon.assert.notCalled(localProcess.stdout.write);
129-
// $FLOW_IGNORE: fake process for testing reasons.
129+
// $FlowIgnore: fake process for testing reasons.
130130
log.flushCapturedLogs({localProcess});
131131
sinon.assert.calledWith(localProcess.stdout.write, 'message\n');
132132
});
@@ -136,14 +136,14 @@ describe('logger', () => {
136136
let localProcess = fakeProcess();
137137

138138
log.startCapturing();
139-
// $FLOW_IGNORE: fake process for testing reasons.
139+
// $FlowIgnore: fake process for testing reasons.
140140
log.write(packet(), {localProcess});
141-
// $FLOW_IGNORE: fake process for testing reasons.
141+
// $FlowIgnore: fake process for testing reasons.
142142
log.flushCapturedLogs({localProcess});
143143

144144
// Make sure there is nothing more to flush.
145145
localProcess = fakeProcess();
146-
// $FLOW_IGNORE: fake process for testing reasons.
146+
// $FlowIgnore: fake process for testing reasons.
147147
log.flushCapturedLogs({localProcess});
148148
sinon.assert.notCalled(localProcess.stdout.write);
149149
});
@@ -153,12 +153,12 @@ describe('logger', () => {
153153
let localProcess = fakeProcess();
154154

155155
log.startCapturing();
156-
// $FLOW_IGNORE: fake process for testing reasons.
156+
// $FlowIgnore: fake process for testing reasons.
157157
log.write(packet(), {localProcess});
158158
sinon.assert.notCalled(localProcess.stdout.write);
159159

160160
log.stopCapturing();
161-
// $FLOW_IGNORE: fake process for testing reasons.
161+
// $FlowIgnore: fake process for testing reasons.
162162
log.write(packet(), {localProcess});
163163
sinon.assert.callCount(localProcess.stdout.write, 1);
164164

@@ -167,7 +167,7 @@ describe('logger', () => {
167167
log.startCapturing();
168168
log.write(packet());
169169
localProcess = fakeProcess();
170-
// $FLOW_IGNORE: fake process for testing reasons.
170+
// $FlowIgnore: fake process for testing reasons.
171171
log.flushCapturedLogs({localProcess});
172172
sinon.assert.callCount(localProcess.stdout.write, 1);
173173
});

‎tests/unit/test.program.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ describe('program.Program', () => {
368368
},
369369
});
370370

371-
// $FLOW_IGNORE: override systemProcess for testing purpose.
371+
// $FlowIgnore: override systemProcess for testing purpose.
372372
program.cleanupProcessEnvConfigs({env: fakeEnv});
373373
assert.deepEqual(fakeEnv, {
374374
WEB_EXT_RUN_OPTION: 'from-env',

‎tests/unit/test.web-ext.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('webExt', () => {
2626
for (const cmd of ['run', 'lint', 'build', 'sign', 'docs']) {
2727
it(`lazily loads cmd/${cmd}`, async () => {
2828
// TODO: use async import instead of require - https://github.com/mozilla/web-ext/issues/1306
29-
// $FLOW_IGNORE: non-literal require used only in tests.
29+
// $FlowIgnore: non-literal require used only in tests.
3030
const cmdModule = require(`../../src/cmd/${cmd}`);
3131
stub = sinon.stub(cmdModule, 'default');
3232

0 commit comments

Comments
 (0)
Please sign in to comment.