Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Enforce jsx conditional style to disallow && use #29

Open
davisshaver opened this issue Jun 27, 2022 · 2 comments
Open

Enforce jsx conditional style to disallow && use #29

davisshaver opened this issue Jun 27, 2022 · 2 comments

Comments

@davisshaver
Copy link
Contributor

See convo here: #26 (comment)

It doesn't look like there's an existing eslint rule for this, but there's some code here which we may be able to incorporate as a custom rule: jsx-eslint/eslint-plugin-react#2888

For more on why we want to avoid this pattern, see here: https://kentcdodds.com/blog/use-ternaries-rather-than-and-and-in-jsx

@jamiew
Copy link
Contributor

jamiew commented Jun 28, 2022

Oh man I always wondered why ternary was preferred to &&. Nice one for wtfjs

@holic
Copy link
Owner

holic commented Jun 29, 2022

Got an old coworker to send me the lint rule/fix + tests! Will see about publishing a plugin that we can pull in here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants