Skip to content

Commit 9f2b743

Browse files
committed
cleanup tests a little
1 parent 2df9be6 commit 9f2b743

File tree

1 file changed

+47
-45
lines changed

1 file changed

+47
-45
lines changed

tests/src/rules/consistent-type-specifier-style.js

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,106 +6,100 @@ const rule = require('rules/consistent-type-specifier-style');
66
const COMMON_TESTS = {
77
valid: [
88
//
9-
// always valid
9+
// prefer-top-level
1010
//
11-
// prefer-inline
1211
test({
1312
code: "import Foo from 'Foo';",
14-
options: ['prefer-inline'],
13+
options: ['prefer-top-level'],
1514
}),
1615
test({
1716
code: "import type Foo from 'Foo';",
18-
options: ['prefer-inline'],
17+
options: ['prefer-top-level'],
1918
}),
2019
test({
2120
code: "import { Foo } from 'Foo';",
22-
options: ['prefer-inline'],
21+
options: ['prefer-top-level'],
2322
}),
2423
test({
2524
code: "import { Foo as Bar } from 'Foo';",
26-
options: ['prefer-inline'],
25+
options: ['prefer-top-level'],
2726
}),
2827
test({
2928
code: "import * as Foo from 'Foo';",
30-
options: ['prefer-inline'],
29+
options: ['prefer-top-level'],
3130
}),
3231
test({
3332
code: "import 'Foo';",
34-
options: ['prefer-inline'],
33+
options: ['prefer-top-level'],
3534
}),
3635
test({
3736
code: "import {} from 'Foo';",
38-
options: ['prefer-inline'],
37+
options: ['prefer-top-level'],
3938
}),
4039
test({
4140
code: "import type {} from 'Foo';",
42-
options: ['prefer-inline'],
41+
options: ['prefer-top-level'],
4342
}),
44-
// prefer-top-level
4543
test({
46-
code: "import Foo from 'Foo';",
44+
code: "import type { Foo } from 'Foo';",
4745
options: ['prefer-top-level'],
4846
}),
4947
test({
50-
code: "import type Foo from 'Foo';",
48+
code: "import type { Foo as Bar } from 'Foo';",
5149
options: ['prefer-top-level'],
5250
}),
5351
test({
54-
code: "import { Foo } from 'Foo';",
52+
code: "import type { Foo, Bar, Baz, Bam } from 'Foo';",
5553
options: ['prefer-top-level'],
5654
}),
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+
}),
5771
test({
5872
code: "import { Foo as Bar } from 'Foo';",
59-
options: ['prefer-top-level'],
73+
options: ['prefer-inline'],
6074
}),
6175
test({
6276
code: "import * as Foo from 'Foo';",
63-
options: ['prefer-top-level'],
77+
options: ['prefer-inline'],
6478
}),
6579
test({
6680
code: "import 'Foo';",
67-
options: ['prefer-top-level'],
81+
options: ['prefer-inline'],
6882
}),
6983
test({
7084
code: "import {} from 'Foo';",
71-
options: ['prefer-top-level'],
85+
options: ['prefer-inline'],
7286
}),
7387
test({
7488
code: "import type {} from 'Foo';",
75-
options: ['prefer-top-level'],
89+
options: ['prefer-inline'],
7690
}),
77-
78-
//
79-
// prefer-inline
80-
//
81-
{
91+
test({
8292
code: "import { type Foo } from 'Foo';",
8393
options: ['prefer-inline'],
84-
},
85-
{
94+
}),
95+
test({
8696
code: "import { type Foo as Bar } from 'Foo';",
8797
options: ['prefer-inline'],
88-
},
89-
{
98+
}),
99+
test({
90100
code: "import { type Foo, type Bar, Baz, Bam } from 'Foo';",
91101
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+
}),
109103
],
110104
invalid: [
111105
//
@@ -214,6 +208,10 @@ const FLOW_ONLY = {
214208
//
215209
// prefer-top-level
216210
//
211+
{
212+
code: "import typeof Foo from 'Foo';",
213+
options: ['prefer-top-level'],
214+
},
217215
{
218216
code: "import typeof { Foo, Bar, Baz, Bam } from 'Foo';",
219217
options: ['prefer-top-level'],
@@ -222,6 +220,10 @@ const FLOW_ONLY = {
222220
//
223221
// prefer-inline
224222
//
223+
{
224+
code: "import typeof Foo from 'Foo';",
225+
options: ['prefer-inline'],
226+
},
225227
{
226228
code: "import { typeof Foo } from 'Foo';",
227229
options: ['prefer-inline'],

0 commit comments

Comments
 (0)