@@ -30,7 +30,7 @@ ruleTester.run('no-wildcard-imports', rule, {
30
30
// Test type import
31
31
{
32
32
code : `import type {SxProp} from '@primer/react/lib-esm/sx'` ,
33
- output : `import type { SxProp} from '@primer/react'` ,
33
+ output : `import { type SxProp} from '@primer/react'` ,
34
34
errors : [
35
35
{
36
36
messageId : 'wildcardMigration' ,
@@ -44,7 +44,7 @@ ruleTester.run('no-wildcard-imports', rule, {
44
44
// Test multiple type imports
45
45
{
46
46
code : `import type {BetterSystemStyleObject, SxProp, BetterCssProperties} from '@primer/react/lib-esm/sx'` ,
47
- output : `import type { BetterSystemStyleObject, SxProp, BetterCssProperties} from '@primer/react'` ,
47
+ output : `import { type BetterSystemStyleObject, type SxProp, type BetterCssProperties} from '@primer/react'` ,
48
48
errors : [
49
49
{
50
50
messageId : 'wildcardMigration' ,
@@ -58,7 +58,7 @@ ruleTester.run('no-wildcard-imports', rule, {
58
58
// Test import alias
59
59
{
60
60
code : `import type {SxProp as RenamedSxProp} from '@primer/react/lib-esm/sx'` ,
61
- output : `import type { SxProp as RenamedSxProp} from '@primer/react'` ,
61
+ output : `import { type SxProp as RenamedSxProp} from '@primer/react'` ,
62
62
errors : [
63
63
{
64
64
messageId : 'wildcardMigration' ,
@@ -108,7 +108,7 @@ ruleTester.run('no-wildcard-imports', rule, {
108
108
// Test renamed wildcard imports
109
109
{
110
110
code : `import type {ItemProps} from '@primer/react/lib-esm/deprecated/ActionList/Item'` ,
111
- output : `import type { ActionListItemProps as ItemProps} from '@primer/react/deprecated'` ,
111
+ output : `import { type ActionListItemProps as ItemProps} from '@primer/react/deprecated'` ,
112
112
errors : [
113
113
{
114
114
messageId : 'wildcardMigration' ,
@@ -122,8 +122,7 @@ ruleTester.run('no-wildcard-imports', rule, {
122
122
// Test mixed imports
123
123
{
124
124
code : `import {Dialog, type DialogProps} from '@primer/react/lib-esm/Dialog/Dialog'` ,
125
- output : `import {Dialog} from '@primer/react/experimental'
126
- import type {DialogProps} from '@primer/react/experimental'` ,
125
+ output : `import {Dialog, type DialogProps} from '@primer/react/experimental'` ,
127
126
errors : [
128
127
{
129
128
messageId : 'wildcardMigration' ,
@@ -134,6 +133,22 @@ import type {DialogProps} from '@primer/react/experimental'`,
134
133
] ,
135
134
} ,
136
135
136
+ // Use existing imports
137
+ {
138
+ code : `import {Box, type BoxProps} from '@primer/react'
139
+ import type {BetterSystemStyleObject} from '@primer/react/lib-esm/sx'` ,
140
+ output : `import {Box, type BoxProps, type BetterSystemStyleObject} from '@primer/react'
141
+ ` ,
142
+ errors : [
143
+ {
144
+ messageId : 'wildcardMigration' ,
145
+ data : {
146
+ wildcardEntrypoint : '@primer/react/lib-esm/sx' ,
147
+ } ,
148
+ } ,
149
+ ] ,
150
+ } ,
151
+
137
152
// Test migrations
138
153
139
154
// Test helpers ------------------------------------------------------------
@@ -155,7 +170,7 @@ import type {DialogProps} from '@primer/react/experimental'`,
155
170
code : `import {ButtonBase} from '@primer/react/lib-esm/Button/ButtonBase';
156
171
import type {ButtonBaseProps} from '@primer/react/lib-esm/Button/ButtonBase'` ,
157
172
output : `import {ButtonBase} from '@primer/react'
158
- import type { ButtonBaseProps} from '@primer/react'` ,
173
+ import { type ButtonBaseProps} from '@primer/react'` ,
159
174
errors : [
160
175
{
161
176
messageId : 'wildcardMigration' ,
@@ -173,7 +188,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
173
188
} ,
174
189
{
175
190
code : `import type {ButtonBaseProps} from '@primer/react/lib-esm/Button/types'` ,
176
- output : `import type { ButtonBaseProps} from '@primer/react'` ,
191
+ output : `import { type ButtonBaseProps} from '@primer/react'` ,
177
192
errors : [
178
193
{
179
194
messageId : 'wildcardMigration' ,
@@ -209,7 +224,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
209
224
} ,
210
225
{
211
226
code : `import type {SelectPanelProps} from '@primer/react/lib-esm/SelectPanel/SelectPanel'` ,
212
- output : `import type { SelectPanelProps} from '@primer/react'` ,
227
+ output : `import { type SelectPanelProps} from '@primer/react'` ,
213
228
errors : [
214
229
{
215
230
messageId : 'wildcardMigration' ,
@@ -221,7 +236,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
221
236
} ,
222
237
{
223
238
code : `import type {LabelColorOptions} from '@primer/react/lib-esm/Label/Label'` ,
224
- output : `import type { LabelColorOptions} from '@primer/react'` ,
239
+ output : `import { type LabelColorOptions} from '@primer/react'` ,
225
240
errors : [
226
241
{
227
242
messageId : 'wildcardMigration' ,
@@ -245,7 +260,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
245
260
} ,
246
261
{
247
262
code : `import type {IssueLabelTokenProps} from '@primer/react/lib-esm/Token/IssueLabelToken'` ,
248
- output : `import type { IssueLabelTokenProps} from '@primer/react'` ,
263
+ output : `import { type IssueLabelTokenProps} from '@primer/react'` ,
249
264
errors : [
250
265
{
251
266
messageId : 'wildcardMigration' ,
@@ -257,7 +272,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
257
272
} ,
258
273
{
259
274
code : `import type {TokenSizeKeys} from '@primer/react/lib-esm/Token/TokenBase'` ,
260
- output : `import type { TokenSizeKeys} from '@primer/react'` ,
275
+ output : `import { type TokenSizeKeys} from '@primer/react'` ,
261
276
errors : [
262
277
{
263
278
messageId : 'wildcardMigration' ,
@@ -269,7 +284,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
269
284
} ,
270
285
{
271
286
code : `import type {ItemProps} from '@primer/react/lib-esm/deprecated/ActionList'` ,
272
- output : `import type { ActionListItemProps as ItemProps} from '@primer/react/deprecated'` ,
287
+ output : `import { type ActionListItemProps as ItemProps} from '@primer/react/deprecated'` ,
273
288
errors : [
274
289
{
275
290
messageId : 'wildcardMigration' ,
@@ -281,7 +296,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
281
296
} ,
282
297
{
283
298
code : `import type {GroupedListProps} from '@primer/react/lib-esm/deprecated/ActionList/List'` ,
284
- output : `import type { ActionListGroupedListProps as GroupedListProps} from '@primer/react/deprecated'` ,
299
+ output : `import { type ActionListGroupedListProps as GroupedListProps} from '@primer/react/deprecated'` ,
285
300
errors : [
286
301
{
287
302
messageId : 'wildcardMigration' ,
@@ -305,7 +320,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
305
320
} ,
306
321
{
307
322
code : `import type {ItemProps} from '@primer/react/lib-esm/deprecated/ActionList/Item'` ,
308
- output : `import type { ActionListItemProps as ItemProps} from '@primer/react/deprecated'` ,
323
+ output : `import { type ActionListItemProps as ItemProps} from '@primer/react/deprecated'` ,
309
324
errors : [
310
325
{
311
326
messageId : 'wildcardMigration' ,
@@ -375,7 +390,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
375
390
} ,
376
391
{
377
392
code : `import type {ResponsiveValue} from '@primer/react/lib-esm/hooks/useResponsiveValue'` ,
378
- output : `import type { ResponsiveValue} from '@primer/react'` ,
393
+ output : `import { type ResponsiveValue} from '@primer/react'` ,
379
394
errors : [
380
395
{
381
396
messageId : 'wildcardMigration' ,
@@ -391,7 +406,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
391
406
// @primer /react/lib-esm/sx
392
407
{
393
408
code : `import type {BetterSystemStyleObject, SxProp, BetterCssProperties} from '@primer/react/lib-esm/sx'` ,
394
- output : `import type { BetterSystemStyleObject, SxProp, BetterCssProperties} from '@primer/react'` ,
409
+ output : `import { type BetterSystemStyleObject, type SxProp, type BetterCssProperties} from '@primer/react'` ,
395
410
errors : [
396
411
{
397
412
messageId : 'wildcardMigration' ,
0 commit comments