Skip to content

Commit 506383f

Browse files
committed
feat: 去除 prettier 相关配置,由外置应用工程自行格式化
1 parent 726b420 commit 506383f

File tree

3 files changed

+45
-8
lines changed

3 files changed

+45
-8
lines changed

src/parsers/types.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,35 @@ export interface ParserOptions {
5656
*/
5757
okMediaType?: string;
5858

59+
/**
60+
* 自定义名称格式化
61+
* @param {NameFormatterProps} props
62+
* @returns {string}
63+
*/
5964
nameFormatter?: (props: NameFormatterProps) => string;
65+
66+
/**
67+
* 请求路径参数类型名称
68+
* @default ReqPath
69+
*/
6070
requestPathTypeName?: string;
71+
72+
/**
73+
* 请求查询参数类型名称
74+
* @default ReqParams
75+
*/
6176
requestQueryTypeName?: string;
77+
78+
/**
79+
* 请求体参数类型名称
80+
* @default ReqData
81+
*/
6282
requestBodyTypeName?: string;
83+
84+
/**
85+
* 响应体类型名称
86+
* @default ResData
87+
*/
6388
responseBodyTypeName?: string;
6489
}
6590

src/printers/BasePrinter.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import type { StrictPrinterOptions, PrinterOptions } from './types';
55
export class BasePrinter {
66
static defaults: StrictPrinterOptions = {
77
axiosImport: `import axios from 'axios';`,
8-
prettier: {
9-
singleQuote: true,
10-
},
118
requestPathArgName: 'path',
129
requestQueryArgName: 'params',
1310
requestBodyArgName: 'data',

src/printers/types.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
1-
import type { Config } from 'prettier';
2-
31
export interface PrinterOptions {
2+
/**
3+
* axios 导入,必须有名称 axios,且 axios.request 是一个请求方法
4+
* @default import axios from 'axios';
5+
*/
46
axiosImport?: string;
57

68
/**
7-
* 格式化配置
9+
* 请求路径的参数名称
10+
* @default path
811
*/
9-
prettier?: Config;
10-
1112
requestPathArgName?: string;
13+
14+
/**
15+
* 请求参数的参数名称
16+
* @default params
17+
*/
1218
requestQueryArgName?: string;
19+
20+
/**
21+
* 请求体的参数名称
22+
* @default data
23+
*/
1324
requestBodyArgName?: string;
1425

26+
/**
27+
* 自定义响应包装类型
28+
* @default AxiosPromise
29+
*/
1530
responseTypeName?: 'Promise' | 'AxiosPromise' | string;
1631
}
1732
export type StrictPrinterOptions = Required<PrinterOptions>;

0 commit comments

Comments
 (0)