File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,13 @@ const create = (context) => {
29
29
context . report ( {
30
30
fix ( fixer ) {
31
31
const imports = node . specifiers . map ( ( specifier ) => {
32
- return 'type ' + specifier . local . name ;
32
+ if ( specifier . type === 'ImportDefaultSpecifier' ) {
33
+ return 'type default as ' + specifier . local . name ;
34
+ } else if ( specifier . imported . name === specifier . local . name ) {
35
+ return 'type ' + specifier . local . name ;
36
+ } else {
37
+ return 'type ' + specifier . imported . name + ' as ' + specifier . local . name ;
38
+ }
33
39
} ) ;
34
40
const source = node . source . value ;
35
41
Original file line number Diff line number Diff line change @@ -11,6 +11,18 @@ export default {
11
11
options : [ 'identifier' ] ,
12
12
output : 'import {type A, type B} from \'a\';'
13
13
} ,
14
+ {
15
+ code : 'import type {A, B as C} from \'a\';' ,
16
+ errors : [ { message : 'Unexpected "import type"' } ] ,
17
+ options : [ 'identifier' ] ,
18
+ output : 'import {type A, type B as C} from \'a\';'
19
+ } ,
20
+ {
21
+ code : 'import type A from \'a\';' ,
22
+ errors : [ { message : 'Unexpected "import type"' } ] ,
23
+ options : [ 'identifier' ] ,
24
+ output : 'import {type default as A} from \'a\';'
25
+ } ,
14
26
{
15
27
code : 'import {type A, type B} from \'a\';' ,
16
28
errors : [
You can’t perform that action at this time.
0 commit comments