Skip to content
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

[prettierx] invalid indentation in case of nested ternary in test condition #73

Open
brodybits opened this issue Dec 2, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@brodybits
Copy link
Owner

brodybits commented Dec 2, 2019

mirror of prettier/prettier#5257

I have reproduced this issue on prettierx with and without using the --no-align-ternary-lines option.

P.S. I found prettier/prettier#5257 by looking through prettier/prettier#5039 where the ternary formatting was changed while investigating the cause and possible solutions for #41.

@brodybits brodybits added the bug Something isn't working label Dec 2, 2019
@brodybits
Copy link
Owner Author

Similar issue on JSX, which seems to be exactly the same on Prettier and prettierx:

Input:

(a ? b : c) ? (
  <Element>
    <Sub />
    <Sub />
    <Sub />
    <Sub />
    <Sub />
    <Sub />
  </Element>
) : (
  <Element2>
    <Sub />
    <Sub />
    <Sub />
  </Element2>
)

Output:

(a ? (
  b
) : (
  c
)) ? (
  <Element>
    <Sub />
    <Sub />
    <Sub />
    <Sub />
    <Sub />
    <Sub />
  </Element>
) : (
  <Element2>
    <Sub />
    <Sub />
    <Sub />
  </Element2>
);

@brodybits
Copy link
Owner Author

The issue I found on JSX would definitely affect the more verbose ternary formatting that I proposed in #71.

@brodybits
Copy link
Owner Author

Looks like a fix should be coming in prettier/prettier#7087, also seems to resolve the ugly JSX formatting issue that I mentioned in #73 (comment) & prettier/prettier#5257 (comment).

I hope it will be merged soon, even better if they release it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant