import-js / import-js/eslint-plugin-import

[no-duplicates] incorrect report on two non-combinable ts type import statements

Open
#2,007 2 comments 2 reactions 0 assignees View on GitHub
bug help wanted typescript
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

```ts
import type ESLint from 'eslint'
import type { Linter, SourceCode } from 'eslint'
```

If I merge them into one statement:

```ts
import type ESLint, { Linter, SourceCode } from 'eslint'
```

TS will fail to compile

```log
packages/eslint-plugin-mdx/src/processors/options.ts:5:8 - error TS1363: A type-only import can specify a default import or named bindings, but not both.

5 import type ESLint, { Linter, SourceCode } from 'eslint'
```

Contributor guide

Open the contributing guide

Research direction

Start with the reproduction in packages/eslint-plugin-mdx/src/processors/options.ts and inspect the no-duplicates rule's handling of separate type-only imports. Run the reported TypeScript example through the relevant lint setup, then verify that the valid non-combinable imports no longer produce an incorrect duplicate report.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.