@@ -6,106 +6,100 @@ const rule = require('rules/consistent-type-specifier-style');
6
6
const COMMON_TESTS = {
7
7
valid : [
8
8
//
9
- // always valid
9
+ // prefer-top-level
10
10
//
11
- // prefer-inline
12
11
test ( {
13
12
code : "import Foo from 'Foo';" ,
14
- options : [ 'prefer-inline ' ] ,
13
+ options : [ 'prefer-top-level ' ] ,
15
14
} ) ,
16
15
test ( {
17
16
code : "import type Foo from 'Foo';" ,
18
- options : [ 'prefer-inline ' ] ,
17
+ options : [ 'prefer-top-level ' ] ,
19
18
} ) ,
20
19
test ( {
21
20
code : "import { Foo } from 'Foo';" ,
22
- options : [ 'prefer-inline ' ] ,
21
+ options : [ 'prefer-top-level ' ] ,
23
22
} ) ,
24
23
test ( {
25
24
code : "import { Foo as Bar } from 'Foo';" ,
26
- options : [ 'prefer-inline ' ] ,
25
+ options : [ 'prefer-top-level ' ] ,
27
26
} ) ,
28
27
test ( {
29
28
code : "import * as Foo from 'Foo';" ,
30
- options : [ 'prefer-inline ' ] ,
29
+ options : [ 'prefer-top-level ' ] ,
31
30
} ) ,
32
31
test ( {
33
32
code : "import 'Foo';" ,
34
- options : [ 'prefer-inline ' ] ,
33
+ options : [ 'prefer-top-level ' ] ,
35
34
} ) ,
36
35
test ( {
37
36
code : "import {} from 'Foo';" ,
38
- options : [ 'prefer-inline ' ] ,
37
+ options : [ 'prefer-top-level ' ] ,
39
38
} ) ,
40
39
test ( {
41
40
code : "import type {} from 'Foo';" ,
42
- options : [ 'prefer-inline ' ] ,
41
+ options : [ 'prefer-top-level ' ] ,
43
42
} ) ,
44
- // prefer-top-level
45
43
test ( {
46
- code : "import Foo from 'Foo';" ,
44
+ code : "import type { Foo } from 'Foo';" ,
47
45
options : [ 'prefer-top-level' ] ,
48
46
} ) ,
49
47
test ( {
50
- code : "import type Foo from 'Foo';" ,
48
+ code : "import type { Foo as Bar } from 'Foo';" ,
51
49
options : [ 'prefer-top-level' ] ,
52
50
} ) ,
53
51
test ( {
54
- code : "import { Foo } from 'Foo';" ,
52
+ code : "import type { Foo, Bar, Baz, Bam } from 'Foo';" ,
55
53
options : [ 'prefer-top-level' ] ,
56
54
} ) ,
55
+
56
+ //
57
+ // prefer-inline
58
+ //
59
+ test ( {
60
+ code : "import Foo from 'Foo';" ,
61
+ options : [ 'prefer-inline' ] ,
62
+ } ) ,
63
+ test ( {
64
+ code : "import type Foo from 'Foo';" ,
65
+ options : [ 'prefer-inline' ] ,
66
+ } ) ,
67
+ test ( {
68
+ code : "import { Foo } from 'Foo';" ,
69
+ options : [ 'prefer-inline' ] ,
70
+ } ) ,
57
71
test ( {
58
72
code : "import { Foo as Bar } from 'Foo';" ,
59
- options : [ 'prefer-top-level ' ] ,
73
+ options : [ 'prefer-inline ' ] ,
60
74
} ) ,
61
75
test ( {
62
76
code : "import * as Foo from 'Foo';" ,
63
- options : [ 'prefer-top-level ' ] ,
77
+ options : [ 'prefer-inline ' ] ,
64
78
} ) ,
65
79
test ( {
66
80
code : "import 'Foo';" ,
67
- options : [ 'prefer-top-level ' ] ,
81
+ options : [ 'prefer-inline ' ] ,
68
82
} ) ,
69
83
test ( {
70
84
code : "import {} from 'Foo';" ,
71
- options : [ 'prefer-top-level ' ] ,
85
+ options : [ 'prefer-inline ' ] ,
72
86
} ) ,
73
87
test ( {
74
88
code : "import type {} from 'Foo';" ,
75
- options : [ 'prefer-top-level ' ] ,
89
+ options : [ 'prefer-inline ' ] ,
76
90
} ) ,
77
-
78
- //
79
- // prefer-inline
80
- //
81
- {
91
+ test ( {
82
92
code : "import { type Foo } from 'Foo';" ,
83
93
options : [ 'prefer-inline' ] ,
84
- } ,
85
- {
94
+ } ) ,
95
+ test ( {
86
96
code : "import { type Foo as Bar } from 'Foo';" ,
87
97
options : [ 'prefer-inline' ] ,
88
- } ,
89
- {
98
+ } ) ,
99
+ test ( {
90
100
code : "import { type Foo, type Bar, Baz, Bam } from 'Foo';" ,
91
101
options : [ 'prefer-inline' ] ,
92
- } ,
93
-
94
- //
95
- // prefer-top-level
96
- //
97
- {
98
- code : "import type { Foo } from 'Foo';" ,
99
- options : [ 'prefer-top-level' ] ,
100
- } ,
101
- {
102
- code : "import type { Foo as Bar } from 'Foo';" ,
103
- options : [ 'prefer-top-level' ] ,
104
- } ,
105
- {
106
- code : "import type { Foo, Bar, Baz, Bam } from 'Foo';" ,
107
- options : [ 'prefer-top-level' ] ,
108
- } ,
102
+ } ) ,
109
103
] ,
110
104
invalid : [
111
105
//
@@ -214,6 +208,10 @@ const FLOW_ONLY = {
214
208
//
215
209
// prefer-top-level
216
210
//
211
+ {
212
+ code : "import typeof Foo from 'Foo';" ,
213
+ options : [ 'prefer-top-level' ] ,
214
+ } ,
217
215
{
218
216
code : "import typeof { Foo, Bar, Baz, Bam } from 'Foo';" ,
219
217
options : [ 'prefer-top-level' ] ,
@@ -222,6 +220,10 @@ const FLOW_ONLY = {
222
220
//
223
221
// prefer-inline
224
222
//
223
+ {
224
+ code : "import typeof Foo from 'Foo';" ,
225
+ options : [ 'prefer-inline' ] ,
226
+ } ,
225
227
{
226
228
code : "import { typeof Foo } from 'Foo';" ,
227
229
options : [ 'prefer-inline' ] ,
0 commit comments