-
-
Notifications
You must be signed in to change notification settings - Fork 59
Avoid converting if/else into long ternary #243
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
Comments
Sorry to be closing issues of yours left and right here, but I'm closing it for the same reason as here: #245 (comment). |
For anyone that comes across this issue in future - for Discourse we've created this simple plugin which disables the automatic conversion of |
@davidtaylorhq I'd be happy to maintain that in Syntax Tree if you wanted to open a PR. That way I wouldn't accidentally break that if I move a module around. |
That would be great, thanks @kddnewton. I refactored the plugin to work similarly to the bundled quote/comma plugins and opened #250 |
Uh oh!
There was an error while loading. Please reload this page.
The formatter should avoid converting
if/else
into ternary if the the resulting line would be too long. I think stree should disregard the configuredprint-width
and use regularif/else
when the line length of the ternary exceeds ~60 chars.Original (easy to read):
Formatted with stree (harder to read):
(Tested with
print-width
of 100)The text was updated successfully, but these errors were encountered: