@@ -100,7 +100,7 @@ function createTestFile() {
100100* @returns {string } `index.d.ts` contents
101101*/
102102function createDefinitionFile ( ns , imports , properties , description ) {
103- return [
103+ var lines = [
104104 '/*' ,
105105 '* @license Apache-2.0' ,
106106 '*' ,
@@ -121,16 +121,23 @@ function createDefinitionFile( ns, imports, properties, description ) {
121121 '' ,
122122 '// TypeScript Version: 4.1' ,
123123 '' ,
124- '/* eslint-disable max-lines */' ,
125- '' ,
126- imports . join ( '\n' ) ,
127- '' ,
124+ '/* eslint-disable max-lines' + ( ( properties . length === 0 ) ? ', @typescript-eslint/no-empty-interface' : '' ) + ' */' ,
125+ ''
126+ ] ;
127+ if ( imports . length > 0 ) {
128+ lines . push ( '' , imports . join ( '\n' ) , '' ) ;
129+ }
130+ lines = lines . concat ( [
128131 '/**' ,
129132 '* Interface describing the `' + ns + '` namespace.' ,
130- '*/' ,
131- 'interface Namespace {' ,
132- properties . join ( '\n' ) ,
133- '}' ,
133+ '*/'
134+ ] ) ;
135+ if ( properties . length > 0 ) {
136+ lines . push ( 'interface Namespace {' , properties . join ( '\n' ) , '}' ) ;
137+ } else {
138+ lines . push ( 'interface Namespace {}' ) ;
139+ }
140+ lines = lines . concat ( [
134141 '' ,
135142 '/**' ,
136143 '* ' + description ,
@@ -142,7 +149,8 @@ function createDefinitionFile( ns, imports, properties, description ) {
142149 '' ,
143150 'export = ns;' ,
144151 ''
145- ] . join ( '\n' ) ;
152+ ] ) ;
153+ return lines . join ( '\n' ) ;
146154}
147155
148156/**
0 commit comments