-
-
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
jsx-indent wrong works with ternary operator #945
Comments
ditto for the ternary operator being inline with the logical if/brackets
However the following passes, but forces an inline else statement (not ideal, but passes linting)
|
yes my biggest remaining problem is with terneries and brackets e.g. when brackets are used, usually indentation goes up by 1, but within a ternary, it currently does not. |
This was caused by a fix to allow this kind of formatting: cond ?
<div/> :
<span/> Before 6.6.0, cond ?
<div/> :
<span/> But this breaks the also common style with |
examples formatted how 6.6.0 expects vs expectation
but I'd expect
next one
but I would expect
|
Makes it really hard when combined with the This apparently was fix of #901 and #897 that was made as a response to another bug around this that was introduced in |
Code like this also produces a linter error now (not previously):
The error is |
If someone could review my PR #950, then that would be great. It fixes the main case reported in this issue. |
@voxpelli Not sure if you noticed, but your fix causes some issues with other implementations |
@alasdairhurst I have not, all tests in the module passes as did the linting on my largest React project so please add any comments to #950 on any additional problems that the fix in there might cause and it will have to be ensured that additional tests are added for those cases and the code modified to pass also those tests. |
Thanks for all your examples, there is a lot of different ways to indent ternaries and seems we missed some of them. I will add more tests cases to the |
@yannickcr this fixes a breaking change - may we get a new release so our CI is happy? |
@rosskevin I hope to publish a new release in the coming hours. |
Version: 6.6.0
The text was updated successfully, but these errors were encountered: