@@ -614,6 +614,23 @@ context('TypeScript', function () {
614
614
} ,
615
615
] ,
616
616
} ) ,
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
+ } ) ,
617
634
] . concat ( ! tsVersionSatisfies ( '>= 4.5' ) || ! typescriptEslintParserSatisfies ( '>= 5.7.0' ) ? [ ] : [
618
635
// without prefer-inline, will dedupe with type import kind
619
636
test ( {
@@ -1018,20 +1035,34 @@ context('TypeScript', function () {
1018
1035
} ,
1019
1036
] ,
1020
1037
} ) ,
1021
- // #2834 Detect duplicates across type and regular imports
1022
1038
test ( {
1023
- code : "import {AValue } from './foo'; import type {AType } from './foo'" ,
1039
+ code : "import { type C, } from './foo';import {AValue, BValue, } from './foo'; " ,
1024
1040
...parserConfig ,
1025
1041
options : [ { 'prefer-inline' : true } ] ,
1026
- output : ` import {AValue,type AType } from './foo'; ` ,
1042
+ output : " import { type C , AValue, BValue } from './foo';" ,
1027
1043
errors : [
1028
1044
{
1029
1045
line : 1 ,
1030
- column : 22 ,
1046
+ column : 25 ,
1031
1047
message : "'./foo' imported multiple times." ,
1032
1048
} ,
1033
1049
{
1034
1050
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 ,
1035
1066
column : 56 ,
1036
1067
message : "'./foo' imported multiple times." ,
1037
1068
} ,
0 commit comments