|
| 1 | +# Snapshot report for `test/consistent-empty-array-spread.mjs` |
| 2 | + |
| 3 | +The actual snapshot is saved in `consistent-empty-array-spread.mjs.snap`. |
| 4 | + |
| 5 | +Generated by [AVA](https://avajs.dev). |
| 6 | + |
| 7 | +## invalid(1): [ ...(test ? [] : "ab"), ...(test ? "ab" : []), ]; |
| 8 | + |
| 9 | +> Input |
| 10 | +
|
| 11 | + `␊ |
| 12 | + 1 | [␊ |
| 13 | + 2 | ...(test ? [] : "ab"),␊ |
| 14 | + 3 | ...(test ? "ab" : []),␊ |
| 15 | + 4 | ];␊ |
| 16 | + ` |
| 17 | + |
| 18 | +> Output |
| 19 | +
|
| 20 | + `␊ |
| 21 | + 1 | [␊ |
| 22 | + 2 | ...(test ? '' : "ab"),␊ |
| 23 | + 3 | ...(test ? "ab" : ''),␊ |
| 24 | + 4 | ];␊ |
| 25 | + ` |
| 26 | + |
| 27 | +> Error 1/2 |
| 28 | +
|
| 29 | + `␊ |
| 30 | + 1 | [␊ |
| 31 | + > 2 | ...(test ? [] : "ab"),␊ |
| 32 | + | ^^ Prefer using empty string since the alternate is a string.␊ |
| 33 | + 3 | ...(test ? "ab" : []),␊ |
| 34 | + 4 | ];␊ |
| 35 | + ` |
| 36 | + |
| 37 | +> Error 2/2 |
| 38 | +
|
| 39 | + `␊ |
| 40 | + 1 | [␊ |
| 41 | + 2 | ...(test ? [] : "ab"),␊ |
| 42 | + > 3 | ...(test ? "ab" : []),␊ |
| 43 | + | ^^ Prefer using empty string since the consequent is a string.␊ |
| 44 | + 4 | ];␊ |
| 45 | + ` |
| 46 | + |
| 47 | +## invalid(2): const STRING = "ab"; [ ...(test ? [] : STRING), ...(test ? STRING : []), ]; |
| 48 | + |
| 49 | +> Input |
| 50 | +
|
| 51 | + `␊ |
| 52 | + 1 | const STRING = "ab";␊ |
| 53 | + 2 | [␊ |
| 54 | + 3 | ...(test ? [] : STRING),␊ |
| 55 | + 4 | ...(test ? STRING : []),␊ |
| 56 | + 5 | ];␊ |
| 57 | + ` |
| 58 | + |
| 59 | +> Output |
| 60 | +
|
| 61 | + `␊ |
| 62 | + 1 | const STRING = "ab";␊ |
| 63 | + 2 | [␊ |
| 64 | + 3 | ...(test ? '' : STRING),␊ |
| 65 | + 4 | ...(test ? STRING : ''),␊ |
| 66 | + 5 | ];␊ |
| 67 | + ` |
| 68 | + |
| 69 | +> Error 1/2 |
| 70 | +
|
| 71 | + `␊ |
| 72 | + 1 | const STRING = "ab";␊ |
| 73 | + 2 | [␊ |
| 74 | + > 3 | ...(test ? [] : STRING),␊ |
| 75 | + | ^^ Prefer using empty string since the alternate is a string.␊ |
| 76 | + 4 | ...(test ? STRING : []),␊ |
| 77 | + 5 | ];␊ |
| 78 | + ` |
| 79 | + |
| 80 | +> Error 2/2 |
| 81 | +
|
| 82 | + `␊ |
| 83 | + 1 | const STRING = "ab";␊ |
| 84 | + 2 | [␊ |
| 85 | + 3 | ...(test ? [] : STRING),␊ |
| 86 | + > 4 | ...(test ? STRING : []),␊ |
| 87 | + | ^^ Prefer using empty string since the consequent is a string.␊ |
| 88 | + 5 | ];␊ |
| 89 | + ` |
| 90 | + |
| 91 | +## invalid(3): [ ...(test ? "" : [a, b]), ...(test ? [a, b] : ""), ]; |
| 92 | + |
| 93 | +> Input |
| 94 | +
|
| 95 | + `␊ |
| 96 | + 1 | [␊ |
| 97 | + 2 | ...(test ? "" : [a, b]),␊ |
| 98 | + 3 | ...(test ? [a, b] : ""),␊ |
| 99 | + 4 | ];␊ |
| 100 | + ` |
| 101 | + |
| 102 | +> Output |
| 103 | +
|
| 104 | + `␊ |
| 105 | + 1 | [␊ |
| 106 | + 2 | ...(test ? [] : [a, b]),␊ |
| 107 | + 3 | ...(test ? [a, b] : []),␊ |
| 108 | + 4 | ];␊ |
| 109 | + ` |
| 110 | + |
| 111 | +> Error 1/2 |
| 112 | +
|
| 113 | + `␊ |
| 114 | + 1 | [␊ |
| 115 | + > 2 | ...(test ? "" : [a, b]),␊ |
| 116 | + | ^^ Prefer using empty array since the alternate is an array.␊ |
| 117 | + 3 | ...(test ? [a, b] : ""),␊ |
| 118 | + 4 | ];␊ |
| 119 | + ` |
| 120 | + |
| 121 | +> Error 2/2 |
| 122 | +
|
| 123 | + `␊ |
| 124 | + 1 | [␊ |
| 125 | + 2 | ...(test ? "" : [a, b]),␊ |
| 126 | + > 3 | ...(test ? [a, b] : ""),␊ |
| 127 | + | ^^ Prefer using empty array since the consequent is an array.␊ |
| 128 | + 4 | ];␊ |
| 129 | + ` |
| 130 | + |
| 131 | +## invalid(4): const ARRAY = ["a", "b"]; [ /* hole */, ...(test ? "" : ARRAY), /* hole */, ...(test ? ARRAY : ""), /* hole */, ]; |
| 132 | + |
| 133 | +> Input |
| 134 | +
|
| 135 | + `␊ |
| 136 | + 1 | const ARRAY = ["a", "b"];␊ |
| 137 | + 2 | [␊ |
| 138 | + 3 | /* hole */,␊ |
| 139 | + 4 | ...(test ? "" : ARRAY),␊ |
| 140 | + 5 | /* hole */,␊ |
| 141 | + 6 | ...(test ? ARRAY : ""),␊ |
| 142 | + 7 | /* hole */,␊ |
| 143 | + 8 | ];␊ |
| 144 | + ` |
| 145 | + |
| 146 | +> Output |
| 147 | +
|
| 148 | + `␊ |
| 149 | + 1 | const ARRAY = ["a", "b"];␊ |
| 150 | + 2 | [␊ |
| 151 | + 3 | /* hole */,␊ |
| 152 | + 4 | ...(test ? [] : ARRAY),␊ |
| 153 | + 5 | /* hole */,␊ |
| 154 | + 6 | ...(test ? ARRAY : []),␊ |
| 155 | + 7 | /* hole */,␊ |
| 156 | + 8 | ];␊ |
| 157 | + ` |
| 158 | + |
| 159 | +> Error 1/2 |
| 160 | +
|
| 161 | + `␊ |
| 162 | + 1 | const ARRAY = ["a", "b"];␊ |
| 163 | + 2 | [␊ |
| 164 | + 3 | /* hole */,␊ |
| 165 | + > 4 | ...(test ? "" : ARRAY),␊ |
| 166 | + | ^^ Prefer using empty array since the alternate is an array.␊ |
| 167 | + 5 | /* hole */,␊ |
| 168 | + 6 | ...(test ? ARRAY : ""),␊ |
| 169 | + 7 | /* hole */,␊ |
| 170 | + 8 | ];␊ |
| 171 | + ` |
| 172 | + |
| 173 | +> Error 2/2 |
| 174 | +
|
| 175 | + `␊ |
| 176 | + 1 | const ARRAY = ["a", "b"];␊ |
| 177 | + 2 | [␊ |
| 178 | + 3 | /* hole */,␊ |
| 179 | + 4 | ...(test ? "" : ARRAY),␊ |
| 180 | + 5 | /* hole */,␊ |
| 181 | + > 6 | ...(test ? ARRAY : ""),␊ |
| 182 | + | ^^ Prefer using empty array since the consequent is an array.␊ |
| 183 | + 7 | /* hole */,␊ |
| 184 | + 8 | ];␊ |
| 185 | + ` |
| 186 | + |
| 187 | +## invalid(5): [...(foo ? "" : [])] |
| 188 | + |
| 189 | +> Input |
| 190 | +
|
| 191 | + `␊ |
| 192 | + 1 | [...(foo ? "" : [])]␊ |
| 193 | + ` |
| 194 | + |
| 195 | +> Output |
| 196 | +
|
| 197 | + `␊ |
| 198 | + 1 | [...(foo ? [] : [])]␊ |
| 199 | + ` |
| 200 | + |
| 201 | +> Error 1/1 |
| 202 | +
|
| 203 | + `␊ |
| 204 | + > 1 | [...(foo ? "" : [])]␊ |
| 205 | + | ^^ Prefer using empty array since the alternate is an array.␊ |
| 206 | + ` |
0 commit comments