Skip to content
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

fix(noUselessFragments): fix result has invalid syntax when under JSX attribute #4648

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

fireairforce
Copy link
Member

@fireairforce fireairforce commented Nov 27, 2024

Summary

closes: #4553

I add judge logic for the fix case like:

<Suspense fallback={<><span>Loading...</span></>}>
   {children}
 </Suspense>;

When the fragment child is a JSXElement like <span>Loading...</span> here, in the fix process, we will keep the JSXAttributeValue.

So it will fix as:

<Suspense fallback={<span>Loading...</span>}>
   {children}
 </Suspense>;

The attribute fallback's value is a JsxExpressionAttributeValue not a JsxTagExpression.

Test Plan

I add test case.

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Changelog Area: changelog labels Nov 27, 2024
Copy link

codspeed-hq bot commented Nov 27, 2024

CodSpeed Performance Report

Merging #4648 will not alter performance

Comparing fireairforce:fix-4553 (3fcc1dc) with main (cd1c8ec)

Summary

✅ 97 untouched benchmarks

@fireairforce fireairforce requested review from a team November 27, 2024 08:50
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Great fix!

@fireairforce fireairforce merged commit 516314c into biomejs:main Nov 27, 2024
12 checks passed
@maxmorozoff
Copy link

Thanks for fixing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Linter Area: linter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 noUselessFragments fix result has invalid jsx syntax
3 participants