Skip to content

Rule Change: support TypeScript syntax in no-duplicate-imports #19834

@rivajunior

Description

@rivajunior

What rule do you want to change?

no-duplicate-imports

What change do you want to make?

Generate fewer warnings

How do you think the change should be implemented?

A new option

Example code

/*eslint no-duplicate-imports: "error"*/
import { Foo } from './foo'
import type { Bar } from './foo' // error  './foo' import is duplicated  no-duplicate-imports

What does the rule currently do for this code?

It currently reports an error in type imports separated in a different import statement

What will the rule do after it's changed?

/*eslint no-duplicate-imports: ["error", { "allowTypeImports": true }]*/
import { Foo } from './foo'
import type { Bar } from './foo' // Ok!

Participation

  • I am willing to submit a pull request to implement this change.

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionenhancementThis change enhances an existing feature of ESLintruleRelates to ESLint's core rules

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions