Skip to content

Commit c04a385

Browse files
committed
chore: lint 增加 tsc 检查
1 parent 2947748 commit c04a385

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "OpenAPI Specification ➡️ TypeScript",
55
"scripts": {
66
"prepare": "husky install",
7-
"lint": "eslint src/**/*.ts",
7+
"lint": "eslint src/**/*.ts && tsc --project tsconfig.json --noEmit",
88
"test": "echo 'no test'",
99
"build:types": "rm -rf dist-dts && tsc --project tsconfig.types.json",
1010
"build:files": "rm -rf dist-cjs dist-mjs && rollup --config",

src/generator.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import chalk from 'chalk';
22
import { cosmiconfig } from 'cosmiconfig';
3-
import { CosmiconfigResult } from 'cosmiconfig/dist/types';
43
import fs from 'fs/promises';
54
import path from 'path';
65
import { generateApi } from 'swagger-typescript-api';

src/helpers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ export function formatHeaders(contentKind: ContentKind) {
1919
/**
2020
* 格式化请求体
2121
* @param {string} contentKind
22-
* @param data
22+
* @param body
2323
* @returns {FormData | string}
2424
*/
25-
export function formatBody(contentKind: ContentKind, data: any) {
25+
export function formatBody(contentKind: ContentKind, body: any) {
2626
switch (contentKind) {
2727
case ContentKind.URL_ENCODED:
28-
return new URLSearchParams(data).toString();
28+
return new URLSearchParams(body).toString();
2929

3030
case ContentKind.FORM_DATA: {
31-
return Object.keys(data).reduce((fd, key) => {
32-
const val = data[key];
31+
return Object.keys(body).reduce((fd, key) => {
32+
const val = body[key];
3333
const isFileType = val instanceof Blob || val instanceof File;
3434
const isString = typeof val === 'string' || typeof val === 'number';
3535
fd.append(key, isFileType ? val : isString ? String(val) : JSON.stringify(val));
@@ -38,6 +38,6 @@ export function formatBody(contentKind: ContentKind, data: any) {
3838
}
3939

4040
default:
41-
return JSON.stringify(data);
41+
return JSON.stringify(body);
4242
}
4343
}

0 commit comments

Comments
 (0)