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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants