@@ -184,16 +184,43 @@ tester.run('define-macros-order', rule, {
184
184
filename : 'test.vue' ,
185
185
code : `
186
186
<script setup>
187
- defineProps({
187
+ import Foo from 'foo'
188
+ /** props */
189
+ defineProps(['foo'])
190
+ /** options */
191
+ defineOptions({})
192
+ /** expose */
193
+ defineExpose({})
194
+ </script>
195
+ ` ,
196
+ options : optionsExposeLast
197
+ } ,
198
+ {
199
+ filename : 'test.vue' ,
200
+ code : `
201
+ <script setup lang="ts">
202
+ import Foo from 'foo'
203
+ /** props */
204
+ const props = defineProps({
188
205
test: Boolean
189
206
})
190
- console.log('test')
191
- defineExpose({
192
- a: 1
193
- })
207
+ /** emits */
208
+ defineEmits(['update:foo'])
209
+ /** slots */
210
+ const slots = defineSlots()
211
+ /** expose */
212
+ defineExpose({})
194
213
</script>
195
214
` ,
196
- options : optionsExposeLast
215
+ options : [
216
+ {
217
+ order : [ 'defineProps' , 'defineEmits' ] ,
218
+ defineExposeLast : true
219
+ }
220
+ ] ,
221
+ parserOptions : {
222
+ parser : require . resolve ( '@typescript-eslint/parser' )
223
+ }
197
224
}
198
225
] ,
199
226
invalid : [
@@ -655,14 +682,14 @@ tester.run('define-macros-order', rule, {
655
682
test: Boolean
656
683
})
657
684
658
- // expose
685
+ /** expose */
659
686
defineExpose({
660
- a: 1
687
+ foo: 'bar'
661
688
})
662
689
663
- // console start
690
+ /** console start */
664
691
console.log('test')
665
- // console end
692
+ /** console end */
666
693
</script>
667
694
` ,
668
695
output : `
@@ -671,13 +698,13 @@ tester.run('define-macros-order', rule, {
671
698
test: Boolean
672
699
})
673
700
674
- // console start
701
+ /** console start */
675
702
console.log('test')
676
- // console end
703
+ /** console end */
677
704
678
- // expose
705
+ /** expose */
679
706
defineExpose({
680
- a: 1
707
+ foo: 'bar'
681
708
})
682
709
</script>
683
710
` ,
@@ -688,6 +715,53 @@ tester.run('define-macros-order', rule, {
688
715
line : 8
689
716
}
690
717
]
718
+ } ,
719
+ {
720
+ filename : 'test.vue' ,
721
+ code : `
722
+ <script setup>
723
+ /** slots */
724
+ const slots = defineSlots()
725
+ /** options */
726
+ defineOptions({})
727
+ /** emits */
728
+ defineEmits(['update:foo'])
729
+ /** expose */
730
+ defineExpose({})
731
+ /** props */
732
+ const props = defineProps(['foo'])
733
+ </script>
734
+ ` ,
735
+ output : `
736
+ <script setup>
737
+ /** options */
738
+ defineOptions({})
739
+ /** emits */
740
+ defineEmits(['update:foo'])
741
+ /** props */
742
+ const props = defineProps(['foo'])
743
+ /** slots */
744
+ const slots = defineSlots()
745
+ /** expose */
746
+ defineExpose({})
747
+ </script>
748
+ ` ,
749
+ options : [
750
+ {
751
+ order : [ 'defineOptions' , 'defineEmits' , 'defineProps' , 'defineSlots' ] ,
752
+ defineExposeLast : true
753
+ }
754
+ ] ,
755
+ errors : [
756
+ {
757
+ message : message ( 'defineOptions' ) ,
758
+ line : 6
759
+ } ,
760
+ {
761
+ message : defineExposeNotTheLast ,
762
+ line : 10
763
+ }
764
+ ]
691
765
}
692
766
]
693
767
} )
0 commit comments