diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..a2d4608 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,21 @@ +{ + "env": { + "browser": true, + "node": true, + "es2021": true + }, + "ignorePatterns": ["vendor", "dist", "node_modules"], + "rules": { + "no-cond-assign": "off", + "no-plusplus": "off", + "no-bitwise": "off" + }, + "overrides": [ + { + "files": ["test/test-types*.ts"], + "rules": { + "no-unused-vars": "off" + } + } + ] +} diff --git a/AGENTS.md b/AGENTS.md index 7b4d967..74f6b46 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -16,7 +16,7 @@ tiny-oss is a tiny object storage SDK focused on uploading, with a functional AP ## Quick notes -- Commands live in `package.json`; formatting/lint are handled by `.editorconfig` and `oxlint.json`. +- Commands live in `package.json`; formatting/lint are handled by `.editorconfig` and `.oxlintrc.json`. - Integration specs (`test/*-integration.spec.ts`) need `npm run serve` first (Hono server on :8080, credentials from `.env`); signature/unit specs don't. - Input data is `Blob | ArrayBuffer | Uint8Array | string`; mini programs pass `ArrayBuffer`. diff --git a/oxlint.json b/oxlint.json deleted file mode 100644 index b288630..0000000 --- a/oxlint.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "es2021": true - }, - "ignore": ["vendor", "dist", "node_modules"], - "rules": { - "no-cond-assign": "off", - "no-plusplus": "off", - "no-bitwise": "off" - } -} diff --git a/src/cos/request.ts b/src/cos/request.ts index b975c20..1a256ac 100644 --- a/src/cos/request.ts +++ b/src/cos/request.ts @@ -1,5 +1,4 @@ import { getTransport } from '../transport' -import { encodeUtf8 } from '../utils' import { normalizeOptions, resolveTimeout, dataSize } from '../ops/request' import { getCosAuth } from './signature' import { resolveCosHost } from './host' diff --git a/src/ops/multipartUpload.ts b/src/ops/multipartUpload.ts index 6cb3720..63be5b7 100644 --- a/src/ops/multipartUpload.ts +++ b/src/ops/multipartUpload.ts @@ -122,8 +122,6 @@ export function createMultipartUpload(protocol: Protocol, deps: MultipartUploadD // Calculate parts to upload for (let i = 1; i <= numParts; i++) { - const start = (i - 1) * actualPartSize - const end = Math.min(i * actualPartSize, fileSize) const isDone = doneParts.some((p) => p.number === i) if (!isDone) { currentCheckpoint.parts.push({ number: i, etag: '' }) @@ -160,7 +158,7 @@ export function createMultipartUpload(protocol: Protocol, deps: MultipartUploadD let result: UploadPartResult try { result = await uploadOnce() - } catch (err) { + } catch { // Retry once on error result = await uploadOnce() } diff --git a/test/aws.spec.ts b/test/aws.spec.ts index b7a4d55..39db0b6 100644 --- a/test/aws.spec.ts +++ b/test/aws.spec.ts @@ -185,7 +185,6 @@ describe('AWS entry point', () => { it('multipartUpload meta uses the x-amz-meta- prefix', async () => { const calls: any[] = [] setTransport(async (url: string, opts: any) => { - const headers: Record = {} if (url.indexOf('?uploads') > -1) { calls.push({ url, opts }) return { diff --git a/test/provider.spec.ts b/test/provider.spec.ts index 23a334a..c7eb5c4 100644 --- a/test/provider.spec.ts +++ b/test/provider.spec.ts @@ -1,4 +1,4 @@ -import { describe, it, expect, vi, afterEach } from 'vitest' +import { describe, it, expect, afterEach } from 'vitest' import { createPut, createInitMultipartUpload,