Skip to content

Commit dd52a15

Browse files
Update Flow (#2754)
1 parent 94dc334 commit dd52a15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+156
-180
lines changed

.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ experimental.const_params=true
4040
include_warnings=true
4141

4242
[version]
43-
^0.131.0
43+
^0.132.0

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"eslint-plugin-internal-rules": "file:./resources/eslint-internal-rules",
6565
"eslint-plugin-istanbul": "0.1.2",
6666
"eslint-plugin-node": "11.1.0",
67-
"flow-bin": "0.131.0",
67+
"flow-bin": "0.132.0",
6868
"mocha": "8.1.1",
6969
"nyc": "15.1.0",
7070
"prettier": "2.0.5",

src/error/GraphQLError.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export class GraphQLError extends Error {
212212
}
213213

214214
// FIXME: workaround to not break chai comparisons, should be remove in v16
215-
// $FlowFixMe Flow doesn't support computed properties yet
215+
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
216216
get [SYMBOL_TO_STRING_TAG](): string {
217217
return 'Object';
218218
}

src/error/__tests__/formatError-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { GraphQLError } from '../GraphQLError';
66

77
describe('formatError: default error formatter', () => {
88
it('uses default message', () => {
9-
// $FlowExpectedError
9+
// $FlowExpectedError[incompatible-call]
1010
const e = new GraphQLError();
1111

1212
expect(formatError(e)).to.deep.equal({
@@ -45,12 +45,12 @@ describe('formatError: default error formatter', () => {
4545
});
4646

4747
it('rejects null and undefined errors', () => {
48-
// $FlowExpectedError
48+
// $FlowExpectedError[incompatible-call]
4949
expect(() => formatError(undefined)).to.throw(
5050
'Received null or undefined error.',
5151
);
5252

53-
// $FlowExpectedError
53+
// $FlowExpectedError[incompatible-call]
5454
expect(() => formatError(null)).to.throw(
5555
'Received null or undefined error.',
5656
);

src/execution/__tests__/abstract-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ describe('Execute: Handles execution of abstract types', () => {
401401
const fooInterface = new GraphQLInterfaceType({
402402
name: 'FooInterface',
403403
fields: { bar: { type: GraphQLString } },
404-
// $FlowExpectedError
405404
resolveType() {
405+
// $FlowExpectedError[incompatible-call]
406406
return [];
407407
},
408408
});

src/execution/__tests__/executor-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ describe('Execute: Handles basic execution tasks', () => {
3131
}),
3232
});
3333

34-
// $FlowExpectedError
34+
// $FlowExpectedError[prop-missing]
3535
expect(() => executeSync({ schema })).to.throw('Must provide document.');
3636
});
3737

3838
it('throws if no schema is provided', () => {
3939
const document = parse('{ field }');
4040

41-
// $FlowExpectedError
41+
// $FlowExpectedError[prop-missing]
4242
expect(() => executeSync({ document })).to.throw(
4343
'Expected undefined to be a GraphQL schema.',
4444
);
@@ -63,7 +63,7 @@ describe('Execute: Handles basic execution tasks', () => {
6363
`);
6464
const variableValues = '{ "a": 1 }';
6565

66-
// $FlowExpectedError
66+
// $FlowExpectedError[incompatible-call]
6767
expect(() => executeSync({ schema, document, variableValues })).to.throw(
6868
'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.',
6969
);

src/jsutils/inspect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function formatObjectValue(value, previouslySeenValues) {
3535
const customInspectFn = getCustomFn(value);
3636

3737
if (customInspectFn !== undefined) {
38-
// $FlowFixMe(>=0.90.0)
38+
// $FlowFixMe[incompatible-use]
3939
const customValue = customInspectFn.call(value);
4040

4141
// check for infinite recursion

src/language/__tests__/parser-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ function expectSyntaxError(text) {
2222

2323
describe('Parser', () => {
2424
it('asserts that a source to parse was provided', () => {
25-
// $FlowExpectedError
25+
// $FlowExpectedError[incompatible-call]
2626
expect(() => parse()).to.throw('Must provide Source. Received: undefined.');
2727
});
2828

2929
it('asserts that an invalid source to parse was provided', () => {
30-
// $FlowExpectedError
30+
// $FlowExpectedError[incompatible-call]
3131
expect(() => parse({})).to.throw('Must provide Source. Received: {}.');
3232
});
3333

src/language/__tests__/printer-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('Printer: Query document', () => {
2424
it('produces helpful error messages', () => {
2525
const badAST = { random: 'Data' };
2626

27-
// $FlowExpectedError
27+
// $FlowExpectedError[incompatible-call]
2828
expect(() => print(badAST)).to.throw(
2929
'Invalid AST Node: { random: "Data" }.',
3030
);
@@ -113,7 +113,7 @@ describe('Printer: Query document', () => {
113113
const printed = print(parse(kitchenSinkQuery));
114114

115115
expect(printed).to.equal(
116-
// $FlowFixMe
116+
// $FlowFixMe[incompatible-call]
117117
dedent(String.raw`
118118
query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery {
119119
whoever123is: node(id: [123, 456]) {

src/language/__tests__/schema-printer-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Printer: SDL document', () => {
2020
it('produces helpful error messages', () => {
2121
const badAST = { random: 'Data' };
2222

23-
// $FlowExpectedError
23+
// $FlowExpectedError[incompatible-call]
2424
expect(() => print(badAST)).to.throw(
2525
'Invalid AST Node: { random: "Data" }.',
2626
);

src/language/__tests__/toJSONDeep.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function toJSONDeep(value: mixed): mixed {
1010
}
1111

1212
if (typeof value.toJSON === 'function') {
13-
// $FlowFixMe(>=0.90.0)
13+
// $FlowFixMe[incompatible-use]
1414
return value.toJSON();
1515
}
1616

src/language/source.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class Source {
3737
);
3838
}
3939

40-
// $FlowFixMe Flow doesn't support computed properties yet
40+
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
4141
get [SYMBOL_TO_STRING_TAG]() {
4242
return 'Source';
4343
}

src/polyfills/arrayFrom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ declare function arrayFrom<T: mixed>(
99
): Array<T>;
1010

1111
/* eslint-disable no-redeclare */
12-
// $FlowFixMe
12+
// $FlowFixMe[name-already-bound]
1313
const arrayFrom =
1414
Array.from ||
1515
function (obj, mapFn, thisArg) {

src/polyfills/find.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ declare function find<T>(
44
): T | void;
55

66
/* eslint-disable no-redeclare */
7-
// $FlowFixMe
7+
// $FlowFixMe[name-already-bound]
88
const find = Array.prototype.find
99
? function (list, predicate) {
1010
return Array.prototype.find.call(list, predicate);

src/polyfills/flatMap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ declare function flatMap<T, U>(
66
const flatMapMethod = Array.prototype.flatMap;
77

88
/* eslint-disable no-redeclare */
9-
// $FlowFixMe
9+
// $FlowFixMe[name-already-bound]
1010
const flatMap = flatMapMethod
1111
? function (list, fn) {
1212
return flatMapMethod.call(list, fn);

src/polyfills/isFinite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ declare function isFinitePolyfill(
33
): boolean %checks(typeof value === 'number');
44

55
/* eslint-disable no-redeclare */
6-
// $FlowFixMe workaround for: https://github.com/facebook/flow/issues/4441
6+
// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
77
const isFinitePolyfill =
88
Number.isFinite ||
99
function (value) {

src/polyfills/isInteger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ declare function isInteger(value: mixed): boolean %checks(typeof value ===
22
'number');
33

44
/* eslint-disable no-redeclare */
5-
// $FlowFixMe workaround for: https://github.com/facebook/flow/issues/4441
5+
// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
66
const isInteger =
77
Number.isInteger ||
88
function (value) {

src/polyfills/objectEntries.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ObjMap } from '../jsutils/ObjMap';
33
declare function objectEntries<T>(obj: ObjMap<T>): Array<[string, T]>;
44

55
/* eslint-disable no-redeclare */
6-
// $FlowFixMe workaround for: https://github.com/facebook/flow/issues/5838
6+
// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
77
const objectEntries =
88
Object.entries || ((obj) => Object.keys(obj).map((key) => [key, obj[key]]));
99

src/polyfills/objectValues.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ObjMap } from '../jsutils/ObjMap';
33
declare function objectValues<T>(obj: ObjMap<T>): Array<T>;
44

55
/* eslint-disable no-redeclare */
6-
// $FlowFixMe workaround for: https://github.com/facebook/flow/issues/2221
6+
// $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
77
const objectValues =
88
Object.values || ((obj) => Object.keys(obj).map((key) => obj[key]));
99
export default objectValues;

src/polyfills/symbols.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ export const SYMBOL_ITERATOR: string =
66
// In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator
77
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
88
export const SYMBOL_ASYNC_ITERATOR: string =
9-
// $FlowFixMe Flow doesn't define `Symbol.asyncIterator` yet
9+
// $FlowFixMe[prop-missing] Flow doesn't define `Symbol.asyncIterator` yet
1010
typeof Symbol === 'function' ? Symbol.asyncIterator : '@@asyncIterator';
1111

1212
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
1313
export const SYMBOL_TO_STRING_TAG: string =
14-
// $FlowFixMe Flow doesn't define `Symbol.toStringTag` yet
14+
// $FlowFixMe[incompatible-type] Flow doesn't define `Symbol.toStringTag` yet
1515
typeof Symbol === 'function' ? Symbol.toStringTag : '@@toStringTag';

src/subscription/__tests__/eventEmitterAsyncIterator-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('eventEmitterAsyncIterator', () => {
4141
const i5 = iterator.next().then((x) => x);
4242

4343
// Terminate emitter
44-
// $FlowFixMe
44+
// $FlowFixMe[prop-missing]
4545
await iterator.return();
4646

4747
// Publish is not caught after terminate

src/subscription/__tests__/eventEmitterAsyncIterator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default function eventEmitterAsyncIterator(
5757
emptyQueue();
5858
return Promise.reject(error);
5959
},
60-
// $FlowFixMe Blocked by https://github.com/facebook/flow/issues/3258
60+
// $FlowFixMe[prop-missing] Blocked by https://github.com/facebook/flow/issues/3258
6161
[Symbol.asyncIterator]() {
6262
return this;
6363
},

src/subscription/__tests__/mapAsyncIterator-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('mapAsyncIterator', () => {
2626
const items = [1, 2, 3];
2727

2828
const iterator: any = {
29-
// $FlowFixMe Blocked by https://github.com/facebook/flow/issues/3258
29+
// $FlowFixMe[prop-missing] Blocked by https://github.com/facebook/flow/issues/3258
3030
[Symbol.asyncIterator]() {
3131
return this;
3232
},
@@ -122,7 +122,7 @@ describe('mapAsyncIterator', () => {
122122
const items = [1, 2, 3];
123123

124124
const iterator: any = {
125-
// $FlowFixMe Blocked by https://github.com/facebook/flow/issues/3258
125+
// $FlowFixMe[prop-missing] Blocked by https://github.com/facebook/flow/issues/3258
126126
[Symbol.asyncIterator]() {
127127
return this;
128128
},
@@ -186,7 +186,7 @@ describe('mapAsyncIterator', () => {
186186
const items = [1, 2, 3];
187187

188188
const iterator: any = {
189-
// $FlowFixMe Blocked by https://github.com/facebook/flow/issues/3258
189+
// $FlowFixMe[prop-missing] Blocked by https://github.com/facebook/flow/issues/3258
190190
[Symbol.asyncIterator]() {
191191
return this;
192192
},

src/subscription/__tests__/subscribe-test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ async function createSubscription(
126126
// `subscribe` returns Promise<AsyncIterator | ExecutionResult>
127127
return {
128128
sendImportantEmail,
129-
// $FlowFixMe
129+
// $FlowFixMe[incompatible-call]
130130
subscription: await subscribe({ schema, document, rootValue: data }),
131131
};
132132
}
@@ -155,7 +155,7 @@ describe('Subscription Initialization Phase', () => {
155155
// Empty
156156
}
157157

158-
// $FlowFixMe
158+
// $FlowFixMe[incompatible-call]
159159
const ai = await subscribe(emailSchema, document, {
160160
importantEmail: emptyAsyncIterator,
161161
});
@@ -210,7 +210,7 @@ describe('Subscription Initialization Phase', () => {
210210
}),
211211
});
212212

213-
// $FlowFixMe
213+
// $FlowFixMe[incompatible-call]
214214
const subscription = await subscribe({
215215
schema,
216216
document: parse(`
@@ -245,7 +245,7 @@ describe('Subscription Initialization Phase', () => {
245245
}),
246246
});
247247

248-
// $FlowFixMe
248+
// $FlowFixMe[incompatible-call]
249249
const subscription = await subscribe({
250250
schema,
251251
document: parse(`
@@ -292,7 +292,7 @@ describe('Subscription Initialization Phase', () => {
292292
subscription: SubscriptionTypeMultiple,
293293
});
294294

295-
// $FlowFixMe
295+
// $FlowFixMe[incompatible-call]
296296
const subscription = await subscribe({
297297
schema,
298298
document: parse(`
@@ -320,27 +320,27 @@ describe('Subscription Initialization Phase', () => {
320320
`);
321321

322322
await expectPromiseToThrow(
323-
// $FlowExpectedError
323+
// $FlowExpectedError[incompatible-call]
324324
() => subscribe({ schema: null, document }),
325325
'Expected null to be a GraphQL schema.',
326326
);
327327

328328
await expectPromiseToThrow(
329-
// $FlowExpectedError
329+
// $FlowExpectedError[incompatible-call]
330330
() => subscribe({ document }),
331331
'Expected undefined to be a GraphQL schema.',
332332
);
333333
});
334334

335335
it('throws an error if document is missing', async () => {
336336
await expectPromiseToThrow(
337-
// $FlowExpectedError
337+
// $FlowExpectedError[incompatible-call]
338338
() => subscribe({ schema: emailSchema, document: null }),
339339
'Must provide document.',
340340
);
341341

342342
await expectPromiseToThrow(
343-
// $FlowExpectedError
343+
// $FlowExpectedError[incompatible-call]
344344
() => subscribe({ schema: emailSchema }),
345345
'Must provide document.',
346346
);
@@ -370,7 +370,7 @@ describe('Subscription Initialization Phase', () => {
370370
it('should pass through unexpected errors thrown in subscribe', async () => {
371371
let expectedError;
372372
try {
373-
// $FlowExpectedError
373+
// $FlowExpectedError[incompatible-call]
374374
await subscribe({ schema: emailSchema, document: {} });
375375
} catch (error) {
376376
expectedError = error;
@@ -930,7 +930,7 @@ describe('Subscription Publish Phase', () => {
930930
},
931931
);
932932

933-
// $FlowFixMe
933+
// $FlowFixMe[incompatible-call]
934934
const subscription = await subscribe({
935935
schema: erroringEmailSchema,
936936
document: parse(`
@@ -1002,7 +1002,7 @@ describe('Subscription Publish Phase', () => {
10021002
(email) => email,
10031003
);
10041004

1005-
// $FlowFixMe
1005+
// $FlowFixMe[incompatible-call]
10061006
const subscription = await subscribe({
10071007
schema: erroringEmailSchema,
10081008
document: parse(`
@@ -1056,7 +1056,7 @@ describe('Subscription Publish Phase', () => {
10561056
(email) => email,
10571057
);
10581058

1059-
// $FlowFixMe
1059+
// $FlowFixMe[incompatible-call]
10601060
const subscription = await subscribe({
10611061
schema: erroringEmailSchema,
10621062
document: parse(`

0 commit comments

Comments
 (0)