mirror of
https://github.com/aaronsb/obsidian-mcp-plugin.git
synced 2026-07-22 06:45:14 +00:00
Obsidian's source-code review forbids disabling obsidianmd/prefer-window-timers and obsidianmd/no-global-this (and flags undescribed directive comments). The 0.11.32 review failed on five such disables. - router.ts, obsidian-api.ts, session-manager.ts: global set/clearInterval and setTimeout → window.* equivalents. - debug.ts: drop the globalThis console fallback → window.console. - tests/setup.ts: alias window to globalThis in the node test env so the window.* timers/console resolve under Jest (Obsidian always provides window at runtime). - session-manager cleanupInterval typed number (window.setInterval's return). All five eslint-disable directives removed. Lint clean, build green, 336 tests pass.
16 lines
No EOL
614 B
TypeScript
16 lines
No EOL
614 B
TypeScript
// Jest setup file for Obsidian plugin testing
|
|
|
|
// Source code uses window.* timers and window.console (per obsidianmd's
|
|
// prefer-window-timers / no-global-this rules — Obsidian always provides
|
|
// window at runtime). The node test env has no window, so alias it to
|
|
// globalThis, which supplies setTimeout/setInterval/clearInterval/console.
|
|
if (typeof (globalThis as { window?: unknown }).window === 'undefined') {
|
|
(globalThis as { window?: unknown }).window = globalThis;
|
|
}
|
|
|
|
// Mock performance API if not available
|
|
if (!global.performance) {
|
|
global.performance = {
|
|
now: () => Date.now(),
|
|
} as any;
|
|
} |