-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
use jsdoc-type-pratt-parser #736
Conversation
I introduced a |
Holy cow! A truly impressive amount of work. And what appears to be a great validation of the Pratt parser strategy. As mentioned, I need a little rest time I think before exploring this, but this is really fantastic.
If it's accepted by catharsis, great. I think this test might have been just my testing to ensure the jsdoctypeparser grammar was being used for validation of some nuanced types, which in this case insisted on what the PEG grammar called a So, no problem dropping this test.
If it doesn't end up adding too much complexity, that sounds nice because some do seem to want to use our tooling just for semantics or for flexible tools. But we've already made explicit hints about the dangers of this mode so it wouldn't be the end of the world I think to drop it if it wasn't relatively easy to support (I see tsdoc mentions lax and strict modes on their site--more on tsdoc below). Btw, FWIW, I am wondering whether we should begin defaulting with "typescript" mode given its meeting needs which jsdoc has yet to support as far as I'm aware (e.g., with I'm not well familiar with whether the various documentation tools (including I can raise this in a separate issue, but figured you might have some thoughts even if you were not deeply familiar with all the tooling support either. Btw, one project I imagine you really would want to check out if you haven't (and if I haven't mentioned it already) is https://tsdoc.org/ . Haven't dug in too deeply myself, but seems like the kind of rigorous ambition we need (and the kind of rigor you have apparently already been applying to your parser). The community would really benefit I think though from a third-party standardized JSDoc specification collection/documentation site similar to this but which, while supporting TypeScript, was oriented in such a way as to make clear that it was not specific to TypeScript users. I think the official JSDoc site, while still under development and the ideal candidate for this, is simply not as responsive to more precise specification and third party concerns to meet the needs of the full community which works on top of JSDoc, while the TypeScript-based efforts I think may scare away some who either don't know TypeScript, or prefer to work with plain JSDoc + JavaScript (JJ). Perhaps such efforts can also lead to what I have elsewhere referred to as the goal of building up JJ with enough precision so as to be compileable directly or indirectly through TypeScript into Web Assembly (and validatable as with TypeScript). Btw, though it doesn't have much traffic (and I wouldn't be able to support it much anyways), you might nevertheless be interested in our Discord chat server which was intended to be an open space for jsdoc projects beyond our own: #601 . Anyways, exciting work, and look forward to reviewing when I feel I may have a good enough block of time to review--but it looks like you've already taken the pain out of our job, given how smoothly you've oriented the tool to integrate! |
To fully remove the In You can see this The real work of This file basically just:
|
I am in favour of defaulting to typescript. I have to say that I do not have to much familiarity with jsdoc tools as well. I just know that jsdoc itself does not support
Yeah that would be really nice. I would have loved something like that during development. I learned quite a bunch while developing this, but the documentation by jsdoc is really thin, the documentation on closure is better, but also not great. For typescript it is good, but also hard to find certain details. In the end I tried out many expression directly on the compilers. |
b45cc3b
to
918df38
Compare
…changes `JSDoc` to `Jsdoc` and uses a different AST format (jsdoc-type-pratt-parser over jsdoctypeparser)
…comment including global comments
b9d7485
to
c19d57e
Compare
🎉 This PR is included in version 35.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This is a proof of concept for using
jsdoc-type-pratt-parser
instead ofjsdoctypeparser
.There is one test failing. It expects this type expression to be invalid:
module:abc#event:foo-bar
. I don't exactly see why this should be the case, but I have to admit that I do not fully understand the event keyword in the jsdoc name paths. The value is accepted by jsdoc/catharsis.The permissive mode is not implemented in
jsdoc-type-pratt-parser
as there are no unambiguous results for certain expressions. I created a small helper function for this. Maybe I redesign the interface ofjsdoc-type-pratt-parser
a little to integrate this kind of helper into the library.