OLD | NEW |
(Empty) | |
| 1 40 columns | |
| 2 >>> space-separated adjacent strings are not split if they fit |
| 3 var name = new Symbol("the first string" "the second"); |
| 4 <<< |
| 5 var name = new Symbol( |
| 6 "the first string" "the second"); |
| 7 >>> space-separated adjacent strings are split if they don't fit |
| 8 var name = new Symbol("the first very long string" "the second very longstring")
; |
| 9 <<< |
| 10 var name = new Symbol( |
| 11 "the first very long string" |
| 12 "the second very longstring"); |
| 13 >>> adjacent string lines all split together; |
| 14 var text = "first" "second" "third" "fourth" "fifth"; |
| 15 <<< |
| 16 var text = "first" |
| 17 "second" |
| 18 "third" |
| 19 "fourth" |
| 20 "fifth"; |
| 21 >>> preserve one newline between adjacent strings |
| 22 var name = "the first string" |
| 23 "the second string" |
| 24 |
| 25 |
| 26 |
| 27 "the third string"; |
| 28 <<< |
| 29 var name = "the first string" |
| 30 "the second string" |
| 31 "the third string"; |
| 32 >>> conditions, same operator |
| 33 if (identifier || identifier || identifier || identifier) { |
| 34 } |
| 35 <<< |
| 36 if (identifier || |
| 37 identifier || |
| 38 identifier || |
| 39 identifier) {} |
| 40 >>> conditions, different operators |
| 41 if (identifier && identifier || identifier |
| 42 && identifier) { |
| 43 } |
| 44 <<< |
| 45 if (identifier && identifier || |
| 46 identifier && identifier) {} |
| 47 >>> split conditional because then doesn't fit |
| 48 var kind = element != null ? longArgument : arg; |
| 49 <<< |
| 50 var kind = element != null |
| 51 ? longArgument |
| 52 : arg; |
| 53 >>> split conditional because else doesn't fit |
| 54 var kind = element != null ? argument : secondArgumentThatIsReallyLong; |
| 55 <<< |
| 56 var kind = element != null |
| 57 ? argument |
| 58 : secondArgumentThatIsReallyLong; |
| 59 >>> split operator chain around block |
| 60 first + second + () {body;} + third + fourth; |
| 61 <<< |
| 62 first + |
| 63 second + |
| 64 () { |
| 65 body; |
| 66 } + |
| 67 third + |
| 68 fourth; |
| 69 >>> indent previous line farther because later line is nested deeper |
| 70 someFunction(someExtremelyLongArgumentName).clamp(); |
| 71 <<< |
| 72 someFunction( |
| 73 someExtremelyLongArgumentName) |
| 74 .clamp(); |
| 75 >>> wrap inside parenthesized |
| 76 (someVerylongIdentifier * someVerylongIdentifier); |
| 77 <<< |
| 78 (someVerylongIdentifier * |
| 79 someVerylongIdentifier); |
| 80 >>> same operator inside parenthesized is treated independently |
| 81 (identifier * (identifier * identifier) * identifier); |
| 82 <<< |
| 83 (identifier * |
| 84 (identifier * identifier) * |
| 85 identifier); |
| 86 >>> nested parenthesized are indented more |
| 87 (identifier * (verylongIdentifier * verylongIdentifier) * identifier); |
| 88 <<< |
| 89 (identifier * |
| 90 (verylongIdentifier * |
| 91 verylongIdentifier) * |
| 92 identifier); |
| 93 >>> conditional operands are nested |
| 94 identifier ? identifier ? someParticularlyLongOperand : someParticularlyLongOper
and : identifier ? someParticularlyLongOperand : someParticularlyLongOperand; |
| 95 <<< |
| 96 identifier |
| 97 ? identifier |
| 98 ? someParticularlyLongOperand |
| 99 : someParticularlyLongOperand |
| 100 : identifier |
| 101 ? someParticularlyLongOperand |
| 102 : someParticularlyLongOperand; |
| 103 >>> index expressions can split after "[" |
| 104 verylongIdentifier[someParticularlyLongArgument]; |
| 105 <<< |
| 106 verylongIdentifier[ |
| 107 someParticularlyLongArgument]; |
| 108 >>> index arguments nest |
| 109 verylongIdentifier[someParticularlyLongArgument[someParticularlyLongArgument]]; |
| 110 <<< |
| 111 verylongIdentifier[ |
| 112 someParticularlyLongArgument[ |
| 113 someParticularlyLongArgument]]; |
| 114 >>> successive index arguments |
| 115 identifier[longArgument][longArgument][longArgument][longArgument][longArgument]
; |
| 116 <<< |
| 117 identifier[longArgument][longArgument] |
| 118 [longArgument][longArgument] |
| 119 [longArgument]; |
| 120 >>> is |
| 121 verylongIdentifier.property is LongTypeName; |
| 122 <<< |
| 123 verylongIdentifier.property |
| 124 is LongTypeName; |
| 125 >>> as |
| 126 verylongIdentifier.property as LongTypeName; |
| 127 <<< |
| 128 verylongIdentifier.property |
| 129 as LongTypeName; |
| 130 >>> null coalescing operator |
| 131 identifier&&identifier&&identifier&&identifier; |
| 132 <<< |
| 133 identifier && |
| 134 identifier && |
| 135 identifier && |
| 136 identifier; |
OLD | NEW |