Skip to content

Bug: eslint-plugin-react-compiler causes @babel/generator to console.log a message about import attributes on TS files #31793

@abrahamguo

Description

@abrahamguo

eslint-plugin-react-compiler version: 19.0.0-beta-37ed2a7-20241206 (which is the latest on NPM)

Steps To Reproduce

In general, to reproduce the issue, run eslint-plugin-react-compiler on a TS file that contains an import attribute.

To reproduce in the linked reproduction repo:

  1. npm i
  2. Run DEBUG=eslint:eslint eslint . in the terminal.
  3. Observe that both a JS file and TS file are linted, and that both of those two files contain an import attribute.
  4. Observe that the message is only printed for the TS file, but not the JS file.

Link to code example:
https://github.com/abrahamguo/repro/tree/react-compiler-import-attributes

The current behavior

The following message is printed via console.log by @babel/generator:

You are using import attributes, without specifying the desired output syntax.
Please specify the "importAttributesKeyword" generator option, whose value can be one of:
 - "with"        : `import { a } from "b" with { type: "json" };`
 - "assert"      : `import { a } from "b" assert { type: "json" };`
 - "with-legacy" : `import { a } from "b" with type: "json";`

The expected behavior

No such message should be printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions