Files
test-repo/tests/js/object-prop-break-in/short-keys.js
T
Georgii DolzhykovandSosuke Suzuki 5f8fee4d07 Prevent wrapping object properties with short keys (#10335)
* Prevent wrapping object properties with short keys

* Update src/language-js/print/assignment.js

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>

* Use getStringWidth instead of .length

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2021-03-03 01:43:46 +02:00

19 lines
1.8 KiB
JavaScript

var obj = {
// an entry with a very long string
x: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
url: 'http://example.com/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890',
longName: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
[i]: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
[prop]: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
'x': "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
a: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
ab: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
abc: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
abcd: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
abcde: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
abcdef: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
'古': 'https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about',
'古今': 'https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about',
'古体诗': 'https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about',
};