Repository navigation
refactor(lint): remove debug console logging - #724
Merged
Merged
Conversation
…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`.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Clears the directory scanner's "Avoid unnecessary logging to console" warnings: all 768 flagged calls, i.e. 759
console.log, 4console.timeand 5console.timeEnd.console.warnandconsole.errorare not flagged and stay.What changed
TaskWorkerManager.log()wrapperconsole.error: failing to register Bases views, widget views, commands or the code blockconsole.warn: non-fatal problems such as tray validity, window focus, quick-capture resize, and IPC not being availableconsole.debug: MCP request/response traces, which only print when the MCP log level is set to "debug"if/elsebranches whose only content was a log. Calls with side effects are kept, e.g.completeTimerandcreateFileTask.Worth a look
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.WorkerPoolOptions.debugandSuggestManager.debugLogSuggestOrder(); nothing uses either.tscdoesn't check. Please open the desktop quick-capture window once to confirm it still works.FileSource.basic.test.tsused to spy onconsole.log. It now checksgetStats().initializedand thatperformInitialScanruns once.Verification
pnpm run buildpasses.tsc --noUnusedLocals --noUnusedParameters: no new unused symbols.