From 2a2a3a7c59a9d18f1876a0e4c92fcfbe215a2996 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 31 Dec 2025 19:59:31 +0100 Subject: [PATCH] chore: run oxlint type-aware in lint --- CHANGELOG.md | 1 + package.json | 10 ++- pnpm-lock.yaml | 153 +++++++++++++++++++++++++++++++++++ src/lib/runtime-query-ids.ts | 6 +- src/lib/twitter-client.ts | 13 +-- tests/cookies.test.ts | 17 ++-- tsconfig.oxlint.json | 9 +++ 7 files changed, 192 insertions(+), 17 deletions(-) create mode 100644 tsconfig.oxlint.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c2287d..246313e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Cookie extraction now uses `@steipete/sweet-cookie` (drops `sqlite3` CLI + custom browser readers in `bird`). - Query ID updater now tracks the Bookmarks GraphQL operation. - Lint rules stricter (block statements, no-negation-else, useConst/useTemplate, top-level regex, import extension enforcement). +- `pnpm lint` now runs both Biome and oxlint (type-aware). ### Tests - Coverage thresholds raised to 90% statements/lines/functions (80% branches). diff --git a/package.json b/package.json index dda0153..94121c9 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,12 @@ "bird": "pnpm run build:dist && node dist/index.js", "test": "vitest run", "test:watch": "vitest", - "lint": "biome check .", - "lint:fix": "biome check --write .", + "lint": "pnpm run lint:biome && pnpm run lint:oxlint", + "lint:biome": "biome check .", + "lint:oxlint": "oxlint --type-aware --tsconfig tsconfig.oxlint.json --import-plugin --node-plugin --vitest-plugin --deny-warnings src tests scripts", + "lint:fix": "pnpm run lint:biome:fix && pnpm run lint:oxlint:fix", + "lint:biome:fix": "biome check --write .", + "lint:oxlint:fix": "oxlint --type-aware --tsconfig tsconfig.oxlint.json --import-plugin --node-plugin --vitest-plugin --deny-warnings --fix src tests scripts", "format": "biome format --write .", "binary": "pnpm run build:binary", "graphql:update": "tsx scripts/update-query-ids.ts" @@ -37,6 +41,8 @@ "@biomejs/biome": "^2.3.10", "@types/node": "^25.0.3", "@vitest/coverage-v8": "4.0.16", + "oxlint": "^1.36.0", + "oxlint-tsgolint": "^0.10.0", "tsx": "^4.21.0", "typescript": "^5.9.3", "vitest": "^4.0.16" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4536b53..65c9fbc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,6 +30,12 @@ importers: '@vitest/coverage-v8': specifier: 4.0.16 version: 4.0.16(vitest@4.0.16(@types/node@25.0.3)(tsx@4.21.0)) + oxlint: + specifier: ^1.36.0 + version: 1.36.0(oxlint-tsgolint@0.10.0) + oxlint-tsgolint: + specifier: ^0.10.0 + version: 0.10.0 tsx: specifier: ^4.21.0 version: 4.21.0 @@ -282,6 +288,76 @@ packages: '@jridgewell/trace-mapping@0.3.31': resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + '@oxlint-tsgolint/darwin-arm64@0.10.0': + resolution: {integrity: sha512-mhBF/pjey0UdLL1ocU46Fqta+uJuRfqrLfDpcViRg17BtDiUNd8JY9iN2FOoS2HGSCAgCUjZ0AZkwkHwFs/VTw==} + cpu: [arm64] + os: [darwin] + + '@oxlint-tsgolint/darwin-x64@0.10.0': + resolution: {integrity: sha512-roLi34mw/i1z+NS7luboix55SXyhVv38dNUTcRDkk+0lNPzI9ngrM+1y1N2oBSUmz5o9OZGnfJJ7BSGCw/fFEQ==} + cpu: [x64] + os: [darwin] + + '@oxlint-tsgolint/linux-arm64@0.10.0': + resolution: {integrity: sha512-HL9NThPH1V2F6l9XhwNmhQZUknN4m4yQYEvQFFGfZTYN6cvEEBIiqfF4KvBUg8c0xadMbQlW+Ug7/ybA9Nn+CA==} + cpu: [arm64] + os: [linux] + + '@oxlint-tsgolint/linux-x64@0.10.0': + resolution: {integrity: sha512-Tw8QNq8ab+4+qE5krvJyMA66v6XE3GoiISRD5WmJ7YOxUnu//jSw/bBm7OYf/TNEZyeV0BTR7zXzhT5R+VFWlQ==} + cpu: [x64] + os: [linux] + + '@oxlint-tsgolint/win32-arm64@0.10.0': + resolution: {integrity: sha512-LTogmTRwpwQqVaH1Ama8Wd5/VVZWBSF8v5qTbeT628+1F5Kt1V5eHBvyFh4oN18UCZlgqrh7DqkDhsieXUaC8Q==} + cpu: [arm64] + os: [win32] + + '@oxlint-tsgolint/win32-x64@0.10.0': + resolution: {integrity: sha512-ygqxx8EmNWy9/wCQS5uXq9k/o2EyYNwNxY1ZHNzlmZC/kV06Aemx5OBDafefawBNqH7xTZPfccUrjdiy+QlTrw==} + cpu: [x64] + os: [win32] + + '@oxlint/darwin-arm64@1.36.0': + resolution: {integrity: sha512-MJkj82GH+nhvWKJhSIM6KlZ8tyGKdogSQXtNdpIyP02r/tTayFJQaAEWayG2Jhsn93kske+nimg5MYFhwO/rlg==} + cpu: [arm64] + os: [darwin] + + '@oxlint/darwin-x64@1.36.0': + resolution: {integrity: sha512-VvEhfkqj/99dCTqOcfkyFXOSbx4lIy5u2m2GHbK4WCMDySokOcMTNRHGw8fH/WgQ5cDrDMSTYIGQTmnBGi9tiQ==} + cpu: [x64] + os: [darwin] + + '@oxlint/linux-arm64-gnu@1.36.0': + resolution: {integrity: sha512-EMx92X5q+hHc3olTuj/kgkx9+yP0p/AVs4yvHbUfzZhBekXNpUWxWvg4hIKmQWn+Ee2j4o80/0ACGO0hDYJ9mg==} + cpu: [arm64] + os: [linux] + + '@oxlint/linux-arm64-musl@1.36.0': + resolution: {integrity: sha512-7YCxtrPIctVYLqWrWkk8pahdCxch6PtsaucfMLC7TOlDt4nODhnQd4yzEscKqJ8Gjrw1bF4g+Ngob1gB+Qr9Fw==} + cpu: [arm64] + os: [linux] + + '@oxlint/linux-x64-gnu@1.36.0': + resolution: {integrity: sha512-lnaJVlx5r3NWmoOMesfQXJSf78jHTn8Z+sdAf795Kgteo72+qGC1Uax2SToCJVN2J8PNG3oRV5bLriiCNR2i6Q==} + cpu: [x64] + os: [linux] + + '@oxlint/linux-x64-musl@1.36.0': + resolution: {integrity: sha512-AhuEU2Qdl66lSfTGu/Htirq8r/8q2YnZoG3yEXLMQWnPMn7efy8spD/N1NA7kH0Hll+cdfwgQkQqC2G4MS2lPQ==} + cpu: [x64] + os: [linux] + + '@oxlint/win32-arm64@1.36.0': + resolution: {integrity: sha512-GlWCBjUJY2QgvBFuNRkiRJu7K/djLmM0UQKfZV8IN+UXbP/JbjZHWKRdd4LXlQmzoz7M5Hd6p+ElCej8/90FCg==} + cpu: [arm64] + os: [win32] + + '@oxlint/win32-x64@1.36.0': + resolution: {integrity: sha512-J+Vc00Utcf8p77lZPruQgb0QnQXuKnFogN88kCnOqs2a83I+vTBB8ILr0+L9sTwVRvIDMSC0pLdeQH4svWGFZg==} + cpu: [x64] + os: [win32] + '@rollup/rollup-android-arm-eabi@4.53.5': resolution: {integrity: sha512-iDGS/h7D8t7tvZ1t6+WPK04KD0MwzLZrG0se1hzBjSi5fyxlsiggoJHwh18PCFNn7tG43OWb6pdZ6Y+rMlmyNQ==} cpu: [arm] @@ -561,6 +637,20 @@ packages: obug@2.1.1: resolution: {integrity: sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==} + oxlint-tsgolint@0.10.0: + resolution: {integrity: sha512-LDDSIu5J/4D4gFUuQQIEQpAC6maNEbMg4nC8JL/+Pe0cUDR86dtVZ09E2x5MwCh8f9yfktoaxt5x6UIVyzrajg==} + hasBin: true + + oxlint@1.36.0: + resolution: {integrity: sha512-IicUdXfXgI8OKrDPnoSjvBfeEF8PkKtm+CoLlg4LYe4ypc8U+T4r7730XYshdBGZdelg+JRw8GtCb2w/KaaZvw==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + oxlint-tsgolint: '>=0.10.0' + peerDependenciesMeta: + oxlint-tsgolint: + optional: true + pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} @@ -851,6 +941,48 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 + '@oxlint-tsgolint/darwin-arm64@0.10.0': + optional: true + + '@oxlint-tsgolint/darwin-x64@0.10.0': + optional: true + + '@oxlint-tsgolint/linux-arm64@0.10.0': + optional: true + + '@oxlint-tsgolint/linux-x64@0.10.0': + optional: true + + '@oxlint-tsgolint/win32-arm64@0.10.0': + optional: true + + '@oxlint-tsgolint/win32-x64@0.10.0': + optional: true + + '@oxlint/darwin-arm64@1.36.0': + optional: true + + '@oxlint/darwin-x64@1.36.0': + optional: true + + '@oxlint/linux-arm64-gnu@1.36.0': + optional: true + + '@oxlint/linux-arm64-musl@1.36.0': + optional: true + + '@oxlint/linux-x64-gnu@1.36.0': + optional: true + + '@oxlint/linux-x64-musl@1.36.0': + optional: true + + '@oxlint/win32-arm64@1.36.0': + optional: true + + '@oxlint/win32-x64@1.36.0': + optional: true + '@rollup/rollup-android-arm-eabi@4.53.5': optional: true @@ -1105,6 +1237,27 @@ snapshots: obug@2.1.1: {} + oxlint-tsgolint@0.10.0: + optionalDependencies: + '@oxlint-tsgolint/darwin-arm64': 0.10.0 + '@oxlint-tsgolint/darwin-x64': 0.10.0 + '@oxlint-tsgolint/linux-arm64': 0.10.0 + '@oxlint-tsgolint/linux-x64': 0.10.0 + '@oxlint-tsgolint/win32-arm64': 0.10.0 + '@oxlint-tsgolint/win32-x64': 0.10.0 + + oxlint@1.36.0(oxlint-tsgolint@0.10.0): + optionalDependencies: + '@oxlint/darwin-arm64': 1.36.0 + '@oxlint/darwin-x64': 1.36.0 + '@oxlint/linux-arm64-gnu': 1.36.0 + '@oxlint/linux-arm64-musl': 1.36.0 + '@oxlint/linux-x64-gnu': 1.36.0 + '@oxlint/linux-x64-musl': 1.36.0 + '@oxlint/win32-arm64': 1.36.0 + '@oxlint/win32-x64': 1.36.0 + oxlint-tsgolint: 0.10.0 + pathe@2.0.3: {} picocolors@1.1.1: {} diff --git a/src/lib/runtime-query-ids.ts b/src/lib/runtime-query-ids.ts index bd335b9..4016d2b 100644 --- a/src/lib/runtime-query-ids.ts +++ b/src/lib/runtime-query-ids.ts @@ -136,11 +136,7 @@ async function readSnapshotFromDisk(cachePath: string): Promise ({ }), })); -const itIfDarwin = process.platform === 'darwin' ? it : it.skip; - describe('cookies', () => { const originalEnv = process.env; @@ -63,7 +61,10 @@ describe('cookies', () => { expect(result.cookies.source).toContain('Firefox'); }); - itIfDarwin('honors cookieSource=safari', async () => { + it('honors cookieSource=safari', async () => { + if (process.platform !== 'darwin') { + return; + } sweet.results.set('safari', { cookies: [ { name: 'auth_token', value: 'safari_auth', domain: 'x.com' }, @@ -245,7 +246,10 @@ describe('cookies', () => { }); describe('extractCookiesFromSafari', () => { - itIfDarwin('returns cookies from Safari', async () => { + it('returns cookies from Safari', async () => { + if (process.platform !== 'darwin') { + return; + } sweet.results.set('safari', { cookies: [ { name: 'auth_token', value: 'safari_auth', domain: 'x.com' }, @@ -262,7 +266,10 @@ describe('cookies', () => { expect(result.cookies.source).toBe('Safari'); }); - itIfDarwin('prefers Safari over Chrome when both are available', async () => { + it('prefers Safari over Chrome when both are available', async () => { + if (process.platform !== 'darwin') { + return; + } sweet.results.set('safari', { cookies: [ { name: 'auth_token', value: 'safari_auth', domain: 'x.com' }, diff --git a/tsconfig.oxlint.json b/tsconfig.oxlint.json new file mode 100644 index 0000000..48ac963 --- /dev/null +++ b/tsconfig.oxlint.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": true, + "rootDir": "." + }, + "include": ["src/**/*.ts", "tests/**/*.ts", "scripts/**/*.ts"], + "exclude": ["node_modules", "dist", "coverage"] +}