Skip to content

Commit ad2d9af

Browse files
bradzacherljharb
authored andcommitted
add tests for mixed default/named imports
1 parent 35909fa commit ad2d9af

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

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

+36
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,24 @@ const COMMON_TESTS = {
8282
type: 'ImportSpecifier',
8383
}],
8484
},
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+
},
85103

86104
//
87105
// prefer-inline
@@ -216,6 +234,24 @@ const FLOW_ONLY = {
216234
},
217235
],
218236
},
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+
},
219255

220256
//
221257
// prefer-inline

0 commit comments

Comments
 (0)