rescript-lang / rescript-compiler

The compiler for ReScript.
https://rescript-lang.org
Other
6.67k stars 444 forks source link

Regression after JSX3 removal #7084

Open cknitt opened 2 hours ago

cknitt commented 2 hours ago

It seems something broke on master with the JSX3 cleanup PR #7072. I forgot to test against a real-world project before merging.

I have a large project with several yarn workspace packages and lots of dependencies. Only the top-level rescript.json has

  "jsx": {
    "version": 4,
    "mode": "automatic"
  },

but not the other workspace packages or the dependencies.

It seems that the default of JSX 4 was previously inherited from the root rescript.json, but now that's not the case anymore. So the project only builds if I add the above configuration to the rescript.json of all workspace packages and dependencies.

@mununki Could you have a look at this? And it would be great to have a test in build_tests to verify that the inheritance of the JSX setting works.

cristianoc commented 2 hours ago

It might default to off instead of inheriting in subprojects. Btw should it ever be off? I would leave it always on and only make the mode configurable. Thoughts?

cristianoc commented 2 hours ago

In any case the config mode should be inherited.

mununki commented 2 hours ago

Previously, if a project had JSX-related configurations, the dependent packages would inherit those JSX settings even if they didn't have their own JSX configurations, right? Do you hope this will continue to be the default behavior in the future?

cknitt commented 2 hours ago

Do you hope this will continue to be the default behavior in the future?

Yes, the dependent packages should continue to inherit the JSX settings.

I would leave it always on and only make the mode configurable. Thoughts?

Sounds good to me. Cannot really think of any major downside. It will be superfluous on non-React/-JSX projects, but it shouldn't do any harm there either.