File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ export class TemplateBase {
1111 this . vars = vars ;
1212 }
1313
14- protected getReactImport ( ) : t . ImportDeclaration | null {
15- const reactImportSpecifiers = this . getReactImportSpecifiers ( ) ;
16-
14+ // eslint-disable-next-line class-methods-use-this
15+ protected getReactImport (
16+ reactImportSpecifiers : t . ImportSpecifier [ ] = [ ]
17+ ) : t . ImportDeclaration | null {
1718 if ( config . newJsx ) {
1819 if ( reactImportSpecifiers . length ) {
1920 return c . importNamed ( reactImportSpecifiers , 'react' ) ;
Original file line number Diff line number Diff line change @@ -48,7 +48,8 @@ export class ComponentTemplate
4848 generateAST ( ) {
4949 const body : t . Statement [ ] = [ ] ;
5050
51- const reactImport = this . getReactImport ( ) ;
51+ const reactImportSpecifiers = this . getReactImportSpecifiers ( ) ;
52+ const reactImport = this . getReactImport ( reactImportSpecifiers ) ;
5253 if ( reactImport ) {
5354 body . push ( reactImport ) ;
5455 }
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ export class HOCTemplate extends TemplateBase implements Template {
1313 generateAST ( ) : t . File {
1414 const body : t . Statement [ ] = [ ] ;
1515
16- const reactImport = this . getReactImport ( ) ;
16+ const reactImportSpecifiers = this . getReactImportSpecifiers ( ) ;
17+ const reactImport = this . getReactImport ( reactImportSpecifiers ) ;
1718 if ( reactImport ) {
1819 body . push ( reactImport ) ;
1920 }
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ export class HookTemplate extends TemplateBase implements Template {
1313 generateAST ( ) : t . File {
1414 const body : t . Statement [ ] = [ ] ;
1515
16- const reactImport = this . getReactImport ( ) ;
16+ const reactImportSpecifiers = this . getReactImportSpecifiers ( ) ;
17+ const reactImport = this . getReactImport ( reactImportSpecifiers ) ;
1718 if ( reactImport ) {
1819 body . push ( reactImport ) ;
1920 }
You can’t perform that action at this time.
0 commit comments