-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
RFC: Formally document prop function signatures #487
Comments
Would be nice if this was done in a way that allowed us to easily generate TS/Flow definitions. |
On that note, I've been considering completely abstracting our props definitions into a plain object. It has several benefits:
|
This will be done as a result of #623 which also includes tasks lists. We will also be able to parse this as a plain object and do with it what we may. Closing in favor of the other issue. |
Issue
Currently, props that take a function do not formally document their signatures. We have inconsistent/informal function signature documentation, like in Rating
onRate
:Not only is this inconsistent, but there is no validation nor linting to aide contribution. We should start formally documenting these.
Proposal
One approach could be to use standard JSDoc tags, which we are already parsing and using.
We could then construct a formal signature in
ComponentProps.js
with thedocs/app/docgenInfo.json
in any format. It could be placed in the description column or type column. It might look something like:Details:
We use a custom plugin
stardust/gulp/plugins/gulp-react-docgen.js
to parse doc blocks on propType and components. It handles parsing JSDoc tags withdoctrine
. All this info is written to a single JSON file,docs/app/docgenInfo.json
. There are React components for the docs that read this JSON info in order to generate descriptions, props info, etc.The text was updated successfully, but these errors were encountered: