@@ -92,27 +92,62 @@ ruleTester.run('no-export-in-script-setup', rule, {
92
92
export * from 'foo'
93
93
export default {}
94
94
export class A {}
95
- </script>
96
- ` ,
97
- output : `
98
- <script setup>
99
-
100
-
101
-
95
+ export const test = '123'
96
+ export function foo() {}
97
+ const a = 1
98
+ export { a }
99
+ export { fao } from 'bar'
102
100
</script>
103
101
` ,
104
102
errors : [
105
103
{
106
104
message : '`<script setup>` cannot contain ES module exports.' ,
107
- line : 3
105
+ line : 3 ,
106
+ endLine : 3 ,
107
+ column : 7 ,
108
+ endColumn : 26
109
+ } ,
110
+ {
111
+ message : '`<script setup>` cannot contain ES module exports.' ,
112
+ line : 4 ,
113
+ endLine : 4 ,
114
+ column : 7 ,
115
+ endColumn : 24
116
+ } ,
117
+ {
118
+ message : '`<script setup>` cannot contain ES module exports.' ,
119
+ line : 5 ,
120
+ endLine : 5 ,
121
+ column : 7 ,
122
+ endColumn : 13
123
+ } ,
124
+ {
125
+ message : '`<script setup>` cannot contain ES module exports.' ,
126
+ line : 6 ,
127
+ endLine : 6 ,
128
+ column : 7 ,
129
+ endColumn : 13
108
130
} ,
109
131
{
110
132
message : '`<script setup>` cannot contain ES module exports.' ,
111
- line : 4
133
+ line : 7 ,
134
+ endLine : 7 ,
135
+ column : 7 ,
136
+ endColumn : 13
112
137
} ,
113
138
{
114
139
message : '`<script setup>` cannot contain ES module exports.' ,
115
- line : 5
140
+ line : 9 ,
141
+ endLine : 9 ,
142
+ column : 7 ,
143
+ endColumn : 19
144
+ } ,
145
+ {
146
+ message : '`<script setup>` cannot contain ES module exports.' ,
147
+ line : 10 ,
148
+ endLine : 10 ,
149
+ column : 7 ,
150
+ endColumn : 32
116
151
}
117
152
]
118
153
} ,
@@ -126,30 +161,29 @@ ruleTester.run('no-export-in-script-setup', rule, {
126
161
export * from 'foo'
127
162
export default {}
128
163
export class A {}
129
- </script>
130
- ` ,
131
- output : `
132
- <script>
133
- let foo;
134
- </script>
135
- <script setup>
136
-
137
-
138
-
139
164
</script>
140
165
` ,
141
166
errors : [
142
167
{
143
168
message : '`<script setup>` cannot contain ES module exports.' ,
144
- line : 6
169
+ line : 6 ,
170
+ endLine : 6 ,
171
+ column : 7 ,
172
+ endColumn : 26
145
173
} ,
146
174
{
147
175
message : '`<script setup>` cannot contain ES module exports.' ,
148
- line : 7
176
+ line : 7 ,
177
+ endLine : 7 ,
178
+ column : 7 ,
179
+ endColumn : 24
149
180
} ,
150
181
{
151
182
message : '`<script setup>` cannot contain ES module exports.' ,
152
- line : 8
183
+ line : 8 ,
184
+ endLine : 8 ,
185
+ column : 7 ,
186
+ endColumn : 13
153
187
}
154
188
]
155
189
} ,
@@ -160,13 +194,6 @@ ruleTester.run('no-export-in-script-setup', rule, {
160
194
export const Foo = {}
161
195
export enum Bar {}
162
196
export {}
163
- </script>
164
- ` ,
165
- output : `
166
- <script setup lang="ts">
167
-
168
-
169
-
170
197
</script>
171
198
` ,
172
199
languageOptions : {
@@ -178,15 +205,24 @@ ruleTester.run('no-export-in-script-setup', rule, {
178
205
errors : [
179
206
{
180
207
message : '`<script setup>` cannot contain ES module exports.' ,
181
- line : 3
208
+ line : 3 ,
209
+ endLine : 3 ,
210
+ column : 7 ,
211
+ endColumn : 13
182
212
} ,
183
213
{
184
214
message : '`<script setup>` cannot contain ES module exports.' ,
185
- line : 4
215
+ line : 4 ,
216
+ endLine : 4 ,
217
+ column : 7 ,
218
+ endColumn : 13
186
219
} ,
187
220
{
188
221
message : '`<script setup>` cannot contain ES module exports.' ,
189
- line : 5
222
+ line : 5 ,
223
+ endLine : 5 ,
224
+ column : 7 ,
225
+ endColumn : 16
190
226
}
191
227
]
192
228
}
0 commit comments