Skip to content

Drop support for Babel AST #20095

Description

@fisker

Currently, we support both Babel and ESTree AST.

The difference can be found here https://babeljs.io/docs/babel-parser#output

Supporting both AST shapes increases maintenance costs.

For example, ChainExpression was not supported for a long time, it was first transformed to Babel AST.

Later, in #15806, we skipped ChainExpression everywhere; the approach doesn't end well, and it caused problems.

At last, we brought ChainExpression back in #16471 (issue, fixed in multiple PRs), but added lots of code for different ASTs.

My idea is to drop support for Babel AST in v4. Not doing this in a minor version since we have formatAST, this can break it. We also have babel-flow parser, which is not maintained; we don't want to deal with possible changes to it.

If we decide to remove it completely, it will be easier for us to maintain, and since we already tested '__babel_estree' parser, it shouldn't cause problems.

Even if we still want support Babel AST in formatAST, we can add a layer to transform the Babel AST to ESTree AST; luckily, it's easy to distinguish: in Babel AST the root node is File and Program in ESTree.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:javascriptIssues affecting JSstatus:needs discussionIssues needing discussion and a decision to be made before action can be takentype:refactorIssues about tackling technical debt

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions