fix(plugin): allow empty type import (#218)
This commit is contained in:
parent
3ef955d56f
commit
5821926148
@ -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\''],
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user