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

react-docgen cannot extract comments with hermes-parser #835

Open
Brianzchen opened this issue Aug 25, 2023 · 3 comments
Open

react-docgen cannot extract comments with hermes-parser #835

Brianzchen opened this issue Aug 25, 2023 · 3 comments

Comments

@Brianzchen
Copy link

Component comment blocks as well as proptype comments cannot be extracted with react docgen when using babel hermes-parser plugin https://www.npmjs.com/package/babel-plugin-syntax-hermes-parser. This parser is essential when running an application with flow

This issue explains it a bit more facebook/hermes#1098. Would it be possible to improve the default handlers to support this?

@danez
Copy link
Collaborator

danez commented Aug 25, 2023

Interesting, first time I heard about this. I will check, but I'm not confident I can do something from our side.

@Brianzchen
Copy link
Author

I've managed to write an albeit hacky solution to extract component and prop descriptions but now I'm struggling to figure out how to jump cross components to find the spread objects and their descriptions. Can you offer some advice here?

import { type B } from '../B';

type A = {
 ...B
}

Sadly it seems there's no documentation on handlers (or much else) so I've just been logging the object structure + trying to decipher the default handlers to try get what I need.

@Brianzchen
Copy link
Author

I've just made my component type definition more complicated which has unfortunately broken my own plugin.. The ones written in this lib to handle all other docs still works as expected. Would be so great if they worked on comments 😢

@danez did you get a chance to look into it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants