@@ -614,6 +614,23 @@ context('TypeScript', function () {
614614 } ,
615615 ] ,
616616 } ) ,
617+ test ( {
618+ code : "import {type x} from './foo'; import {y} from './foo'" ,
619+ ...parserConfig ,
620+ output : `import {type x, y} from './foo'; ` ,
621+ errors : [
622+ {
623+ line : 1 ,
624+ column : 22 ,
625+ message : "'./foo' imported multiple times." ,
626+ } ,
627+ {
628+ line : 1 ,
629+ column : 47 ,
630+ message : "'./foo' imported multiple times." ,
631+ } ,
632+ ] ,
633+ } ) ,
617634 ] . concat ( ! tsVersionSatisfies ( '>= 4.5' ) || ! typescriptEslintParserSatisfies ( '>= 5.7.0' ) ? [ ] : [
618635 // without prefer-inline, will dedupe with type import kind
619636 test ( {
@@ -1018,20 +1035,34 @@ context('TypeScript', function () {
10181035 } ,
10191036 ] ,
10201037 } ) ,
1021- // #2834 Detect duplicates across type and regular imports
10221038 test ( {
1023- code : "import {AValue } from './foo'; import type {AType } from './foo'" ,
1039+ code : "import { type C, } from './foo';import {AValue, BValue, } from './foo'; " ,
10241040 ...parserConfig ,
10251041 options : [ { 'prefer-inline' : true } ] ,
1026- output : ` import {AValue,type AType } from './foo'; ` ,
1042+ output : " import { type C , AValue, BValue } from './foo';" ,
10271043 errors : [
10281044 {
10291045 line : 1 ,
1030- column : 22 ,
1046+ column : 25 ,
10311047 message : "'./foo' imported multiple times." ,
10321048 } ,
10331049 {
10341050 line : 1 ,
1051+ column : 64 ,
1052+ message : "'./foo' imported multiple times." ,
1053+ }
1054+ ] ,
1055+ } ) ,
1056+ // #2834 Detect duplicates across type and regular imports
1057+ test ( {
1058+ code : "import {AValue} from './foo'; import type {AType} from './foo'" ,
1059+ ...parserConfig ,
1060+ options : [ { 'prefer-inline' : true } ] ,
1061+ output : `import {AValue,type AType} from './foo'; ` ,
1062+ errors : [
1063+ {
1064+ line : 1 ,
1065+ column : 22 ,
10351066 column : 56 ,
10361067 message : "'./foo' imported multiple times." ,
10371068 } ,
0 commit comments