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-props: Enforcing incorrect indents when using a component with props in ternary before #3146
Comments
Can you provide your rule config? |
My rule config is as follows (retrieved via
|
Interesting; I'm having trouble reproducing your issue - in other words, all three examples are failing the rule in my local tests. |
Weird, I just double-checked the example and in my case only the 3rd one fails the rule. Do you agree that the expected behavior would be that none of the examples fails the rule for the given rule config? |
I'm not sure what the expected behavior should be; I would expect multiline jsx to always be wrapped in parens, so it'd look like this: export const LintExample2 = () => {
const foo = true
? <div id="id">test</div> // added prop "id" here
: false;
return (
<div
id="id"
>
test
</div>
);
}; |
With parens, everything is fine. However, the |
I see what you're saying. While I find that indentation style horribly confusing, it does seem like it should be accepted. A PR with failing test cases, and ideally a fix, would be appreciated. |
Ok, great! I'll try to submit one by the end of next week. |
Still broken in 7.29.0 Sorry if that first message felt harsh btw 😅 |
I experience some odd behavior of
jsx-indent-props
depending on a ternary before the actual component.When having a component with props within the ternary and not having the whole ternary in one line, the rule enforces more indents for the subsequent component than it should.
I would expect the ternary not having any impact on the returning component.
Tested versions: 7.27.0 and 7.27.1
The text was updated successfully, but these errors were encountered: