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(biome_js_analyze): update noUselessFragments's action logic to avoid the panic #595

Merged
merged 3 commits into from
Oct 24, 2023

Conversation

nissy-dev
Copy link
Contributor

@nissy-dev nissy-dev commented Oct 24, 2023

Summary

Fix #459

Previously, I modified the logic that convert JsxText to JsxString (ref: rome/tools#4662), but it seem it is not correct. Basically, we should convert JsxText to JsStringLiteral. If JsxText is part of JsxAttributeValue, we convert JsxText to JsxString

Test Plan

I confirmed the panic doesn't happened using binary built in my local.

The confirmed snippets

const _Comp = () => {
  return (
    <>
      {"" != null && <div>stuff</div>}
      <>{"" != null && stuff}</>
      {<>stuff</>}
      {"" != null && <>stuff</>}
      <div x-some-prop={<>Foo</>} />
    </>
  );
};

@nissy-dev nissy-dev temporarily deployed to Website deployment October 24, 2023 12:42 — with GitHub Actions Inactive
@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Oct 24, 2023
@ematipico
Copy link
Member

Remember to add a changelog line :)

@github-actions github-actions bot added A-Website Area: website A-Changelog Area: changelog labels Oct 24, 2023
@nissy-dev nissy-dev temporarily deployed to Website deployment October 24, 2023 13:05 — with GitHub Actions Inactive
@nissy-dev nissy-dev merged commit c6dda82 into main Oct 24, 2023
17 checks passed
@nissy-dev nissy-dev deleted the fix-useless-fragment branch October 24, 2023 13:36
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 A-Website Area: website L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Unexpected error when running biome check --apply-unsafe
2 participants