question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suboptimal binary + operator formatting

See original GitHub issue

This strikes me as a really ugly format:

$ echo "lots + of + additions + are + put + into + some + weird + format + thats + ugly > 0" > /tmp/test.js && prettier /tmp/test.js
lots + of + additions + are + put + into + some + weird + format + thats +
  ugly >
  0;

Better would be:

lots + of + additions + are + put + into + some + weird + format + thats +
  ugly > 0;

Do you agree, or is this intentionally the format used by prettier?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jlongstercommented, Jan 10, 2017

That’s not intentional, and is ugly. Binary operators are a bit difficult to get right. We can play with this.

0reactions
jlongstercommented, Jan 17, 2017

Heck, with a quick hack I was able to implement something like this:

  var z = 1 + 2 + 3 * (4 * 5 + 3) / (100000000000000000 * 328233872942374 +
      3423942394239) + 2343242342342343 + 10000;

I will follow-up in the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEP 460 – Add binary interpolation and formatting
PEP 460 – Add binary interpolation and formatting ... This PEP proposes to add minimal formatting operations to bytes and bytearray objects.
Read more >
Define a binary operator such that in displaymath subscripts ...
I would like to change the definition of \tensor and \comptensor such that in textstyle nothing changes, but in displaystyle I would like...
Read more >
How to get 0-padded binary representation of an integer in java?
I think this is a suboptimal solution, but you could do. String.format("%16s", Integer.toBinaryString(1)).replace(' ', '0').
Read more >
Auto-formatting handles multi-line binary operations in strange ...
Auto-formatting handles multi-line binary operations in strange manner. 2. Is duplicated by 1. Is duplicated by 1 issue (0 unresolved).
Read more >
Line break occurred before a binary operator (W503)
Line breaks should occur after the binary operator to keep all variable names aligned. This rule goes against the PEP 8 recommended style,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found