From 3f1e51fc3d30e2ce5f6e46786409b50dc6c25766 Mon Sep 17 00:00:00 2001 From: RDCLder Date: Thu, 5 Nov 2026 22:31:09 -0600 Subject: [PATCH] Lint: dropped background tasks, async mistakes, and unhandled promises in the viewer ruff now also selects PLE (errors that crash at run time), ASYNC (blocking calls and other mistakes in async code) and RUF006 (an asyncio task whose result is dropped, so it can be garbage-collected mid-run). Four ASYNC rules that give advice rather than find bugs are left out (ASYNC109, ASYNC110, ASYNC115, ASYNC116). The viewer's oxlint runs four type-aware rules as errors: no-floating-promises, no-misused-promises, await-thenable and switch-exhaustiveness-check (a default case counts as handling the rest). oxlint-tsgolint, which runs them, is pinned in web/. None of the new rules finds anything on main today. --- .github/workflows/ci.yml | 2 +- CLAUDE.md | 2 +- pyproject.toml | 4 +- web/.oxlintrc.json | 6 ++- web/package-lock.json | 107 ++++++++++++++++++++++++++++++++++++++- web/package.json | 3 +- 6 files changed, 117 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7429256..83d87a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,4 +84,4 @@ jobs: - name: Lint viewer working-directory: web - run: npx oxlint src + run: npx oxlint --type-aware src diff --git a/CLAUDE.md b/CLAUDE.md index 4dc9b89..4c107ff 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -22,7 +22,7 @@ timeline. It is the first of three planned tools; the programme is in `docs/road - Install: `uv sync` and `cd web && npm ci` - Lint: `uv run ruff check src tests && uv run ruff format --check src tests`; - viewer `cd web && npx oxlint src` + viewer `cd web && npx oxlint --type-aware src` - Typecheck (viewer): `cd web && npx tsc -b` - Test: `uv run pytest -q`. Real weights (about 1.3 GB download, then cached): `JEPA_SCOPE_MODEL_TESTS=1 uv run pytest tests/test_real_model.py -s` diff --git a/pyproject.toml b/pyproject.toml index c8a2748..114d7d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,9 @@ dev = [ line-length = 120 [tool.ruff.lint] -select = ["E", "F", "I", "B", "UP"] +select = ["E", "F", "I", "B", "UP", "PLE", "ASYNC", "RUF006"] +# ASYNC rules that give advice rather than find bugs. +ignore = ["ASYNC109", "ASYNC110", "ASYNC115", "ASYNC116"] [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/web/.oxlintrc.json b/web/.oxlintrc.json index 6fa991d..c7f9d2c 100644 --- a/web/.oxlintrc.json +++ b/web/.oxlintrc.json @@ -3,6 +3,10 @@ "plugins": ["react", "typescript", "oxc"], "rules": { "react/rules-of-hooks": "error", - "react/only-export-components": ["warn", { "allowConstantExport": true }] + "react/only-export-components": ["warn", { "allowConstantExport": true }], + "typescript/no-floating-promises": "error", + "typescript/no-misused-promises": "error", + "typescript/await-thenable": "error", + "typescript/switch-exhaustiveness-check": ["error", { "considerDefaultExhaustiveForUnions": true }] } } diff --git a/web/package-lock.json b/web/package-lock.json index 4314714..38ecbd5 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1,11 +1,11 @@ { - "name": "web", + "name": "jepa-scope-web", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "web", + "name": "jepa-scope-web", "version": "0.0.0", "dependencies": { "react": "^19.3.1", @@ -17,6 +17,7 @@ "@types/react-dom": "^19.3.0", "@vitejs/plugin-react": "^6.1.2", "oxlint": "^1.90.0", + "oxlint-tsgolint": "7.0.2006", "typescript": "~7.0.2", "vite": "^8.3.6" } @@ -31,6 +32,90 @@ "url": "https://github.com/sponsors/oxc-project" } }, + "node_modules/@oxlint-tsgolint/darwin-arm64": { + "version": "7.0.2006", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-arm64/-/darwin-arm64-7.0.2006.tgz", + "integrity": "sha512-uc0MEHXZUDW23Zmo5X28eSNeSnP17jKnh9GiehpVZqhfy99ks8spyXT5Llar3tjDN7ppnQN0Qd9FK6WNkdD+fQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint-tsgolint/darwin-x64": { + "version": "7.0.2006", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-x64/-/darwin-x64-7.0.2006.tgz", + "integrity": "sha512-+x1/pa3S3VMC9cif8XKTOCQUuqRT+wu1Ix+FK5svXa2xbXCuE7+4S0SfmuSnK/mk9AI5+xBxZFhILxmCPUZ1hA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxlint-tsgolint/linux-arm64": { + "version": "7.0.2006", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-arm64/-/linux-arm64-7.0.2006.tgz", + "integrity": "sha512-90v7HX8m54kHXn5DpjNEN18Fb7xwJMREe/wji3USyAf9pTMv7a3qZ3cPoLViIcIzxPLmkcYZIs1j1H3Z2gbVLA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint-tsgolint/linux-x64": { + "version": "7.0.2006", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-x64/-/linux-x64-7.0.2006.tgz", + "integrity": "sha512-/k0wsEqHiA5dWBJYuld3Vecv6bIhKCasxpho/aFkvh870Qox33MuTkKUGWIVm/njAxw7W4pu1a/Xfa3jwuKuPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxlint-tsgolint/win32-arm64": { + "version": "7.0.2006", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-arm64/-/win32-arm64-7.0.2006.tgz", + "integrity": "sha512-CQT5sqcLZLNZSWLzUUEjQmp74UX8h1agp3ZJ8pfRktHbx6gfBa8a7CjrnRrZ9VXlwnXVkpw7m5KBO6y+S5MQRA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxlint-tsgolint/win32-x64": { + "version": "7.0.2006", + "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-x64/-/win32-x64-7.0.2006.tgz", + "integrity": "sha512-VZsGowXcp3vQNkjoGeVCOTf4aGrRpRk6bBJWhefnJVPr6z+dX+LKqqHfwaqnFvg66Q2iJpXqklRW38YO21ee+Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@oxlint/binding-android-arm-eabi": { "version": "1.91.0", "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.91.0.tgz", @@ -1449,6 +1534,24 @@ } } }, + "node_modules/oxlint-tsgolint": { + "version": "7.0.2006", + "resolved": "https://registry.npmjs.org/oxlint-tsgolint/-/oxlint-tsgolint-7.0.2006.tgz", + "integrity": "sha512-5B3UtH71kycPHUC1kFEIffivEAs49SUmkJuHZOZnTY0NPj4legp0bcsCQucuLVNCoJzDucS68P2C4WIhP+LypQ==", + "dev": true, + "license": "MIT", + "bin": { + "tsgolint": "bin/tsgolint.js" + }, + "optionalDependencies": { + "@oxlint-tsgolint/darwin-arm64": "7.0.2006", + "@oxlint-tsgolint/darwin-x64": "7.0.2006", + "@oxlint-tsgolint/linux-arm64": "7.0.2006", + "@oxlint-tsgolint/linux-x64": "7.0.2006", + "@oxlint-tsgolint/win32-arm64": "7.0.2006", + "@oxlint-tsgolint/win32-x64": "7.0.2006" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", diff --git a/web/package.json b/web/package.json index bf59747..d9a5c03 100644 --- a/web/package.json +++ b/web/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "vite", "build": "tsc -b && vite build", - "lint": "oxlint", + "lint": "oxlint --type-aware", "preview": "vite preview" }, "dependencies": { @@ -19,6 +19,7 @@ "@types/react-dom": "^19.3.0", "@vitejs/plugin-react": "^6.1.2", "oxlint": "^1.90.0", + "oxlint-tsgolint": "7.0.2006", "typescript": "~7.0.2", "vite": "^8.3.6" }