gulp-react-docs icon indicating copy to clipboard operation
gulp-react-docs copied to clipboard

Support for ES6.

Open rahul1059 opened this issue 8 years ago • 5 comments

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

rahul1059 avatar Mar 01 '16 10:03 rahul1059

@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.

marsjosephine avatar Mar 01 '16 21:03 marsjosephine

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

rahul1059 avatar Mar 02 '16 04:03 rahul1059

@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?

marsjosephine avatar Mar 02 '16 16:03 marsjosephine

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

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

Version: 5.0.0

</Jumbotron> ); } }

export default HelloWorld;

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

rahul1059 avatar Mar 04 '16 09:03 rahul1059

@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.

marsjosephine avatar Mar 04 '16 22:03 marsjosephine