File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11import path from "path" ;
22import prettier from "prettier" ;
3+ import parserTypescript from "prettier/parser-typescript" ;
34import { swaggerVersion } from "./utils" ;
45import { transformAll } from "./transform/index" ;
56import { OpenAPI2 , OpenAPI3 , SchemaObject , SwaggerToTSOptions } from "./types" ;
@@ -30,13 +31,17 @@ export default function swaggerToTS(
3031` ;
3132
3233 // 3. Prettify output
33- let prettierOptions : prettier . Options = { parser : "typescript" } ;
34+ let prettierOptions : prettier . Options = {
35+ parser : "typescript" ,
36+ plugins : [ parserTypescript ] ,
37+ } ;
3438 if ( options && options . prettierConfig ) {
3539 try {
3640 const userOptions = prettier . resolveConfig . sync ( path . resolve ( process . cwd ( ) , options . prettierConfig ) ) ;
3741 prettierOptions = {
42+ ...( userOptions || { } ) ,
3843 ...prettierOptions ,
39- ...userOptions ,
44+ plugins : [ ...( prettierOptions . plugins as prettier . Plugin [ ] ) , ... ( ( userOptions && userOptions . plugins ) || [ ] ) ] ,
4045 } ;
4146 } catch ( err ) {
4247 console . error ( `❌ ${ err } ` ) ;
You can’t perform that action at this time.
0 commit comments