facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
227.06k stars 46.29k forks source link

[Compiler Bug]: Health check --src option only works with one file (so a glob needs to be quoted) #29639

Open guillaumebrunerie opened 3 months ago

guillaumebrunerie commented 3 months ago

What kind of issue is this?

Link to repro

Any project with several component files (e.g. https://github.com/guillaumebrunerie/LD55)

Repro steps

Running the compiler health check with a normal glob only checks the first file it finds:

> npx react-compiler-healthcheck --src src/**/*.{tsx,ts}
Successfully compiled 1 out of 1 components.

This is a bit surprising as most command line utilities handle multiple input files, here we need to quote the glob to have it work as intended:

> npx react-compiler-healthcheck --src "src/**/*.{tsx,ts}"
Successfully compiled 379 out of 399 components.

I would suggest making the first one work as well, that is the --src argument should accept an arbitrary number of files and process all of them.

How often does this bug happen?

Every time

What version of React are you using?

-

poteto commented 3 months ago

Good call! Would you like to submit a PR for this?

SeekingLight233 commented 2 months ago

Good call! Would you like to submit a PR for this?

I've run into the same issue. Currently, I'm using the isDynamicPattern function from fast-glob to differentiate the src parameters. However, I'm not sure how to add tests for this PR 🥲