Support for ES6.
I tried to generate docs for es6 jsx files. No changes are included in docs apart from file names. Is this supported?
@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 Yes I am using ES6 classes. If i add any comments they too are not picked up.
@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?
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 -- 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.