Skip to content

Suggest using JSX fragment where appropriate #7714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 25, 2025

Conversation

zth
Copy link
Collaborator

@zth zth commented Jul 24, 2025

Applies some sort of heuristic to guess when the user might've accidentally forgot to use JSX fragments.

It's not perfect, but I think it's an OK improvement.

@zth zth requested review from cknitt and tsnobip July 24, 2025 21:20
Copy link

pkg-pr-new bot commented Jul 24, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7714

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7714

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7714

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7714

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7714

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7714

commit: 60cc1e7


- Did you forget to wrap this + adjacent JSX in a JSX fragment (<></>)?
- Did you mean to assign this to a variable?
- If you don't care about the result of this expression, you can assign it to _ via let _ = ... or pipe it to ignore via expression->ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user wrote some JSX, he probably does not want to ignore it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's a good point, we can omit that part for JSX.

@zth zth force-pushed the suggest-using-jsx-fragment-when-appropriate branch from 922175d to 49baf5f Compare July 25, 2025 16:30
@zth zth enabled auto-merge (squash) July 25, 2025 16:35
@zth zth requested a review from cknitt July 25, 2025 16:39
@zth zth merged commit c79b033 into master Jul 25, 2025
27 checks passed
@cknitt cknitt deleted the suggest-using-jsx-fragment-when-appropriate branch July 28, 2025 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants