|
| 1 | +--- |
| 2 | +source: crates/oxc_formatter/tests/fixtures/mod.rs |
| 3 | +--- |
| 4 | +==================== Input ==================== |
| 5 | +// Prettier keeps a trailing double space on JSDoc lines (prettier/prettier#18594). |
| 6 | +/** |
| 7 | + * Two spaces stay. |
| 8 | + * It's on another line |
| 9 | + */ |
| 10 | +function two() {} |
| 11 | + |
| 12 | +/** |
| 13 | + * Three spaces collapse to two. |
| 14 | + * next |
| 15 | + */ |
| 16 | +function three() {} |
| 17 | + |
| 18 | +/** |
| 19 | + * One space goes. |
| 20 | + * next |
| 21 | + */ |
| 22 | +function one() {} |
| 23 | + |
| 24 | +/** |
| 25 | + * |
| 26 | + * A bare star line drops its spaces. |
| 27 | + */ |
| 28 | +function bare() {} |
| 29 | + |
| 30 | +/** |
| 31 | + * Spaces on the opening line go, spaces here stay. |
| 32 | + */ |
| 33 | +function opening() {} |
| 34 | + |
| 35 | +function nested() { |
| 36 | + /** |
| 37 | + * Misaligned and indented, spaces stay. |
| 38 | + */ |
| 39 | + return 1; |
| 40 | +} |
| 41 | + |
| 42 | +/*** |
| 43 | + * Not JSDoc, spaces go. |
| 44 | + */ |
| 45 | +function notJsdoc() {} |
| 46 | + |
| 47 | +/* |
| 48 | + * Plain block comment, spaces go. |
| 49 | + */ |
| 50 | +function plain() {} |
| 51 | + |
| 52 | +==================== Output ==================== |
| 53 | +------------------ |
| 54 | +{ printWidth: 80 } |
| 55 | +------------------ |
| 56 | +// Prettier keeps a trailing double space on JSDoc lines (prettier/prettier#18594). |
| 57 | +/** |
| 58 | + * Two spaces stay. |
| 59 | + * It's on another line |
| 60 | + */ |
| 61 | +function two() {} |
| 62 | + |
| 63 | +/** |
| 64 | + * Three spaces collapse to two. |
| 65 | + * next |
| 66 | + */ |
| 67 | +function three() {} |
| 68 | + |
| 69 | +/** |
| 70 | + * One space goes. |
| 71 | + * next |
| 72 | + */ |
| 73 | +function one() {} |
| 74 | + |
| 75 | +/** |
| 76 | + * |
| 77 | + * A bare star line drops its spaces. |
| 78 | + */ |
| 79 | +function bare() {} |
| 80 | + |
| 81 | +/** |
| 82 | + * Spaces on the opening line go, spaces here stay. |
| 83 | + */ |
| 84 | +function opening() {} |
| 85 | + |
| 86 | +function nested() { |
| 87 | + /** |
| 88 | + * Misaligned and indented, spaces stay. |
| 89 | + */ |
| 90 | + return 1; |
| 91 | +} |
| 92 | + |
| 93 | +/*** |
| 94 | + * Not JSDoc, spaces go. |
| 95 | + */ |
| 96 | +function notJsdoc() {} |
| 97 | + |
| 98 | +/* |
| 99 | + * Plain block comment, spaces go. |
| 100 | + */ |
| 101 | +function plain() {} |
| 102 | + |
| 103 | +------------------- |
| 104 | +{ printWidth: 100 } |
| 105 | +------------------- |
| 106 | +// Prettier keeps a trailing double space on JSDoc lines (prettier/prettier#18594). |
| 107 | +/** |
| 108 | + * Two spaces stay. |
| 109 | + * It's on another line |
| 110 | + */ |
| 111 | +function two() {} |
| 112 | + |
| 113 | +/** |
| 114 | + * Three spaces collapse to two. |
| 115 | + * next |
| 116 | + */ |
| 117 | +function three() {} |
| 118 | + |
| 119 | +/** |
| 120 | + * One space goes. |
| 121 | + * next |
| 122 | + */ |
| 123 | +function one() {} |
| 124 | + |
| 125 | +/** |
| 126 | + * |
| 127 | + * A bare star line drops its spaces. |
| 128 | + */ |
| 129 | +function bare() {} |
| 130 | + |
| 131 | +/** |
| 132 | + * Spaces on the opening line go, spaces here stay. |
| 133 | + */ |
| 134 | +function opening() {} |
| 135 | + |
| 136 | +function nested() { |
| 137 | + /** |
| 138 | + * Misaligned and indented, spaces stay. |
| 139 | + */ |
| 140 | + return 1; |
| 141 | +} |
| 142 | + |
| 143 | +/*** |
| 144 | + * Not JSDoc, spaces go. |
| 145 | + */ |
| 146 | +function notJsdoc() {} |
| 147 | + |
| 148 | +/* |
| 149 | + * Plain block comment, spaces go. |
| 150 | + */ |
| 151 | +function plain() {} |
| 152 | + |
| 153 | +===================== End ===================== |
0 commit comments