Skip to content

Commit

Permalink
prettier on "Flow: inference_mode=constrain_writes"
Browse files Browse the repository at this point in the history
This mode is going to be the new default in Flow going forward.
There was an unfortuante large number of suppressions in this update.

More on the changes can be found in this [Flow blog post](https://medium.com/flow-type/new-flow-language-rule-constrained-writes-4c70e375d190).

Added some of the required annotations using the provided codemod:

```sh
node_modules/.bin/flow codemod annotate-declarations --write .
```

[ghstack-poisoned]
  • Loading branch information
kassens committed Oct 4, 2022
2 parents 980d023 + f266852 commit adfc69d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
4 changes: 3 additions & 1 deletion packages/react-devtools-shared/src/devtools/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ const resourceConfigs: Map<Resource<any, any, any>, Config> = new Map();
function getEntriesForResource(
resource: any,
): Map<any, any> | WeakMap<any, any> {
let entriesForResource: Map<any, any> | WeakMap<any, any> = ((entries.get(resource): any): Map<any, any>);
let entriesForResource: Map<any, any> | WeakMap<any, any> = ((entries.get(
resource,
): any): Map<any, any>);
if (entriesForResource === undefined) {
const config = resourceConfigs.get(resource);
entriesForResource =
Expand Down
8 changes: 4 additions & 4 deletions packages/react-devtools-shared/src/devtools/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,10 +806,10 @@ export default class Store extends EventEmitter<{

currentElement =
currentElement.parentID !== 0
// $FlowFixMe[incompatible-type] found when upgrading Flow
? this.getElementByID(currentElement.parentID)
// $FlowFixMe[incompatible-type] found when upgrading Flow
: null;
? // $FlowFixMe[incompatible-type] found when upgrading Flow
this.getElementByID(currentElement.parentID)
: // $FlowFixMe[incompatible-type] found when upgrading Flow
null;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ const resource: Resource<
return request.promise;
}

let resolveFn:
| ResolveFn
| ((result: Promise<StyleAndLayoutFrontend> | StyleAndLayoutFrontend) => void) = ((null: any): ResolveFn);
let resolveFn:
| ResolveFn
| ((
result: Promise<StyleAndLayoutFrontend> | StyleAndLayoutFrontend,
) => void) = ((null: any): ResolveFn);
const promise = new Promise(resolve => {
resolveFn = resolve;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ const resource: Resource<
return request.promise;
}

let resolveFn:
| ResolveFn
| ((
result: Promise<Array<SerializedElement>> | Array<SerializedElement>
) => void) = ((null: any): ResolveFn);
let resolveFn:
| ResolveFn
| ((
result: Promise<Array<SerializedElement>> | Array<SerializedElement>,
) => void) = ((null: any): ResolveFn);
const promise = new Promise(resolve => {
resolveFn = resolve;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* @flow
*/

import type { Element } from './types';import * as React from 'react';
import type {Element} from './types';
import * as React from 'react';
import {useContext, useMemo} from 'react';
import {TreeStateContext} from './TreeContext';
import {SettingsContext} from '../Settings/SettingsContext';
Expand Down

0 comments on commit adfc69d

Please sign in to comment.