Skip to content

Commit

Permalink
add tests for mixed default/named imports
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher authored and ljharb committed Jun 10, 2022
1 parent 35909fa commit ad2d9af
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/src/rules/consistent-type-specifier-style.js
Expand Up @@ -82,6 +82,24 @@ const COMMON_TESTS = {
type: 'ImportSpecifier',
}],
},
{
code: "import Foo, { type Bar } from 'Foo';",
output: "import Foo, { } from 'Foo';\nimport type {Bar} from 'Foo';",
options: ['prefer-top-level'],
errors: [{
message: 'Prefer using a top-level type-only import instead of inline type specifiers.',
type: 'ImportSpecifier',
}],
},
{
code: "import Foo, { type Bar, Baz } from 'Foo';",
output: "import Foo, { Baz } from 'Foo';\nimport type {Bar} from 'Foo';",
options: ['prefer-top-level'],
errors: [{
message: 'Prefer using a top-level type-only import instead of inline type specifiers.',
type: 'ImportSpecifier',
}],
},

//
// prefer-inline
Expand Down Expand Up @@ -216,6 +234,24 @@ const FLOW_ONLY = {
},
],
},
{
code: "import Foo, { typeof Bar } from 'Foo';",
output: "import Foo, { } from 'Foo';\nimport typeof {Bar} from 'Foo';",
options: ['prefer-top-level'],
errors: [{
message: 'Prefer using a top-level typeof-only import instead of inline typeof specifiers.',
type: 'ImportSpecifier',
}],
},
{
code: "import Foo, { typeof Bar, Baz } from 'Foo';",
output: "import Foo, { Baz } from 'Foo';\nimport typeof {Bar} from 'Foo';",
options: ['prefer-top-level'],
errors: [{
message: 'Prefer using a top-level typeof-only import instead of inline typeof specifiers.',
type: 'ImportSpecifier',
}],
},

//
// prefer-inline
Expand Down

0 comments on commit ad2d9af

Please sign in to comment.