-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add ESLint rule to wrap multiline JSX in parentheses #18302
Conversation
31ae4a2
to
eef514d
Compare
cc @aduth since your past suggestion to do this was the only result when searching for this rule 😊 |
This requires a note in the CHANGELOG of the |
Good call, I missed that one. Pushed in 1fbe05e |
I tried that branch and cherry-picked the change to enable the rule. It doesn't seem to conflict (although I'm seeing some unrelated lint errors , but it's also not catching any violations. I think if prettier is going to land soon, this PR just becomes superfluous, so it depends on the timeline for that. |
Prettier inserts parens around multiline JSX expressions in most cases, so it shouldn't conflict with this ESLint rule. But once Prettier gets merged, these formatting-only ESLint rules become superfluous -- the formatting is handled by AI and doesn't need to be checked by another AI 🙂 That's why my PR removes them and why there even exists a |
@koke - since the Prettier PR already landed, is this PR still relevant? |
We still need to formal all files but it shouldn’t be an issue anymore. From now on, Prettier is the boss in terms of formatting 😃 |
Description
I noticed this is the prevalent style across the codebase but it's not currently enforced by ESLint.
I added react/jsx-wrap-multilines to the recommended set of rules.
I also changed the default configuration to ensure new lines after the parentheses. There were 18 violations with the default settings and 23 with the new-line setting.
The
condition
,logical
, andprop
configurations also seemed nicer to me, but enabling them bumped the violation count to 118, so it doesn't seem there's enough consensus on that one.Checklist: