Skip to content

Add a prefix to Flow specific AST node type #9344

Open

Description

@fisker

Add a prefix to the type of Node.

  1. Avoid future conflicts with new ES syntax. Eg: we already support Match syntax, but there is a proposal ECMAScript Pattern Matching, once it reachs higher stage, most likly ESTree will use Pattern or Match as a prefix for these nodes.
  2. Prettier currently supports 330 types of node (exclude 8 from flow v0.294), sometimes it's hard to tell which node is from Flow, typescript-eslint prefixes the node with TS, and our Angular related node also use NG as a prefix, they are easy to identify.

Activity

  1. changed the title [-]Add a prefix to Flow specific node type[/-] [+]Add a prefix to Flow specific AST node type[/+] on Dec 12, 2025
  2. gkz commented on Dec 18, 2025

    @gkz
    Member

    Something for us to consider. If we are going to redo our AST node output, now that Flow has adopted most of TypeScript's syntax, should we output TS-prefixed nodes where the syntax is the same? That would simplify some tooling. There would still be differences that would need to be handled however.

  3. fisker commented on Dec 20, 2025

    @fisker
    Author

    I'm not sure if this is a good idea.

    TSFoo with a parent FLOWBar seems weird to me, and may also confuse.

    If we want to align with TypeScript, I assume we will follow typescript-eslint.

    There are some bad designs for some of their AST shape. For example, the current AST in Flow for as const makes more sense to me. I already asked them to update the AST in the past few years, will we strictly follow?

    On the other hand,

    That would simplify some tooling.

    This is true.

    So, I'm fine with whatever decision you make.

  4. fisker commented on Jan 23, 2026

    @fisker
    Author

    RecordExpression was available in babel7, the proposal is dead now. https://github.com/tc39/proposal-record-tuple

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions