Skip to content
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

Support for ES6. #3

Open
rahul1059 opened this issue Mar 1, 2016 · 5 comments
Open

Support for ES6. #3

rahul1059 opened this issue Mar 1, 2016 · 5 comments

Comments

@rahul1059
Copy link

I tried to generate docs for es6 jsx files. No changes are included in docs apart from file names.
Is this supported?

@marsjosephine
Copy link
Contributor

@rahul1059 -- are you using ES6 classes by any chance? Where propTypes might be defined like the following:

export class Example extends React.Component {
    render() {
        return (<div>Hello world!</div>);
    }
}

Example.propTypes = { num: React.PropTypes.number };

Example.defaultProps = { num: 0 };

During testing we realized that react-docgen had trouble extracting the propTypes from React component defined using ES6 classes.

@rahul1059
Copy link
Author

@marsjosephine Yes I am using ES6 classes. If i add any comments they too are not picked up.

@marsjosephine
Copy link
Contributor

@rahul1059 -- looks like the version of react-docgen we're using should indeed be able to parse ES6 JSX files. I just did a quick sanity check locally and looks like it's working.

Would you mind providing us with some more detail about your setup? Perhaps a copy of the component you're trying to parse? Or what your gulp tasks look like?

@rahul1059
Copy link
Author

import React from 'react';
import { Jumbotron } from 'react-bootstrap';

// Hello World
class HelloWorld extends React.Component {
render() {
return (

Version: 5.0.0



);
}
}

export default HelloWorld;

Anyway thanks for help, i tried using esdoc and its working for me.

@marsjosephine
Copy link
Contributor

@rahul1059 -- it doesn't look like the code above has any propTypes defined or comments for the HelloWorld component. Were you trying to generate documentation for the component that you imported into that file (Jumbotron) instead? gulp-react-docs will only be able to generate documentation for the component, not also for components that are being imported into your file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants