facebook/react

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

abrahamguo opened this issue · 0 comments

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.