-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[Fix] jsx-indent-props
: Reset line.isUsingOperator
correctly after ternary (#3146)
#3157
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looking at the test cases, this doesn't seem right.
@@ -153,7 +153,7 @@ module.exports = { | |||
|
|||
const indent = regExp.exec(src); | |||
const useOperator = /^([ ]|[\t])*[:]/.test(src) || /^([ ]|[\t])*[?]/.test(src); | |||
const useBracket = /^([ ]|[\t])*[<]/.test(src); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some test cases that use tabs, since that's what's being removed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've added them.
Codecov Report
@@ Coverage Diff @@
## master #3157 +/- ##
=======================================
Coverage 97.51% 97.51%
=======================================
Files 119 119
Lines 8130 8130
Branches 2895 2895
=======================================
Hits 7928 7928
Misses 202 202
Continue to review full report at Codecov.
|
Closes #3146
When having a JSX element after a ternary and there are not only spaces before the opening bracket (e.g. due to a
return
keyword)line.isUsingOperator
is not reset correctly and the rule enforces a higher indent.Example: