Refactor: remove jsdoc-api from the docs app#2051
Conversation
|
d4f3c51 to
432b3e0
Compare
|
|
||
| render() { | ||
| const { layout } = this.props | ||
| renderGenericRows() { |
There was a problem hiding this comment.
now it can display generic parameters
There was a problem hiding this comment.
Pull Request Overview
Refactors the documentation generation to drop jsdoc-api in favor of the TypeScript compiler API, updates JSDoc comments for utility modules, and enhances the docs UI to surface generic type parameters.
- Switch parsing from
jsdoc-apito TypeScript compiler API in build scripts. - Remove outdated module-level JSDoc blocks and add inline JSDoc for utilities.
- Extend documentation components (
Params,Returns) to support generic type parameters.
Reviewed Changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/docs/buildScripts/utils/getJSDoc.mts | Replaced jsdoc-api usage with TypeScript compiler API parsing. |
| packages/docs/src/Params/props.ts | Added genericParameters prop support but missing in allowedProps. |
| packages/docs/src/Params/index.tsx | Extended UI to render a Generic Parameters table. |
| packages/ui-position/src/calculateElementPosition.ts | Added JSDoc block but missing module name in @module tag. |
| packages/ui-dom-utils/src/findTabbable.ts | Reorganized code but removed JSDoc for findTabbable. |
Comments suppressed due to low confidence (4)
packages/ui-position/src/calculateElementPosition.ts:79
- The
@moduletag should include the module name (e.g.@module calculateElementPosition) so the docs generator can correctly associate comments with this function.
* @module
packages/ui-dom-utils/src/findTabbable.ts:44
- The
findTabbablefunction no longer has its JSDoc comment after the refactor; add a descriptive block above the function to ensure it’s documented.
function findTabbable(el?: UIElement, shouldSearchRootNode?: boolean) {
packages/docs/src/Params/index.tsx:62
- [nitpick] The new
genericParametersrendering logic isn’t covered by existing tests. Consider adding unit tests for this branch to guarantee it displays correctly.
renderGenericRows() {
packages/docs/buildScripts/utils/getClientProps.mts:44
- [nitpick] The previous
if (doc.undocumented) returncheck was removed, so docs without JSDoc may now slip through. Verify this change or reintroduce filtering forundocumentedentries if unintended.
.filter((doc) => !doc.private)
| <Table.Body> | ||
| <Table.Row> | ||
| <Table.Cell> | ||
| <code>{this.props.types.type}</code> |
There was a problem hiding this comment.
[nitpick] Rendering this.props.types.type directly may display undefined when no return type exists. Provide a fallback or conditional rendering to handle missing types.
| <code>{this.props.types.type}</code> | |
| <code>{this.props.types.type ?? 'N/A'}</code> |
461b904 to
feb99c4
Compare
| The **source code** is parsed with [JSDoc](https://jsdoc.app/) with the exeption of react components, which are parsed by [react-docgen](https://react-docgen.dev/) and it provides `type` information for the docs. | ||
| The **source code** is parsed with the [TypeScript compiler API](https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API) with the exception of React components, which are parsed by [react-docgen](https://react-docgen.dev/). These tools parse out JSDoc comments, type information of React component props and types for functions. | ||
|
|
||
| ## Utility functions |
There was a problem hiding this comment.
Heres the high level information how it works
balzss
left a comment
There was a problem hiding this comment.
nice work. good to see another legacy dependency gone
It uses the TypeScript compiler API instead of
JSDoc-api JSDoc is outdated and its meant for
JavaScript projects.
We use this to parse everything thats not a
React component or a Markdown file.
(the utilities menu in the sidebar).
It gets type information for functions from the
TypeScript types, so it can be deleted in the
jsdoc (the {Object} part in @param {Object} bla).
For non-function or complex utilities
it gets the info from the JSDoc so we need to
keep it (e.g. withStyle, contains).
Removed DateTime and conversions and some
custom PropTypes from the doc since they were
parsed in a special way and contained no useful
info.
note that it cannot parse types if the jsdoc is
at the export statement
Changes:
JSDoc-apiJSDoc is outdated and its meant for JavaScript projects. We use this to parse everything thats not a React component or a Markdown file. (theutilitiesmenu in the sidebar).{Object}part in@param {Object} bla).withStyle,contains).DateTimeandconversionsand some custom PropTypes from the doc since they were parsed in a special way and contained no useful info.To test:
utilitiessubmenu, they should display equal or more informationCloses INSTUI-4574