-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[New] jsx-first-prop-new-line
: add multiprop
option
#3533
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3533 +/- ##
=======================================
Coverage 97.60% 97.60%
=======================================
Files 132 132
Lines 9282 9285 +3
Branches 3392 3395 +3
=======================================
+ Hits 9060 9063 +3
Misses 222 222
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
So, just to clarify, this is |
Yes indeed 🙂 - so it will force multiline for multiple props only, or force single line for up to 1 prop. |
jsx-first-prop-new-line
: add multiprop
option
@ljharb Is there an ETA on when this will be released? |
@ljharb just spent some time debugging why i couldn't use this even though it's in the docs. guess i found the answer. i'd love to use this option, so i've got the same question: when is the next release? :) |
by the way: what if the prop itself is multiline? i would like to enforce something like this in such cases:
right now, the
|
@mindnektar everywhere on github, you have to look at the docs on the tagged release and not on the default branch. For your other question, you'd combine it with the jsx-indent and indent rules. @sanketnaik99 no, there is no ETA. hopefully soon. |
The
jsx-first-prop-new-line
rule is great but it just falls short in one place for me. This addition allows the rule to enforce a new line, but only if there are multiple props, else it forces it inline - a hybrid betweenmultiline
andmultiline-multiprop
.Before Linting (currently the div element thinks that it is valid, but I want it to throw a linting error)
After Linting (the div is automatically formatted to put the prop on the first line, but the component below is kept multiline)
(I hope I've formatted this okay as I couldn't find a template for PRs)