From 9362bda2e43ddadb365c25575c5d70748efd5342 Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Wed, 21 Dec 2022 14:16:54 -0500 Subject: [PATCH] [flow] enable enforce_local_inference_annotations --- packages/react-cache/src/ReactCacheOld.js | 1 + .../react-devtools-core/src/standalone.js | 1 + .../react-devtools-extensions/src/backend.js | 2 ++ packages/react-devtools-inline/src/backend.js | 2 ++ .../react-devtools-inline/src/frontend.js | 1 + .../src/backend/console.js | 2 ++ .../src/devtools/ContextMenu/ContextMenu.js | 1 + .../devtools/views/Components/Components.js | 1 + .../views/Components/EditableValue.js | 3 +++ .../src/devtools/views/Components/Element.js | 5 +++++ .../Components/InspectedElementContextTree.js | 1 + .../Components/InspectedElementHooksTree.js | 1 + .../src/devtools/views/Components/KeyValue.js | 2 ++ .../NativeStyleEditor/AutoSizeInput.js | 1 + .../NativeStyleEditor/StyleEditor.js | 3 +++ .../views/Components/NewArrayValue.js | 1 + .../devtools/views/Components/NewKeyValue.js | 1 + .../src/devtools/views/Components/Tree.js | 1 + .../Profiler/SidebarSelectedFiberInfo.js | 1 + .../views/Profiler/SnapshotSelector.js | 4 ++++ .../src/devtools/views/SearchInput.js | 2 ++ .../src/devtools/views/hooks.js | 1 + .../src/app/EditableProps/index.js | 2 ++ .../src/app/ErrorBoundaries/index.js | 1 + .../src/app/Iframe/index.js | 1 + .../src/app/InlineWarnings/index.js | 19 +++++++++++++++++++ .../src/app/InspectableElements/Contexts.js | 4 ++++ .../src/app/SuspenseTree/index.js | 1 + .../react-devtools-shell/src/app/index.js | 1 + .../src/e2e-apps/ListApp.js | 1 + .../src/e2e-apps/ListAppLegacy.js | 1 + .../react-devtools-timeline/src/Timeline.js | 1 + .../src/client/inputValueTracking.js | 1 + .../src/events/SyntheticEvent.js | 1 + .../src/events/plugins/ChangeEventPlugin.js | 2 ++ .../src/server/ReactDOMServerFormatConfig.js | 2 ++ .../src/server/ReactDOMLegacyServerImpl.js | 2 ++ .../server/ReactDOMLegacyServerNodeStream.js | 2 ++ .../src/dom/create-event-handle/Focus.js | 1 + .../react-native-renderer/src/ReactFabric.js | 2 ++ .../src/ReactFabricHostConfig.js | 1 + .../src/ReactNativeBridgeEventPlugin.js | 7 +++++++ .../src/ReactNativeEventEmitter.js | 1 + .../src/ReactNativeFiberInspector.js | 5 +++++ .../src/ReactNativeGetListeners.js | 1 + .../src/ReactNativeRenderer.js | 1 + .../src/legacy-events/EventBatching.js | 1 + .../src/ReactFiberClassComponent.js | 2 ++ .../react-reconciler/src/ReactFiberRoot.js | 1 + .../src/ReactFiberWorkLoop.js | 3 ++- .../ReactFlightDOMRelayClientHostConfig.js | 1 + .../src/ReactFlightWebpackNodeRegister.js | 1 + .../src/ReactFlightWebpackPlugin.js | 2 ++ .../ReactFlightNativeRelayClientHostConfig.js | 1 + .../src/ReactFizzClassComponent.js | 2 ++ packages/react-server/src/ReactFizzServer.js | 1 + .../src/ReactTestRenderer.js | 4 ++++ packages/react/src/ReactLazy.js | 2 ++ packages/shared/invokeGuardedCallbackImpl.js | 1 + scripts/flow/config/flowconfig | 2 +- 60 files changed, 121 insertions(+), 2 deletions(-) diff --git a/packages/react-cache/src/ReactCacheOld.js b/packages/react-cache/src/ReactCacheOld.js index d101565415db4..99716076984c0 100644 --- a/packages/react-cache/src/ReactCacheOld.js +++ b/packages/react-cache/src/ReactCacheOld.js @@ -62,6 +62,7 @@ function readContext(Context: ReactContext) { return dispatcher.readContext(Context); } +// $FlowFixMe[missing-local-annot] function identityHashFn(input) { if (__DEV__) { if ( diff --git a/packages/react-devtools-core/src/standalone.js b/packages/react-devtools-core/src/standalone.js index ba4efd813d165..22cf1677003e1 100644 --- a/packages/react-devtools-core/src/standalone.js +++ b/packages/react-devtools-core/src/standalone.js @@ -167,6 +167,7 @@ function onDisconnected() { disconnectedCallback(); } +// $FlowFixMe[missing-local-annot] function onError({code, message}) { safeUnmount(); diff --git a/packages/react-devtools-extensions/src/backend.js b/packages/react-devtools-extensions/src/backend.js index 533551003330c..5c397c3ee2128 100644 --- a/packages/react-devtools-extensions/src/backend.js +++ b/packages/react-devtools-extensions/src/backend.js @@ -8,6 +8,7 @@ let welcomeHasInitialized = false; +// $FlowFixMe[missing-local-annot] function welcome(event) { if ( event.source !== window || @@ -55,6 +56,7 @@ function setup(hook: any) { const bridge = new Bridge({ listen(fn) { + // $FlowFixMe[missing-local-annot] const listener = event => { if ( event.source !== window || diff --git a/packages/react-devtools-inline/src/backend.js b/packages/react-devtools-inline/src/backend.js index 97d2368ac1696..659b6c8521c95 100644 --- a/packages/react-devtools-inline/src/backend.js +++ b/packages/react-devtools-inline/src/backend.js @@ -10,6 +10,7 @@ import type {BackendBridge} from 'react-devtools-shared/src/bridge'; import type {Wall} from 'react-devtools-shared/src/types'; function startActivation(contentWindow: any, bridge: BackendBridge) { + // $FlowFixMe[missing-local-annot] const onSavedPreferences = data => { // This is the only message we're listening for, // so it's safe to cleanup after we've received it. @@ -96,6 +97,7 @@ export function createBridge(contentWindow: any, wall?: Wall): BackendBridge { if (wall == null) { wall = { listen(fn) { + // $FlowFixMe[missing-local-annot] const onMessage = ({data}) => { fn(data); }; diff --git a/packages/react-devtools-inline/src/frontend.js b/packages/react-devtools-inline/src/frontend.js index 272fbba0b9265..018ce76c5df25 100644 --- a/packages/react-devtools-inline/src/frontend.js +++ b/packages/react-devtools-inline/src/frontend.js @@ -37,6 +37,7 @@ export function createBridge(contentWindow: any, wall?: Wall): FrontendBridge { if (wall == null) { wall = { listen(fn) { + // $FlowFixMe[missing-local-annot] const onMessage = ({data}) => { fn(data); }; diff --git a/packages/react-devtools-shared/src/backend/console.js b/packages/react-devtools-shared/src/backend/console.js index 5753d910eba1d..61ead6d7c478d 100644 --- a/packages/react-devtools-shared/src/backend/console.js +++ b/packages/react-devtools-shared/src/backend/console.js @@ -197,6 +197,7 @@ export function patch({ ? targetConsole[method].__REACT_DEVTOOLS_ORIGINAL_METHOD__ : targetConsole[method]); + // $FlowFixMe[missing-local-annot] const overrideMethod = (...args) => { let shouldAppendWarningStack = false; if (method !== 'log') { @@ -335,6 +336,7 @@ export function patchForStrictMode() { ? targetConsole[method].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ : targetConsole[method]); + // $FlowFixMe[missing-local-annot] const overrideMethod = (...args) => { if (!consoleSettingsRef.hideConsoleLogsInStrictMode) { // Dim the text color of the double logs if we're not diff --git a/packages/react-devtools-shared/src/devtools/ContextMenu/ContextMenu.js b/packages/react-devtools-shared/src/devtools/ContextMenu/ContextMenu.js index 43556f9dc6cce..3b4d2b6964965 100644 --- a/packages/react-devtools-shared/src/devtools/ContextMenu/ContextMenu.js +++ b/packages/react-devtools-shared/src/devtools/ContextMenu/ContextMenu.js @@ -104,6 +104,7 @@ export default function ContextMenu({children, id}: Props): React.Node { const menu = ((menuRef.current: any): HTMLElement); const container = containerRef.current; if (container !== null) { + // $FlowFixMe[missing-local-annot] const hideUnlessContains = event => { if (!menu.contains(event.target)) { hideMenu(); diff --git a/packages/react-devtools-shared/src/devtools/views/Components/Components.js b/packages/react-devtools-shared/src/devtools/views/Components/Components.js index 9535e598174d3..ba2e99cf34393 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/Components.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/Components.js @@ -100,6 +100,7 @@ function Components(_: {}) { onResizeEnd = () => dispatch({type: 'ACTION_SET_IS_RESIZING', payload: false}); + // $FlowFixMe[missing-local-annot] onResize = event => { const resizeElement = resizeElementRef.current; const wrapperElement = wrapperElementRef.current; diff --git a/packages/react-devtools-shared/src/devtools/views/Components/EditableValue.js b/packages/react-devtools-shared/src/devtools/views/Components/EditableValue.js index 03fe9d7bf7fb2..0511a388a574a 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/EditableValue.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/EditableValue.js @@ -36,6 +36,7 @@ export default function EditableValue({ externalValue: value, }); + // $FlowFixMe[missing-local-annot] const handleChange = ({target}) => dispatch({ type: 'UPDATE', @@ -43,6 +44,7 @@ export default function EditableValue({ externalValue: value, }); + // $FlowFixMe[missing-local-annot] const handleCheckBoxToggle = ({target}) => { dispatch({ type: 'UPDATE', @@ -58,6 +60,7 @@ export default function EditableValue({ overrideValue(path, target.checked); }; + // $FlowFixMe[missing-local-annot] const handleKeyDown = event => { // Prevent keydown events from e.g. change selected element in the tree event.stopPropagation(); diff --git a/packages/react-devtools-shared/src/devtools/views/Components/Element.js b/packages/react-devtools-shared/src/devtools/views/Components/Element.js index bb850398df32e..c43164b511039 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/Element.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/Element.js @@ -75,6 +75,7 @@ export default function Element({data, index, style}: Props): React.Node { } }; + // $FlowFixMe[missing-local-annot] const handleClick = ({metaKey}) => { if (id !== null) { logEvent({ @@ -99,6 +100,7 @@ export default function Element({data, index, style}: Props): React.Node { setIsHovered(false); }; + // $FlowFixMe[missing-local-annot] const handleKeyDoubleClick = event => { // Double clicks on key value are used for text selection (if the text has been truncated). // They should not enter the owners tree view. @@ -220,6 +222,7 @@ export default function Element({data, index, style}: Props): React.Node { } // Prevent double clicks on toggle from drilling into the owner list. +// $FlowFixMe[missing-local-annot] const swallowDoubleClick = event => { event.preventDefault(); event.stopPropagation(); @@ -233,6 +236,7 @@ type ExpandCollapseToggleProps = { function ExpandCollapseToggle({element, store}: ExpandCollapseToggleProps) { const {children, id, isCollapsed} = element; + // $FlowFixMe[missing-local-annot] const toggleCollapsed = event => { event.preventDefault(); event.stopPropagation(); @@ -240,6 +244,7 @@ function ExpandCollapseToggle({element, store}: ExpandCollapseToggleProps) { store.toggleIsCollapsed(id, !isCollapsed); }; + // $FlowFixMe[missing-local-annot] const stopPropagation = event => { // Prevent the row from selecting event.stopPropagation(); diff --git a/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementContextTree.js b/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementContextTree.js index f04a0fd8e067b..eb74c244d9d1a 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementContextTree.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementContextTree.js @@ -53,6 +53,7 @@ export default function InspectedElementContextTree({ // We add an object with a "value" key as a wrapper around Context data // so that we can use the shared component to display it. // This wrapper object can't be renamed. + // $FlowFixMe[missing-local-annot] const canRenamePathsAtDepth = depth => depth > 1; if (isEmpty) { diff --git a/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementHooksTree.js b/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementHooksTree.js index f97a27c372a4c..6744cf4bc6477 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementHooksTree.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementHooksTree.js @@ -223,6 +223,7 @@ function HookView({ // Certain hooks are not editable at all (as identified by react-debug-tools). // Primitive hook names (e.g. the "State" name for useState) are also never editable. + // $FlowFixMe[missing-local-annot] const canRenamePathsAtDepth = depth => isStateEditable && depth > 1; const isCustomHook = subHooks.length > 0; diff --git a/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js b/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js index c9240034dc5cd..ca2f623c1a4c1 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js @@ -480,7 +480,9 @@ export default function KeyValue({ return children; } +// $FlowFixMe[missing-local-annot] function DeleteToggle({deletePath, name, path}) { + // $FlowFixMe[missing-local-annot] const handleClick = event => { event.stopPropagation(); deletePath(path); diff --git a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js index 057dd4625f2c3..059cb42273f44 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js @@ -27,6 +27,7 @@ export default function AutoSizeInput({ value, ...rest }: Props): React.Node { + // $FlowFixMe[missing-local-annot] const onFocusWrapper = event => { const input = event.target; if (input !== null) { diff --git a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js index 7b85633f214a8..5b7cdf8563412 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js @@ -171,6 +171,7 @@ function Row({ const [isAttributeValid, setIsAttributeValid] = useState(true); const [isValueValid, setIsValueValid] = useState(true); + // $FlowFixMe[missing-local-annot] const validateAndSetLocalAttribute = newAttribute => { const isValid = newAttribute === '' || @@ -183,6 +184,7 @@ function Row({ }); }; + // $FlowFixMe[missing-local-annot] const validateAndSetLocalValue = newValue => { let isValid = false; try { @@ -262,6 +264,7 @@ function Field({ placeholder, value, }: FieldProps) { + // $FlowFixMe[missing-local-annot] const onKeyDown = event => { switch (event.key) { case 'Enter': diff --git a/packages/react-devtools-shared/src/devtools/views/Components/NewArrayValue.js b/packages/react-devtools-shared/src/devtools/views/Components/NewArrayValue.js index 5a9fffed5ca4e..c8247f7449623 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/NewArrayValue.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/NewArrayValue.js @@ -46,6 +46,7 @@ export default function NewArrayValue({ // This is a bit of an unusual usage of the EditableName component, // but otherwise it acts the way we want for a new Array entry. + // $FlowFixMe[missing-local-annot] const overrideName = (oldPath: any, newPath) => { const value = newPath[newPath.length - 1]; diff --git a/packages/react-devtools-shared/src/devtools/views/Components/NewKeyValue.js b/packages/react-devtools-shared/src/devtools/views/Components/NewKeyValue.js index 9a354a81adb5d..8fb4cc1dc8ca9 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/NewKeyValue.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/NewKeyValue.js @@ -42,6 +42,7 @@ export default function NewKeyValue({ const [newPropKey, setNewPropKey] = useState(0); const [newPropName, setNewPropName] = useState(''); + // $FlowFixMe[missing-local-annot] const overrideNewEntryName = (oldPath: any, newPath) => { setNewPropName(newPath[newPath.length - 1]); }; diff --git a/packages/react-devtools-shared/src/devtools/views/Components/Tree.js b/packages/react-devtools-shared/src/devtools/views/Components/Tree.js index 60cbddb60dae0..7374e4d70ff32 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/Tree.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/Tree.js @@ -540,6 +540,7 @@ function updateIndentationSizeVar( list.style.setProperty('--indentation-size', `${maxIndentationSize}px`); } +// $FlowFixMe[missing-local-annot] function InnerElementType({children, style, ...rest}) { const {ownerID} = useContext(TreeStateContext); diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarSelectedFiberInfo.js b/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarSelectedFiberInfo.js index bfdb4a6e31684..930183ee0cc65 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarSelectedFiberInfo.js +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/SidebarSelectedFiberInfo.js @@ -38,6 +38,7 @@ export default function SidebarSelectedFiberInfo(_: Props): React.Node { rootID: ((rootID: any): number), }); + // $FlowFixMe[missing-local-annot] const handleKeyDown = event => { switch (event.key) { case 'ArrowUp': diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotSelector.js b/packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotSelector.js index 052c0c100c648..57b26ce15fa3d 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotSelector.js +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotSelector.js @@ -86,6 +86,7 @@ export default function SnapshotSelector(_: Props): React.Node { let label = null; if (numFilteredCommits > 0) { + // $FlowFixMe[missing-local-annot] const handleCommitInputChange = event => { const value = parseInt(event.currentTarget.value, 10); if (!isNaN(value)) { @@ -100,10 +101,12 @@ export default function SnapshotSelector(_: Props): React.Node { } }; + // $FlowFixMe[missing-local-annot] const handleClick = event => { event.currentTarget.select(); }; + // $FlowFixMe[missing-local-annot] const handleKeyDown = event => { switch (event.key) { case 'ArrowDown': @@ -159,6 +162,7 @@ export default function SnapshotSelector(_: Props): React.Node { selectCommitIndex(filteredCommitIndices[nextCommitIndex]); }; + // $FlowFixMe[missing-local-annot] const handleKeyDown = event => { switch (event.key) { case 'ArrowLeft': diff --git a/packages/react-devtools-shared/src/devtools/views/SearchInput.js b/packages/react-devtools-shared/src/devtools/views/SearchInput.js index 2569b685536ec..8a43202f87c30 100644 --- a/packages/react-devtools-shared/src/devtools/views/SearchInput.js +++ b/packages/react-devtools-shared/src/devtools/views/SearchInput.js @@ -40,9 +40,11 @@ export default function SearchInput({ const resetSearch = () => search(''); + // $FlowFixMe[missing-local-annot] const handleChange = ({currentTarget}) => { search(currentTarget.value); }; + // $FlowFixMe[missing-local-annot] const handleKeyPress = ({key, shiftKey}) => { if (key === 'Enter') { if (shiftKey) { diff --git a/packages/react-devtools-shared/src/devtools/views/hooks.js b/packages/react-devtools-shared/src/devtools/views/hooks.js index 795532a45f6c0..c5ee3a3e83d7a 100644 --- a/packages/react-devtools-shared/src/devtools/views/hooks.js +++ b/packages/react-devtools-shared/src/devtools/views/hooks.js @@ -191,6 +191,7 @@ export function useLocalStorage( // Listen for changes to this local storage value made from other windows. // This enables the e.g. "⚛️ Elements" tab to update in response to changes from "⚛️ Settings". useLayoutEffect(() => { + // $FlowFixMe[missing-local-annot] const onStorage = event => { const newValue = getValueFromLocalStorage(); if (key === event.key && storedValue !== newValue) { diff --git a/packages/react-devtools-shell/src/app/EditableProps/index.js b/packages/react-devtools-shell/src/app/EditableProps/index.js index 5c780ee86e72e..5cfad3f7e837f 100644 --- a/packages/react-devtools-shell/src/app/EditableProps/index.js +++ b/packages/react-devtools-shell/src/app/EditableProps/index.js @@ -24,6 +24,7 @@ import { const initialData = {foo: 'FOO', bar: 'BAR'}; +// $FlowFixMe[missing-local-annot] function reducer(state, action: {type: string}) { switch (action.type) { case 'swap': @@ -80,6 +81,7 @@ class StatefulClass extends Component { state: 'California', }; + // $FlowFixMe[missing-local-annot] handleChange = ({target}): any => this.setState({ state: target.value, diff --git a/packages/react-devtools-shell/src/app/ErrorBoundaries/index.js b/packages/react-devtools-shell/src/app/ErrorBoundaries/index.js index 234ffb642fcc6..a87d853ea1b25 100644 --- a/packages/react-devtools-shell/src/app/ErrorBoundaries/index.js +++ b/packages/react-devtools-shell/src/app/ErrorBoundaries/index.js @@ -49,6 +49,7 @@ class ErrorBoundary extends React.Component { } } +// $FlowFixMe[missing-local-annot] function Component({label}) { return
{label}
; } diff --git a/packages/react-devtools-shell/src/app/Iframe/index.js b/packages/react-devtools-shell/src/app/Iframe/index.js index 50beadd137aa2..99eafee6b29b7 100644 --- a/packages/react-devtools-shell/src/app/Iframe/index.js +++ b/packages/react-devtools-shell/src/app/Iframe/index.js @@ -19,6 +19,7 @@ export default function Iframe(): React.Node { const iframeStyle = {border: '2px solid #eee', height: 80}; +// $FlowFixMe[missing-local-annot] function Frame(props) { const [element, setElement] = React.useState(null); diff --git a/packages/react-devtools-shell/src/app/InlineWarnings/index.js b/packages/react-devtools-shell/src/app/InlineWarnings/index.js index 6b7b189f70174..ddfac6acb4c3b 100644 --- a/packages/react-devtools-shell/src/app/InlineWarnings/index.js +++ b/packages/react-devtools-shell/src/app/InlineWarnings/index.js @@ -3,11 +3,13 @@ import * as React from 'react'; import {Fragment, useEffect, useRef, useState} from 'react'; +// $FlowFixMe[missing-local-annot] function WarnDuringRender({children = null}) { console.warn('This warning fires during every render'); return children; } +// $FlowFixMe[missing-local-annot] function WarnOnMount({children = null}) { useEffect(() => { console.warn('This warning fires on initial mount only'); @@ -15,6 +17,7 @@ function WarnOnMount({children = null}) { return children; } +// $FlowFixMe[missing-local-annot] function WarnOnUpdate({children = null}) { const didMountRef = useRef(false); useEffect(() => { @@ -27,6 +30,7 @@ function WarnOnUpdate({children = null}) { return children; } +// $FlowFixMe[missing-local-annot] function WarnOnUnmount({children = null}) { useEffect(() => { return () => { @@ -36,11 +40,13 @@ function WarnOnUnmount({children = null}) { return children; } +// $FlowFixMe[missing-local-annot] function ErrorDuringRender({children = null}) { console.error('This error fires during every render'); return children; } +// $FlowFixMe[missing-local-annot] function ErrorOnMount({children = null}) { useEffect(() => { console.error('This error fires on initial mount only'); @@ -48,6 +54,7 @@ function ErrorOnMount({children = null}) { return children; } +// $FlowFixMe[missing-local-annot] function ErrorOnUpdate({children = null}) { const didMountRef = useRef(false); useEffect(() => { @@ -60,6 +67,7 @@ function ErrorOnUpdate({children = null}) { return children; } +// $FlowFixMe[missing-local-annot] function ErrorOnUnmount({children = null}) { useEffect(() => { return () => { @@ -69,12 +77,14 @@ function ErrorOnUnmount({children = null}) { return children; } +// $FlowFixMe[missing-local-annot] function ErrorAndWarningDuringRender({children = null}) { console.warn('This warning fires during every render'); console.error('This error fires during every render'); return children; } +// $FlowFixMe[missing-local-annot] function ErrorAndWarningOnMount({children = null}) { useEffect(() => { console.warn('This warning fires on initial mount only'); @@ -83,6 +93,7 @@ function ErrorAndWarningOnMount({children = null}) { return children; } +// $FlowFixMe[missing-local-annot] function ErrorAndWarningOnUpdate({children = null}) { const didMountRef = useRef(false); useEffect(() => { @@ -96,6 +107,7 @@ function ErrorAndWarningOnUpdate({children = null}) { return children; } +// $FlowFixMe[missing-local-annot] function ErrorAndWarningOnUnmount({children = null}) { useEffect(() => { return () => { @@ -106,6 +118,7 @@ function ErrorAndWarningOnUnmount({children = null}) { return children; } +// $FlowFixMe[missing-local-annot] function ReallyLongErrorMessageThatWillCauseTextToBeTruncated({ children = null, }) { @@ -115,20 +128,24 @@ function ReallyLongErrorMessageThatWillCauseTextToBeTruncated({ return children; } +// $FlowFixMe[missing-local-annot] function ErrorWithMultipleArgs({children = null}) { console.error('This error', 'passes console', 4, 'arguments'); return children; } +// $FlowFixMe[missing-local-annot] function ErrorWithStringSubstitutions({children = null}) { console.error('This error uses "%s" substitutions', 'string'); return children; } +// $FlowFixMe[missing-local-annot] function ReactErrorOnHostComponent({children = null}) { return
{children}
; } +// $FlowFixMe[missing-local-annot] function DuplicateWarningsAndErrors({children = null}) { console.warn('this warning is logged twice per render'); console.warn('this warning is logged twice per render'); @@ -137,6 +154,7 @@ function DuplicateWarningsAndErrors({children = null}) { return
{children}
; } +// $FlowFixMe[missing-local-annot] function MultipleWarningsAndErrors({children = null}) { console.warn('this is the first warning logged'); console.warn('this is the second warning logged'); @@ -145,6 +163,7 @@ function MultipleWarningsAndErrors({children = null}) { return
{children}
; } +// $FlowFixMe[missing-local-annot] function ComponentWithMissingKey({children}) { return [
]; } diff --git a/packages/react-devtools-shell/src/app/InspectableElements/Contexts.js b/packages/react-devtools-shell/src/app/InspectableElements/Contexts.js index 0cafb31390f1e..fc76fc11c5476 100644 --- a/packages/react-devtools-shell/src/app/InspectableElements/Contexts.js +++ b/packages/react-devtools-shell/src/app/InspectableElements/Contexts.js @@ -115,6 +115,7 @@ class LegacyContextProviderWithUpdates extends Component { return {type: this.state.type}; } + // $FlowFixMe[missing-local-annot] handleChange = event => { this.setState({type: event.target.value}); }; @@ -135,6 +136,7 @@ LegacyContextProviderWithUpdates.childContextTypes = { type: PropTypes.string, }; +// $FlowFixMe[missing-local-annot] function LegacyFunctionalContextConsumer(props: any, context) { return formatContextForDisplay('LegacyFunctionContextConsumer', context.type); } @@ -203,7 +205,9 @@ function FunctionalContextConsumerWithContextUpdates() { const {string2, setString2} = useContext(StringContextWithUpdates2); const [state, setState] = useState('state'); + // $FlowFixMe[missing-local-annot] const handleChange = e => setString(e.target.value); + // $FlowFixMe[missing-local-annot] const handleChange2 = e => setString2(e.target.value); return ( diff --git a/packages/react-devtools-shell/src/app/SuspenseTree/index.js b/packages/react-devtools-shell/src/app/SuspenseTree/index.js index c262846b48b8f..e5b46bc7c8904 100644 --- a/packages/react-devtools-shell/src/app/SuspenseTree/index.js +++ b/packages/react-devtools-shell/src/app/SuspenseTree/index.js @@ -29,6 +29,7 @@ function EmptySuspense() { return ; } +// $FlowFixMe[missing-local-annot] function PrimaryFallbackTest({initialSuspend}) { const [suspend, setSuspend] = useState(initialSuspend); const fallbackStep = useTestSequence('fallback', Fallback1, Fallback2); diff --git a/packages/react-devtools-shell/src/app/index.js b/packages/react-devtools-shell/src/app/index.js index 0045e81f139cd..6568fa7d3f019 100644 --- a/packages/react-devtools-shell/src/app/index.js +++ b/packages/react-devtools-shell/src/app/index.js @@ -52,6 +52,7 @@ function mountApp(App: () => React$Node) { unmountFunctions.push(() => root.unmount()); } +// $FlowFixMe[missing-local-annot] function mountStrictApp(App) { function StrictRoot() { return createElement(App); diff --git a/packages/react-devtools-shell/src/e2e-apps/ListApp.js b/packages/react-devtools-shell/src/e2e-apps/ListApp.js index f365686ad139b..9cb17188b0ffd 100644 --- a/packages/react-devtools-shell/src/e2e-apps/ListApp.js +++ b/packages/react-devtools-shell/src/e2e-apps/ListApp.js @@ -43,6 +43,7 @@ function List() { ); } +// $FlowFixMe[missing-local-annot] function ListItem({label}) { return
  • {label}
  • ; } diff --git a/packages/react-devtools-shell/src/e2e-apps/ListAppLegacy.js b/packages/react-devtools-shell/src/e2e-apps/ListAppLegacy.js index 98e15d2f6501b..056bd7b2243be 100644 --- a/packages/react-devtools-shell/src/e2e-apps/ListAppLegacy.js +++ b/packages/react-devtools-shell/src/e2e-apps/ListAppLegacy.js @@ -50,6 +50,7 @@ class List extends React.Component { } } +// $FlowFixMe[missing-local-annot] function ListItem({label}) { return
  • {label}
  • ; } diff --git a/packages/react-devtools-timeline/src/Timeline.js b/packages/react-devtools-timeline/src/Timeline.js index 5ed6a0f7443f8..492725e17aa97 100644 --- a/packages/react-devtools-timeline/src/Timeline.js +++ b/packages/react-devtools-timeline/src/Timeline.js @@ -117,6 +117,7 @@ const ProcessingData = () => (
    ); +// $FlowFixMe[missing-local-annot] const CouldNotLoadProfile = ({error, onFileSelect}) => (
    Could not load profile
    diff --git a/packages/react-dom-bindings/src/client/inputValueTracking.js b/packages/react-dom-bindings/src/client/inputValueTracking.js index e1e45a13a54f8..5d2e8d9f96b09 100644 --- a/packages/react-dom-bindings/src/client/inputValueTracking.js +++ b/packages/react-dom-bindings/src/client/inputValueTracking.js @@ -81,6 +81,7 @@ function trackValueOnNode(node: any): ?ValueTracker { get: function(this: any) { return get.call(this); }, + // $FlowFixMe[missing-local-annot] set: function(this: any, value) { if (__DEV__) { checkFormFieldValueStringCoercion(value); diff --git a/packages/react-dom-bindings/src/events/SyntheticEvent.js b/packages/react-dom-bindings/src/events/SyntheticEvent.js index 82758b565b0fe..953c9110b72e8 100644 --- a/packages/react-dom-bindings/src/events/SyntheticEvent.js +++ b/packages/react-dom-bindings/src/events/SyntheticEvent.js @@ -423,6 +423,7 @@ const modifierKeyToProp = { // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support // getModifierState. If getModifierState is not supported, we map it to a set of // modifier keys exposed by the event. In this case, Lock-keys are not supported. +// $FlowFixMe[missing-local-annot] function modifierStateGetter(this: any, keyArg) { const syntheticEvent = this; const nativeEvent = syntheticEvent.nativeEvent; diff --git a/packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js b/packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js index 3b57d4ec05148..cbfc872770d28 100644 --- a/packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js +++ b/packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js @@ -51,6 +51,7 @@ function registerEvents() { } function createAndAccumulateChangeEvent( + // $FlowFixMe[missing-local-annot] dispatchQueue, inst: null | Fiber, nativeEvent: AnyNativeEvent, @@ -173,6 +174,7 @@ function stopWatchingForValueChange() { * (For IE <=9) Handles a propertychange event, sending a `change` event if * the value of the active element has changed. */ +// $FlowFixMe[missing-local-annot] function handlePropertyChange(nativeEvent) { if (nativeEvent.propertyName !== 'value') { return; diff --git a/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js b/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js index d9c16f776723c..843c4bee1ff6d 100644 --- a/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js +++ b/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js @@ -2769,6 +2769,7 @@ export function writeInitialResources( const {src, integrity} = responseState.externalRuntimeConfig; preinitImpl(resources, src, {as: 'script', integrity}); } + // $FlowFixMe[missing-local-annot] function flushLinkResource(resource) { if (!resource.flushed) { pushLinkImpl(target, resource.props, responseState); @@ -2893,6 +2894,7 @@ export function writeImmediateResources( resources: Resources, responseState: ResponseState, ): boolean { + // $FlowFixMe[missing-local-annot] function flushLinkResource(resource) { if (!resource.flushed) { pushLinkImpl(target, resource.props, responseState); diff --git a/packages/react-dom/src/server/ReactDOMLegacyServerImpl.js b/packages/react-dom/src/server/ReactDOMLegacyServerImpl.js index 9563adfeec6bd..2d9fed4a556f1 100644 --- a/packages/react-dom/src/server/ReactDOMLegacyServerImpl.js +++ b/packages/react-dom/src/server/ReactDOMLegacyServerImpl.js @@ -43,12 +43,14 @@ function renderToStringImpl( let fatalError = null; let result = ''; const destination = { + // $FlowFixMe[missing-local-annot] push(chunk) { if (chunk !== null) { result += chunk; } return true; }, + // $FlowFixMe[missing-local-annot] destroy(error) { didFatal = true; fatalError = error; diff --git a/packages/react-dom/src/server/ReactDOMLegacyServerNodeStream.js b/packages/react-dom/src/server/ReactDOMLegacyServerNodeStream.js index e0726fa79eb03..167d6cc1e1147 100644 --- a/packages/react-dom/src/server/ReactDOMLegacyServerNodeStream.js +++ b/packages/react-dom/src/server/ReactDOMLegacyServerNodeStream.js @@ -40,12 +40,14 @@ class ReactMarkupReadableStream extends Readable { this.startedFlowing = false; } + // $FlowFixMe[missing-local-annot] _destroy(err, callback) { abort(this.request); // $FlowFixMe: The type definition for the callback should allow undefined and null. callback(err); } + // $FlowFixMe[missing-local-annot] _read(size) { if (this.startedFlowing) { startFlowing(this.request, this); diff --git a/packages/react-interactions/events/src/dom/create-event-handle/Focus.js b/packages/react-interactions/events/src/dom/create-event-handle/Focus.js index 16ce67848cf87..58b4eb44f5092 100644 --- a/packages/react-interactions/events/src/dom/create-event-handle/Focus.js +++ b/packages/react-interactions/events/src/dom/create-event-handle/Focus.js @@ -125,6 +125,7 @@ function isRelatedTargetWithin( } function setFocusVisibleListeners( + // $FlowFixMe[missing-local-annot] focusVisibleHandles, focusTarget: EventTarget, callback: boolean => void, diff --git a/packages/react-native-renderer/src/ReactFabric.js b/packages/react-native-renderer/src/ReactFabric.js index 4ec730a3f9a5e..bcd04fb7596b3 100644 --- a/packages/react-native-renderer/src/ReactFabric.js +++ b/packages/react-native-renderer/src/ReactFabric.js @@ -201,6 +201,7 @@ function sendAccessibilityEvent(handle: any, eventType: string) { } } +// $FlowFixMe[missing-local-annot] function onRecoverableError(error) { // TODO: Expose onRecoverableError option to userspace // eslint-disable-next-line react-internal/no-production-logging, react-internal/warning-args @@ -236,6 +237,7 @@ function render( return getPublicRootInstance(root); } +// $FlowFixMe[missing-this-annot] function unmountComponentAtNode(containerTag: number) { this.stopSurface(containerTag); } diff --git a/packages/react-native-renderer/src/ReactFabricHostConfig.js b/packages/react-native-renderer/src/ReactFabricHostConfig.js index ec6918e96d346..7f98be1c9f37b 100644 --- a/packages/react-native-renderer/src/ReactFabricHostConfig.js +++ b/packages/react-native-renderer/src/ReactFabricHostConfig.js @@ -244,6 +244,7 @@ class ReactFabricHostComponent { eventType: string, listener: EventListener, options: EventListenerOptions | boolean, + // $FlowFixMe[missing-local-annot] ) { if (typeof eventType !== 'string') { throw new Error('addEventListener_unstable eventType must be a string'); diff --git a/packages/react-native-renderer/src/ReactNativeBridgeEventPlugin.js b/packages/react-native-renderer/src/ReactNativeBridgeEventPlugin.js index 618cdce27b644..3e7a3a91adf5f 100644 --- a/packages/react-native-renderer/src/ReactNativeBridgeEventPlugin.js +++ b/packages/react-native-renderer/src/ReactNativeBridgeEventPlugin.js @@ -31,12 +31,14 @@ const { // Start of inline: the below functions were inlined from // EventPropagator.js, as they deviated from ReactDOM's newer // implementations. +// $FlowFixMe[missing-local-annot] function listenersAtPhase(inst, event, propagationPhase: PropagationPhases) { const registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; return getListeners(inst, registrationName, propagationPhase, true); } +// $FlowFixMe[missing-local-annot] function accumulateListenersAndInstances(inst, event, listeners) { const listenersLength = listeners ? isArray(listeners) @@ -64,6 +66,7 @@ function accumulateListenersAndInstances(inst, event, listeners) { } } +// $FlowFixMe[missing-local-annot] function accumulateDirectionalDispatches(inst, phase, event) { if (__DEV__) { if (!inst) { @@ -74,6 +77,7 @@ function accumulateDirectionalDispatches(inst, phase, event) { accumulateListenersAndInstances(inst, event, listeners); } +// $FlowFixMe[missing-local-annot] function getParent(inst) { do { inst = inst.return; @@ -117,6 +121,7 @@ export function traverseTwoPhase( } } +// $FlowFixMe[missing-local-annot] function accumulateTwoPhaseDispatchesSingle(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { traverseTwoPhase( @@ -128,10 +133,12 @@ function accumulateTwoPhaseDispatchesSingle(event) { } } +// $FlowFixMe[missing-local-annot] function accumulateTwoPhaseDispatches(events) { forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); } +// $FlowFixMe[missing-local-annot] function accumulateCapturePhaseDispatches(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { traverseTwoPhase( diff --git a/packages/react-native-renderer/src/ReactNativeEventEmitter.js b/packages/react-native-renderer/src/ReactNativeEventEmitter.js index aeb3e23cb0368..f4ed0f641623b 100644 --- a/packages/react-native-renderer/src/ReactNativeEventEmitter.js +++ b/packages/react-native-renderer/src/ReactNativeEventEmitter.js @@ -43,6 +43,7 @@ const EMPTY_NATIVE_EVENT = (({}: any): AnyNativeEvent); * @param {Array} indices Indices by which to pull subsequence. * @return {Array} Subsequence of touch objects. */ +// $FlowFixMe[missing-local-annot] const touchSubsequence = function(touches, indices) { const ret = []; for (let i = 0; i < indices.length; i++) { diff --git a/packages/react-native-renderer/src/ReactNativeFiberInspector.js b/packages/react-native-renderer/src/ReactNativeFiberInspector.js index 14545550647dd..01d71a2825cb4 100644 --- a/packages/react-native-renderer/src/ReactNativeFiberInspector.js +++ b/packages/react-native-renderer/src/ReactNativeFiberInspector.js @@ -39,6 +39,7 @@ let getOwnerHierarchy; let traverseOwnerTreeUp; if (__DEV__ || enableGetInspectorDataForInstanceInProduction) { + // $FlowFixMe[missing-local-annot] createHierarchy = function(fiberHierarchy) { return fiberHierarchy.map(fiber => ({ name: getComponentNameFromType(fiber.type), @@ -68,6 +69,7 @@ if (__DEV__ || enableGetInspectorDataForInstanceInProduction) { })); }; + // $FlowFixMe[missing-local-annot] getHostNode = function(fiber: Fiber | null, findNodeHandle) { let hostNode; // look for children first for the hostNode @@ -84,6 +86,7 @@ if (__DEV__ || enableGetInspectorDataForInstanceInProduction) { return null; }; + // $FlowFixMe[missing-local-annot] getHostProps = function(fiber) { const host = findCurrentHostFiber(fiber); if (host) { @@ -128,6 +131,7 @@ if (__DEV__ || enableGetInspectorDataForInstanceInProduction) { return hierarchy; }; + // $FlowFixMe[missing-local-annot] lastNonHostInstance = function(hierarchy) { for (let i = hierarchy.length - 1; i > 1; i--) { const instance = hierarchy[i]; @@ -139,6 +143,7 @@ if (__DEV__ || enableGetInspectorDataForInstanceInProduction) { return hierarchy[0]; }; + // $FlowFixMe[missing-local-annot] traverseOwnerTreeUp = function(hierarchy, instance: any) { if (instance) { hierarchy.unshift(instance); diff --git a/packages/react-native-renderer/src/ReactNativeGetListeners.js b/packages/react-native-renderer/src/ReactNativeGetListeners.js index 3417f69b4a3c6..2f3520a1ceb22 100644 --- a/packages/react-native-renderer/src/ReactNativeGetListeners.js +++ b/packages/react-native-renderer/src/ReactNativeGetListeners.js @@ -117,6 +117,7 @@ export default function getListeners( // all imperative event listeners in a function to unwrap the SyntheticEvent // and pass them an Event. // When this API is more stable and used more frequently, we can revisit. + // $FlowFixMe[missing-local-annot] const listenerFnWrapper = function(syntheticEvent, ...args) { const eventInst = new CustomEvent(mangledImperativeRegistrationName, { detail: syntheticEvent.nativeEvent, diff --git a/packages/react-native-renderer/src/ReactNativeRenderer.js b/packages/react-native-renderer/src/ReactNativeRenderer.js index 85e8a1436a9f4..e07b8285a4d4a 100644 --- a/packages/react-native-renderer/src/ReactNativeRenderer.js +++ b/packages/react-native-renderer/src/ReactNativeRenderer.js @@ -198,6 +198,7 @@ function sendAccessibilityEvent(handle: any, eventType: string) { } } +// $FlowFixMe[missing-local-annot] function onRecoverableError(error) { // TODO: Expose onRecoverableError option to userspace // eslint-disable-next-line react-internal/no-production-logging, react-internal/warning-args diff --git a/packages/react-native-renderer/src/legacy-events/EventBatching.js b/packages/react-native-renderer/src/legacy-events/EventBatching.js index 26bb977492811..ec98a86fb61df 100644 --- a/packages/react-native-renderer/src/legacy-events/EventBatching.js +++ b/packages/react-native-renderer/src/legacy-events/EventBatching.js @@ -34,6 +34,7 @@ const executeDispatchesAndRelease = function(event: ReactSyntheticEvent) { } } }; +// $FlowFixMe[missing-local-annot] const executeDispatchesAndReleaseTopLevel = function(e) { return executeDispatchesAndRelease(e); }; diff --git a/packages/react-reconciler/src/ReactFiberClassComponent.js b/packages/react-reconciler/src/ReactFiberClassComponent.js index 5f39a1fd12295..2443db472ba1d 100644 --- a/packages/react-reconciler/src/ReactFiberClassComponent.js +++ b/packages/react-reconciler/src/ReactFiberClassComponent.js @@ -194,6 +194,7 @@ function applyDerivedStateFromProps( const classComponentUpdater = { isMounted, + // $FlowFixMe[missing-local-annot] enqueueSetState(inst: any, payload: any, callback) { const fiber = getInstance(inst); const eventTime = requestEventTime(); @@ -262,6 +263,7 @@ const classComponentUpdater = { markStateUpdateScheduled(fiber, lane); } }, + // $FlowFixMe[missing-local-annot] enqueueForceUpdate(inst: any, callback) { const fiber = getInstance(inst); const eventTime = requestEventTime(); diff --git a/packages/react-reconciler/src/ReactFiberRoot.js b/packages/react-reconciler/src/ReactFiberRoot.js index bfaf176a019ab..82f5655250084 100644 --- a/packages/react-reconciler/src/ReactFiberRoot.js +++ b/packages/react-reconciler/src/ReactFiberRoot.js @@ -47,6 +47,7 @@ export type RootState = { function FiberRootNode( this: $FlowFixMe, containerInfo: any, + // $FlowFixMe[missing-local-annot] tag, hydrate: any, identifierPrefix: any, diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index 692d0a9943db5..cd9f1498c655b 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -1003,7 +1003,7 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) { // This is the entry point for every concurrent task, i.e. anything that // goes through Scheduler. -function performConcurrentWorkOnRoot(root: FiberRoot, didTimeout) { +function performConcurrentWorkOnRoot(root: FiberRoot, didTimeout: boolean) { if (enableProfilerTimer && enableProfilerNestedUpdatePhase) { resetNestedUpdateFlag(); } @@ -3897,6 +3897,7 @@ export function restorePendingUpdaters(root: FiberRoot, lanes: Lanes): void { } const fakeActCallbackNode = {}; +// $FlowFixMe[missing-local-annot] function scheduleCallback(priorityLevel: any, callback) { if (__DEV__) { // If we're currently inside an `act` scope, bypass Scheduler and push to diff --git a/packages/react-server-dom-relay/src/ReactFlightDOMRelayClientHostConfig.js b/packages/react-server-dom-relay/src/ReactFlightDOMRelayClientHostConfig.js index a611259e76d07..a4dccf3513a35 100644 --- a/packages/react-server-dom-relay/src/ReactFlightDOMRelayClientHostConfig.js +++ b/packages/react-server-dom-relay/src/ReactFlightDOMRelayClientHostConfig.js @@ -44,6 +44,7 @@ export function resolveModuleReference( return resolveModuleReferenceImpl(moduleData); } +// $FlowFixMe[missing-local-annot] function parseModelRecursively(response: Response, parentObj, key, value) { if (typeof value === 'string') { return parseModelString(response, parentObj, key, value); diff --git a/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js b/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js index fc686b0db5d8f..b23a5918d8af7 100644 --- a/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js +++ b/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js @@ -54,6 +54,7 @@ module.exports = function register() { // If this module is expected to return a Promise (such as an AsyncModule) then // we should resolve that with a client reference that unwraps the Promise on // the client. + // $FlowFixMe[missing-local-annot] const then = function then(resolve, reject: any) { const moduleReference: {[string]: any, ...} = { $$typeof: MODULE_REFERENCE, diff --git a/packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js b/packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js index df2f78823f9de..0cdc501446822 100644 --- a/packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js +++ b/packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js @@ -144,6 +144,7 @@ export default class ReactFlightWebpackPlugin { new NullDependency.Template(), ); + // $FlowFixMe[missing-local-annot] const handler = parser => { // We need to add all client references as dependency of something in the graph so // Webpack knows which entries need to know about the relevant chunks and include the @@ -220,6 +221,7 @@ export default class ReactFlightWebpackPlugin { return c.id; }); + // $FlowFixMe[missing-local-annot] function recordModule(id: any, module) { // TODO: Hook into deps instead of the target module. // That way we know by the type of dep whether to include. diff --git a/packages/react-server-native-relay/src/ReactFlightNativeRelayClientHostConfig.js b/packages/react-server-native-relay/src/ReactFlightNativeRelayClientHostConfig.js index 012d005ac83ad..ae2e2c0afb028 100644 --- a/packages/react-server-native-relay/src/ReactFlightNativeRelayClientHostConfig.js +++ b/packages/react-server-native-relay/src/ReactFlightNativeRelayClientHostConfig.js @@ -44,6 +44,7 @@ export function resolveModuleReference( return resolveModuleReferenceImpl(moduleData); } +// $FlowFixMe[missing-local-annot] function parseModelRecursively(response: Response, parentObj, key, value) { if (typeof value === 'string') { return parseModelString(response, parentObj, key, value); diff --git a/packages/react-server/src/ReactFizzClassComponent.js b/packages/react-server/src/ReactFizzClassComponent.js index 73f3ec55f93ef..f03117f65a440 100644 --- a/packages/react-server/src/ReactFizzClassComponent.js +++ b/packages/react-server/src/ReactFizzClassComponent.js @@ -109,6 +109,7 @@ const classComponentUpdater = { isMounted(inst: any) { return false; }, + // $FlowFixMe[missing-local-annot] enqueueSetState(inst: any, payload: any, callback) { const internals: InternalInstance = getInstance(inst); if (internals.queue === null) { @@ -132,6 +133,7 @@ const classComponentUpdater = { } } }, + // $FlowFixMe[missing-local-annot] enqueueForceUpdate(inst: any, callback) { const internals: InternalInstance = getInstance(inst); if (internals.queue === null) { diff --git a/packages/react-server/src/ReactFizzServer.js b/packages/react-server/src/ReactFizzServer.js index ac03ae25689b1..bc7ece8424d12 100644 --- a/packages/react-server/src/ReactFizzServer.js +++ b/packages/react-server/src/ReactFizzServer.js @@ -1301,6 +1301,7 @@ function renderElement( ); } +// $FlowFixMe[missing-local-annot] function validateIterable(iterable, iteratorFn: Function): void { if (__DEV__) { // We don't support rendering Generators because it's a mutation. diff --git a/packages/react-test-renderer/src/ReactTestRenderer.js b/packages/react-test-renderer/src/ReactTestRenderer.js index 4645047977113..50153791e9fcc 100644 --- a/packages/react-test-renderer/src/ReactTestRenderer.js +++ b/packages/react-test-renderer/src/ReactTestRenderer.js @@ -133,6 +133,7 @@ function toJSON(inst: Instance | TextInstance): ReactTestRendererNode | null { } } +// $FlowFixMe[missing-local-annot] function childrenToTree(node) { if (!node) { return null; @@ -146,6 +147,7 @@ function childrenToTree(node) { return flatten(children.map(toTree)); } +// $FlowFixMe[missing-local-annot] function nodeAndSiblingsArray(nodeWithSibling) { const array = []; let node = nodeWithSibling; @@ -156,6 +158,7 @@ function nodeAndSiblingsArray(nodeWithSibling) { return array; } +// $FlowFixMe[missing-local-annot] function flatten(arr) { const result = []; const stack = [{i: 0, array: arr}]; @@ -449,6 +452,7 @@ function propsMatch(props: Object, filter: Object): boolean { return true; } +// $FlowFixMe[missing-local-annot] function onRecoverableError(error) { // TODO: Expose onRecoverableError option to userspace // eslint-disable-next-line react-internal/no-production-logging, react-internal/warning-args diff --git a/packages/react/src/ReactLazy.js b/packages/react/src/ReactLazy.js index 6537ef601e71b..04c5654bc80cf 100644 --- a/packages/react/src/ReactLazy.js +++ b/packages/react/src/ReactLazy.js @@ -144,6 +144,7 @@ export function lazy( get() { return defaultProps; }, + // $FlowFixMe[missing-local-annot] set(newDefaultProps) { console.error( 'React.lazy(...): It is not supported to assign `defaultProps` to ' + @@ -163,6 +164,7 @@ export function lazy( get() { return propTypes; }, + // $FlowFixMe[missing-local-annot] set(newPropTypes) { console.error( 'React.lazy(...): It is not supported to assign `propTypes` to ' + diff --git a/packages/shared/invokeGuardedCallbackImpl.js b/packages/shared/invokeGuardedCallbackImpl.js index 217fc04e9789e..d129a35784a5d 100644 --- a/packages/shared/invokeGuardedCallbackImpl.js +++ b/packages/shared/invokeGuardedCallbackImpl.js @@ -156,6 +156,7 @@ if (__DEV__) { let didSetError = false; let isCrossOriginError = false; + // $FlowFixMe[missing-local-annot] function handleWindowError(event) { error = event.error; didSetError = true; diff --git a/scripts/flow/config/flowconfig b/scripts/flow/config/flowconfig index f746dfa43bdae..a4c50ad930eb6 100644 --- a/scripts/flow/config/flowconfig +++ b/scripts/flow/config/flowconfig @@ -43,7 +43,7 @@ untyped-type-import=error %CI_MAX_WORKERS% exact_by_default=true munge_underscores=false -enforce_local_inference_annotations=false +enforce_local_inference_annotations=true # Substituted by createFlowConfig.js: %REACT_RENDERER_FLOW_OPTIONS%