Recommended abstract syntax tree for JavaScript/TypeScript
For context, I'm trying to create a Eslint plugin to detect JavaScript runtime compatibility issues.
So I need to keep track of variable types - a bit like how TypeScript keeps track of types.
I find the way Eslint exposes the AST to be quite limiting.
3 Replies
AST explorer
An online AST explorer.
select javascript and pick a parser
I mentioned JavaScript AST was too limiting. Eslint uses Espree AST, which is based off Acorn AST.
The main goal is to extract Nodejs types for detection.
JavaScript ASTs don't appear to provide type info, so you may have to write some crazy ass algorithm to detect types.
Found a possible answer from Solidjs channel:
Use typescript-eslint plugin to extract types.