Skip to content
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

Debug docgen behaviour #1425

Closed
wants to merge 7 commits into from
Closed

Debug docgen behaviour #1425

wants to merge 7 commits into from

Conversation

siddharthkp
Copy link
Member

@siddharthkp siddharthkp commented Sep 15, 2021

Chasing #1419

⚠️ This PR is an exploration, don't need to merge it

 

From what I'm noticing in fixtures from react-docgen-typescript, there is a very specific syntax that works for docgen, which we might want to adopt

These are the components that have missing data:

┌───────────────────────────────────────────┬──────┬───────┬────────────────────────────┐
│                                      path │ docs │ props │                displayName │
├───────────────────────────────────────────┼──────┼───────┼────────────────────────────┤
│                            Breadcrumb.tsx │    ✓ │     ✕ │                 Breadcrumb │
│                            FilterList.tsx │    ✓ │     ✕ │                 FilterList │
│                               Overlay.tsx │    ✓ │     ✕ │                    Overlay │
│                             TextInput.tsx │    ✕ │     ✕ │                            │
│                         ThemeProvider.tsx │    ✕ │     ✕ │                            │
│                    ActionList/Divider.tsx │    ✓ │     ✕ │                    Divider │
│                       ActionList/List.tsx │    ✓ │     ✕ │                 ActionList │
│       AnchoredOverlay/AnchoredOverlay.tsx │    ✓ │     ✕ │            AnchoredOverlay │
│                     Button/ButtonBase.tsx │    ✓ │     ✕ │          buttonSystemProps │
│                   Button/ButtonStyles.tsx │    ✕ │     ✕ │                            │
│             Dialog/ConfirmationDialog.tsx │    ✓ │     ✕ │                 useConfirm │
│                         Dialog/Dialog.tsx │    ✓ │     ✕ │                     Dialog │
│           DropdownMenu/DropdownButton.tsx │    ✕ │     ✕ │                            │
│                      Pagination/model.tsx │    ✕ │     ✕ │                            │
│                         Portal/Portal.tsx │    ✓ │     ✕ │         registerPortalRoot │
│                 SelectMenu/SelectMenu.tsx │    ✕ │     ✕ │                            │
│          SelectMenu/SelectMenuContext.tsx │    ✕ │     ✕ │                            │
│           SelectMenu/SelectMenuFilter.tsx │    ✓ │     ✕ │           SelectMenuFilter │
│ SelectMenu/SelectMenuLoadingAnimation.tsx │    ✓ │     ✕ │ SelectMenuLoadingAnimation │
│            SelectMenu/SelectMenuModal.tsx │    ✕ │     ✕ │                            │
│                                     Total │      │       │                         20 │
└───────────────────────────────────────────┴──────┴───────┴────────────────────────────┘

 

1. forwardRef

- import React from 'react'
- const Component = React.forwardRef<HTMLButtonElement, ComponentProps>

+ import { forwardRef } from 'react'
+ const Component = forwardRef<HTMLButtonElement, ComponentProps>

2. TextInput

After making the above change, TextInput shows up in docgen output, but not it's props.

Trying to make the smallest reproducible bug, it seems like docgen isn't able to parse this specific line. Still looking for the fix.

 

How to run this test:

To get the list

cd debug && node list.ts

To debug syntax:

cd debug && node docgen.ts

then keep an eye on debug/output.json

 

I don't love the idea of changing how we write code for tooling needs, but because most of these are surface level changes that don't affect readability of the code, I don't mind either 🤷‍♀️

@changeset-bot
Copy link

changeset-bot bot commented Sep 15, 2021

⚠️ No Changeset found

Latest commit: e3161af

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Sep 15, 2021

size-limit report 📦

Path Size
dist/browser.esm.js 48.59 KB (0%)
dist/browser.umd.js 48.85 KB (0%)

@colebemis
Copy link
Contributor

I don't love the idea of changing how we write code for tooling needs, but because most of these are surface level changes that don't affect readability of the code, I don't mind either 🤷‍♀️

Agreed. I'm happy to change the way we write components if it also makes our code simpler and easier to reason about 👍

@siddharthkp siddharthkp added the docs Documentation label Sep 20, 2021
@siddharthkp siddharthkp linked an issue Sep 24, 2021 that may be closed by this pull request
3 tasks
@siddharthkp siddharthkp added bug Something isn't working developer experience enhancement New feature or request and removed bug Something isn't working enhancement New feature or request developer experience labels Sep 24, 2021
@siddharthkp siddharthkp self-assigned this Sep 24, 2021
@siddharthkp siddharthkp added docs Documentation experimental and removed docs Documentation experimental labels Oct 3, 2021
@siddharthkp
Copy link
Member Author

siddharthkp commented Nov 19, 2021

I'm not working on this pull request anymore :)

@joshblack joshblack deleted the sid/debug-docgen branch January 19, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants