-
Notifications
You must be signed in to change notification settings - Fork 22
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
known --offset-ternary-expressions formatting issues #468
Labels
bug
Something isn't working
Comments
brody4hire
changed the title
known --offset-ternary-expressions formatting issue
known --offset-ternary-expressions formatting issues
Mar 8, 2021
This was referenced Mar 8, 2021
This was referenced May 23, 2021
One more thing to check is that the formatting of conditional types in TypeScript should be and remain consistent with the formatting of ternary (conditional) expressions. Here is the code for context in Prettier 2.3.1: https://github.com/prettier/prettier/blob/2.3.1/src/language-js/print/typescript.js#L490-L491 case "TSConditionalType":
return printTernary(path, options, print); |
brody4hire
pushed a commit
that referenced
this issue
Jun 7, 2021
formatting of conditional TypeScript types is expected to work the same way as formatting of ES ternary expressions as discussed in: - #468 (comment)
8 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updated:
Here are some cases for which issue #41 is still not resolved at this point (case 3 discovered in June 2021):
case 1
encountered in brody4hire/react-native-module-init#98 ... simpler reproduction:
should have been (same as Prettier 2):
case 2
case 2a
from #41 (@sheerun):
should have been:
case 2b
from #41 (comment):
should have been:
case 3
Same as "case 2" from issue #522, but discovered to be worse when using
--offset-ternary-expressions
option.case 3a
input:
output with
--offset-ternary-expressions
option, missing some expected indentation:output with default options (same as Prettier 2.3.1):
While not ideal, as discussed in issue #522, this is better than with the
--offset-ternary-expressions
option.case 3b
input:
output with
--offset-ternary-expressions
option, definitely missing some needed indentation:output with default options (same as Prettier 2.3.1):
While not ideal, as discussed in issue #522, this is better than with the
--offset-ternary-expressions
option.P.S. I tried the inputs for case 3 with
--no-align-ternary-lines
in release0.16.1
, same results as with--offset-ternary-expressions
in recent0.18.2
release.The text was updated successfully, but these errors were encountered: