-
-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For #6 Support ES6 export declarations #12
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Sweet! I will take a close look later today. Thank you for this! |
@@ -47,6 +48,17 @@ function findExportedReactCreateClass( | |||
visitDoWhileStatement: ignore, | |||
visitForStatement: ignore, | |||
visitForInStatement: ignore, | |||
visitExportDeclaration: function(path) { | |||
path = resolveToCallExpression(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmh, do we have to introduce resolveToCallExpression
? My approach would have been to just extract the path from ExportDeclaration
that we are interested in, and run resolveToValue
on that.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, seems we can change here with
path = resolveToValue(path.get('declaration'));
and add the conditions to resolveToValue
if (types.VariableDeclaration.check(node)) {
return resolveToValue(path.get('declarations', 0))
} else if (types.VariableDeclarator.check(node)) {
if (node.init) {
return resolveToValue(path.get('init'));
}
}
I will push another commit to update the change.
however, I feel the resolveToValue
need to do some refact when we added a lot of conditions.
Thanks.
It doesn't seem like this would support support export {
comeponent,
something else
}; or does it?
Not sure. I think if the need arises we can still that.
Seems fine to me. |
Cool. I feel we are not necessary to write like that. With react-docgen's help, we can get docs so easy, in my last projects. So I put the docs tool in my testing repo (preview) Recently, we need to update to ES6, that why I try to make the update for react-docgen. |
#6
This way is done.
Should we support this?
And not sure, is it ok, to support ES6 module and CommonJS in one handler.