build(projects): update tsconfig、eslintrc

This commit is contained in:
Soybean
2022-03-12 16:21:40 +08:00
parent 4093dcd6dc
commit 75de2b0604
131 changed files with 1174 additions and 1140 deletions

View File

@ -6,7 +6,7 @@ import {
NETWORK_ERROR_MSG,
REQUEST_TIMEOUT_CODE,
REQUEST_TIMEOUT_MSG,
ERROR_STATUS
ERROR_STATUS,
} from '@/config';
import { exeStrategyActions } from '../common';
import { showErrorMsg } from './msg';
@ -21,7 +21,7 @@ export function handleAxiosError(axiosError: AxiosError) {
const error: Service.RequestError = {
type: 'axios',
code: DEFAULT_REQUEST_ERROR_CODE,
msg: DEFAULT_REQUEST_ERROR_MSG
msg: DEFAULT_REQUEST_ERROR_MSG,
};
const actions: Common.StrategyAction[] = [
@ -30,14 +30,14 @@ export function handleAxiosError(axiosError: AxiosError) {
!window.navigator.onLine || axiosError.message === 'Network Error',
() => {
Object.assign(error, { code: NETWORK_ERROR_CODE, msg: NETWORK_ERROR_MSG });
}
},
],
[
// 超时错误
axiosError.code === REQUEST_TIMEOUT_CODE && axiosError.message.includes('timeout'),
() => {
Object.assign(error, { code: REQUEST_TIMEOUT_CODE, msg: REQUEST_TIMEOUT_MSG });
}
},
],
[
// 请求不成功的错误
@ -46,8 +46,8 @@ export function handleAxiosError(axiosError: AxiosError) {
const errorCode: ErrorStatus = (axiosError.response?.status as ErrorStatus) || 'DEFAULT';
const msg = ERROR_STATUS[errorCode];
Object.assign(error, { code: errorCode, msg });
}
]
},
],
];
exeStrategyActions(actions);
@ -65,7 +65,7 @@ export function handleResponseError(response: AxiosResponse) {
const error: Service.RequestError = {
type: 'axios',
code: DEFAULT_REQUEST_ERROR_CODE,
msg: DEFAULT_REQUEST_ERROR_MSG
msg: DEFAULT_REQUEST_ERROR_MSG,
};
if (!window.navigator.onLine) {
@ -92,7 +92,7 @@ export function handleBackendError(backendResult: Record<string, any>, config: S
const error: Service.RequestError = {
type: 'backend',
code: backendResult[codeKey],
msg: backendResult[msgKey]
msg: backendResult[msgKey],
};
showErrorMsg(error);

View File

@ -3,13 +3,13 @@ export async function handleServiceResult<T = any>(error: Service.RequestError |
if (error) {
const fail: Service.FailedResult = {
error,
data: null
data: null,
};
return fail;
}
const success: Service.SuccessResult<T> = {
error: null,
data
data,
};
return success;
}

View File

@ -34,7 +34,7 @@ async function transformFile(file: File[] | File, key: string) {
if (isArray(file)) {
// 多文件
await Promise.all(
(file as File[]).map(item => {
(file as File[]).map((item) => {
formData.append(key, item);
return true;
})