Skip to content

Bug: [no-duplicate-imports] triggers on default+named type imports #19898

@danielrentz

Description

@danielrentz

Environment

Node version: 22
npm version:
Local ESLint version: 9.30.0
Global ESLint version:
Operating System: Win11

What parser are you using?

@typescript-eslint/parser

What did you do?

Configuration
{
  "rules": {
    "no-duplicate-imports": "error"
  }
}
  import type A from "a";
  import type { B } from "a";

What did you expect to happen?

Code passes

What actually happened?

Code triggers "no-duplicate-imports"

Link to Minimal Reproducible Example

https://typescript-eslint.io/play/#ts=5.5.4&fileType=.tsx&code=CYUwxgNghgTiAEBbA9sArhBAiKX4G8BYAKHnhAA8AHZGAF3lADMoMGBLAOzpBhbAQBBAvAC%2BJMpRr14XHnygD4AIRHji6kqEiwEKdJnhYARniKlZiaQzoBPKkPhMYyREdwBuCZevw7DkVVRJxc3HCwvCylaG3sEfHhBABoVMUj1IA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQHYHsBaAE1gAd4BLAYwEMAXRQygWzP2ntQ0kWmg6RwYAL4gRQA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

In difference to value imports, TypeScript does not allow to combine default and named type imports, i.e. these are all syntax errors:

import type A, { B } from "a";
import type A, type { B } from "a";
import type A, { type B } from "a";

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionbugESLint is working incorrectlyrepro:yesIssues with a reproducible exampleruleRelates 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