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

Multi-line support in ternary operator #1760

Closed
sjuratov opened this issue Mar 7, 2021 · 2 comments
Closed

Multi-line support in ternary operator #1760

sjuratov opened this issue Mar 7, 2021 · 2 comments
Labels
enhancement New feature or request revisit

Comments

@sjuratov
Copy link

sjuratov commented Mar 7, 2021

Is your feature request related to a problem? Please describe.
My variable is defined as follow (all single line).

var subscriptionRoles = (subscriptionRole == 'owner' ? '8e3af657-a8ff-443c-a75c-2fe8c4bcb635' : (subscriptionRole == 'contributor' ? 'b24988ac-6180-42a0-ab88-20f7382dd24c' : (subscriptionRole == 'reader' ? 'acdd72a7-3385-48ef-bd42-f606fba81ae7' : '')))

This works OK but it's really difficult to read and understand. subscriptionRole is parameter.

Describe the solution you'd like
I would like to format this one liner over a few lines for better readability. I've tried but getting squiggly line error.

Note: Please let me know if there is already another way to implement this, that is better readable.

@sjuratov sjuratov added the enhancement New feature or request label Mar 7, 2021
@ghost ghost added the Needs: Triage 🔍 label Mar 7, 2021
@anthony-c-martin
Copy link
Member

Great point, thanks for raising this! Linking this to #146 as the ternary operator is another important consideration for newline sensitivity.

@alex-frankel
Copy link
Collaborator

Closing as dup of #5829

@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request revisit
Projects
None yet
Development

No branches or pull requests

3 participants