fkling / astexplorer

A web tool to explore the ASTs generated by various parsers.
https://astexplorer.net/
MIT License
6.05k stars 711 forks source link

feat: adding JSDoc-Block-capable parser #639

Open brettz9 opened 2 years ago

brettz9 commented 2 years ago

Describe the bug

This is a feature request for supporting the @es-joy/jsdoc-eslint-parser.

Although the parser is still experimental and has low adoption, we are using the kind of AST it produces within eslint-plugin-jsdoc, making it desirable for our users to have a means of introspecting on JSDoc Block AST.

Expected behavior

I would like to see jsdoc-eslint-parser available in the dropdown so as to allow introspection on its AST.

Additional context

Without standardization (and lack of adequate support for JSDoc structure within the pseudo-standards that do exist) and a consequent lack of structured comment support in popular parsing tools, there remains a strong need for a JSDoc-aware parser.

Although jsdoc-eslint-parser does not bring such AST to regular TypeScript syntax (@typescript-eslint/parser has an issue that might bring that, but the priority there is less due to regular TypeScript files apparently ignoring JSDoc), this parser does allow AST where it not only serves a purpose toward ensuring proper documentation, but also a type-checking purpose, given that the checkJs option of TypeScript used with its tsc tool allows checking regular JavaScript (along with TypeScript-flavored JSDoc) for type usage accuracy and this JSDoc-aware parser can support such plain JavaScript.

So despite this being a new, experimental tool, with it allowing for the definition of rules and user-custom rules which target JSDoc precisely, I think it is a good candidate for your AST explorer tool. Thanks!