@@ -159,6 +159,24 @@ new RuleTester({ parserOptions }).run('jsx-newline', rule, {
159
159
features : [ 'fragment' ] ,
160
160
options : [ { prevent : true , allowMultilines : true } ] ,
161
161
} ,
162
+ {
163
+ code : `
164
+ <div>
165
+ {/* this does not have a newline */}
166
+ <Icon f7='gear' />
167
+ {/* neither does this */}
168
+ <OneLineComponent />
169
+
170
+ {/* but this one needs one */}
171
+ <Button>
172
+ <IconPreview />
173
+ Button 2
174
+ <span></span>
175
+ </Button>
176
+ </div>
177
+ ` ,
178
+ options : [ { prevent : true , allowMultilines : true } ] ,
179
+ } ,
162
180
{
163
181
code : `
164
182
<div>
@@ -284,6 +302,76 @@ new RuleTester({ parserOptions }).run('jsx-newline', rule, {
284
302
` ,
285
303
errors : [ { messageId : 'require' } ] ,
286
304
} ,
305
+ {
306
+ code : `
307
+ <div>
308
+ {/* this does not have a newline */}
309
+ <Icon f7='gear' />
310
+ {/* neither does this */}
311
+ <OneLineComponent />
312
+ {/* but this one needs one */}
313
+ <Button>
314
+ <IconPreview />
315
+ Button 2
316
+ <span></span>
317
+ </Button>
318
+ </div>
319
+ ` ,
320
+ output : `
321
+ <div>
322
+ {/* this does not have a newline */}
323
+ <Icon f7='gear' />
324
+ {/* neither does this */}
325
+ <OneLineComponent />
326
+
327
+ {/* but this one needs one */}
328
+ <Button>
329
+ <IconPreview />
330
+ Button 2
331
+ <span></span>
332
+ </Button>
333
+ </div>
334
+ ` ,
335
+ options : [ { prevent : true , allowMultilines : true } ] ,
336
+ errors : [ { messageId : 'allowMultilines' } ] ,
337
+ } ,
338
+ {
339
+ code : `
340
+ <div>
341
+ {/* this does not have a newline */}
342
+ <Icon f7='gear' />
343
+ {/* neither does this */}
344
+ <OneLineComponent />
345
+ {/* Multiline */}
346
+ {/* Block comments */}
347
+ {/* Stick to MultilineComponent */}
348
+ <Button>
349
+ <IconPreview />
350
+ Button 2
351
+ <span></span>
352
+ </Button>
353
+ </div>
354
+ ` ,
355
+ output : `
356
+ <div>
357
+ {/* this does not have a newline */}
358
+ <Icon f7='gear' />
359
+ {/* neither does this */}
360
+ <OneLineComponent />
361
+
362
+ {/* Multiline */}
363
+ {/* Block comments */}
364
+ {/* Stick to MultilineComponent */}
365
+ <Button>
366
+ <IconPreview />
367
+ Button 2
368
+ <span></span>
369
+ </Button>
370
+ </div>
371
+ ` ,
372
+ options : [ { prevent : true , allowMultilines : true } ] ,
373
+ errors : [ { messageId : 'allowMultilines' } ] ,
374
+ } ,
287
375
{
288
376
code : `
289
377
<div>
0 commit comments