-
-
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
Can't seem to properly indent ? : statements #625
Comments
Seems related to #540 |
#540 has been closed - did it fix this? There was no test for it. |
{condition ? (
<div>
<div> something </div>
</div>
) : (
<div>
<div> something </div>
</div>
)} or {condition
? (
<div>
<div> something </div>
</div>
)
: (
<div>
<div> something </div>
</div>
)
} ? |
Neither -
|
Right, I'm suggesting two forms that should satisfy the rule. If those work, and your example doesn't, then it seems like an issue when parens are omitted. |
I would also love to be able to use:
rather than
The closing is aligned to the opening tags, rather than the Would this be possible to add as an option? |
Is this ever going to get fixed? To this day, still have to keep jsx-indent turned off because this doesn't work as expected (or at least have an option). |
Made a new issue since @ljharb perhaps indicated it's an issue with lacking parens (but that seems like it should be a valid use case?). |
To clarify, I think it should be a supported use case, but I don't think it's a good style :-) |
@ljharb Thanks for the clarification! That's good to hear. In your opinion should it be the default (when parens are omitted, that is) or an added option? |
I think that the default should be identical when parens are omitted or not - iow, delete the parens out of #625 (comment) for the style without them. The more compact style requested here should be an option (not the default) |
In our codebase we use quite a bit of this type of if/else rendering:
Whatever indentation I try I always seem to get a jsx-indent error. Is there a way to format this without the linter complaining?
The text was updated successfully, but these errors were encountered: