Skip to content

Commit

Permalink
fix(plugin): allow empty type import (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jul 15, 2023
1 parent 3ef955d commit 5821926
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Expand Up @@ -6,6 +6,7 @@ const valids = [
'import { type Foo } from \'foo\'',
'import type Foo from \'foo\'',
'import type * as Foo from \'foo\'',
'import type {} from \'foo\'',
]
const invalids = [
['import type { Foo } from \'foo\'', 'import { type Foo } from \'foo\''],
Expand Down
Expand Up @@ -30,7 +30,7 @@ export default createEslintRule<Options, MessageIds>({
// ignore bare type imports
if (node.specifiers.length === 1 && ['ImportNamespaceSpecifier', 'ImportDefaultSpecifier'].includes(node.specifiers[0].type))
return
if (node.importKind === 'type') {
if (node.importKind === 'type' && node.specifiers.length > 0) {
context.report({
*fix(fixer) {
yield * removeTypeSpecifier(fixer, sourceCode, node)
Expand Down

0 comments on commit 5821926

Please sign in to comment.