Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin): allow empty type import #218

Merged
merged 1 commit into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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