Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Playground to understand how to use jsdoc and jsdoc-parser to generate API documentation and how it relates to #13329
As per the instructions in the core ticket, in the Gutenberg root folder, execute:
and open the generated file
parsed-jsdoc.json(see here the raw formatted file).Questions
Here's a set of questions I don't have answers for yet:
How to restrict generated documentation to the Public API?
Example:
packages/dompackage.Symbols that should be documented (and are):
Symbols that we shouldn't be documented (and are):
In this package, we should document the named export
focus, but we don't. This is a tricky one. Here's what jsdoc finds and what not:domnamespace, we should usedom.focus.focusable.findinstead.domnamespace, we should usedom.focus.focusable.findinstead.How to document symbols that don't have a JSDoc comment?
In the above example, jsdoc didn't report the existence of
focus.tabbable.findbecause it didn't have any JSDoc comment.How to document functions exported as variables
packages/a11ypackage. We should have two functions documented (setup,speak) but they aren't.This is a common pattern:
export const myFunction = ( ... ) => { ... }?. It looks like jsdoc classifies this as amemberand doesn't provide input/output information.How to document default exports?
Example:
packages/api-fetchpackage. The default export isn't documented.Example:
packages/components. It looks like jsdoc needs a@moduletag to detect thedefaultexports. That could solve the particular case ofpackages/api-fetch, but how would we document default exports in sub-folders?How to document renamed exports?
Example:
packages/block-library. It should document a few functionschildren,node,serialize,parseexported throughapi.jsthat are renamed from the default export.Example:
packages/components. Almost all components are exported insrc/index.jsby renaming the default exports.Example:
packages/compose. Besides the renamed default exports, we also should report thecomposenamed export that is renamed fromflowRight.How to document export chains?
packages/editor.The editor exports a variety of things. We should document
mediaUploadas a function in thewp.editornamespace. Because it's exported through a export chain it isn't properly reported by jsdoc (it is reported, but its name is "exports", it should bemediaUpload).