diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 9f61a2f..5e058ce 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -19,7 +19,7 @@ const config = { offsetTernaryExpressions: true //三元表达式缩进 }], quotes: ["error", "double"], // 引号 - "object-shorthand": ["error", "consistent"], // 对象字面量简写语法 + "object-shorthand": ["off", "consistent"], // 对象字面量简写语法 "no-unused-vars": "off", // 禁止未使用过的变量。已禁用,使用typescript检查 "no-undef": "off", // 禁止未声明的变量。已禁用,使用typescript检查 diff --git a/src/components/upload/HashCalculator.ts b/src/components/upload/HashCalculator.ts index 6fa77b7..a06426f 100644 --- a/src/components/upload/HashCalculator.ts +++ b/src/components/upload/HashCalculator.ts @@ -18,7 +18,7 @@ export class SHA256Calculator { } else if (data instanceof Uint8Array) { newData = data } else { - throw new Error("Data must be a string or ArrayBuffer") + throw new Error("Data must be a string or Uint8Array") } const combinedData = new Uint8Array(this.digestBuffer.length + newData.length) combinedData.set(this.digestBuffer, 0) diff --git a/src/components/upload/types.d.ts b/src/components/upload/types.d.ts index 24c020d..4c2597f 100644 --- a/src/components/upload/types.d.ts +++ b/src/components/upload/types.d.ts @@ -36,7 +36,7 @@ interface UploaderWorkerConfig { } /** 上传任务 */ -interface UploadTask { +interface UploadTask { /** 任务ID */ id: number /** 文件 */ diff --git a/src/components/upload/uploadWorker.ts b/src/components/upload/uploadWorker.ts index fc8b17f..c665002 100644 --- a/src/components/upload/uploadWorker.ts +++ b/src/components/upload/uploadWorker.ts @@ -219,7 +219,7 @@ function uploadChunkTask(taskId: any, { index, hash, blob }: FileChunk, onProgre }) } -function checkMergeStatus(taskId) { +function checkMergeStatus(taskId: number) { return new Promise((resolve) => { // 轮询检查合并状态 const f = async () => { @@ -271,6 +271,7 @@ async function postData(url: string, data: unknown) { function retry(f: Function, count: number) { let retryCount = 0 return async (...args: any) => { + // eslint-disable-next-line no-constant-condition while (true) { try { retryCount += 1