@@ -2308,6 +2308,63 @@ describe(ruleName, () => {
2308
2308
invalid : [ ] ,
2309
2309
} ,
2310
2310
)
2311
+
2312
+ ruleTester . run (
2313
+ `${ ruleName } (${ type } ): supports style imports with optional chaining` ,
2314
+ rule ,
2315
+ {
2316
+ valid : [
2317
+ {
2318
+ code : dedent `
2319
+ import b from './b.css?raw'
2320
+ import c from './c.css'
2321
+
2322
+ import a from './a.js'
2323
+ ` ,
2324
+ options : [
2325
+ {
2326
+ ...options ,
2327
+ groups : [ 'style' , 'unknown' ] ,
2328
+ newlinesBetween : 'always' ,
2329
+ } ,
2330
+ ] ,
2331
+ } ,
2332
+ ] ,
2333
+ invalid : [
2334
+ {
2335
+ code : dedent `
2336
+ import a from './a.js'
2337
+ import b from './b.css?raw'
2338
+ import c from './c.css'
2339
+ ` ,
2340
+ output : dedent `
2341
+ import b from './b.css?raw'
2342
+ import c from './c.css'
2343
+
2344
+ import a from './a.js'
2345
+ ` ,
2346
+ options : [
2347
+ {
2348
+ ...options ,
2349
+ groups : [ 'style' , 'unknown' ] ,
2350
+ newlinesBetween : 'always' ,
2351
+ } ,
2352
+ ] ,
2353
+ errors : [
2354
+ {
2355
+ messageId : 'unexpectedImportsGroupOrder' ,
2356
+ data : {
2357
+ left : './a.js' ,
2358
+ leftGroup : 'unknown' ,
2359
+ right : './b.css?raw' ,
2360
+ rightGroup : 'style' ,
2361
+ } ,
2362
+ } ,
2363
+ ] ,
2364
+ } ,
2365
+ ] ,
2366
+ } ,
2367
+ )
2311
2368
} )
2312
2369
2313
2370
describe ( `${ ruleName } : sorting by natural order` , ( ) => {
@@ -3805,6 +3862,63 @@ describe(ruleName, () => {
3805
3862
] ,
3806
3863
} ,
3807
3864
)
3865
+
3866
+ ruleTester . run (
3867
+ `${ ruleName } (${ type } ): supports style imports with optional chaining` ,
3868
+ rule ,
3869
+ {
3870
+ valid : [
3871
+ {
3872
+ code : dedent `
3873
+ import b from './b.css?raw'
3874
+ import c from './c.css'
3875
+
3876
+ import a from './a.js'
3877
+ ` ,
3878
+ options : [
3879
+ {
3880
+ ...options ,
3881
+ groups : [ 'style' , 'unknown' ] ,
3882
+ newlinesBetween : 'always' ,
3883
+ } ,
3884
+ ] ,
3885
+ } ,
3886
+ ] ,
3887
+ invalid : [
3888
+ {
3889
+ code : dedent `
3890
+ import a from './a.js'
3891
+ import b from './b.css?raw'
3892
+ import c from './c.css'
3893
+ ` ,
3894
+ output : dedent `
3895
+ import b from './b.css?raw'
3896
+ import c from './c.css'
3897
+
3898
+ import a from './a.js'
3899
+ ` ,
3900
+ options : [
3901
+ {
3902
+ ...options ,
3903
+ groups : [ 'style' , 'unknown' ] ,
3904
+ newlinesBetween : 'always' ,
3905
+ } ,
3906
+ ] ,
3907
+ errors : [
3908
+ {
3909
+ messageId : 'unexpectedImportsGroupOrder' ,
3910
+ data : {
3911
+ left : './a.js' ,
3912
+ leftGroup : 'unknown' ,
3913
+ right : './b.css?raw' ,
3914
+ rightGroup : 'style' ,
3915
+ } ,
3916
+ } ,
3917
+ ] ,
3918
+ } ,
3919
+ ] ,
3920
+ } ,
3921
+ )
3808
3922
} )
3809
3923
3810
3924
describe ( `${ ruleName } : sorting by line length` , ( ) => {
@@ -5374,6 +5488,63 @@ describe(ruleName, () => {
5374
5488
] ,
5375
5489
} ,
5376
5490
)
5491
+
5492
+ ruleTester . run (
5493
+ `${ ruleName } (${ type } ): supports style imports with optional chaining` ,
5494
+ rule ,
5495
+ {
5496
+ valid : [
5497
+ {
5498
+ code : dedent `
5499
+ import b from './b.css?raw'
5500
+ import c from './c.css'
5501
+
5502
+ import a from './a.js'
5503
+ ` ,
5504
+ options : [
5505
+ {
5506
+ ...options ,
5507
+ groups : [ 'style' , 'unknown' ] ,
5508
+ newlinesBetween : 'always' ,
5509
+ } ,
5510
+ ] ,
5511
+ } ,
5512
+ ] ,
5513
+ invalid : [
5514
+ {
5515
+ code : dedent `
5516
+ import a from './a.js'
5517
+ import b from './b.css?raw'
5518
+ import c from './c.css'
5519
+ ` ,
5520
+ output : dedent `
5521
+ import b from './b.css?raw'
5522
+ import c from './c.css'
5523
+
5524
+ import a from './a.js'
5525
+ ` ,
5526
+ options : [
5527
+ {
5528
+ ...options ,
5529
+ groups : [ 'style' , 'unknown' ] ,
5530
+ newlinesBetween : 'always' ,
5531
+ } ,
5532
+ ] ,
5533
+ errors : [
5534
+ {
5535
+ messageId : 'unexpectedImportsGroupOrder' ,
5536
+ data : {
5537
+ left : './a.js' ,
5538
+ leftGroup : 'unknown' ,
5539
+ right : './b.css?raw' ,
5540
+ rightGroup : 'style' ,
5541
+ } ,
5542
+ } ,
5543
+ ] ,
5544
+ } ,
5545
+ ] ,
5546
+ } ,
5547
+ )
5377
5548
} )
5378
5549
5379
5550
describe ( `${ ruleName } : validating group configuration` , ( ) => {
0 commit comments