Skip to content

refactor(lint): remove debug console logging - #724

Merged
Quorafind merged 3 commits into
masterfrom
refactor/remove-console-logging
Nov 29, 2026
Merged

Quorafind merged 3 commits into
masterfrom
refactor/remove-console-logging

Conversation

@Quorafind

Copy link
Copy Markdown
Member

Clears the directory scanner's "Avoid unnecessary logging to console" warnings: all 768 flagged calls, i.e. 759 console.log, 4 console.time and 5 console.timeEnd. console.warn and console.error are not flagged and stay.

What changed

  • Removed 754 debug calls, using an AST codemod plus 4 manual cases. Also removed:
    • 21 commented-out logs
    • the logs in the quick-capture window's inline script
    • the never-enabled TaskWorkerManager.log() wrapper
  • 16 failure messages kept as warnings or errors, not dropped:
    • 8 → console.error: failing to register Bases views, widget views, commands or the code block
    • 6 → console.warn: non-fatal problems such as tray validity, window focus, quick-capture resize, and IPC not being available
    • 2 → console.debug: MCP request/response traces, which only print when the MCP log level is set to "debug"
  • Fallout cleanup: removed timers, counters, destructured fields and imports that only fed the removed logs, plus if/else branches whose only content was a log. Calls with side effects are kept, e.g. completeTimer and createFileTask.

Worth a look

  • In WriteAPI.ts, the rrule-parse fallback catch is now comment-only. It is the normal path for plain-English recurrences like "every week", so a warning there would fire on every recurring-task completion.
  • Removed WorkerPoolOptions.debug and SuggestManager.debugLogSuggestOrder(); nothing uses either.
  • The quick-capture inline script is a string that tsc doesn't check. Please open the desktop quick-capture window once to confirm it still works.
  • FileSource.basic.test.ts used to spy on console.log. It now checks getStats().initialized and that performInitialScan runs once.

Verification

  • pnpm run build passes.
  • Full jest suite: 187 suites, 2005 tests, all passing.
  • eslint on the 106 changed files: no new problems compared with master.
  • tsc --noUnusedLocals --noUnusedParameters: no new unused symbols.

…nsole.log

Failure paths that logged with console.log now use console.error (failed
view/command registration) or console.warn (best-effort Electron window
operations, missing calendar component, missing IPC bridge in the quick
capture window), so removing debug logging does not silence real errors.

The MCP request/response traces gated by the user's "debug" log level
setting move to console.debug so that setting keeps working.
Delete the console.log/time/timeEnd calls flagged by the Obsidian
community scanner ("Avoid unnecessary logging to console"), plus the ones
it missed: commented-out console.log lines and the logs in the quick
capture window's inline script.

The removal was done with a TypeScript-AST codemod, so multi-line calls
are removed whole. Statements that only existed to log are removed with
them: if/else branches whose bodies only logged (conditions are side
effect free), forEach loops that only logged, comments that only
described a log, the no-op TaskWorkerManager.log() wrapper with its call
sites and unused `debug` option, the unused
SuggestManager.debugLogSuggestOrder(), the hard-coded-off DEBUG_MODE
blocks in FluentTaskView, and callbacks that are now empty.

The FileSource initialization tests asserted on a removed log; they now
check getStats().initialized and that the initial scan runs once.
Remove the timers (Date.now/performance.now), counters, destructured
fields, callback parameters, constants, an import and a private field
that only existed to build the now-deleted log messages. Calls with side
effects are kept (completeTimer, createFileTask, controller.next); only
their unused results are dropped.

Also remove the progress check in TaskWorkerManager.processBatch whose
body was the removed this.log() call, and type the FileSource test spy
without `any`.
@Quorafind
Quorafind merged commit 7ce2b17 into master Nov 29, 2026
3 checks passed
@Quorafind
Quorafind deleted the refactor/remove-console-logging branch November 29, 2026 03:15
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant