From d11ca94073d7a36bac673ceb76c2d1815eebcd0a Mon Sep 17 00:00:00 2001 From: ClaudiaFang Date: Sun, 5 Jul 2026 05:14:28 +0000 Subject: [PATCH] fix(lint): resolve Obsidian plugin linter warnings - drop unnecessary type assertion in SyncStatusView tab rendering - use window.setTimeout instead of global setTimeout - use window instead of globalThis when resolving Electron's require docs: list supported Git providers at the top of README --- README.md | 5 +++++ src/ui/SyncStatusView.ts | 4 ++-- src/utils/symlink.ts | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b666228..5df4741 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,11 @@ [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square)](https://conventionalcommits.org) [![License](https://img.shields.io/github/license/firstsun-dev/git-files-sync?style=flat-square)](LICENSE) +**Supports:** +GitHub +GitLab +Gitea + **Git File Sync** is a powerful Obsidian plugin that enables seamless synchronization of individual notes with GitLab, GitHub, or self-hosted Gitea repositories. Unlike full-vault sync solutions, it gives you granular control over what gets pushed and pulled, making it perfect for shared projects, selective backups, and cross-platform workflows. [繁體中文使用說明](USAGE_zh.md) diff --git a/src/ui/SyncStatusView.ts b/src/ui/SyncStatusView.ts index 44f260e..1ad6367 100644 --- a/src/ui/SyncStatusView.ts +++ b/src/ui/SyncStatusView.ts @@ -143,7 +143,7 @@ export class SyncStatusView extends ItemView { }); // Share the status icon set with the file list so tabs never drift. if (tab.value !== 'all') { - setIcon(btn.createSpan(), statusMeta(tab.value as FileStatus['status']).icon); + setIcon(btn.createSpan(), statusMeta(tab.value).icon); } btn.createSpan({ cls: 'ssv-tab-label', text: ` ${tab.label}` }); const count = counts[tab.value]; @@ -252,7 +252,7 @@ export class SyncStatusView extends ItemView { await this.plugin.sync.pullFile(fileStatus.file || fileStatus.path); } - await new Promise(r => setTimeout(r, 500)); + await new Promise(r => window.setTimeout(r, 500)); await this.refreshFileStatus(fileStatus.file || fileStatus.path); this.renderView(); } catch (e) { diff --git a/src/utils/symlink.ts b/src/utils/symlink.ts index a436fe5..5b4de51 100644 --- a/src/utils/symlink.ts +++ b/src/utils/symlink.ts @@ -36,7 +36,7 @@ export function canUseRealSymlinks(app: App): boolean { // Electron exposes a CommonJS `require` on the global object on desktop; it is // absent on mobile. Resolving it dynamically avoids a static node import. function nodeModules(): { fs: NodeFs; path: NodePath } | null { - const req = (globalThis as unknown as { require?: NodeRequire }).require; + const req = (window as unknown as { require?: NodeRequire }).require; if (typeof req !== 'function') return null; try { return { fs: req('fs') as NodeFs, path: req('path') as NodePath };