Skip to content

flow-remove-types throws a syntax error on ES import attributes #9347

Closed

Description

@sangafabrice

flow-remove-types version: 2.295.0
Flow version: 0.295.0

Actual behavior

The Flow parser successfully parses the following script without any errors:

/** @flow @file index.js */
import ruleset from "./htmlhint.json" with { type: "json" };

However, running flow-remove-types on the same file results in a syntax error:

$ npx flow-remove-types --out-file .\index.out.js .\index.js
.\index.js
 ↳ Syntax Error: ';' expected (2:38)
import ruleset from "./htmlhint.json" with { type: "json" };
                                      ^
   1:  import ruleset from "./htmlhint.json" with { type: "json" };

Expected behavior

The command should complete successfully and generate the output file without throwing an error:

$ npx flow-remove-types --out-file .\index.out.js .\index.js
.\index.js
 ↳ .\index.out.js
  • Link to Try-Flow or Github repo: N/A (The issue is specific to flow-remove-types and does not require Flow server execution or .flowconfig settings.)

Activity

  1. hiSandog commented on Jun 29, 2026

    @hiSandog

    For import attributes, it may help to include both parser and stripping expectations. flow-remove-types users usually expect syntax it does not understand to be preserved when it is not type syntax, so a fixture with import data from './x.json' with { type: 'json' } would clarify whether the failure is in parser support or in the transform step. That would also guard parity with the main Flow parser.

  2. SamChou19815 commented on Oct 22, 2026

    @SamChou19815
    Contributor

    now it works

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions