Skip to content

Chore: lint and format the test code - #12

Merged
SandObserver merged 1 commit into
mainfrom
chore/check-test-code
Aug 9, 2026
Merged

SandObserver merged 1 commit into
mainfrom
chore/check-test-code

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Add api/test/**/*.js, api/test-support/**/*.js and ui/test/**/*.mjs to biome.json's files.includes, so lint and format cover them.
  • Add a scoped overrides entry turning off six rules for those directories only: noAssignInExpressions, noRedundantUseStrict, noTemplateCurlyInString, noGlobalEval, noCommaOperator and noUnusedFunctionParameters. Each is correct for source and wrong for a test; the 'use strict' one is load-bearing, since widget-settings.test.js asserts that a frozen write throws, which only happens in strict mode.
  • Fix what the linter found: 27 unused requires across 24 files, an unused response-body accumulator in session-revocation.test.js (the listener still drains the stream), an unused handler parameter in provider-dispatch.test.js, and a local named unescape shadowing the deprecated global in log.test.js.
  • Reformat the test files. That is the bulk of the diff and is mechanical.
  • Document in CONTRIBUTING.md that the test directories are linted but not typechecked, with the measured cost of changing that, and add two tests asserting the linter covers them and that the typecheck exclusion stays documented.

Testing
All green: 1053 backend, 549 frontend, lint, format, both typechecks, coverage floor. Added 2 tests. Verified by re-running both suites after the reformat, not only after the edits.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.
  • CHANGELOG.md updated under Unreleased if the change is user-visible.

About a megabyte of test code sat outside every quality gate: biome.json's
globs covered api/src, ui/js, ui/widgets, scripts and e2e, and nothing else.
Adding the three test directories found 27 requires that nothing used, one
accumulator that was written and never read, and a shadow of the deprecated
unescape global.

Six rules are relaxed for those directories, because they are right for source
and wrong for a test: a stub whose signature has to match a real one keeps its
unused parameter, a scanner keeps its assignment-in-condition, and 'use strict'
stays where a test depends on strict-mode semantics rather than being deleted
as redundant.

Typechecking them is left out and the reason is written down: checkJs over
api/test reports 131 errors, nearly all narrowing around server.address() in
harnesses, and clearing them means JSDoc casts across forty files for no
behaviour change.
@SandObserver SandObserver added the refractor Code improvement / cleanup, no behavior change label Aug 9, 2026
@SandObserver
SandObserver merged commit b4c1262 into main Aug 9, 2026
4 checks passed
@SandObserver
SandObserver deleted the chore/check-test-code branch August 9, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refractor Code improvement / cleanup, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant