(node, keyDoc, options)
| 403 | } |
| 404 | |
| 405 | function isObjectPropertyWithShortKey(node, keyDoc, options) { |
| 406 | if (!isObjectProperty(node)) { |
| 407 | return false; |
| 408 | } |
| 409 | // TODO: for performance, it might make sense to use a more lightweight |
| 410 | // version of cleanDoc, such that it would stop once it detects that |
| 411 | // the doc can't be reduced to a string. |
| 412 | keyDoc = cleanDoc(keyDoc); |
| 413 | const MIN_OVERLAP_FOR_BREAK = 3; |
| 414 | // ↓↓ - insufficient overlap for a line break |
| 415 | // key1: longValue1, |
| 416 | // ↓↓↓↓↓↓ - overlap is long enough to break |
| 417 | // key2abcd: |
| 418 | // longValue2 |
| 419 | return ( |
| 420 | typeof keyDoc === "string" && |
| 421 | getStringWidth(keyDoc) < options.tabWidth + MIN_OVERLAP_FOR_BREAK |
| 422 | ); |
| 423 | } |
| 424 | |
| 425 | function isCallExpressionWithComplexTypeArguments(node, print) { |
| 426 | const typeArgs = node.typeArguments?.params; |
no test coverage detected
searching dependent graphs…