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

False positivie on "jsx-no-useless-fragment" #2432

Closed
kud opened this issue Oct 2, 2019 · 4 comments

Comments

@kud
Copy link

commented Oct 2, 2019

                 {state.filtersExpanded ? (
                    <>{`Refermer les filtres`}</>
                  ):(
                    <>{`Filtrer les amendements`}</>
                  )}

If I remove them:

image

@golopot

This comment has been minimized.

Copy link
Contributor

commented Oct 2, 2019

How about

<Text>
  {state.filtersExpanded ? (
    <>Refermer les filtres</>
  ) : (
    <>Filtrer les amendements</>
  )}
</Text>;

or

<p>
  {state.filtersExpanded ? `Refermer les filtres` : `Filtrer les amendements`}
</p>;
@kud

This comment has been minimized.

Copy link
Author

commented Oct 2, 2019

Not the first one because eslint requires jsx-no-literals :)

But the second one could work yeah.

@ljharb

This comment has been minimized.

Copy link
Collaborator

commented Oct 2, 2019

The second one is the proper fix - when removing wrapping jsx, you have to be aware to remove the jsx-only curly braces as well.

That doesn't seem to be an autofix, so I'm going to close this, but happy to reopen if indeed there's something actionable here.

@ljharb ljharb closed this Oct 2, 2019
@kud

This comment has been minimized.

Copy link
Author

commented Oct 2, 2019

Okay thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.