@@ -100,7 +100,7 @@ function createTestFile() {
100
100
* @returns {string } `index.d.ts` contents
101
101
*/
102
102
function createDefinitionFile ( ns , imports , properties , description ) {
103
- return [
103
+ var lines = [
104
104
'/*' ,
105
105
'* @license Apache-2.0' ,
106
106
'*' ,
@@ -121,16 +121,23 @@ function createDefinitionFile( ns, imports, properties, description ) {
121
121
'' ,
122
122
'// TypeScript Version: 4.1' ,
123
123
'' ,
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 ( [
128
131
'/**' ,
129
132
'* 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 ( [
134
141
'' ,
135
142
'/**' ,
136
143
'* ' + description ,
@@ -142,7 +149,8 @@ function createDefinitionFile( ns, imports, properties, description ) {
142
149
'' ,
143
150
'export = ns;' ,
144
151
''
145
- ] . join ( '\n' ) ;
152
+ ] ) ;
153
+ return lines . join ( '\n' ) ;
146
154
}
147
155
148
156
/**
0 commit comments