Skip to content

Commit 2eb0862

Browse files
wbinnssmithfkling
authored andcommitted
Update flow and use flow-typed; fill in gaps introduced (#121)
This updates react-docgen to use the latest version of flow. It also moves our libdefs to a directory called flow-typed, which is now a common convention (see flowtype/flow-typed). It also fills in a couple of gaps introduced by updating to the latest flow.
1 parent be78a60 commit 2eb0862

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

.flowconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
[include]
55

66
[libs]
7-
flow/
87

98
[options]
File renamed without changes.
File renamed without changes.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"babel-preset-stage-1": "^6.5.0",
4848
"cross-spawn": "^4.0.0",
4949
"eslint": "^3.2.2",
50-
"flow-bin": "^0.30.0",
50+
"flow-bin": "^0.31.0",
5151
"jest-cli": "^14.1.0",
5252
"rimraf": "^2.3.2",
5353
"temp": "^0.8.1"

src/utils/isStatelessComponent.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ function returnsJSXElementOrReactCreateElementCall(path) {
104104
if (resolvedValue && types.ObjectExpression.check(resolvedValue.node)) {
105105
var resolvedMemberExpression = namesToResolve
106106
.reduce((result, path) => { // eslint-disable-line no-shadow
107+
if (!path) {
108+
return result;
109+
}
110+
107111
if (result) {
108112
result = getPropertyValuePath(result, path.node.name);
109113
if (result && types.Identifier.check(result.node)) {
@@ -113,7 +117,10 @@ function returnsJSXElementOrReactCreateElementCall(path) {
113117
return result;
114118
}, resolvedValue);
115119

116-
if (returnsJSXElementOrReactCreateElementCall(resolvedMemberExpression)) {
120+
if (
121+
!resolvedMemberExpression ||
122+
returnsJSXElementOrReactCreateElementCall(resolvedMemberExpression)
123+
) {
117124
visited = true;
118125
return false;
119126
}

0 commit comments

Comments
 (0)