File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,13 @@ const create = (context) => {
2929 context . report ( {
3030 fix ( fixer ) {
3131 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+ }
3339 } ) ;
3440 const source = node . source . value ;
3541
Original file line number Diff line number Diff line change @@ -11,6 +11,18 @@ export default {
1111 options : [ 'identifier' ] ,
1212 output : 'import {type A, type B} from \'a\';'
1313 } ,
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+ } ,
1426 {
1527 code : 'import {type A, type B} from \'a\';' ,
1628 errors : [
You can’t perform that action at this time.
0 commit comments