@@ -81,10 +81,15 @@ export class Printer {
8181
8282 print ( configs ?: PrinterConfigs ) {
8383 Object . assign ( this . configs , configs ) ;
84- const { hideInfo, hideComponents, hideImports, hidePaths } = this . configs ;
84+ const { hideLintComments, hideInfo, hideComponents, hideImports, hidePaths } = this . configs ;
85+ const eslintComments = [
86+ //
87+ '/* eslint-disable @typescript-eslint/ban-ts-comment */' ,
88+ '/* eslint-disable @typescript-eslint/no-explicit-any */' ,
89+ ] . join ( '\n' ) ;
8590
8691 return [
87- //
92+ ! hideLintComments && eslintComments ,
8893 ! hideInfo && this . _printInfo ( ) ,
8994 ! hideImports && this . _printImports ( ) ,
9095 ! hideComponents && this . _printComponents ( ) ,
@@ -94,6 +99,25 @@ export class Printer {
9499 . join ( '\n\n' ) ;
95100 }
96101
102+ private _printInfo ( ) {
103+ const { contact, description, license, summary, termsOfService, title, version } = this . document . info ;
104+ const { externalDocs } = this . document ;
105+ const { name, email, url } = contact || { } ;
106+ const jsDoc = new JsDoc ( ) ;
107+ const { module } = this . configs ;
108+ if ( module ) jsDoc . addComments ( { module } ) ;
109+ const extDoc = JsDoc . printExternalDoc ( externalDocs ) ;
110+ jsDoc . addComments ( {
111+ title,
112+ version,
113+ contact : name || url || email ? [ name , email ? `<${ email } >` : '' , url ? `(${ url } )` : '' ] . filter ( Boolean ) . join ( ' ' ) : undefined ,
114+ description,
115+ summary,
116+ see : extDoc ,
117+ } ) ;
118+ return jsDoc . print ( ) ;
119+ }
120+
97121 private _printImports ( ) {
98122 const {
99123 axiosImportName = AXIOS_IMPORT_NAME ,
@@ -111,9 +135,6 @@ export class Printer {
111135
112136 return [
113137 //
114- '/* eslint-disable @typescript-eslint/ban-ts-comment */' ,
115- '/* eslint-disable @typescript-eslint/no-explicit-any */' ,
116- '' ,
117138 axiosNamedImport
118139 ? // 具名导入
119140 `import {${ axiosImportName } } from "${ importPath } ";`
@@ -127,25 +148,6 @@ export class Printer {
127148 ] . join ( '\n' ) ;
128149 }
129150
130- private _printInfo ( ) {
131- const { contact, description, license, summary, termsOfService, title, version } = this . document . info ;
132- const { externalDocs } = this . document ;
133- const { name, email, url } = contact || { } ;
134- const jsDoc = new JsDoc ( ) ;
135- const { module } = this . configs ;
136- if ( module ) jsDoc . addComments ( { module } ) ;
137- const extDoc = JsDoc . printExternalDoc ( externalDocs ) ;
138- jsDoc . addComments ( {
139- title,
140- version,
141- contact : name || url || email ? [ name , email ? `<${ email } >` : '' , url ? `(${ url } )` : '' ] . filter ( Boolean ) . join ( ' ' ) : undefined ,
142- description,
143- summary,
144- see : extDoc ,
145- } ) ;
146- return jsDoc . print ( ) ;
147- }
148-
149151 private _printComponents ( ) {
150152 return Object . entries ( this . document . components ?. schemas || { } )
151153 . map ( ( [ name , schema ] ) => {
0 commit comments