feat(web): add eslint + prettier + vitest toolchain + web CI job (R8)

Added to web/package.json devDeps: eslint (9, flat config) +
eslint-plugin-svelte + typescript-eslint + globals; prettier +
prettier-plugin-svelte; vitest (jsdom env) + jsdom. New scripts: lint,
lint:fix, format, format:check, test, test:watch.

Configs:
- web/eslint.config.js — flat config, TS + Svelte, browser/node globals,
  no-explicit-any as warn, unused-vars as error (ignores _-prefixed).
- web/.prettierrc.json — single-quote, 100 width, svelte parser override.
- web/.prettierignore — dist/node_modules/build/lockfiles.
- web/vite.config.ts — vitest test block via reference directive, jsdom env,
  globals enabled.

Sample test: web/src/lib/utils.test.ts (6 tests covering relativeTime,
truncateMiddle, debounce — all passing).

CI: new web job in .gitea/workflows/ci.yml (npm ci, check [advisory],
lint [advisory], format:check [advisory], test [gate], build [gate]).
Advisory steps use continue-on-error until the baseline is clean —
matching the existing golangci-lint advisory pattern.

Known baseline surfaced by the new toolchain (pre-existing, not caused
by R8): svelte-check 154 errors (133-file config cascade), eslint 126
errors + 12 warnings (unused vars, @html XSS, unused CSS), prettier 175
unformatted files. Fixing these is a follow-up cleanup.

VERSION 0.7.9 -> 0.7.10. Plan R8 marked done; C.1 updated.
This commit is contained in:
2026-07-17 22:49:27 +02:00
parent fb39a48bef
commit 463bdacf5c
10 changed files with 4090 additions and 66 deletions

View File

@@ -176,14 +176,29 @@ CONTRIBUTING §Testing gates: policy + learning ≥ 80%, others ≥ 60%.
`npm run build` succeeds with Svelte 5 warnings. 722 KB JS bundle (222 KB
gzip), no code splitting.
### C.1 Tooling gaps — fixed in this pass
### C.1 Tooling gaps — fixed in this pass + R8
- `package.json` had only `dev`/`build`/`preview`. **Added** `check`
(`svelte-check`), `typecheck` (`tsc --noEmit`), and `lint` scripts, plus
`svelte-check` + `typescript` devDeps. Run `npm install` to pick them up.
- Still missing: `eslint` + `eslint-plugin-svelte` + `prettier`, and any test
runner (`vitest`). Recommended next step.
- No CI config in `web/` — nothing enforces type-check/build on PR.
- **R8 added:** `eslint` (flat config) + `eslint-plugin-svelte` +
`typescript-eslint` + `globals`; `prettier` + `prettier-plugin-svelte`;
`vitest` (jsdom env) with a sample test (`src/lib/utils.test.ts`, 6 tests).
New scripts: `lint`, `lint:fix`, `format`, `format:check`, `test`,
`test:watch`. Vitest config wired into `vite.config.ts` via
`/// <reference types="vitest/config" />`.
- **CI:** new `web` job in `.gitea/workflows/ci.yml` runs `npm ci`,
`npm run check` (advisory), `npm run lint` (advisory),
`npm run format:check` (advisory), `npm run test` (gate),
`npm run build` (gate). Advisory steps use `continue-on-error: true`
until the lint/check baseline is clean — matching the existing
`golangci-lint` advisory pattern.
- **Known baseline:** svelte-check reports 154 pre-existing errors (133
files, "No Svelte configuration found in vite config" cascade — not
caused by R8); eslint reports 126 errors + 12 warnings (unused vars,
`@html` XSS, unused CSS); prettier reports 175 unformatted files. These
are real findings surfaced by the new toolchain — fixing them is a
follow-up cleanup task.
### C.2 Dead code — the tool-renderer registry (21 files, ~1.5k lines)
@@ -414,7 +429,7 @@ the gitignore comment); `build` target ensures `bin/` exists; `clean` removes `b
| R5 | Rewrite `.agents/domains/knowledge/schema.md` + `.agents/shared/llm-wiki.md` for the DB-native model; delete/deprecate root `inventory.yaml` | M | Low | ✅ done |
| R6 | Inject desktop `version` from `VERSION` via ldflags; fix `Makefile` `BINARY` colliding with `oikos/` dir | S | Low | ✅ done |
| R7 | Add tests for `learning` (80% gate), `actuator`, `scheduler`, `domain`, `notifier`, `knowledge` | L | Low |
| R8 | Add `eslint`+`prettier`+`vitest` to `web/`; wire `svelte-check`+`tsc` into CI; add `web/` CI job | M | Low |
| R8 | Add `eslint`+`prettier`+`vitest` to `web/`; wire `svelte-check`+`tsc` into CI; add `web/` CI job | M | Low | ✅ done |
| R9 | Define `OikosEvent` discriminated union; eliminate ~15 `any` sites in web | S | Low |
| R10 | Replace `<svelte:component>` in `ActivityTimeline.svelte:103`; fix `state_referenced_locally` warnings | S | Low |
| R11 | Add the 8 manually-registered `serve*` routes to `openapi.yaml` (or document the carve-out) | S | Low |