@@ -82,6 +82,24 @@ const COMMON_TESTS = {
82
82
type : 'ImportSpecifier' ,
83
83
} ] ,
84
84
} ,
85
+ {
86
+ code : "import Foo, { type Bar } from 'Foo';" ,
87
+ output : "import Foo, { } from 'Foo';\nimport type {Bar} from 'Foo';" ,
88
+ options : [ 'prefer-top-level' ] ,
89
+ errors : [ {
90
+ message : 'Prefer using a top-level type-only import instead of inline type specifiers.' ,
91
+ type : 'ImportSpecifier' ,
92
+ } ] ,
93
+ } ,
94
+ {
95
+ code : "import Foo, { type Bar, Baz } from 'Foo';" ,
96
+ output : "import Foo, { Baz } from 'Foo';\nimport type {Bar} from 'Foo';" ,
97
+ options : [ 'prefer-top-level' ] ,
98
+ errors : [ {
99
+ message : 'Prefer using a top-level type-only import instead of inline type specifiers.' ,
100
+ type : 'ImportSpecifier' ,
101
+ } ] ,
102
+ } ,
85
103
86
104
//
87
105
// prefer-inline
@@ -216,6 +234,24 @@ const FLOW_ONLY = {
216
234
} ,
217
235
] ,
218
236
} ,
237
+ {
238
+ code : "import Foo, { typeof Bar } from 'Foo';" ,
239
+ output : "import Foo, { } from 'Foo';\nimport typeof {Bar} from 'Foo';" ,
240
+ options : [ 'prefer-top-level' ] ,
241
+ errors : [ {
242
+ message : 'Prefer using a top-level typeof-only import instead of inline typeof specifiers.' ,
243
+ type : 'ImportSpecifier' ,
244
+ } ] ,
245
+ } ,
246
+ {
247
+ code : "import Foo, { typeof Bar, Baz } from 'Foo';" ,
248
+ output : "import Foo, { Baz } from 'Foo';\nimport typeof {Bar} from 'Foo';" ,
249
+ options : [ 'prefer-top-level' ] ,
250
+ errors : [ {
251
+ message : 'Prefer using a top-level typeof-only import instead of inline typeof specifiers.' ,
252
+ type : 'ImportSpecifier' ,
253
+ } ] ,
254
+ } ,
219
255
220
256
//
221
257
// prefer-inline
0 commit comments