eslint-plugin-import
eslint-plugin-import copied to clipboard
[Fix] `no-duplicates`: Removing duplicates breaks in TypeScript
This PR addresses the issue where multiple import type statements from the same module are not properly combined when the prefer-inline option is enabled. Specifically, the problem arises when importing types with separate import type statements, which should be consolidated into a single import statement with inline type specifiers.
Fixes #3016, fixes #2792.
Given the following code:
import type { x } from 'foo';
import { type y } from 'foo';
as-is:
import type { x, type y } from 'foo';
to-be:
import { type x, type y } from 'foo';
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.91%. Comparing base (
09476d7) to head (eb8882d).
Additional details and impacted files
@@ Coverage Diff @@
## main #3033 +/- ##
==========================================
- Coverage 96.02% 95.91% -0.12%
==========================================
Files 78 78
Lines 3299 3305 +6
Branches 1160 1162 +2
==========================================
+ Hits 3168 3170 +2
- Misses 131 135 +4
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.