[flow] make Flow suppressions explicit on the error (#26487)
Added an explicit type to all $FlowFixMe suppressions to reduce over-suppressions of new errors that might be caused on the same lines. Also removes suppressions that aren't used (e.g. in a `@noflow` file as they're purely misleading) Test Plan: yarn flow-ci
Jan Kassens committed
Mar 27, 2023 at 13:43 UTC
afea1d0c536e0336735b0ea5c74f635527b65785
90 files changed
+164
-209
packages/internal-test-utils/internalAct.js
+3
-3
@@ -35,7 +35,7 @@ export async function act<T>(scope: () => Thenable<T>): Thenable<T> {
35
);
36
}
37
38
- // $FlowFixMe: Flow doesn't know about global Jest object
38
+ // $FlowFixMe[cannot-resolve-name]: Flow doesn't know about global Jest object
39
if (!jest.isMockFunction(setTimeout)) {
40
throw Error(
41
"This version of `act` requires Jest's timer mocks " +
@@ -70,7 +70,7 @@ export async function act<T>(scope: () => Thenable<T>): Thenable<T> {
70
// Wait until end of current task/microtask.
71
await waitForMicrotasks();
72
73
- // $FlowFixMe: Flow doesn't know about global Jest object
73
+ // $FlowFixMe[cannot-resolve-name]: Flow doesn't know about global Jest object
74
if (jest.isEnvironmentTornDown()) {
75
error.message =
76
'The Jest environment was torn down before `act` completed. This ' +
@@ -79,7 +79,7 @@ export async function act<T>(scope: () => Thenable<T>): Thenable<T> {
79
}
80
81
if (!Scheduler.unstable_hasPendingWork()) {
82
- // $FlowFixMe: Flow doesn't know about global Jest object
82
+ // $FlowFixMe[cannot-resolve-name]: Flow doesn't know about global Jest object
83
jest.runOnlyPendingTimers();
84
if (Scheduler.unstable_hasPendingWork()) {
85
// Committing a fallback scheduled additional work. Continue flushing.
packages/react-client/src/ReactFlightClient.js
+5
-5
@@ -189,12 +189,12 @@ export function getRoot<T>(response: Response): Thenable<T> {
189
}
190
191
function createPendingChunk<T>(response: Response): PendingChunk<T> {
192
- // $FlowFixMe Flow doesn't support functions as constructors
192
+ // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
193
return new Chunk(PENDING, null, null, response);
194
}
195
196
function createBlockedChunk<T>(response: Response): BlockedChunk<T> {
197
- // $FlowFixMe Flow doesn't support functions as constructors
197
+ // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
198
return new Chunk(BLOCKED, null, null, response);
199
}
200
@@ -202,7 +202,7 @@ function createErrorChunk<T>(
202
response: Response,
203
error: ErrorWithDigest,
204
): ErroredChunk<T> {
205
- // $FlowFixMe Flow doesn't support functions as constructors
205
+ // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
206
return new Chunk(ERRORED, null, error, response);
207
}
208
@@ -253,7 +253,7 @@ function createResolvedModelChunk<T>(
253
response: Response,
254
value: UninitializedModel,
255
): ResolvedModelChunk<T> {
256
- // $FlowFixMe Flow doesn't support functions as constructors
256
+ // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
257
return new Chunk(RESOLVED_MODEL, value, null, response);
258
}
259
@@ -261,7 +261,7 @@ function createResolvedModuleChunk<T>(
261
response: Response,
262
value: ClientReference<T>,
263
): ResolvedModuleChunk<T> {
264
- // $FlowFixMe Flow doesn't support functions as constructors
264
+ // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
265
return new Chunk(RESOLVED_MODULE, value, null, response);
266
}
267
packages/react-client/src/ReactFlightReplyClient.js
+4
-4
@@ -103,7 +103,7 @@ export function processReply(
103
): ReactJSONValue {
104
const parent = this;
105
if (__DEV__) {
106
- // $FlowFixMe
106
+ // $FlowFixMe[incompatible-use]
107
const originalValue = this[key];
108
if (typeof originalValue === 'object' && originalValue !== value) {
109
if (objectName(originalValue) !== 'Object') {
@@ -212,7 +212,7 @@ export function processReply(
212
}
213
}
214
215
- // $FlowFixMe
215
+ // $FlowFixMe[incompatible-return]
216
return value;
217
}
218
@@ -249,13 +249,13 @@ export function processReply(
249
}
250
251
if (typeof value === 'symbol') {
252
- // $FlowFixMe `description` might be undefined
252
+ // $FlowFixMe[incompatible-type] `description` might be undefined
253
const name: string = value.description;
254
if (Symbol.for(name) !== value) {
255
throw new Error(
256
'Only global symbols received from Symbol.for(...) can be passed to Server Functions. ' +
257
`The symbol Symbol.for(${
258
- // $FlowFixMe `description` might be undefined
258
+ // $FlowFixMe[incompatible-type] `description` might be undefined
259
value.description
260
}) cannot be found among global symbols.`,
261
);
packages/react-debug-tools/src/ReactDebugHooks.js
+3
-3
@@ -123,7 +123,7 @@ function useState<S>(
123
hook !== null
124
? hook.memoizedState
125
: typeof initialState === 'function'
126
- ? // $FlowFixMe: Flow doesn't like mixed types
126
+ ? // $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
127
initialState()
128
: initialState;
129
hookLog.push({primitive: 'State', stackError: new Error(), value: state});
@@ -674,7 +674,7 @@ function handleRenderFunctionError(error: any): void {
674
// that the error is caused by user's code in renderFunction.
675
// In this case, we should wrap the original error inside a custom error
676
// so that devtools can give a clear message about it.
677
- // $FlowFixMe: Flow doesn't know about 2nd argument of Error constructor
677
+ // $FlowFixMe[extra-arg]: Flow doesn't know about 2nd argument of Error constructor
678
const wrapperError = new Error('Error rendering inspected component', {
679
cause: error,
680
});
@@ -682,7 +682,7 @@ function handleRenderFunctionError(error: any): void {
682
// TODO: refactor this if we ever combine the devtools and debug tools packages
683
wrapperError.name = 'ReactDebugToolsRenderError';
684
// this stage-4 proposal is not supported by all environments yet.
685
- // $FlowFixMe Flow doesn't have this type yet.
685
+ // $FlowFixMe[prop-missing] Flow doesn't have this type yet.
686
wrapperError.cause = error;
687
throw wrapperError;
688
}
packages/react-devtools-shared/src/__tests__/inspectedElement-test.js
-1
@@ -1841,7 +1841,6 @@ describe('InspectedElement', () => {
1841
xyz: 1,
1842
},
1843
});
1844
- // $FlowFixMe
1844
const bigInt = BigInt(123); // eslint-disable-line no-undef
1845
1846
await utils.actAsync(() =>
packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js
-1
@@ -873,7 +873,6 @@ describe('InspectedElementContext', () => {
873
xyz: 1,
874
},
875
});
876
- // $FlowFixMe
876
const bigInt = BigInt(123); // eslint-disable-line no-undef
877
878
act(() =>
packages/react-devtools-shared/src/__tests__/setupTests.js
-2
@@ -80,7 +80,6 @@ beforeEach(() => {
80
}
81
82
const originalConsoleError = console.error;
83
- // $FlowFixMe
83
console.error = (...args) => {
84
const firstArg = args[0];
85
if (
@@ -111,7 +110,6 @@ beforeEach(() => {
110
originalConsoleError.apply(console, args);
111
};
112
const originalConsoleWarn = console.warn;
114
- // $FlowFixMe
113
console.warn = (...args) => {
114
if (shouldIgnoreConsoleErrorOrWarn(args)) {
115
// Allows testing how DevTools behaves when it encounters console.warn without cluttering the test output.
packages/react-devtools-shared/src/__tests__/storeStressTestConcurrent-test.js
-20
@@ -67,7 +67,6 @@ describe('StoreStressConcurrent', () => {
67
68
// 1. Render a normal version of [a, b, c, d, e].
69
let container = document.createElement('div');
70
- // $FlowFixMe
70
let root = ReactDOMClient.createRoot(container);
71
act(() => root.render(<Parent>{[a, b, c, d, e]}</Parent>));
72
expect(store).toMatchInlineSnapshot(
@@ -151,7 +150,6 @@ describe('StoreStressConcurrent', () => {
150
for (let i = 0; i < cases.length; i++) {
151
// Ensure fresh mount.
152
container = document.createElement('div');
154
- // $FlowFixMe
153
root = ReactDOMClient.createRoot(container);
154
155
// Verify mounting 'abcde'.
@@ -181,7 +179,6 @@ describe('StoreStressConcurrent', () => {
179
// 6. Verify *updates* by reusing the container between iterations.
180
// There'll be no unmounting until the very end.
181
container = document.createElement('div');
184
- // $FlowFixMe
182
root = ReactDOMClient.createRoot(container);
183
for (let i = 0; i < cases.length; i++) {
184
// Verify mounting 'abcde'.
@@ -249,7 +246,6 @@ describe('StoreStressConcurrent', () => {
246
const snapshots = [];
247
let container = document.createElement('div');
248
for (let i = 0; i < steps.length; i++) {
252
- // $FlowFixMe
249
const root = ReactDOMClient.createRoot(container);
250
act(() => root.render(<Root>{steps[i]}</Root>));
251
// We snapshot each step once so it doesn't regress.
@@ -321,7 +317,6 @@ describe('StoreStressConcurrent', () => {
317
for (let i = 0; i < steps.length; i++) {
318
for (let j = 0; j < steps.length; j++) {
319
container = document.createElement('div');
324
- // $FlowFixMe
320
const root = ReactDOMClient.createRoot(container);
321
act(() => root.render(<Root>{steps[i]}</Root>));
322
expect(print(store)).toMatch(snapshots[i]);
@@ -338,7 +333,6 @@ describe('StoreStressConcurrent', () => {
333
for (let i = 0; i < steps.length; i++) {
334
for (let j = 0; j < steps.length; j++) {
335
container = document.createElement('div');
341
- // $FlowFixMe
336
const root = ReactDOMClient.createRoot(container);
337
act(() =>
338
root.render(
@@ -412,7 +406,6 @@ describe('StoreStressConcurrent', () => {
406
const snapshots = [];
407
let container = document.createElement('div');
408
for (let i = 0; i < steps.length; i++) {
415
- // $FlowFixMe
409
const root = ReactDOMClient.createRoot(container);
410
act(() =>
411
root.render(
@@ -515,7 +508,6 @@ describe('StoreStressConcurrent', () => {
508
509
// 2. Verify check Suspense can render same steps as initial fallback content.
510
for (let i = 0; i < steps.length; i++) {
518
- // $FlowFixMe
511
const root = ReactDOMClient.createRoot(container);
512
act(() =>
513
root.render(
@@ -540,7 +532,6 @@ describe('StoreStressConcurrent', () => {
532
for (let j = 0; j < steps.length; j++) {
533
// Always start with a fresh container and steps[i].
534
container = document.createElement('div');
543
- // $FlowFixMe
535
const root = ReactDOMClient.createRoot(container);
536
act(() =>
537
root.render(
@@ -586,7 +577,6 @@ describe('StoreStressConcurrent', () => {
577
for (let j = 0; j < steps.length; j++) {
578
// Always start with a fresh container and steps[i].
579
container = document.createElement('div');
589
- // $FlowFixMe
580
const root = ReactDOMClient.createRoot(container);
581
act(() =>
582
root.render(
@@ -644,7 +634,6 @@ describe('StoreStressConcurrent', () => {
634
for (let j = 0; j < steps.length; j++) {
635
// Always start with a fresh container and steps[i].
636
container = document.createElement('div');
647
- // $FlowFixMe
637
const root = ReactDOMClient.createRoot(container);
638
act(() =>
639
root.render(
@@ -694,7 +683,6 @@ describe('StoreStressConcurrent', () => {
683
for (let j = 0; j < steps.length; j++) {
684
// Always start with a fresh container and steps[i].
685
container = document.createElement('div');
697
- // $FlowFixMe
686
const root = ReactDOMClient.createRoot(container);
687
act(() =>
688
root.render(
@@ -748,7 +736,6 @@ describe('StoreStressConcurrent', () => {
736
for (let j = 0; j < steps.length; j++) {
737
// Always start with a fresh container and steps[i].
738
container = document.createElement('div');
751
- // $FlowFixMe
739
const root = ReactDOMClient.createRoot(container);
740
act(() =>
741
root.render(
@@ -904,7 +891,6 @@ describe('StoreStressConcurrent', () => {
891
const snapshots = [];
892
let container = document.createElement('div');
893
for (let i = 0; i < steps.length; i++) {
907
- // $FlowFixMe
894
const root = ReactDOMClient.createRoot(container);
895
act(() =>
896
root.render(
@@ -928,7 +914,6 @@ describe('StoreStressConcurrent', () => {
914
// which is different from the snapshots above. So we take more snapshots.
915
const fallbackSnapshots = [];
916
for (let i = 0; i < steps.length; i++) {
931
- // $FlowFixMe
917
const root = ReactDOMClient.createRoot(container);
918
act(() =>
919
root.render(
@@ -1062,7 +1047,6 @@ describe('StoreStressConcurrent', () => {
1047
for (let j = 0; j < steps.length; j++) {
1048
// Always start with a fresh container and steps[i].
1049
container = document.createElement('div');
1065
- // $FlowFixMe
1050
const root = ReactDOMClient.createRoot(container);
1051
act(() =>
1052
root.render(
@@ -1114,7 +1098,6 @@ describe('StoreStressConcurrent', () => {
1098
for (let j = 0; j < steps.length; j++) {
1099
// Always start with a fresh container and steps[i].
1100
container = document.createElement('div');
1117
- // $FlowFixMe
1101
const root = ReactDOMClient.createRoot(container);
1102
act(() =>
1103
root.render(
@@ -1181,7 +1164,6 @@ describe('StoreStressConcurrent', () => {
1164
for (let j = 0; j < steps.length; j++) {
1165
// Always start with a fresh container and steps[i].
1166
container = document.createElement('div');
1184
- // $FlowFixMe
1167
const root = ReactDOMClient.createRoot(container);
1168
act(() =>
1169
root.render(
@@ -1233,7 +1215,6 @@ describe('StoreStressConcurrent', () => {
1215
for (let j = 0; j < steps.length; j++) {
1216
// Always start with a fresh container and steps[i].
1217
container = document.createElement('div');
1236
- // $FlowFixMe
1218
const root = ReactDOMClient.createRoot(container);
1219
act(() =>
1220
root.render(
@@ -1285,7 +1266,6 @@ describe('StoreStressConcurrent', () => {
1266
for (let j = 0; j < steps.length; j++) {
1267
// Always start with a fresh container and steps[i].
1268
container = document.createElement('div');
1288
- // $FlowFixMe
1269
const root = ReactDOMClient.createRoot(container);
1270
act(() =>
1271
root.render(
packages/react-devtools-shared/src/__tests__/utils.js
-3
@@ -46,7 +46,6 @@ export async function actAsync(
46
const {act: actTestRenderer} = require('react-test-renderer');
47
const {act: actDOM} = require('react-dom/test-utils');
48
49
- // $FlowFixMe Flow doesn't know about "await act()" yet
49
await actDOM(async () => {
50
await actTestRenderer(async () => {
51
await cb();
@@ -55,7 +54,6 @@ export async function actAsync(
54
55
if (recursivelyFlush) {
56
while (jest.getTimerCount() > 0) {
58
- // $FlowFixMe Flow doesn't know about "await act()" yet
57
await actDOM(async () => {
58
await actTestRenderer(async () => {
59
jest.runAllTimers();
@@ -63,7 +61,6 @@ export async function actAsync(
61
});
62
}
63
} else {
66
- // $FlowFixMe Flow doesn't know about "await act()" yet
64
await actDOM(async () => {
65
await actTestRenderer(async () => {
66
jest.runOnlyPendingTimers();
packages/react-devtools-shared/src/backend/DevToolsComponentStackFrame.js
+2
-2
@@ -77,7 +77,7 @@ export function describeNativeComponentFrame(
77
let control;
78
79
const previousPrepareStackTrace = Error.prepareStackTrace;
80
- // $FlowFixMe It does accept undefined.
80
+ // $FlowFixMe[incompatible-type] It does accept undefined.
81
Error.prepareStackTrace = undefined;
82
83
reentry = true;
@@ -98,7 +98,7 @@ export function describeNativeComponentFrame(
98
const Fake = function () {
99
throw Error();
100
};
101
- // $FlowFixMe
101
+ // $FlowFixMe[prop-missing]
102
Object.defineProperty(Fake.prototype, 'props', {
103
set: function () {
104
// We use a throwing setter instead of frozen or non-writable props
packages/react-devtools-shared/src/backend/DevToolsConsolePatching.js
+2
-2
@@ -45,7 +45,7 @@ export function disableLogs(): void {
45
value: disabledLog,
46
writable: true,
47
};
48
- // $FlowFixMe Flow thinks console is immutable.
48
+ // $FlowFixMe[cannot-write] Flow thinks console is immutable.
49
Object.defineProperties(console, {
50
info: props,
51
log: props,
@@ -69,7 +69,7 @@ export function reenableLogs(): void {
69
enumerable: true,
70
writable: true,
71
};
72
- // $FlowFixMe Flow thinks console is immutable.
72
+ // $FlowFixMe[cannot-write] Flow thinks console is immutable.
73
Object.defineProperties(console, {
74
log: {...props, value: prevLog},
75
info: {...props, value: prevInfo},
packages/react-devtools-shared/src/backend/profilingHooks.js
+3
-3
@@ -64,7 +64,7 @@ if (supportsUserTiming) {
64
});
65
66
try {
67
- // $FlowFixMe: Flow expects the User Timing level 2 API.
67
+ // $FlowFixMe[extra-arg]: Flow expects the User Timing level 2 API.
68
performance.mark(CHECK_V3_MARK, markOptions);
69
} catch (error) {
70
// Ignore
@@ -281,7 +281,7 @@ export function createProfilingHooks({
281
);
282
}
283
284
- // $FlowFixMe This property should not be writable outside of this function.
284
+ // $FlowFixMe[cannot-write] This property should not be writable outside of this function.
285
top.duration = currentTime - top.timestamp;
286
287
if (currentTimelineData) {
@@ -590,7 +590,7 @@ export function createProfilingHooks({
590
591
const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
592
593
- // $FlowFixMe: Flow cannot handle polymorphic WeakMaps
593
+ // $FlowFixMe[incompatible-type]: Flow cannot handle polymorphic WeakMaps
594
const wakeableIDs: WeakMap<Wakeable, number> = new PossiblyWeakMap();
595
let wakeableID: number = 0;
596
function getWakeableID(wakeable: Wakeable): number {
packages/react-devtools-shared/src/backend/renderer.js
+1
-1
@@ -384,7 +384,7 @@ export function getInternalReactConstants(version: string): {
384
typeof type === 'object' && type !== null ? type.$$typeof : type;
385
386
return typeof symbolOrNumber === 'symbol'
387
- ? // $FlowFixMe `toString()` doesn't match the type signature?
387
+ ? // $FlowFixMe[incompatible-return] `toString()` doesn't match the type signature?
388
symbolOrNumber.toString()
389
: symbolOrNumber;
390
}
packages/react-devtools-shared/src/backend/utils.js
+4
-4
@@ -72,7 +72,7 @@ export function copyWithDelete(
72
delete updated[key];
73
}
74
} else {
75
- // $FlowFixMe number or string is fine here
75
+ // $FlowFixMe[incompatible-use] number or string is fine here
76
updated[key] = copyWithDelete(obj[key], path, index + 1);
77
}
78
return updated;
@@ -90,7 +90,7 @@ export function copyWithRename(
90
const updated = isArray(obj) ? obj.slice() : {...obj};
91
if (index + 1 === oldPath.length) {
92
const newKey = newPath[index];
93
- // $FlowFixMe number or string is fine here
93
+ // $FlowFixMe[incompatible-use] number or string is fine here
94
updated[newKey] = updated[oldKey];
95
if (isArray(updated)) {
96
updated.splice(((oldKey: any): number), 1);
@@ -98,7 +98,7 @@ export function copyWithRename(
98
delete updated[oldKey];
99
}
100
} else {
101
- // $FlowFixMe number or string is fine here
101
+ // $FlowFixMe[incompatible-use] number or string is fine here
102
updated[oldKey] = copyWithRename(obj[oldKey], oldPath, newPath, index + 1);
103
}
104
return updated;
@@ -115,7 +115,7 @@ export function copyWithSet(
115
}
116
const key = path[index];
117
const updated = isArray(obj) ? obj.slice() : {...obj};
118
- // $FlowFixMe number or string is fine here
118
+ // $FlowFixMe[incompatible-use] number or string is fine here
119
updated[key] = copyWithSet(obj[key], path, value, index + 1);
120
return updated;
121
}
packages/react-devtools-shared/src/bridge.js
+2
-2
@@ -339,9 +339,9 @@ class Bridge<
339
this._isShutdown = true;
340
341
// Disable the API inherited from EventEmitter that can add more listeners and send more messages.
342
- // $FlowFixMe This property is not writable.
342
+ // $FlowFixMe[cannot-write] This property is not writable.
343
this.addListener = function () {};
344
- // $FlowFixMe This property is not writable.
344
+ // $FlowFixMe[cannot-write] This property is not writable.
345
this.emit = function () {};
346
// NOTE: There's also EventEmitter API like `on` and `prependListener` that we didn't add to our Flow type of EventEmitter.
347
packages/react-devtools-shared/src/devtools/views/Button.js
+1
-1
@@ -28,7 +28,7 @@ export default function Button({
28
...rest
29
}: Props): React.Node {
30
let button = (
31
- // $FlowFixMe unsafe spread
31
+ // $FlowFixMe[cannot-spread-inexact] unsafe spread
32
<button
33
className={`${styles.Button} ${className}`}
34
data-testname={testName}
packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js
+1
-1
@@ -43,7 +43,7 @@ export default function AutoSizeInput({
43
const isEmpty = value === '' || value === '""';
44
45
return (
46
- // $FlowFixMe unsafe rest spread
46
+ // $FlowFixMe[cannot-spread-inexact] unsafe rest spread
47
<input
48
className={[styles.Input, className].join(' ')}
49
data-testname={testName}
packages/react-devtools-shared/src/devtools/views/Components/reach-ui/menu-button.js
+1
-1
@@ -25,7 +25,7 @@ const MenuList = ({
25
}): React.Node => {
26
const style = useThemeStyles();
27
return (
28
- // $FlowFixMe unsafe spread
28
+ // $FlowFixMe[cannot-spread-inexact] unsafe spread
29
<ReachMenuList style={style} {...props}>
30
{children}
31
</ReachMenuList>
packages/react-devtools-shared/src/devtools/views/Components/reach-ui/tooltip.js
+1
-1
@@ -23,7 +23,7 @@ const Tooltip = ({
23
}): React.Node => {
24
const style = useThemeStyles();
25
return (
26
- // $FlowFixMe unsafe spread
26
+ // $FlowFixMe[cannot-spread-inexact] unsafe spread
27
<ReachTooltip
28
className={`${tooltipStyles.Tooltip} ${className}`}
29
style={style}
packages/react-devtools-shared/src/devtools/views/Settings/SettingsContext.js
+1
-1
@@ -290,7 +290,7 @@ export function updateThemeVariables(
290
// but it makes a significant UI improvement in dark mode.
291
// https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-color
292
documentElements.forEach(documentElement => {
293
- // $FlowFixMe scrollbarColor is missing in CSSStyleDeclaration
293
+ // $FlowFixMe[prop-missing] scrollbarColor is missing in CSSStyleDeclaration
294
documentElement.style.scrollbarColor = `var(${`--${theme}-color-scroll-thumb`}) var(${`--${theme}-color-scroll-track`})`;
295
});
296
}
packages/react-devtools-shared/src/devtools/views/utils.js
+1
-1
@@ -133,7 +133,7 @@ export function serializeDataForCopy(props: Object): string {
133
}
134
135
export function serializeHooksForCopy(hooks: HooksTree | null): string {
136
- // $FlowFixMe "HooksTree is not an object"
136
+ // $FlowFixMe[not-an-object] "HooksTree is not an object"
137
const cloned = Object.assign(([]: Array<any>), hooks);
138
139
const queue = [...cloned];
packages/react-devtools-shared/src/registerDevToolsEventLogger.js
+3
-2
@@ -31,7 +31,8 @@ export function registerDevToolsEventLogger(
31
let metadata = null;
32
if (event.metadata != null) {
33
metadata = event.metadata;
34
- // $FlowFixMe: metadata is not writable and nullable
34
+ // $FlowFixMe[cannot-write]: metadata is not writable and nullable
35
+ // $FlowFixMe[prop-missing]
36
delete event.metadata;
37
}
38
loggingIFrame.contentWindow.postMessage(
@@ -43,7 +44,7 @@ export function registerDevToolsEventLogger(
44
version: process.env.DEVTOOLS_VERSION,
45
metadata: metadata !== null ? JSON.stringify(metadata) : '',
46
...(fetchAdditionalContext != null
46
- ? // $FlowFixMe
47
+ ? // $FlowFixMe[not-an-object]
48
await fetchAdditionalContext()
49
: {}),
50
},
packages/react-devtools-shared/src/utils.js
+1
-1
@@ -93,7 +93,7 @@ export function getAllEnumerableKeys(
93
];
94
const descriptors = Object.getOwnPropertyDescriptors(current);
95
currentKeys.forEach(key => {
96
- // $FlowFixMe: key can be a Symbol https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor
96
+ // $FlowFixMe[incompatible-type]: key can be a Symbol https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor
97
if (descriptors[key].enumerable) {
98
keys.add(key);
99
}
packages/react-devtools-shell/src/app/InspectableElements/CustomHooks.js
+1
-1
@@ -107,7 +107,7 @@ function wrapWithHoc(Component: (props: any, ref: React$Ref<any>) => any) {
107
function Hoc() {
108
return <Component />;
109
}
110
- // $FlowFixMe
110
+ // $FlowFixMe[prop-missing]
111
const displayName = Component.displayName || Component.name;
112
// $FlowFixMe[incompatible-type] found when upgrading Flow
113
Hoc.displayName = `withHoc(${displayName})`;
packages/react-devtools-shell/src/app/ReactNativeWeb/index.js
-1
@@ -9,7 +9,6 @@
9
10
import * as React from 'react';
11
import {Fragment, useState} from 'react';
12
-// $FlowFixMe
12
import {Button, Text, View} from 'react-native-web';
13
14
export default function ReactNativeWeb(): React.Node {
packages/react-devtools-shell/src/app/devtools.js
+1
-1
@@ -11,7 +11,7 @@ import {initDevTools} from 'react-devtools-shared/src/devtools';
11
12
// This is a pretty gross hack to make the runtime loaded named-hooks-code work.
13
// TODO (Webpack 5) Hoepfully we can remove this once we upgrade to Webpack 5.
14
-// $FlowFixMe
14
+// $FlowFixMe[cannot-resolve-name]
15
__webpack_public_path__ = '/dist/'; // eslint-disable-line no-undef
16
17
const iframe = ((document.getElementById('target'): any): HTMLIFrameElement);
packages/react-devtools-shell/src/e2e-regression/devtools.js
-2
@@ -9,7 +9,6 @@ import {initialize as createDevTools} from 'react-devtools-inline/frontend';
9
10
// This is a pretty gross hack to make the runtime loaded named-hooks-code work.
11
// TODO (Webpack 5) Hoepfully we can remove this once we upgrade to Webpack 5.
12
-// $FlowFixMe
12
__webpack_public_path__ = '/dist/'; // eslint-disable-line no-undef
13
14
// TODO (Webpack 5) Hopefully we can remove this prop after the Webpack 5 migration.
@@ -33,7 +32,6 @@ function init(appIframe, devtoolsContainer, appSource) {
32
const DevTools = createDevTools(contentWindow);
33
34
inject(contentDocument, appSource, () => {
36
- // $FlowFixMe Flow doesn't know about createRoot() yet.
35
createRoot(devtoolsContainer).render(
36
<DevTools
37
hookNamesModuleLoaderFunction={hookNamesModuleLoaderFunction}
packages/react-devtools-shell/src/e2e/devtools.js
-2
@@ -18,7 +18,6 @@ import {initialize as createDevTools} from 'react-devtools-inline/frontend';
18
19
// This is a pretty gross hack to make the runtime loaded named-hooks-code work.
20
// TODO (Webpack 5) Hoepfully we can remove this once we upgrade to Webpack 5.
21
-// $FlowFixMe
21
__webpack_public_path__ = '/dist/'; // eslint-disable-line no-undef
22
23
// TODO (Webpack 5) Hopefully we can remove this prop after the Webpack 5 migration.
@@ -42,7 +41,6 @@ function init(appIframe, devtoolsContainer, appSource) {
41
const DevTools = createDevTools(contentWindow);
42
43
inject(contentDocument, appSource, () => {
45
- // $FlowFixMe Flow doesn't know about createRoot() yet.
44
createRoot(devtoolsContainer).render(
45
<DevTools
46
hookNamesModuleLoaderFunction={hookNamesModuleLoaderFunction}
packages/react-devtools-shell/src/perf-regression/devtools.js
-1
@@ -8,7 +8,6 @@ import {initialize as createDevTools} from 'react-devtools-inline/frontend';
8
9
// This is a pretty gross hack to make the runtime loaded named-hooks-code work.
10
// TODO (Webpack 5) Hoepfully we can remove this once we upgrade to Webpack 5.
11
-// $FlowFixMe
11
__webpack_public_path__ = '/dist/'; // eslint-disable-line no-undef
12
13
// TODO (Webpack 5) Hopefully we can remove this prop after the Webpack 5 migration.
packages/react-devtools-timeline/src/content-views/NativeEventsView.js
+1
-1
@@ -65,7 +65,7 @@ export class NativeEventsView extends View {
65
if (!this._depthToNativeEvent.has(depth)) {
66
this._depthToNativeEvent.set(depth, [event]);
67
} else {
68
- // $FlowFixMe This is unnecessary.
68
+ // $FlowFixMe[incompatible-use] This is unnecessary.
69
this._depthToNativeEvent.get(depth).push(event);
70
}
71
});
packages/react-devtools-timeline/src/content-views/NetworkMeasuresView.js
+1
-1
@@ -68,7 +68,7 @@ export class NetworkMeasuresView extends View {
68
if (!this._depthToNetworkMeasure.has(depth)) {
69
this._depthToNetworkMeasure.set(depth, [event]);
70
} else {
71
- // $FlowFixMe This is unnecessary.
71
+ // $FlowFixMe[incompatible-use] This is unnecessary.
72
this._depthToNetworkMeasure.get(depth).push(event);
73
}
74
});
packages/react-devtools-timeline/src/content-views/SnapshotsView.js
+1
-1
@@ -166,7 +166,7 @@ export class SnapshotsView extends View {
166
imageRect.size.height,
167
);
168
169
- // $FlowFixMe Flow doesn't know about the 9 argument variant of drawImage()
169
+ // $FlowFixMe[incompatible-call] Flow doesn't know about the 9 argument variant of drawImage()
170
context.drawImage(
171
snapshot.image,
172
packages/react-devtools-timeline/src/content-views/SuspenseEventsView.js
+1
-1
@@ -72,7 +72,7 @@ export class SuspenseEventsView extends View {
72
if (!this._depthToSuspenseEvent.has(depth)) {
73
this._depthToSuspenseEvent.set(depth, [event]);
74
} else {
75
- // $FlowFixMe This is unnecessary.
75
+ // $FlowFixMe[incompatible-use] This is unnecessary.
76
this._depthToSuspenseEvent.get(depth).push(event);
77
}
78
});
packages/react-devtools-timeline/src/import-worker/preprocessData.js
+2
-2
@@ -207,7 +207,7 @@ function markWorkCompleted(
207
console.error('Could not find matching measure for type "%s".', type);
208
}
209
210
- // $FlowFixMe This property should not be writable outside of this function.
210
+ // $FlowFixMe[cannot-write] This property should not be writable outside of this function.
211
measure.duration = stopTime - startTime;
212
}
213
@@ -370,7 +370,7 @@ function processScreenshot(
370
fetch(snapshot.imageSource)
371
.then(response => response.blob())
372
.then(blob => {
373
- // $FlowFixMe createImageBitmap
373
+ // $FlowFixMe[cannot-resolve-name] createImageBitmap
374
createImageBitmap(blob).then(bitmap => {
375
snapshot.height = bitmap.height;
376
snapshot.width = bitmap.width;
packages/react-dom-bindings/src/client/DOMPropertyOperations.js
+1
-1
@@ -480,7 +480,7 @@ export function setValueForPropertyOnCustomComponent(
480
node.removeAttribute(name);
481
}
482
}
483
- // $FlowFixMe value can't be casted to EventListener.
483
+ // $FlowFixMe[incompatible-cast] value can't be casted to EventListener.
484
node.addEventListener(eventName, (value: EventListener), useCapture);
485
return;
486
}
packages/react-dom-bindings/src/client/ReactDOMComponent.js
-11
@@ -1182,7 +1182,6 @@ function diffHydratedCustomComponent(
1182
}
1183
continue;
1184
case 'style':
1185
- // $FlowFixMe - Should be inferred as not undefined.
1185
extraAttributeNames.delete(propKey);
1186
diffHydratedStyles(domElement, nextProp);
1187
continue;
@@ -1195,7 +1194,6 @@ function diffHydratedCustomComponent(
1194
case 'outerText':
1195
case 'outerHTML':
1196
if (enableCustomElementPropertySupport) {
1198
- // $FlowFixMe - Should be inferred as not undefined.
1197
extraAttributeNames.delete(propKey.toLowerCase());
1198
if (__DEV__) {
1199
console.error(
@@ -1212,10 +1210,8 @@ function diffHydratedCustomComponent(
1210
ownNamespaceDev = getIntrinsicNamespace(tag);
1211
}
1212
if (ownNamespaceDev === HTML_NAMESPACE) {
1215
- // $FlowFixMe - Should be inferred as not undefined.
1213
extraAttributeNames.delete(propKey.toLowerCase());
1214
} else {
1218
- // $FlowFixMe - Should be inferred as not undefined.
1215
extraAttributeNames.delete(propKey);
1216
}
1217
const serverValue = getValueForAttributeOnCustomComponent(
@@ -1280,7 +1276,6 @@ function diffHydratedGenericElement(
1276
}
1277
continue;
1278
case 'style':
1283
- // $FlowFixMe - Should be inferred as not undefined.
1279
extraAttributeNames.delete(propKey);
1280
diffHydratedStyles(domElement, nextProp);
1281
continue;
@@ -1299,7 +1294,6 @@ function diffHydratedGenericElement(
1294
let isMismatchDueToBadCasing = false;
1295
let serverValue;
1296
if (propertyInfo !== null) {
1302
- // $FlowFixMe - Should be inferred as not undefined.
1297
extraAttributeNames.delete(propertyInfo.attributeName);
1298
serverValue = getValueForProperty(
1299
domElement,
@@ -1313,7 +1307,6 @@ function diffHydratedGenericElement(
1307
ownNamespaceDev = getIntrinsicNamespace(tag);
1308
}
1309
if (ownNamespaceDev === HTML_NAMESPACE) {
1316
- // $FlowFixMe - Should be inferred as not undefined.
1310
extraAttributeNames.delete(propKey.toLowerCase());
1311
} else {
1312
const standardName = getPossibleStandardName(propKey);
@@ -1324,10 +1317,8 @@ function diffHydratedGenericElement(
1317
// However, we already warn about bad casing elsewhere.
1318
// So we'll skip the misleading extra mismatch warning in this case.
1319
isMismatchDueToBadCasing = true;
1327
- // $FlowFixMe - Should be inferred as not undefined.
1320
extraAttributeNames.delete(standardName);
1321
}
1330
- // $FlowFixMe - Should be inferred as not undefined.
1322
extraAttributeNames.delete(propKey);
1323
}
1324
serverValue = getValueForAttribute(domElement, propKey, nextProp);
@@ -1484,11 +1475,9 @@ export function diffHydratedProperties(
1475
);
1476
}
1477
if (
1487
- // $FlowFixMe - Should be inferred as not undefined.
1478
extraAttributeNames.size > 0 &&
1479
rawProps.suppressHydrationWarning !== true
1480
) {
1491
- // $FlowFixMe - Should be inferred as not undefined.
1481
warnForExtraAttributes(extraAttributeNames);
1482
}
1483
}
packages/react-dom-bindings/src/client/ReactDOMHostConfig.js
+4
-4
@@ -641,7 +641,7 @@ function dispatchBeforeDetachedBlur(
641
// Dispatch "beforeblur" directly on the target,
642
// so it gets picked up by the event system and
643
// can propagate through the React internal tree.
644
- // $FlowFixMe: internal field
644
+ // $FlowFixMe[prop-missing]: internal field
645
event._detachedInterceptFiber = internalInstanceHandle;
646
target.dispatchEvent(event);
647
}
@@ -1324,7 +1324,7 @@ export function didNotHydrateInstanceWithinSuspenseInstance(
1324
instance: HydratableInstance,
1325
) {
1326
if (__DEV__) {
1327
- // $FlowFixMe: Only Element or Document can be parent nodes.
1327
+ // $FlowFixMe[incompatible-type]: Only Element or Document can be parent nodes.
1328
const parentNode: Element | Document | null = parentInstance.parentNode;
1329
if (parentNode !== null) {
1330
if (instance.nodeType === ELEMENT_NODE) {
@@ -1391,7 +1391,7 @@ export function didNotFindHydratableInstanceWithinSuspenseInstance(
1391
props: Props,
1392
) {
1393
if (__DEV__) {
1394
- // $FlowFixMe: Only Element or Document can be parent nodes.
1394
+ // $FlowFixMe[incompatible-type]: Only Element or Document can be parent nodes.
1395
const parentNode: Element | Document | null = parentInstance.parentNode;
1396
if (parentNode !== null)
1397
warnForInsertedHydratedElement(parentNode, type, props);
@@ -1403,7 +1403,7 @@ export function didNotFindHydratableTextInstanceWithinSuspenseInstance(
1403
text: string,
1404
) {
1405
if (__DEV__) {
1406
- // $FlowFixMe: Only Element or Document can be parent nodes.
1406
+ // $FlowFixMe[incompatible-type]: Only Element or Document can be parent nodes.
1407
const parentNode: Element | Document | null = parentInstance.parentNode;
1408
if (parentNode !== null) warnForInsertedHydratedText(parentNode, text);
1409
}
packages/react-dom-bindings/src/events/SyntheticEvent.js
+12
-12
@@ -94,7 +94,7 @@ function createSyntheticEvent(Interface: EventInterfaceType) {
94
95
if (event.preventDefault) {
96
event.preventDefault();
97
- // $FlowFixMe - flow is not aware of `unknown` in IE
97
+ // $FlowFixMe[illegal-typeof] - flow is not aware of `unknown` in IE
98
} else if (typeof event.returnValue !== 'unknown') {
99
event.returnValue = false;
100
}
@@ -110,7 +110,7 @@ function createSyntheticEvent(Interface: EventInterfaceType) {
110
111
if (event.stopPropagation) {
112
event.stopPropagation();
113
- // $FlowFixMe - flow is not aware of `unknown` in IE
113
+ // $FlowFixMe[illegal-typeof] - flow is not aware of `unknown` in IE
114
} else if (typeof event.cancelBubble !== 'unknown') {
115
// The ChangeEventPlugin registers a "propertychange" event for
116
// IE. This event does not support bubbling or cancelling, and
@@ -173,9 +173,9 @@ let lastMouseEvent;
173
function updateMouseMovementPolyfillState(event: {[propName: string]: mixed}) {
174
if (event !== lastMouseEvent) {
175
if (lastMouseEvent && event.type === 'mousemove') {
176
- // $FlowFixMe assuming this is a number
176
+ // $FlowFixMe[unsafe-arithmetic] assuming this is a number
177
lastMovementX = event.screenX - lastMouseEvent.screenX;
178
- // $FlowFixMe assuming this is a number
178
+ // $FlowFixMe[unsafe-arithmetic] assuming this is a number
179
lastMovementY = event.screenY - lastMouseEvent.screenY;
180
} else {
181
lastMovementX = 0;
@@ -380,7 +380,7 @@ function getEventKey(nativeEvent: {[propName: string]: mixed}) {
380
// FireFox implements `key` but returns `MozPrintableKey` for all
381
// printable characters (normalized to `Unidentified`), ignore it.
382
const key =
383
- // $FlowFixMe unable to index with a `mixed` value
383
+ // $FlowFixMe[invalid-computed-prop] unable to index with a `mixed` value
384
normalizeKey[nativeEvent.key] || nativeEvent.key;
385
if (key !== 'Unidentified') {
386
return key;
@@ -390,7 +390,7 @@ function getEventKey(nativeEvent: {[propName: string]: mixed}) {
390
// Browser does not implement `key`, polyfill as much of it as we can.
391
if (nativeEvent.type === 'keypress') {
392
const charCode = getEventCharCode(
393
- // $FlowFixMe unable to narrow to `KeyboardEvent`
393
+ // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
394
nativeEvent,
395
);
396
@@ -401,7 +401,7 @@ function getEventKey(nativeEvent: {[propName: string]: mixed}) {
401
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
402
// While user keyboard layout determines the actual meaning of each
403
// `keyCode` value, almost all function keys have a universal value.
404
- // $FlowFixMe unable to index with a `mixed` value
404
+ // $FlowFixMe[invalid-computed-prop] unable to index with a `mixed` value
405
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
406
}
407
return '';
@@ -462,7 +462,7 @@ const KeyboardEventInterface = {
462
// implemented in any major browser. Only KeyPress has charCode.
463
if (event.type === 'keypress') {
464
return getEventCharCode(
465
- // $FlowFixMe unable to narrow to `KeyboardEvent`
465
+ // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
466
event,
467
);
468
}
@@ -486,7 +486,7 @@ const KeyboardEventInterface = {
486
// type of the event.
487
if (event.type === 'keypress') {
488
return getEventCharCode(
489
- // $FlowFixMe unable to narrow to `KeyboardEvent`
489
+ // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
490
event,
491
);
492
}
@@ -565,7 +565,7 @@ const WheelEventInterface = {
565
? event.deltaX
566
: // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
567
'wheelDeltaX' in event
568
- ? // $FlowFixMe assuming this is a number
568
+ ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
569
-event.wheelDeltaX
570
: 0;
571
},
@@ -574,11 +574,11 @@ const WheelEventInterface = {
574
? event.deltaY
575
: // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
576
'wheelDeltaY' in event
577
- ? // $FlowFixMe assuming this is a number
577
+ ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
578
-event.wheelDeltaY
579
: // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
580
'wheelDelta' in event
581
- ? // $FlowFixMe assuming this is a number
581
+ ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
582
-event.wheelDelta
583
: 0;
584
},
packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js
+1
-1
@@ -61,6 +61,6 @@ export function clonePrecomputedChunk(
61
}
62
63
export function closeWithError(destination: Destination, error: mixed): void {
64
- // $FlowFixMe: This is an Error object or the destination accepts other types.
64
+ // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
65
destination.destroy(error);
66
}
packages/react-dom/src/client/ReactDOM.js
+3
-3
@@ -65,11 +65,11 @@ export {
65
if (__DEV__) {
66
if (
67
typeof Map !== 'function' ||
68
- // $FlowFixMe Flow incorrectly thinks Map has no prototype
68
+ // $FlowFixMe[prop-missing] Flow incorrectly thinks Map has no prototype
69
Map.prototype == null ||
70
typeof Map.prototype.forEach !== 'function' ||
71
typeof Set !== 'function' ||
72
- // $FlowFixMe Flow incorrectly thinks Set has no prototype
72
+ // $FlowFixMe[prop-missing] Flow incorrectly thinks Set has no prototype
73
Set.prototype == null ||
74
typeof Set.prototype.clear !== 'function' ||
75
typeof Set.prototype.forEach !== 'function'
@@ -91,7 +91,7 @@ function createPortal(
91
}
92
93
// TODO: pass ReactDOM portal implementation as third argument
94
- // $FlowFixMe The Flow type is opaque but there's no way to actually create it.
94
+ // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it.
95
return createPortalImpl(children, container, null, key);
96
}
97
packages/react-dom/src/client/ReactDOMLegacy.js
+1
-1
@@ -420,7 +420,7 @@ export function unmountComponentAtNode(container: Container): boolean {
420
// Unmount should not be batched.
421
flushSync(() => {
422
legacyRenderSubtreeIntoContainer(null, null, container, false, () => {
423
- // $FlowFixMe This should probably use `delete container._reactRootContainer`
423
+ // $FlowFixMe[incompatible-type] This should probably use `delete container._reactRootContainer`
424
container._reactRootContainer = null;
425
unmarkContainerAsRoot(container);
426
});
packages/react-dom/src/server/ReactDOMFizzServerBrowser.js
+1
-1
@@ -65,7 +65,7 @@ function renderToReadableStream(
65
abort(request);
66
},
67
},
68
- // $FlowFixMe size() methods are not allowed on byte streams.
68
+ // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
69
{highWaterMark: 0},
70
): any);
71
// TODO: Move to sub-classing ReadableStream.
packages/react-dom/src/server/ReactDOMFizzServerBun.js
+1
-1
@@ -66,7 +66,7 @@ function renderToReadableStream(
66
abort(request);
67
},
68
},
69
- // $FlowFixMe size() methods are not allowed on byte streams.
69
+ // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
70
{highWaterMark: 2048},
71
): any);
72
// TODO: Move to sub-classing ReadableStream.
packages/react-dom/src/server/ReactDOMFizzServerEdge.js
+1
-1
@@ -65,7 +65,7 @@ function renderToReadableStream(
65
abort(request);
66
},
67
},
68
- // $FlowFixMe size() methods are not allowed on byte streams.
68
+ // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
69
{highWaterMark: 0},
70
): any);
71
// TODO: Move to sub-classing ReadableStream.
packages/react-dom/src/server/ReactDOMFizzStaticBrowser.js
+1
-1
@@ -55,7 +55,7 @@ function prerender(
55
startFlowing(request, controller);
56
},
57
},
58
- // $FlowFixMe size() methods are not allowed on byte streams.
58
+ // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
59
{highWaterMark: 0},
60
);
61
packages/react-dom/src/server/ReactDOMFizzStaticEdge.js
+1
-1
@@ -55,7 +55,7 @@ function prerender(
55
startFlowing(request, controller);
56
},
57
},
58
- // $FlowFixMe size() methods are not allowed on byte streams.
58
+ // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
59
{highWaterMark: 0},
60
);
61
packages/react-dom/src/server/ReactDOMLegacyServerNodeStream.js
-1
@@ -43,7 +43,6 @@ class ReactMarkupReadableStream extends Readable {
43
// $FlowFixMe[missing-local-annot]
44
_destroy(err, callback) {
45
abort(this.request);
46
- // $FlowFixMe: The type definition for the callback should allow undefined and null.
46
callback(err);
47
}
48
packages/react-interactions/events/src/dom/create-event-handle/Focus.js
+4
-4
@@ -288,7 +288,7 @@ export function useFocusWithin<T>(
288
// Handle focus visible
289
setFocusVisibleListeners(
290
focusVisibleHandles,
291
- // $FlowFixMe focusWithinTarget is not null here
291
+ // $FlowFixMe[incompatible-call] focusWithinTarget is not null here
292
focusWithinTarget,
293
isFocusVisible => {
294
if (state.isFocused && state.isFocusVisible !== isFocusVisible) {
@@ -301,7 +301,7 @@ export function useFocusWithin<T>(
301
);
302
303
// Handle focus
304
- // $FlowFixMe focusWithinTarget is not null here
304
+ // $FlowFixMe[incompatible-call] focusWithinTarget is not null here
305
focusHandle.setListener(focusWithinTarget, (event: FocusEvent) => {
306
if (disabled) {
307
return;
@@ -328,7 +328,7 @@ export function useFocusWithin<T>(
328
});
329
330
// Handle blur
331
- // $FlowFixMe focusWithinTarget is not null here
331
+ // $FlowFixMe[incompatible-call] focusWithinTarget is not null here
332
blurHandle.setListener(focusWithinTarget, (event: FocusEvent) => {
333
if (disabled) {
334
return;
@@ -354,7 +354,7 @@ export function useFocusWithin<T>(
354
355
// Handle before blur. This is a special
356
// React provided event.
357
- // $FlowFixMe focusWithinTarget is not null here
357
+ // $FlowFixMe[incompatible-call] focusWithinTarget is not null here
358
beforeBlurHandle.setListener(focusWithinTarget, (event: FocusEvent) => {
359
if (disabled) {
360
return;
packages/react-native-renderer/src/ReactFabric.js
-1
@@ -74,7 +74,6 @@ function render(
74
}
75
updateContainer(element, root, null, callback);
76
77
- // $FlowFixMe Flow has hardcoded values for React DOM that don't work with RN
77
return getPublicRootInstance(root);
78
}
79
packages/react-native-renderer/src/ReactNativeAttributePayload.js
-3
@@ -186,9 +186,7 @@ function diffNestedProperty(
186
if (isArray(prevProp)) {
187
return diffProperties(
188
updatePayload,
189
- // $FlowFixMe - We know that this is always an object when the input is.
189
flattenStyle(prevProp),
191
- // $FlowFixMe - We know that this isn't an array because of above flow.
190
nextProp,
191
validAttributes,
192
);
@@ -197,7 +195,6 @@ function diffNestedProperty(
195
return diffProperties(
196
updatePayload,
197
prevProp,
200
- // $FlowFixMe - We know that this is always an object when the input is.
198
flattenStyle(nextProp),
199
validAttributes,
200
);
packages/react-native-renderer/src/ReactNativeBridgeEventPlugin.js
+1
-1
@@ -183,7 +183,7 @@ const ReactNativeBridgeEventPlugin = {
183
184
if (!bubbleDispatchConfig && !directDispatchConfig) {
185
throw new Error(
186
- // $FlowFixMe - Flow doesn't like this string coercion because DOMTopLevelEventType is opaque
186
+ // $FlowFixMe[incompatible-type] - Flow doesn't like this string coercion because DOMTopLevelEventType is opaque
187
`Unsupported top level event type "${topLevelType}" dispatched`,
188
);
189
}
packages/react-native-renderer/src/ReactNativeEventEmitter.js
+1
-1
@@ -235,7 +235,7 @@ export function receiveTouches(
235
rootNodeID = target;
236
}
237
}
238
- // $FlowFixMe Shouldn't we *not* call it if rootNodeID is null?
238
+ // $FlowFixMe[incompatible-call] Shouldn't we *not* call it if rootNodeID is null?
239
_receiveRootNodeIDEvent(rootNodeID, eventTopLevelType, nativeEvent);
240
}
241
}
packages/react-native-renderer/src/ReactNativeRenderer.js
-1
@@ -77,7 +77,6 @@ function render(
77
}
78
updateContainer(element, root, null, callback);
79
80
- // $FlowFixMe Flow has hardcoded values for React DOM that don't work with RN
80
return getPublicRootInstance(root);
81
}
82
packages/react-native-renderer/src/legacy-events/accumulateInto.js
+3
-2
@@ -40,11 +40,12 @@ function accumulateInto<T>(
40
// certain that x is an Array (x could be a string with concat method).
41
if (isArray(current)) {
42
if (isArray(next)) {
43
- // $FlowFixMe `isArray` does not ensure array is mutable
43
+ // $FlowFixMe[prop-missing] `isArray` does not ensure array is mutable
44
+ // $FlowFixMe[method-unbinding]
45
current.push.apply(current, next);
46
return current;
47
}
47
- // $FlowFixMe `isArray` does not ensure array is mutable
48
+ // $FlowFixMe[prop-missing] `isArray` does not ensure array is mutable
49
current.push(next);
50
return current;
51
}
packages/react-noop-renderer/src/createReactNoop.js
-3
@@ -830,7 +830,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
830
if (child.length === 1) {
831
return childToJSX(child[0], null);
832
}
833
- // $FlowFixMe
833
const children = child.map(c => childToJSX(c, null));
834
if (children.every(c => typeof c === 'string' || typeof c === 'number')) {
835
return children.join('');
@@ -1269,9 +1268,7 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
1268
if (typeof child.text === 'string') {
1269
log(indent + '- ' + child.text);
1270
} else {
1272
- // $FlowFixMe - The child should've been refined now.
1271
log(indent + '- ' + child.type + '#' + child.id);
1274
- // $FlowFixMe - The child should've been refined now.
1272
logHostInstances(child.children, depth + 1);
1273
}
1274
}
packages/react-reconciler/src/DebugTracing.js
+1
-1
@@ -84,7 +84,7 @@ export function logCommitStopped(): void {
84
}
85
86
const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
87
-// $FlowFixMe: Flow cannot handle polymorphic WeakMaps
87
+// $FlowFixMe[incompatible-type]: Flow cannot handle polymorphic WeakMaps
88
const wakeableIDs: WeakMap<Wakeable, number> = new PossiblyWeakMap();
89
let wakeableID: number = 0;
90
function getWakeableID(wakeable: Wakeable): number {
packages/react-reconciler/src/ReactChildFiber.js
+2
-2
@@ -86,7 +86,7 @@ if (__DEV__) {
86
);
87
}
88
89
- // $FlowFixMe unable to narrow type from mixed to writable object
89
+ // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object
90
child._store.validated = true;
91
92
const componentName = getComponentNameFromFiber(returnFiber) || 'Component';
@@ -1022,7 +1022,7 @@ function createChildReconciler(
1022
// See https://github.com/facebook/react/issues/12995
1023
if (
1024
typeof Symbol === 'function' &&
1025
- // $FlowFixMe Flow doesn't know about toStringTag
1025
+ // $FlowFixMe[prop-missing] Flow doesn't know about toStringTag
1026
newChildrenIterable[Symbol.toStringTag] === 'Generator'
1027
) {
1028
if (!didWarnAboutGenerators) {
packages/react-reconciler/src/ReactFiber.js
+1
-1
@@ -230,7 +230,7 @@ function createFiber(
230
key: null | string,
231
mode: TypeOfMode,
232
): Fiber {
233
- // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
233
+ // $FlowFixMe[invalid-constructor]: the shapes are exact here but Flow doesn't like constructors
234
return new FiberNode(tag, pendingProps, key, mode);
235
}
236
packages/react-reconciler/src/ReactFiberAct.js
+1
-1
@@ -29,7 +29,7 @@ export function isLegacyActEnvironment(fiber: Fiber): boolean {
29
IS_REACT_ACT_ENVIRONMENT
30
: undefined;
31
32
- // $FlowFixMe - Flow doesn't know about jest
32
+ // $FlowFixMe[cannot-resolve-name] - Flow doesn't know about jest
33
const jestIsDefined = typeof jest !== 'undefined';
34
return (
35
warnsIfNotActing && jestIsDefined && isReactActEnvironmentGlobal !== false
packages/react-reconciler/src/ReactFiberCommitWork.js
+2
-2
@@ -347,7 +347,7 @@ function safelyDetachRef(current: Fiber, nearestMountedAncestor: Fiber | null) {
347
}
348
}
349
} else {
350
- // $FlowFixMe unable to narrow type to RefObject
350
+ // $FlowFixMe[incompatible-use] unable to narrow type to RefObject
351
ref.current = null;
352
}
353
}
@@ -1633,7 +1633,7 @@ function commitAttachRef(finishedWork: Fiber) {
1633
}
1634
}
1635
1636
- // $FlowFixMe unable to narrow type to the non-function case
1636
+ // $FlowFixMe[incompatible-use] unable to narrow type to the non-function case
1637
ref.current = instanceToUse;
1638
}
1639
}
packages/react-reconciler/src/ReactFiberCompleteWork.js
+3
-3
@@ -910,7 +910,7 @@ function completeDehydratedSuspenseBoundary(
910
// Don't count time spent in a timed out Suspense subtree as part of the base duration.
911
const primaryChildFragment = workInProgress.child;
912
if (primaryChildFragment !== null) {
913
- // $FlowFixMe Flow doesn't support type casting in combination with the -= operator
913
+ // $FlowFixMe[unsafe-arithmetic] Flow doesn't support type casting in combination with the -= operator
914
workInProgress.treeBaseDuration -=
915
((primaryChildFragment.treeBaseDuration: any): number);
916
}
@@ -940,7 +940,7 @@ function completeDehydratedSuspenseBoundary(
940
// Don't count time spent in a timed out Suspense subtree as part of the base duration.
941
const primaryChildFragment = workInProgress.child;
942
if (primaryChildFragment !== null) {
943
- // $FlowFixMe Flow doesn't support type casting in combination with the -= operator
943
+ // $FlowFixMe[unsafe-arithmetic] Flow doesn't support type casting in combination with the -= operator
944
workInProgress.treeBaseDuration -=
945
((primaryChildFragment.treeBaseDuration: any): number);
946
}
@@ -1484,7 +1484,7 @@ function completeWork(
1484
// Don't count time spent in a timed out Suspense subtree as part of the base duration.
1485
const primaryChildFragment = workInProgress.child;
1486
if (primaryChildFragment !== null) {
1487
- // $FlowFixMe Flow doesn't support type casting in combination with the -= operator
1487
+ // $FlowFixMe[unsafe-arithmetic] Flow doesn't support type casting in combination with the -= operator
1488
workInProgress.treeBaseDuration -=
1489
((primaryChildFragment.treeBaseDuration: any): number);
1490
}
packages/react-reconciler/src/ReactFiberHooks.js
+2
-2
@@ -1036,7 +1036,7 @@ function useMemoCache(size: number): Array<any> {
1036
}
1037
1038
function basicStateReducer<S>(state: S, action: BasicStateAction<S>): S {
1039
- // $FlowFixMe: Flow doesn't like mixed types
1039
+ // $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
1040
return typeof action === 'function' ? action(state) : action;
1041
}
1042
@@ -1828,7 +1828,7 @@ function mountState<S>(
1828
): [S, Dispatch<BasicStateAction<S>>] {
1829
const hook = mountWorkInProgressHook();
1830
if (typeof initialState === 'function') {
1831
- // $FlowFixMe: Flow doesn't like mixed types
1831
+ // $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
1832
initialState = initialState();
1833
}
1834
hook.memoizedState = hook.baseState = initialState;
packages/react-reconciler/src/ReactFiberReconciler.js
+5
-5
@@ -563,7 +563,7 @@ if (__DEV__) {
563
}
564
return updated;
565
}
566
- // $FlowFixMe number or string is fine here
566
+ // $FlowFixMe[incompatible-use] number or string is fine here
567
updated[key] = copyWithDeleteImpl(obj[key], path, index + 1);
568
return updated;
569
};
@@ -585,7 +585,7 @@ if (__DEV__) {
585
const updated = isArray(obj) ? obj.slice() : {...obj};
586
if (index + 1 === oldPath.length) {
587
const newKey = newPath[index];
588
- // $FlowFixMe number or string is fine here
588
+ // $FlowFixMe[incompatible-use] number or string is fine here
589
updated[newKey] = updated[oldKey];
590
if (isArray(updated)) {
591
updated.splice(((oldKey: any): number), 1);
@@ -593,9 +593,9 @@ if (__DEV__) {
593
delete updated[oldKey];
594
}
595
} else {
596
- // $FlowFixMe number or string is fine here
596
+ // $FlowFixMe[incompatible-use] number or string is fine here
597
updated[oldKey] = copyWithRenameImpl(
598
- // $FlowFixMe number or string is fine here
598
+ // $FlowFixMe[incompatible-use] number or string is fine here
599
obj[oldKey],
600
oldPath,
601
newPath,
@@ -637,7 +637,7 @@ if (__DEV__) {
637
}
638
const key = path[index];
639
const updated = isArray(obj) ? obj.slice() : {...obj};
640
- // $FlowFixMe number or string is fine here
640
+ // $FlowFixMe[incompatible-use] number or string is fine here
641
updated[key] = copyWithSetImpl(obj[key], path, index + 1, value);
642
return updated;
643
};
packages/react-reconciler/src/ReactFiberWorkLoop.js
+1
-1
@@ -1797,7 +1797,7 @@ function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber {
1797
// The root previous suspended and scheduled a timeout to commit a fallback
1798
// state. Now that we have additional work, cancel the timeout.
1799
root.timeoutHandle = noTimeout;
1800
- // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
1800
+ // $FlowFixMe[incompatible-call] Complains noTimeout is not a TimeoutID, despite the check above
1801
cancelTimeout(timeoutHandle);
1802
}
1803
const cancelPendingCommit = root.cancelPendingCommit;
packages/react-server-dom-relay/src/ReactFlightDOMRelayClient.js
+12
-6
@@ -25,25 +25,31 @@ export {createResponse, close, getRoot};
25
26
export function resolveRow(response: Response, chunk: RowEncoding): void {
27
if (chunk[0] === 'O') {
28
- // $FlowFixMe unable to refine on array indices
28
+ // $FlowFixMe[incompatible-call] unable to refine on array indices
29
resolveModel(response, chunk[1], chunk[2]);
30
} else if (chunk[0] === 'I') {
31
- // $FlowFixMe unable to refine on array indices
31
+ // $FlowFixMe[incompatible-call] unable to refine on array indices
32
resolveModule(response, chunk[1], chunk[2]);
33
} else {
34
if (__DEV__) {
35
resolveErrorDev(
36
response,
37
chunk[1],
38
- // $FlowFixMe: Flow doesn't support disjoint unions on tuples.
38
+ // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
39
+ // $FlowFixMe[prop-missing]
40
+ // $FlowFixMe[incompatible-use]
41
chunk[2].digest,
40
- // $FlowFixMe: Flow doesn't support disjoint unions on tuples.
42
+ // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
43
+ // $FlowFixMe[incompatible-use]
44
chunk[2].message || '',
42
- // $FlowFixMe: Flow doesn't support disjoint unions on tuples.
45
+ // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
46
+ // $FlowFixMe[incompatible-use]
47
chunk[2].stack || '',
48
);
49
} else {
46
- // $FlowFixMe: Flow doesn't support disjoint unions on tuples.
50
+ // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
51
+ // $FlowFixMe[prop-missing]
52
+ // $FlowFixMe[incompatible-use]
53
resolveErrorProd(response, chunk[1], chunk[2].digest);
54
}
55
}
packages/react-server-dom-relay/src/ReactFlightDOMRelayServerHostConfig.js
+2
-5
@@ -148,8 +148,6 @@ function convertModelToJSON(
148
}
149
return jsonArray;
150
} else {
151
- /* $FlowFixMe the old version of Flow doesn't have a good way to define
152
- * an empty exact object. */
151
const jsonObj: {[key: string]: JSONValue} = {};
152
for (const nextKey in json) {
153
if (hasOwnProperty.call(json, nextKey)) {
@@ -172,7 +170,6 @@ export function processModelChunk(
170
id: number,
171
model: ReactClientValue,
172
): Chunk {
175
- // $FlowFixMe no good way to define an empty exact object
173
const json = convertModelToJSON(request, {}, '', model);
174
return ['O', id, json];
175
}
@@ -207,7 +204,7 @@ export const requestStorage: AsyncLocalStorage<Map<Function, mixed>> =
204
export function beginWriting(destination: Destination) {}
205
206
export function writeChunk(destination: Destination, chunk: Chunk): void {
210
- // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
207
+ // $FlowFixMe[incompatible-call] `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
208
emitRow(destination, chunk);
209
}
210
@@ -215,7 +212,7 @@ export function writeChunkAndReturn(
212
destination: Destination,
213
chunk: Chunk,
214
): boolean {
218
- // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
215
+ // $FlowFixMe[incompatible-call] `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
216
emitRow(destination, chunk);
217
return true;
218
}
packages/react-server-dom-webpack/src/ReactFlightDOMServerBrowser.js
+1
-1
@@ -69,7 +69,7 @@ function renderToReadableStream(
69
},
70
cancel: (reason): ?Promise<void> => {},
71
},
72
- // $FlowFixMe size() methods are not allowed on byte streams.
72
+ // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
73
{highWaterMark: 0},
74
);
75
return stream;
packages/react-server-dom-webpack/src/ReactFlightDOMServerEdge.js
+1
-1
@@ -69,7 +69,7 @@ function renderToReadableStream(
69
},
70
cancel: (reason): ?Promise<void> => {},
71
},
72
- // $FlowFixMe size() methods are not allowed on byte streams.
72
+ // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
73
{highWaterMark: 0},
74
);
75
return stream;
packages/react-server-native-relay/src/ReactFlightNativeRelayClient.js
+12
-6
@@ -25,25 +25,31 @@ export {createResponse, close, getRoot};
25
26
export function resolveRow(response: Response, chunk: RowEncoding): void {
27
if (chunk[0] === 'O') {
28
- // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
28
+ // $FlowFixMe[incompatible-call] `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
29
resolveModel(response, chunk[1], chunk[2]);
30
} else if (chunk[0] === 'I') {
31
- // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
31
+ // $FlowFixMe[incompatible-call] `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
32
resolveModule(response, chunk[1], chunk[2]);
33
} else {
34
if (__DEV__) {
35
resolveErrorDev(
36
response,
37
chunk[1],
38
- // $FlowFixMe: Flow doesn't support disjoint unions on tuples.
38
+ // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
39
+ // $FlowFixMe[incompatible-use]
40
+ // $FlowFixMe[prop-missing]
41
chunk[2].digest,
40
- // $FlowFixMe: Flow doesn't support disjoint unions on tuples.
42
+ // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
43
+ // $FlowFixMe[incompatible-use]
44
chunk[2].message || '',
42
- // $FlowFixMe: Flow doesn't support disjoint unions on tuples.
45
+ // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
46
+ // $FlowFixMe[incompatible-use]
47
chunk[2].stack || '',
48
);
49
} else {
46
- // $FlowFixMe: Flow doesn't support disjoint unions on tuples.
50
+ // $FlowFixMe[incompatible-call]: Flow doesn't support disjoint unions on tuples.
51
+ // $FlowFixMe[incompatible-use]
52
+ // $FlowFixMe[prop-missing]
53
resolveErrorProd(response, chunk[1], chunk[2].digest);
54
}
55
}
packages/react-server-native-relay/src/ReactFlightNativeRelayServerHostConfig.js
+2
-4
@@ -144,7 +144,6 @@ function convertModelToJSON(
144
}
145
return jsonArray;
146
} else {
147
- // $FlowFixMe no good way to define an empty exact object
147
const jsonObj: {[key: string]: JSONValue} = {};
148
for (const nextKey in json) {
149
if (hasOwnProperty.call(json, nextKey)) {
@@ -167,7 +166,6 @@ export function processModelChunk(
166
id: number,
167
model: ReactClientValue,
168
): Chunk {
170
- // $FlowFixMe no good way to define an empty exact object
169
const json = convertModelToJSON(request, {}, '', model);
170
return ['O', id, json];
171
}
@@ -202,7 +200,7 @@ export const requestStorage: AsyncLocalStorage<Map<Function, mixed>> =
200
export function beginWriting(destination: Destination) {}
201
202
export function writeChunk(destination: Destination, chunk: Chunk): void {
205
- // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
203
+ // $FlowFixMe[incompatible-call] `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
204
emitRow(destination, chunk);
205
}
206
@@ -210,7 +208,7 @@ export function writeChunkAndReturn(
208
destination: Destination,
209
chunk: Chunk,
210
): boolean {
213
- // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
211
+ // $FlowFixMe[incompatible-call] `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
212
emitRow(destination, chunk);
213
return true;
214
}
packages/react-server/src/ReactFizzHooks.js
+1
-1
@@ -291,7 +291,7 @@ function useContext<T>(context: ReactContext<T>): T {
291
}
292
293
function basicStateReducer<S>(state: S, action: BasicStateAction<S>): S {
294
- // $FlowFixMe: Flow doesn't like mixed types
294
+ // $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
295
return typeof action === 'function' ? action(state) : action;
296
}
297
packages/react-server/src/ReactFizzNewContext.js
+1
-1
@@ -163,7 +163,7 @@ export function switchContext(newSnapshot: ContextSnapshot): void {
163
const next = newSnapshot;
164
if (prev !== next) {
165
if (prev === null) {
166
- // $FlowFixMe: This has to be non-null since it's not equal to prev.
166
+ // $FlowFixMe[incompatible-call]: This has to be non-null since it's not equal to prev.
167
pushAllNext(next);
168
} else if (next === null) {
169
popAllPrevious(prev);
packages/react-server/src/ReactFizzServer.js
-1
@@ -1292,7 +1292,6 @@ function validateIterable(iterable, iteratorFn: Function): void {
1292
// See https://github.com/facebook/react/issues/12995
1293
if (
1294
typeof Symbol === 'function' &&
1295
- // $FlowFixMe Flow doesn't know about toStringTag
1295
iterable[Symbol.toStringTag] === 'Generator'
1296
) {
1297
if (!didWarnAboutGenerators) {
packages/react-server/src/ReactFlightNewContext.js
+1
-1
@@ -165,7 +165,7 @@ export function switchContext(newSnapshot: ContextSnapshot): void {
165
const next = newSnapshot;
166
if (prev !== next) {
167
if (prev === null) {
168
- // $FlowFixMe: This has to be non-null since it's not equal to prev.
168
+ // $FlowFixMe[incompatible-call]: This has to be non-null since it's not equal to prev.
169
pushAllNext(next);
170
} else if (next === null) {
171
popAllPrevious(prev);
packages/react-server/src/ReactFlightReplyServer.js
+2
-2
@@ -141,7 +141,7 @@ export function getRoot<T>(response: Response): Thenable<T> {
141
}
142
143
function createPendingChunk<T>(response: Response): PendingChunk<T> {
144
- // $FlowFixMe Flow doesn't support functions as constructors
144
+ // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
145
return new Chunk(PENDING, null, null, response);
146
}
147
@@ -192,7 +192,7 @@ function createResolvedModelChunk<T>(
192
response: Response,
193
value: string,
194
): ResolvedModelChunk<T> {
195
- // $FlowFixMe Flow doesn't support functions as constructors
195
+ // $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
196
return new Chunk(RESOLVED_MODEL, value, null, response);
197
}
198
packages/react-server/src/ReactFlightServer.js
+4
-4
@@ -666,7 +666,7 @@ export function resolveModelToJSON(
666
value: ReactClientValue,
667
): ReactJSONValue {
668
if (__DEV__) {
669
- // $FlowFixMe
669
+ // $FlowFixMe[incompatible-use]
670
const originalValue = parent[key];
671
if (typeof originalValue === 'object' && originalValue !== value) {
672
if (objectName(originalValue) !== 'Object') {
@@ -865,7 +865,7 @@ export function resolveModelToJSON(
865
}
866
}
867
868
- // $FlowFixMe
868
+ // $FlowFixMe[incompatible-return]
869
return value;
870
}
871
@@ -909,14 +909,14 @@ export function resolveModelToJSON(
909
if (existingId !== undefined) {
910
return serializeByValueID(existingId);
911
}
912
- // $FlowFixMe `description` might be undefined
912
+ // $FlowFixMe[incompatible-type] `description` might be undefined
913
const name: string = value.description;
914
915
if (Symbol.for(name) !== value) {
916
throw new Error(
917
'Only global symbols received from Symbol.for(...) can be passed to Client Components. ' +
918
`The symbol Symbol.for(${
919
- // $FlowFixMe `description` might be undefined
919
+ // $FlowFixMe[incompatible-type] `description` might be undefined
920
value.description
921
}) cannot be found among global symbols.` +
922
describeObjectForErrorMessage(parent, key),
packages/react-server/src/ReactServerStreamConfigBrowser.js
+1
-1
@@ -146,7 +146,7 @@ export function clonePrecomputedChunk(
146
export function closeWithError(destination: Destination, error: mixed): void {
147
// $FlowFixMe[method-unbinding]
148
if (typeof destination.error === 'function') {
149
- // $FlowFixMe: This is an Error object or the destination accepts other types.
149
+ // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
150
destination.error(error);
151
} else {
152
// Earlier implementations doesn't support this method. In that environment you're
packages/react-server/src/ReactServerStreamConfigBun.js
+1
-1
@@ -72,7 +72,7 @@ export function clonePrecomputedChunk(
72
73
export function closeWithError(destination: Destination, error: mixed): void {
74
if (typeof destination.error === 'function') {
75
- // $FlowFixMe: This is an Error object or the destination accepts other types.
75
+ // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
76
destination.error(error);
77
} else {
78
// Earlier implementations doesn't support this method. In that environment you're
packages/react-server/src/ReactServerStreamConfigEdge.js
+1
-1
@@ -147,7 +147,7 @@ export function clonePrecomputedChunk(
147
export function closeWithError(destination: Destination, error: mixed): void {
148
// $FlowFixMe[method-unbinding]
149
if (typeof destination.error === 'function') {
150
- // $FlowFixMe: This is an Error object or the destination accepts other types.
150
+ // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
151
destination.error(error);
152
} else {
153
// Earlier implementations doesn't support this method. In that environment you're
packages/react-server/src/ReactServerStreamConfigNode.js
+1
-1
@@ -220,6 +220,6 @@ export function clonePrecomputedChunk(
220
}
221
222
export function closeWithError(destination: Destination, error: mixed): void {
223
- // $FlowFixMe: This is an Error object or the destination accepts other types.
223
+ // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
224
destination.destroy(error);
225
}
packages/react/src/ReactCache.js
+2
-2
@@ -57,7 +57,7 @@ export function cache<A: Iterable<mixed>, T>(fn: (...A) => T): (...A) => T {
57
const dispatcher = ReactCurrentCache.current;
58
if (!dispatcher) {
59
// If there is no dispatcher, then we treat this as not being cached.
60
- // $FlowFixMe: We don't want to use rest arguments since we transpile the code.
60
+ // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code.
61
return fn.apply(null, arguments);
62
}
63
const fnMap: WeakMap<any, CacheNode<T>> = dispatcher.getCacheForType(
@@ -111,7 +111,7 @@ export function cache<A: Iterable<mixed>, T>(fn: (...A) => T): (...A) => T {
111
throw cacheNode.v;
112
}
113
try {
114
- // $FlowFixMe: We don't want to use rest arguments since we transpile the code.
114
+ // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code.
115
const result = fn.apply(null, arguments);
116
const terminatedNode: TerminatedCacheNode<T> = (cacheNode: any);
117
terminatedNode.s = TERMINATED;
packages/react/src/ReactChildren.js
+3
-3
@@ -125,7 +125,7 @@ function mapIntoArray(
125
if (__DEV__) {
126
// The `if` statement here prevents auto-disabling of the safe
127
// coercion ESLint rule, so we must manually disable it below.
128
- // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
128
+ // $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key
129
if (mappedChild.key && (!child || child.key !== mappedChild.key)) {
130
checkKeyStringCoercion(mappedChild.key);
131
}
@@ -135,7 +135,7 @@ function mapIntoArray(
135
// Keep both the (mapped) and old keys if they differ, just as
136
// traverseAllChildren used to do for objects as children
137
escapedPrefix +
138
- // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
138
+ // $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key
139
(mappedChild.key && (!child || child.key !== mappedChild.key)
140
? escapeUserProvidedKey(
141
// $FlowFixMe[unsafe-addition]
@@ -191,7 +191,7 @@ function mapIntoArray(
191
const iterator = iteratorFn.call(iterableChildren);
192
let step;
193
let ii = 0;
194
- // $FlowFixMe `iteratorFn` might return null according to typing.
194
+ // $FlowFixMe[incompatible-use] `iteratorFn` might return null according to typing.
195
while (!(step = iterator.next()).done) {
196
child = step.value;
197
nextName = nextNamePrefix + getElementKey(child, ii++);
packages/react/src/ReactContext.js
+2
-2
@@ -54,7 +54,7 @@ export function createContext<T>(defaultValue: T): ReactContext<T> {
54
$$typeof: REACT_CONTEXT_TYPE,
55
_context: context,
56
};
57
- // $FlowFixMe: Flow complains about not setting a value, which is intentional here
57
+ // $FlowFixMe[prop-missing]: Flow complains about not setting a value, which is intentional here
58
Object.defineProperties(Consumer, {
59
Provider: {
60
get() {
@@ -123,7 +123,7 @@ export function createContext<T>(defaultValue: T): ReactContext<T> {
123
},
124
},
125
});
126
- // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
126
+ // $FlowFixMe[prop-missing]: Flow complains about missing properties because it doesn't understand defineProperty
127
context.Consumer = Consumer;
128
} else {
129
context.Consumer = context;
packages/react/src/ReactFetch.js
+1
-1
@@ -77,7 +77,7 @@ if (enableCache && enableFetchInstrumentation) {
77
const request = new Request(resource, options);
78
if (
79
(request.method !== 'GET' && request.method !== 'HEAD') ||
80
- // $FlowFixMe: keepalive is real
80
+ // $FlowFixMe[prop-missing]: keepalive is real
81
request.keepalive
82
) {
83
// We currently don't dedupe requests that might have side-effects. Those
packages/react/src/ReactLazy.js
+3
-3
@@ -137,7 +137,7 @@ export function lazy<T>(
137
// In production, this would just set it on the object.
138
let defaultProps;
139
let propTypes;
140
- // $FlowFixMe
140
+ // $FlowFixMe[prop-missing]
141
Object.defineProperties(lazyType, {
142
defaultProps: {
143
configurable: true,
@@ -153,7 +153,7 @@ export function lazy<T>(
153
);
154
defaultProps = newDefaultProps;
155
// Match production behavior more closely:
156
- // $FlowFixMe
156
+ // $FlowFixMe[prop-missing]
157
Object.defineProperty(lazyType, 'defaultProps', {
158
enumerable: true,
159
});
@@ -173,7 +173,7 @@ export function lazy<T>(
173
);
174
propTypes = newPropTypes;
175
// Match production behavior more closely:
176
- // $FlowFixMe
176
+ // $FlowFixMe[prop-missing]
177
Object.defineProperty(lazyType, 'propTypes', {
178
enumerable: true,
179
});
packages/shared/CheckStringCoercion.js
+3
-3
@@ -17,7 +17,7 @@
17
* of the `value` object).
18
*/
19
20
-// $FlowFixMe only called in DEV, so void return is not possible.
20
+// $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
21
function typeName(value: mixed): string {
22
if (__DEV__) {
23
// toStringTag is needed for namespaced types like Temporal.Instant
@@ -26,12 +26,12 @@ function typeName(value: mixed): string {
26
(hasToStringTag && (value: any)[Symbol.toStringTag]) ||
27
(value: any).constructor.name ||
28
'Object';
29
- // $FlowFixMe
29
+ // $FlowFixMe[incompatible-return]
30
return type;
31
}
32
}
33
34
-// $FlowFixMe only called in DEV, so void return is not possible.
34
+// $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
35
function willCoercionThrow(value: mixed): boolean {
36
if (__DEV__) {
37
try {
packages/shared/ConsolePatchingDev.js
+2
-2
@@ -42,7 +42,7 @@ export function disableLogs(): void {
42
value: disabledLog,
43
writable: true,
44
};
45
- // $FlowFixMe Flow thinks console is immutable.
45
+ // $FlowFixMe[cannot-write] Flow thinks console is immutable.
46
Object.defineProperties(console, {
47
info: props,
48
log: props,
@@ -68,7 +68,7 @@ export function reenableLogs(): void {
68
enumerable: true,
69
writable: true,
70
};
71
- // $FlowFixMe Flow thinks console is immutable.
71
+ // $FlowFixMe[cannot-write] Flow thinks console is immutable.
72
Object.defineProperties(console, {
73
log: {...props, value: prevLog},
74
info: {...props, value: prevInfo},
packages/shared/ReactComponentStackFrame.js
+2
-2
@@ -83,7 +83,7 @@ export function describeNativeComponentFrame(
83
84
reentry = true;
85
const previousPrepareStackTrace = Error.prepareStackTrace;
86
- // $FlowFixMe It does accept undefined.
86
+ // $FlowFixMe[incompatible-type] It does accept undefined.
87
Error.prepareStackTrace = undefined;
88
let previousDispatcher;
89
if (__DEV__) {
@@ -100,7 +100,7 @@ export function describeNativeComponentFrame(
100
const Fake = function () {
101
throw Error();
102
};
103
- // $FlowFixMe
103
+ // $FlowFixMe[prop-missing]
104
Object.defineProperty(Fake.prototype, 'props', {
105
set: function () {
106
// We use a throwing setter instead of frozen or non-writable props
packages/shared/ReactServerContextRegistry.js
+1
-1
@@ -21,7 +21,7 @@ export function getOrCreateServerContext(
21
if (!ContextRegistry[globalName]) {
22
ContextRegistry[globalName] = createServerContext(
23
globalName,
24
- // $FlowFixMe function signature doesn't reflect the symbol value
24
+ // $FlowFixMe[incompatible-call] function signature doesn't reflect the symbol value
25
REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED,
26
);
27
}
packages/shared/checkPropTypes.js
+1
-1
@@ -40,7 +40,7 @@ export default function checkPropTypes(
40
element?: any,
41
): void {
42
if (__DEV__) {
43
- // $FlowFixMe This is okay but Flow doesn't know it.
43
+ // $FlowFixMe[incompatible-use] This is okay but Flow doesn't know it.
44
const has = Function.call.bind(hasOwnProperty);
45
for (const typeSpecName in typeSpecs) {
46
if (has(typeSpecs, typeSpecName)) {