-
Notifications
You must be signed in to change notification settings - Fork 64
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
feat: support for JSDoc extraction #248
base: main
Are you sure you want to change the base?
Conversation
I am marking this as draft for now, until I make sure it all works well, since a couple issues have risen from my initial testing. Also, yes, I know my code isn't the best, as this is the prototype version. Any constructive criticism and suggestions for improvement are appreciated! |
Marking this as ready for review after all testing I could do was done, would appreciate feedback! |
I migrated from TypeScript, in stead I used regex patterns, but this was a big change so I may or may not have broken something. Would appreciate feedback! |
@antfu sorry for being impatient, but is there any updates on this? I do think this will greatly improve overall DX. |
@pi0 is there anything else I should include/change? |
@danielroe I forgot to ask, should I make a test case for this? I'm not the best at writing tests (in fact, I have never done it) but I can certainly try if it's needed, I'm just not sure what the conditions for writing tests are. |
I think, in general, the quality of this PR does not match the standard:
I am sorry for taking long to respond. I think the feature itself is legit and would indeed benefit the DX if we implement it well. However, we would need time to think of a more robust solution. |
I'll return this to a draft again while I make some more tests |
There is a slight issue. I don't think there's a way to make this more framework agnostic, mainly because of the existent changes between framework. Yes, this is based on conventions, and yes, it's not really agnostic. But it's reliable, and it catches all the edge cases. How would you go about making it not rely on conventions? |
Attempt number 3, I have completely reworked the way I handle this, and now I am utilizing map and reading the files to rely as little as possible on conventions. When the file isn't found through package.json it checks all extension, otherwise will just return null. Would love to hear your opinion! |
Converting to a draft to work on the discussed implementation. |
Sorry i will try to be back on this as soon as I can (probably next week, sorry again). For the digest, we have talked with @antfu and @GalacticHypernova to use of an AST parser to extract JSDocs. untyped already exposes a bundled AST parser as well as tools that allow this. However thinking more, since mlly also plans to switch to AST parsers (unjs/mlly#219) + the fact that we probably don't want to make users (of all these packages) have multiple versions of AST parser, I think probably best course of action would be wait for AST switch in mlly + try to use babel parser (which supports TypeScript) or untyped for making a full proof on concept here in this PR. Alternatives that probably not work:
|
This PR aims to extend the auto import process to allow for automatic JSDoc extraction for better in-IDE documentation.
Initially thought of using for nuxt, I figured this might benefit all tools that may use unimport.