|
|
|
|
|
by NikhilVerma
1719 days ago
|
|
I've been tinkering with an AST based grep tool. (It only works for JS/TS right now). It allows you to search for code in a more free-form way and I hope better code-searching tools like this can come out. Because searching by string is really primitive. (pun intended) Here is an example: npx @nikhilverma/ast-grep '{ meta: { title: "___" }}' src/ |
|
Have been working on something similar, although my use case is more about learning how code has changed across git commits: https://github.com/bugout-dev/locust
For Javascript/Typescript/React support, like you, I hooked into the Babel toolchain. Can't recommend it highly enough.
There's also a newish project called quick-lint-js which seems to have written their own from-scratch AST parser for JS, but I haven't tried it yet: https://github.com/quick-lint/quick-lint-js
Finally, another project that I know in this space is comby (I believe it is owned/maintained by the folks at Sourcegraph): https://comby.dev/
Don't know why I dumped all those links there. Just figured there may be something useful in them for you. Am also just super passionate about building knowledge about code bases by analyzing their ASTs. Nice to meet a fellow enthusiast. :)