chore: Taskfile + ESLint + jsdom tests + DB isolation env var - #6
Merged
Merged
Conversation
Wraps npm scripts under task(1) with named tasks (install, dev, build, test, lint, check, ci, clean, db:reset, install:lint). Updates README with a Tooling section documenting the preferred workflow.
Layer 1 — ESLint 9 flat config (eslint.config.js) with no-undef enforced
on renderer (public/*.js) and main-process files. Verified statically
catches the two recent sidebar.js regressions:
- undeclared subagentIndex in renderProjects destructure
- out-of-scope projectPath in buildSessionsList orphan branch
Wired via "lint" + "pretest" scripts; npm test now lints first.
Layer 2 — jsdom-backed renderer tests (test/dom-setup.js, test/dom-sidebar.test.js):
- bootstraps a JSDOM window, evaluates utils.js / icons.js / sidebar.js
in its VM context, stubs cross-file globals (window.api, sessionMap,
activePtyIds, etc.)
- sample fixture: 2 top-level sessions, 3 subagents (1 orphan),
1 starred, 1 archived
- 7 tests covering: structural completeness, starred/archived classes,
subagent carets, orphan group, projectPath localStorage key, empty
project, idempotent re-render
Both bug-class regressions are now caught at lint time AND runtime.
Existing 24+ tests still green (npm test → 32 pass).
Notes:
- Pre-existing no-unused-vars / no-redeclare warnings (204) left as
warnings, not errors; not in scope.
- One stray no-undef (_shellProfiles in main.js) annotated with
eslint-disable + TODO; appears to be dead code from a refactor.
Adds husky pre-commit hook that runs `task check` when task is on PATH, falling back to `npm run lint && npm test` otherwise. Stops bad code from reaching origin — the two ReferenceError regressions we just fixed (subagentIndex undefined, project.projectPath out of scope) would have been caught locally by `task lint` before commit. Set SKIP_TESTS=1 to skip the heavier test suite in a pinch.
Two electron instances on the same ~/.switchboard/switchboard.db race on session_cache and crash silently. This blocked any agent that wanted to launch dev electron while the user's installed AppImage was running. - db.js: honour SWITCHBOARD_DATA_DIR env var, fall back to ~/.switchboard. Skip the legacy ~/.claude/browser/ migration when a custom dir is set so a fresh dev DB doesn't steal the AppImage's old data. - main.js: !app.isPackaged → default the env var to ~/.switchboard-dev before db.js is required. Explicit env var overrides (test sandbox / agent run). - Taskfile.yaml: 'task dev' sets the env var for belt-and-suspenders; new 'task db:reset:dev' wipes just the dev DB. Result: dev electron and installed AppImage coexist safely.
JeanBaptisteRenard
force-pushed
the
chore/taskfile-tooling
branch
from
May 22, 2026 12:09
c3c933f to
bf18dc1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Standardises tooling and adds the missing static analysis that would have caught the two ReferenceError regressions we shipped earlier this session.
Pieces
Verify
```
task check
tests 32 / pass 32 / fail 0
0 errors, 204 warnings
```