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 1
1
import path from "path" ;
2
2
import prettier from "prettier" ;
3
+ import parserTypescript from "prettier/parser-typescript" ;
3
4
import { swaggerVersion } from "./utils" ;
4
5
import { transformAll } from "./transform/index" ;
5
6
import { OpenAPI2 , OpenAPI3 , SchemaObject , SwaggerToTSOptions } from "./types" ;
@@ -30,13 +31,17 @@ export default function swaggerToTS(
30
31
` ;
31
32
32
33
// 3. Prettify output
33
- let prettierOptions : prettier . Options = { parser : "typescript" } ;
34
+ let prettierOptions : prettier . Options = {
35
+ parser : "typescript" ,
36
+ plugins : [ parserTypescript ] ,
37
+ } ;
34
38
if ( options && options . prettierConfig ) {
35
39
try {
36
40
const userOptions = prettier . resolveConfig . sync ( path . resolve ( process . cwd ( ) , options . prettierConfig ) ) ;
37
41
prettierOptions = {
42
+ ...( userOptions || { } ) ,
38
43
...prettierOptions ,
39
- ...userOptions ,
44
+ plugins : [ ...( prettierOptions . plugins as prettier . Plugin [ ] ) , ... ( ( userOptions && userOptions . plugins ) || [ ] ) ] ,
40
45
} ;
41
46
} catch ( err ) {
42
47
console . error ( `❌ ${ err } ` ) ;
You can’t perform that action at this time.
0 commit comments