Skip to content

Commit e47a09d

Browse files
committed
[flow] enable enforce_local_inference_annotations
1 parent d6fc143 commit e47a09d

File tree

60 files changed

+121
-2
lines changed

Some content is hidden

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

60 files changed

+121
-2
lines changed

packages/react-cache/src/ReactCacheOld.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ function readContext(Context: ReactContext<mixed>) {
6262
return dispatcher.readContext(Context);
6363
}
6464

65+
// $FlowFixMe[missing-local-annot]
6566
function identityHashFn(input) {
6667
if (__DEV__) {
6768
if (

packages/react-devtools-core/src/standalone.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ function onDisconnected() {
167167
disconnectedCallback();
168168
}
169169

170+
// $FlowFixMe[missing-local-annot]
170171
function onError({code, message}) {
171172
safeUnmount();
172173

packages/react-devtools-extensions/src/backend.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
let welcomeHasInitialized = false;
1010

11+
// $FlowFixMe[missing-local-annot]
1112
function welcome(event) {
1213
if (
1314
event.source !== window ||
@@ -55,6 +56,7 @@ function setup(hook: any) {
5556

5657
const bridge = new Bridge({
5758
listen(fn) {
59+
// $FlowFixMe[missing-local-annot]
5860
const listener = event => {
5961
if (
6062
event.source !== window ||

packages/react-devtools-inline/src/backend.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type {BackendBridge} from 'react-devtools-shared/src/bridge';
1010
import type {Wall} from 'react-devtools-shared/src/types';
1111

1212
function startActivation(contentWindow: any, bridge: BackendBridge) {
13+
// $FlowFixMe[missing-local-annot]
1314
const onSavedPreferences = data => {
1415
// This is the only message we're listening for,
1516
// so it's safe to cleanup after we've received it.
@@ -96,6 +97,7 @@ export function createBridge(contentWindow: any, wall?: Wall): BackendBridge {
9697
if (wall == null) {
9798
wall = {
9899
listen(fn) {
100+
// $FlowFixMe[missing-local-annot]
99101
const onMessage = ({data}) => {
100102
fn(data);
101103
};

packages/react-devtools-inline/src/frontend.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export function createBridge(contentWindow: any, wall?: Wall): FrontendBridge {
3737
if (wall == null) {
3838
wall = {
3939
listen(fn) {
40+
// $FlowFixMe[missing-local-annot]
4041
const onMessage = ({data}) => {
4142
fn(data);
4243
};

packages/react-devtools-shared/src/backend/console.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export function patch({
197197
? targetConsole[method].__REACT_DEVTOOLS_ORIGINAL_METHOD__
198198
: targetConsole[method]);
199199

200+
// $FlowFixMe[missing-local-annot]
200201
const overrideMethod = (...args) => {
201202
let shouldAppendWarningStack = false;
202203
if (method !== 'log') {
@@ -335,6 +336,7 @@ export function patchForStrictMode() {
335336
? targetConsole[method].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__
336337
: targetConsole[method]);
337338

339+
// $FlowFixMe[missing-local-annot]
338340
const overrideMethod = (...args) => {
339341
if (!consoleSettingsRef.hideConsoleLogsInStrictMode) {
340342
// Dim the text color of the double logs if we're not

packages/react-devtools-shared/src/devtools/ContextMenu/ContextMenu.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export default function ContextMenu({children, id}: Props): React.Node {
104104
const menu = ((menuRef.current: any): HTMLElement);
105105
const container = containerRef.current;
106106
if (container !== null) {
107+
// $FlowFixMe[missing-local-annot]
107108
const hideUnlessContains = event => {
108109
if (!menu.contains(event.target)) {
109110
hideMenu();

packages/react-devtools-shared/src/devtools/views/Components/Components.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ function Components(_: {}) {
100100
onResizeEnd = () =>
101101
dispatch({type: 'ACTION_SET_IS_RESIZING', payload: false});
102102

103+
// $FlowFixMe[missing-local-annot]
103104
onResize = event => {
104105
const resizeElement = resizeElementRef.current;
105106
const wrapperElement = wrapperElementRef.current;

packages/react-devtools-shared/src/devtools/views/Components/EditableValue.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ export default function EditableValue({
3636
externalValue: value,
3737
});
3838

39+
// $FlowFixMe[missing-local-annot]
3940
const handleChange = ({target}) =>
4041
dispatch({
4142
type: 'UPDATE',
4243
editableValue: target.value,
4344
externalValue: value,
4445
});
4546

47+
// $FlowFixMe[missing-local-annot]
4648
const handleCheckBoxToggle = ({target}) => {
4749
dispatch({
4850
type: 'UPDATE',
@@ -58,6 +60,7 @@ export default function EditableValue({
5860
overrideValue(path, target.checked);
5961
};
6062

63+
// $FlowFixMe[missing-local-annot]
6164
const handleKeyDown = event => {
6265
// Prevent keydown events from e.g. change selected element in the tree
6366
event.stopPropagation();

packages/react-devtools-shared/src/devtools/views/Components/Element.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export default function Element({data, index, style}: Props): React.Node {
7575
}
7676
};
7777

78+
// $FlowFixMe[missing-local-annot]
7879
const handleClick = ({metaKey}) => {
7980
if (id !== null) {
8081
logEvent({
@@ -99,6 +100,7 @@ export default function Element({data, index, style}: Props): React.Node {
99100
setIsHovered(false);
100101
};
101102

103+
// $FlowFixMe[missing-local-annot]
102104
const handleKeyDoubleClick = event => {
103105
// Double clicks on key value are used for text selection (if the text has been truncated).
104106
// They should not enter the owners tree view.
@@ -220,6 +222,7 @@ export default function Element({data, index, style}: Props): React.Node {
220222
}
221223

222224
// Prevent double clicks on toggle from drilling into the owner list.
225+
// $FlowFixMe[missing-local-annot]
223226
const swallowDoubleClick = event => {
224227
event.preventDefault();
225228
event.stopPropagation();
@@ -233,13 +236,15 @@ type ExpandCollapseToggleProps = {
233236
function ExpandCollapseToggle({element, store}: ExpandCollapseToggleProps) {
234237
const {children, id, isCollapsed} = element;
235238

239+
// $FlowFixMe[missing-local-annot]
236240
const toggleCollapsed = event => {
237241
event.preventDefault();
238242
event.stopPropagation();
239243

240244
store.toggleIsCollapsed(id, !isCollapsed);
241245
};
242246

247+
// $FlowFixMe[missing-local-annot]
243248
const stopPropagation = event => {
244249
// Prevent the row from selecting
245250
event.stopPropagation();

packages/react-devtools-shared/src/devtools/views/Components/InspectedElementContextTree.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default function InspectedElementContextTree({
5353
// We add an object with a "value" key as a wrapper around Context data
5454
// so that we can use the shared <KeyValue> component to display it.
5555
// This wrapper object can't be renamed.
56+
// $FlowFixMe[missing-local-annot]
5657
const canRenamePathsAtDepth = depth => depth > 1;
5758

5859
if (isEmpty) {

packages/react-devtools-shared/src/devtools/views/Components/InspectedElementHooksTree.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ function HookView({
223223

224224
// Certain hooks are not editable at all (as identified by react-debug-tools).
225225
// Primitive hook names (e.g. the "State" name for useState) are also never editable.
226+
// $FlowFixMe[missing-local-annot]
226227
const canRenamePathsAtDepth = depth => isStateEditable && depth > 1;
227228

228229
const isCustomHook = subHooks.length > 0;

packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,9 @@ export default function KeyValue({
480480
return children;
481481
}
482482

483+
// $FlowFixMe[missing-local-annot]
483484
function DeleteToggle({deletePath, name, path}) {
485+
// $FlowFixMe[missing-local-annot]
484486
const handleClick = event => {
485487
event.stopPropagation();
486488
deletePath(path);

packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default function AutoSizeInput({
2727
value,
2828
...rest
2929
}: Props): React.Node {
30+
// $FlowFixMe[missing-local-annot]
3031
const onFocusWrapper = event => {
3132
const input = event.target;
3233
if (input !== null) {

packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ function Row({
171171
const [isAttributeValid, setIsAttributeValid] = useState(true);
172172
const [isValueValid, setIsValueValid] = useState(true);
173173

174+
// $FlowFixMe[missing-local-annot]
174175
const validateAndSetLocalAttribute = newAttribute => {
175176
const isValid =
176177
newAttribute === '' ||
@@ -183,6 +184,7 @@ function Row({
183184
});
184185
};
185186

187+
// $FlowFixMe[missing-local-annot]
186188
const validateAndSetLocalValue = newValue => {
187189
let isValid = false;
188190
try {
@@ -262,6 +264,7 @@ function Field({
262264
placeholder,
263265
value,
264266
}: FieldProps) {
267+
// $FlowFixMe[missing-local-annot]
265268
const onKeyDown = event => {
266269
switch (event.key) {
267270
case 'Enter':

packages/react-devtools-shared/src/devtools/views/Components/NewArrayValue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default function NewArrayValue({
4646

4747
// This is a bit of an unusual usage of the EditableName component,
4848
// but otherwise it acts the way we want for a new Array entry.
49+
// $FlowFixMe[missing-local-annot]
4950
const overrideName = (oldPath: any, newPath) => {
5051
const value = newPath[newPath.length - 1];
5152

packages/react-devtools-shared/src/devtools/views/Components/NewKeyValue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default function NewKeyValue({
4242
const [newPropKey, setNewPropKey] = useState<number>(0);
4343
const [newPropName, setNewPropName] = useState<string>('');
4444

45+
// $FlowFixMe[missing-local-annot]
4546
const overrideNewEntryName = (oldPath: any, newPath) => {
4647
setNewPropName(newPath[newPath.length - 1]);
4748
};

packages/react-devtools-shared/src/devtools/views/Components/Tree.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ function updateIndentationSizeVar(
540540
list.style.setProperty('--indentation-size', `${maxIndentationSize}px`);
541541
}
542542

543+
// $FlowFixMe[missing-local-annot]
543544
function InnerElementType({children, style, ...rest}) {
544545
const {ownerID} = useContext(TreeStateContext);
545546

packages/react-devtools-shared/src/devtools/views/Profiler/SidebarSelectedFiberInfo.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default function SidebarSelectedFiberInfo(_: Props): React.Node {
3838
rootID: ((rootID: any): number),
3939
});
4040

41+
// $FlowFixMe[missing-local-annot]
4142
const handleKeyDown = event => {
4243
switch (event.key) {
4344
case 'ArrowUp':

packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotSelector.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export default function SnapshotSelector(_: Props): React.Node {
8686

8787
let label = null;
8888
if (numFilteredCommits > 0) {
89+
// $FlowFixMe[missing-local-annot]
8990
const handleCommitInputChange = event => {
9091
const value = parseInt(event.currentTarget.value, 10);
9192
if (!isNaN(value)) {
@@ -100,10 +101,12 @@ export default function SnapshotSelector(_: Props): React.Node {
100101
}
101102
};
102103

104+
// $FlowFixMe[missing-local-annot]
103105
const handleClick = event => {
104106
event.currentTarget.select();
105107
};
106108

109+
// $FlowFixMe[missing-local-annot]
107110
const handleKeyDown = event => {
108111
switch (event.key) {
109112
case 'ArrowDown':
@@ -159,6 +162,7 @@ export default function SnapshotSelector(_: Props): React.Node {
159162
selectCommitIndex(filteredCommitIndices[nextCommitIndex]);
160163
};
161164

165+
// $FlowFixMe[missing-local-annot]
162166
const handleKeyDown = event => {
163167
switch (event.key) {
164168
case 'ArrowLeft':

packages/react-devtools-shared/src/devtools/views/SearchInput.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ export default function SearchInput({
4040

4141
const resetSearch = () => search('');
4242

43+
// $FlowFixMe[missing-local-annot]
4344
const handleChange = ({currentTarget}) => {
4445
search(currentTarget.value);
4546
};
47+
// $FlowFixMe[missing-local-annot]
4648
const handleKeyPress = ({key, shiftKey}) => {
4749
if (key === 'Enter') {
4850
if (shiftKey) {

packages/react-devtools-shared/src/devtools/views/hooks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export function useLocalStorage<T>(
191191
// Listen for changes to this local storage value made from other windows.
192192
// This enables the e.g. "⚛️ Elements" tab to update in response to changes from "⚛️ Settings".
193193
useLayoutEffect(() => {
194+
// $FlowFixMe[missing-local-annot]
194195
const onStorage = event => {
195196
const newValue = getValueFromLocalStorage();
196197
if (key === event.key && storedValue !== newValue) {

packages/react-devtools-shell/src/app/EditableProps/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424

2525
const initialData = {foo: 'FOO', bar: 'BAR'};
2626

27+
// $FlowFixMe[missing-local-annot]
2728
function reducer(state, action: {type: string}) {
2829
switch (action.type) {
2930
case 'swap':
@@ -80,6 +81,7 @@ class StatefulClass extends Component<Props, State> {
8081
state: 'California',
8182
};
8283

84+
// $FlowFixMe[missing-local-annot]
8385
handleChange = ({target}): any =>
8486
this.setState({
8587
state: target.value,

packages/react-devtools-shell/src/app/ErrorBoundaries/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class ErrorBoundary extends React.Component {
4949
}
5050
}
5151

52+
// $FlowFixMe[missing-local-annot]
5253
function Component({label}) {
5354
return <div>{label}</div>;
5455
}

packages/react-devtools-shell/src/app/Iframe/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default function Iframe(): React.Node {
1919

2020
const iframeStyle = {border: '2px solid #eee', height: 80};
2121

22+
// $FlowFixMe[missing-local-annot]
2223
function Frame(props) {
2324
const [element, setElement] = React.useState(null);
2425

0 commit comments

Comments
 (0)