@@ -142,6 +142,52 @@ const tests = {
142
142
})
143
143
` ,
144
144
} ,
145
+ {
146
+ code : `
147
+ const styles = StyleSheet.create({
148
+ a: {
149
+ margin: 1,
150
+ marginLeft: 1,
151
+ },
152
+ b: {
153
+ border: 1,
154
+ borderLeft: 1,
155
+ },
156
+ c: {
157
+ padding: 1,
158
+ paddingLeft: 1,
159
+ },
160
+ d: {
161
+ flex: 1,
162
+ flexGrow: 1,
163
+ }
164
+ })
165
+ ` ,
166
+ options : [ 'asc' ] ,
167
+ } ,
168
+ {
169
+ code : `
170
+ const styles = StyleSheet.create({
171
+ d: {
172
+ marginLeft: 1,
173
+ margin: 1,
174
+ },
175
+ c: {
176
+ border: 1,
177
+ borderLeft: 1,
178
+ },
179
+ b: {
180
+ padding: 1,
181
+ paddingLeft: 1,
182
+ },
183
+ a: {
184
+ flex: 1,
185
+ flexGrow: 1,
186
+ }
187
+ })
188
+ ` ,
189
+ options : [ 'desc' ] ,
190
+ } ,
145
191
] ,
146
192
invalid : [
147
193
{
@@ -165,7 +211,8 @@ const tests = {
165
211
` ,
166
212
errors : [
167
213
{
168
- message : "Expected style properties to be in ascending order. 'x' should be before 'y'." ,
214
+ message :
215
+ "Expected style properties to be in ascending order. 'x' should be before 'y'." ,
169
216
} ,
170
217
] ,
171
218
} ,
@@ -196,7 +243,8 @@ const tests = {
196
243
` ,
197
244
errors : [
198
245
{
199
- message : "Expected class names to be in ascending order. 'a' should be before 'b'." ,
246
+ message :
247
+ "Expected class names to be in ascending order. 'a' should be before 'b'." ,
200
248
} ,
201
249
] ,
202
250
} ,
@@ -222,7 +270,8 @@ const tests = {
222
270
` ,
223
271
errors : [
224
272
{
225
- message : "Expected class names to be in ascending order. 'c' should be before 'd'." ,
273
+ message :
274
+ "Expected class names to be in ascending order. 'c' should be before 'd'." ,
226
275
} ,
227
276
] ,
228
277
} ,
@@ -241,7 +290,8 @@ const tests = {
241
290
` ,
242
291
errors : [
243
292
{
244
- message : "Expected class names to be in ascending order. 'a' should be before 'b'." ,
293
+ message :
294
+ "Expected class names to be in ascending order. 'a' should be before 'b'." ,
245
295
} ,
246
296
] ,
247
297
} ,
@@ -314,13 +364,16 @@ const tests = {
314
364
` ,
315
365
errors : [
316
366
{
317
- message : "Expected style properties to be in ascending order. 'x' should be before 'y'." ,
367
+ message :
368
+ "Expected style properties to be in ascending order. 'x' should be before 'y'." ,
318
369
} ,
319
370
{
320
- message : "Expected style properties to be in ascending order. 'c' should be before 'd'." ,
371
+ message :
372
+ "Expected style properties to be in ascending order. 'c' should be before 'd'." ,
321
373
} ,
322
374
{
323
- message : "Expected class names to be in ascending order. 'c' should be before 'd'." ,
375
+ message :
376
+ "Expected class names to be in ascending order. 'c' should be before 'd'." ,
324
377
} ,
325
378
] ,
326
379
} ,
@@ -442,6 +495,176 @@ const tests = {
442
495
} ,
443
496
] ,
444
497
} ,
498
+ {
499
+ code : `
500
+ const styles = StyleSheet.create({
501
+ a: {
502
+ z: 1,
503
+ margin: 1,
504
+ b: 1,
505
+ marginLeft: 1,
506
+ a: 1,
507
+ },
508
+ b: {
509
+ z: 1,
510
+ b: 1,
511
+ border: 1,
512
+ borderLeft: 1,
513
+ a: 1,
514
+ },
515
+ c: {
516
+ z: 1,
517
+ padding: 1,
518
+ paddingLeft: 1,
519
+ b: 1,
520
+ a: 1,
521
+ },
522
+ d: {
523
+ flex: 1,
524
+ z: 1,
525
+ b: 1,
526
+ flexGrow: 1,
527
+ a: 1,
528
+ }
529
+ })
530
+ ` ,
531
+ output : `
532
+ const styles = StyleSheet.create({
533
+ a: {
534
+ a: 1,
535
+ b: 1,
536
+ margin: 1,
537
+ marginLeft: 1,
538
+ z: 1,
539
+ },
540
+ b: {
541
+ a: 1,
542
+ b: 1,
543
+ border: 1,
544
+ borderLeft: 1,
545
+ z: 1,
546
+ },
547
+ c: {
548
+ a: 1,
549
+ b: 1,
550
+ padding: 1,
551
+ paddingLeft: 1,
552
+ z: 1,
553
+ },
554
+ d: {
555
+ a: 1,
556
+ b: 1,
557
+ flex: 1,
558
+ flexGrow: 1,
559
+ z: 1,
560
+ }
561
+ })
562
+ ` ,
563
+ options : [ 'asc' ] ,
564
+ errors : [
565
+ {
566
+ message :
567
+ "Expected style properties to be in ascending order. 'margin' should be before 'z'." ,
568
+ } ,
569
+ {
570
+ message :
571
+ "Expected style properties to be in ascending order. 'b' should be before 'z'." ,
572
+ } ,
573
+ {
574
+ message :
575
+ "Expected style properties to be in ascending order. 'padding' should be before 'z'." ,
576
+ } ,
577
+ {
578
+ message :
579
+ "Expected style properties to be in ascending order. 'b' should be before 'z'." ,
580
+ } ,
581
+ ] ,
582
+ } ,
583
+ {
584
+ code : `
585
+ const styles = StyleSheet.create({
586
+ d: {
587
+ a: 1,
588
+ marginLeft: 1,
589
+ b: 1,
590
+ margin: 1,
591
+ z: 1,
592
+ },
593
+ c: {
594
+ a: 1,
595
+ b: 1,
596
+ border: 1,
597
+ borderLeft: 1,
598
+ z: 1,
599
+ },
600
+ b: {
601
+ a: 1,
602
+ padding: 1,
603
+ paddingLeft: 1,
604
+ b: 1,
605
+ z: 1,
606
+ },
607
+ a: {
608
+ flex: 1,
609
+ a: 1,
610
+ b: 1,
611
+ flexGrow: 1,
612
+ z: 1,
613
+ }
614
+ })
615
+ ` ,
616
+ output : `
617
+ const styles = StyleSheet.create({
618
+ d: {
619
+ z: 1,
620
+ marginLeft: 1,
621
+ margin: 1,
622
+ b: 1,
623
+ a: 1,
624
+ },
625
+ c: {
626
+ z: 1,
627
+ border: 1,
628
+ borderLeft: 1,
629
+ b: 1,
630
+ a: 1,
631
+ },
632
+ b: {
633
+ z: 1,
634
+ padding: 1,
635
+ paddingLeft: 1,
636
+ b: 1,
637
+ a: 1,
638
+ },
639
+ a: {
640
+ z: 1,
641
+ flex: 1,
642
+ flexGrow: 1,
643
+ b: 1,
644
+ a: 1,
645
+ }
646
+ })
647
+ ` ,
648
+ options : [ 'desc' ] ,
649
+ errors : [
650
+ {
651
+ message :
652
+ "Expected style properties to be in descending order. 'marginLeft' should be before 'a'." ,
653
+ } ,
654
+ {
655
+ message :
656
+ "Expected style properties to be in descending order. 'b' should be before 'a'." ,
657
+ } ,
658
+ {
659
+ message :
660
+ "Expected style properties to be in descending order. 'padding' should be before 'a'." ,
661
+ } ,
662
+ {
663
+ message :
664
+ "Expected style properties to be in descending order. 'b' should be before 'a'." ,
665
+ } ,
666
+ ] ,
667
+ } ,
445
668
] ,
446
669
} ;
447
670
0 commit comments