-
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
Docs: Add Gutenberg-specific JSDoc recommendations #18920
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome, thanks for opening this PR with all the detailed guidelines. I'll take a closer look tomorrow 😍
I added a new section for this in ee70ae3. |
This looks all really good to me. One small consistency thing I noticed is the use of double quotes in string unions in the docs, but single quotes everywhere else. Is there a standard here? Examples... gutenberg/docs/contributors/coding-guidelines.md Lines 236 to 241 in 82bfa2f
gutenberg/docs/contributors/coding-guidelines.md Lines 250 to 252 in 82bfa2f
Other than that, really nice work! |
@dsifford Good call. I think subconsciously the I agree it's probably best to be consistent here. I'd probably lean toward the single quote. What do you think? |
I'm on team single-quote as well, but I'll leave that to you all with more skin in the game to make the final call. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some minor comments but overall I love the proposal. I don't know what are the next steps planned, but I would be fine with merging it as soon as possible. We should follow the guidelines while enabling TypeScript validation for packages and revisit all proposals once we encounter any issues in the actual usage.
Co-Authored-By: Grzegorz (Greg) Ziółkowski <[email protected]>
Co-Authored-By: Grzegorz (Greg) Ziółkowski <[email protected]>
Co-Authored-By: Grzegorz (Greg) Ziółkowski <[email protected]>
Thanks for the reviews! I think there might still be room for some further tweaking, but this should serve as a good starting-point I think. Let's get it in. |
Related: https://make.wordpress.org/core/2019/12/04/javascript-chat-summary-december-3-2019/
Related: #18838
This pull request seeks to add a new section to the Coding Guidelines documentation, describing specific extensions of the WordPress JavaScript Documentation Standards relevant for Gutenberg's distinct use of import semantics in organizing files, the use of TypeScript tooling for types validation, and automated documentation generation using
@wordpress/docgen
.→ Read the documentation
Open Questions:
There's a few things I chose not to include here, though might be relevant for additional detailing:
Clarifying distinctions between nullable, undefined, and optional parameter types, and between undefined and "(Added in ee70ae3)void
" returns@see
and@link
tags documented in the core guidelines (I feel this should be a revision made to those core guidelines, upon clarification){Object}
vs.{object}
, etc. Likewise to the above, this should be a revision made to the core guidelines. The current guidelines are consistent with what is enforced in Gutenberg withpreferredTypes
, but the recommendation is not made explicit.Testing Instructions:
As these changes only include edits to documentation, there is no expected impact on the application runtime.