Skip to content

Commit f4d627c

Browse files
hramosfacebook-github-bot
authored andcommitted
Fix failure due to missing Metro flow types
Summary: Fixes the Flow failure due to an undefined Ast type. Before: ``` $ npm run flow -- check > [email protected] flow /Users/hramos/git/react-native > flow "check" Error: local-cli/__tests__/fs-mock-test.js:27 27: beforeEach(() => { ^^^^^^^^^^ beforeEach. Could not resolve name Error: local-cli/__tests__/fs-mock-test.js:53 53: expect(content).toEqual('beep'); ^^^^^^ expect. Could not resolve name Error: local-cli/__tests__/fs-mock-test.js:88 88: expect(content).toEqual('hello, world!'); ^^^^^^ expect. Could not resolve name Error: local-cli/__tests__/fs-mock-test.js:100 100: expect(content).toEqual('hello, world!'); ^^^^^^ expect. Could not resolve name Error: node_modules/metro/src/Bundler/util.js.flow:46 46: ): Ast { ^^^ Ast. Could not resolve name Error: node_modules/metro/src/ModuleGraph/worker/collect-dependencies.js.flow:283 283: const xp = (module.exports = (ast: Ast) => ^^^ Ast. Could not resolve name Error: node_modules/metro/src/assetTransformer.js.flow:29 29: ): Promise<{ast: Ast}> { ^^^ Ast. Could not resolve name ``` After ``` $ npm run flow -- check > [email protected] flow /Users/hramos/git/react-native > flow "check" Error: local-cli/__tests__/fs-mock-test.js:27 27: beforeEach(() => { ^^^^^^^^^^ beforeEach. Could not resolve name Error: local-cli/__tests__/fs-mock-test.js:53 53: expect(content).toEqual('beep'); ^^^^^^ expect. Could not resolve name Error: local-cli/__tests__/fs-mock-test.js:88 88: expect(content).toEqual('hello, world!'); ^^^^^^ expect. Could not resolve name Error: local-cli/__tests__/fs-mock-test.js:100 100: expect(content).toEqual('hello, world!'); ^^^^^^ expect. Could not resolve name ``` [ GENERAL ] [ BUGFIX] [ .flowconfig ] - Have Flow ignore Metro node_nodules Closes #17187 Differential Revision: D6572303 Pulled By: hramos fbshipit-source-id: aa256b9725970fcc2a6da6578c83e7c0875e3cfd
1 parent eca51eb commit f4d627c

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

Diff for: .flowconfig

+4
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@
2222
; Ignore polyfills
2323
.*/Libraries/polyfills/.*
2424

25+
; Ignore metro
26+
.*/node_modules/metro/.*
27+
2528
[include]
2629

2730
[libs]
2831
Libraries/react-native/react-native-interface.js
2932
flow/
33+
flow-github/
3034

3135
[options]
3236
emoji=true

Diff for: flow-github/metro.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Copyright (c) 2017-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
9+
* @flow
10+
*/
11+
12+
declare module 'metro' {
13+
declare module.exports: any;
14+
}
15+
16+
declare module 'metro/src/lib/TerminalReporter' {
17+
declare module.exports: any;
18+
}
19+
20+
declare module 'metro/src/HmrServer' {
21+
declare module.exports: any;
22+
}

Diff for: local-cli/templates/HelloWorld/_flowconfig

+4
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@
1616
; Ignore polyfills
1717
.*/Libraries/polyfills/.*
1818

19+
; Ignore metro
20+
.*/node_modules/metro/.*
21+
1922
[include]
2023

2124
[libs]
2225
node_modules/react-native/Libraries/react-native/react-native-interface.js
2326
node_modules/react-native/flow/
27+
node_modules/react-native/flow-github/
2428

2529
[options]
2630
emoji=true

0 commit comments

Comments
 (0)