emscripten-core / emscripten-core/emscripten
[tooling] Use eslint-scope for scope tracking in acorn-optimizer
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Looking at number of issues and custom code related to scope tracking, may I suggest looking at escope or its more active fork [eslint-scope](https://www.npmjs.com/package/eslint-scope)?
While Acorn takes care of AST, this battle-tested package specifically focuses on taking an AST and augmenting it with scope information, so you can tell from each node whether it's a local binding, global binding, what it resolves to and so on. Here's demo from the original project: https://mazurov.github.io/escope-demo/.
I know Emscripten generally tries not to rely on many 3rd-party packages, but given the complexity of scope tracking, especially in JS with all the different kinds of bindings and scopes, I really believe it would be worth it in terms of saved time on individual bugs.
_Originally posted by @RReverser in https://github.com/emscripten-core/emscripten/issues/20435#issuecomment-1756259848_
Contributor guide
Assessment
This issue has not been assessed yet.