better-docs
better-docs copied to clipboard
Not displaying React propTypes isRequired in the document
Tried the sample react component with proptypes. The example gets generated fine but required is 'No' even if isRequired is added to proptype.
`/**
- Some documented component
- @component
- @example
- const text = 'some example text'
- return (
-
- )
*/
const Documented = (props) => {
const { text } = props
return (
{text}) }
Documented.propTypes = { /** * Text is a text */ text: PropTypes.string.isRequired, }
export default Documented`
This is my config
{ "tags": { "allowUnknownTags": true, "dictionaries": ["jsdoc"] }, "source": { "include": ["src"], "includePattern": ".+\\.js(doc|x)?$", "excludePattern": "(^|\\/|\\\\)_" }, "plugins": [ "plugins/markdown", "node_modules/better-docs/component", "node_modules/better-docs/category" ], "templates": { "better-docs": { "name": "My React components" } }, "opts": { "destination": "docs", "encoding": "utf8", "recurse": true, "verbose": true, "readme": "README.md", "template": "node_modules/better-docs/" } }
Did you ever find a solution for this? I am facing the same problem, I just set JSDoc and better-docs up in my react app. And when I set up the first component, it showed it correctly, but now that I was in the process of making docs for the rest of the components, I noticed that the isRequired always says 'No'. Even on the first component where I saw it say 'Yes' in the beginning.