Skip to content

fix: allow separate default and named type imports #19899

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

Merged

Conversation

xbinaryx
Copy link
Contributor

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

This PR fixes a false positive in no-duplicate-imports rule where it incorrectly flagged separate default and named TypeScript type imports as duplicates. Since TypeScript syntax prohibits combining these into a single import statement, the rule should allow them to coexist without warnings.

What changes did you make? (Give an overview)

  • Fixed no-duplicate-imports rule to not flag separate default + named type imports (e.g., import type A from "a"; import type { B } from "a") as duplicates.
  • Updated tests to verify the new behavior.

Fixes #19898

Is there anything you'd like reviewers to focus on?

@xbinaryx xbinaryx requested a review from a team as a code owner June 30, 2025 10:18
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Jun 30, 2025
Copy link

netlify bot commented Jun 30, 2025

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 2e457fe
🔍 Latest deploy log https://app.netlify.com/projects/docs-eslint/deploys/6863f29ec769470008edca10

@eslint-github-bot eslint-github-bot bot added the bug ESLint is working incorrectly label Jun 30, 2025
@github-actions github-actions bot added the rule Relates to ESLint's core rules label Jun 30, 2025
@aladdin-add aladdin-add moved this from Needs Triage to Implementing in Triage Jun 30, 2025
@aladdin-add aladdin-add added the accepted There is consensus among the team that this change meets the criteria for inclusion label Jun 30, 2025
nzakas
nzakas previously approved these changes Jun 30, 2025
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks. Holding off on merging until we decide on a patch release.

@nzakas nzakas moved this from Implementing to Merge Candidates in Triage Jun 30, 2025
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this case be considered valid as well?

{
	code: `
	import type A from "module";
	export type { B } from "module";
	`,
	options: [{ includeExports: true }],
},

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I believe this should be valid.

Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@fasttime
Copy link
Member

fasttime commented Jul 1, 2025

We are going to release this fix with ESLint v9.30.1.

@fasttime fasttime merged commit e91bb87 into eslint:main Jul 1, 2025
29 of 30 checks passed
@github-project-automation github-project-automation bot moved this from Merge Candidates to Complete in Triage Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly contributor pool rule Relates to ESLint's core rules
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Bug: [no-duplicate-imports] triggers on default+named type imports
5 participants