Ternary Operator Forced Into Multiple Lines
See original GitHub issueInput
Ternary operators are forced into multiple lines.
let test = (true) ? true : false;
Expected Output
let test = (true) ? true : false;
Actual Output
let test = (true)
? true
: false;
Settings
{
"indent_size": 2,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 2,
"jslint_happy": false,
"space_after_anon_function": true,
"brace_style": "collapse-preserve-inline",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"break_chained_methods": false,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to force chop line for ternary operator? - Stack Overflow
But if the ternary operator is all on one line, it won't break it into multiple lines. This can also be achieved by...
Read more >multiline-ternary - ESLint - Pluggable JavaScript Linter
This rule enforces or disallows newlines between operands of a ternary expression. Note: The location of the operators is not enforced by this...
Read more >Multiple lines in a ternary operator's clauses? - SitePoint
I'm pretty sure the answer to your question is “no”. The semi-colon is used to indicate the end of the ternary operation, so...
Read more >How can i use a ternary operator with multiple lines of code
Hi, I am using a ternary operator like the following MyObject has a field "Name" String WebSite = 'Yahoo.com';
Read more >How to use multiple ternary operators in a single statement in ...
In the above syntax, we have tested 2 conditions in a single statement using the ternary operator. In the syntax, if condition1 is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For your information, I’d to dig into the repository of atom-beautify to find the fix. Add option
"preserve_ternary_lines":true
in.jsbeautifyrc
See https://github.com/Glavin001/atom-beautify/pull/726
I will move the issue to the atom-beautify repo since the issue appears to be coming from them.