Skip to content

Commit b83baf6

Browse files
authored
Transform updates to support Flow this annotation syntax (#25918)
Flow introduced a new syntax to annotated the context type of a function, this tries to update the rest and add 1 example usage. - 2b1fb91 already added the changes required for eslint. - Jest transform is updated to use the recommended `hermes-parser` which can parse current and Flow syntax and will be updated in the future. - Rollup uses a new plugin to strip the flow types. This isn't ideal as the npm module is deprecated in favor of using `hermes-parser`, but I couldn't figure out how to integrate that with Rollup.
1 parent 2619886 commit b83baf6

File tree

16 files changed

+95
-8
lines changed

16 files changed

+95
-8
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@
6262
"fbjs-scripts": "1.2.0",
6363
"filesize": "^6.0.1",
6464
"flow-bin": "^0.190.0",
65+
"flow-remove-types": "^2.196.1",
6566
"glob": "^7.1.6",
6667
"glob-stream": "^6.1.0",
6768
"google-closure-compiler": "^20200517.0.0",
6869
"gzip-size": "^5.1.1",
6970
"hermes-eslint": "^0.9.0",
71+
"hermes-parser": "^0.9.0",
7072
"jasmine-check": "^1.0.0-rc.0",
7173
"jest": "^26.6.3",
7274
"jest-cli": "^26.6.3",

packages/react-dom-bindings/src/shared/DOMNamespaces.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @noflow
68
*/
79

810
export const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';

packages/react-dom-bindings/src/shared/ReactControlledValuePropTypes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @noflow
68
*/
79

810
const hasReadOnlyValue = {

packages/react-dom-bindings/src/shared/assertValidProps.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @noflow
68
*/
79

810
import voidElementTags from './voidElementTags';

packages/react-dom/src/test-utils/ReactTestUtils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @noflow
68
*/
79

810
import * as React from 'react';

packages/react-native-renderer/src/legacy-events/ResponderEventPlugin.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @noflow
68
*/
79

810
import {

packages/react-server/src/ReactFizzServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,7 @@ function erroredTask(
16681668
}
16691669
}
16701670

1671-
function abortTaskSoft(task: Task): void {
1671+
function abortTaskSoft(this: Request, task: Task): void {
16721672
// This aborts task without aborting the parent boundary that it blocks.
16731673
// It's used for when we didn't need this task to complete the tree.
16741674
// If task was needed, then it should use abortTask instead.

packages/react/src/ReactForwardRef.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @noflow
68
*/
79

810
import {REACT_FORWARD_REF_TYPE, REACT_MEMO_TYPE} from 'shared/ReactSymbols';

packages/react/src/ReactMemo.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @noflow
68
*/
79

810
import {REACT_MEMO_TYPE} from 'shared/ReactSymbols';

packages/shared/forks/invokeGuardedCallbackImpl.www.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @noflow
68
*/
79

810
// Provided by www

0 commit comments

Comments
 (0)