Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ jobs:
deno-version: v2.x

- name: Install dependencies
run: npm ci
run: npx --yes npm@10.9.4 ci

- name: Build
run: npm run build

- name: Lint
run: npm run lint

- name: Community review blockers
run: npm run lint:community -- --quiet

- name: UI tests
run: npm run test:ui

Expand Down
46 changes: 46 additions & 0 deletions eslint.community.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import obsidianmd from "eslint-plugin-obsidianmd";
import globals from "globals";
import { defineConfig, globalIgnores } from "eslint/config";

export default defineConfig(
globalIgnores([
"node_modules",
"dist",
"coverage",
"main.js",
"package.json",
"package-lock.json",
"versions.json",
"**/*.svelte",
"**/*.test.ts",
"test/**",
]),
{
languageOptions: {
globals: {
...globals.browser,
},
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: import.meta.dirname,
},
},
},
...obsidianmd.configs.recommended,
{
rules: {
// The directory review reports console usage as guidance rather than a release blocker.
"obsidianmd/rule-custom-message": "off",
"no-console": "warn",
// Keep existing type-safety debt visible while reserving errors for directory-review blockers.
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-unsafe-return": "warn",
"@typescript-eslint/no-base-to-string": "warn",
"@typescript-eslint/no-redundant-type-constituents": "warn",
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
},
}
);
17 changes: 8 additions & 9 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ export default class DiffZipBackupPlugin extends Plugin {
}

get sep(): string {
//@ts-ignore
return (this.isDesktopMode ? this.app.vault.adapter.path.sep : "/") as string;
if (!this.isDesktopMode) return "/";
const desktopAdapter = this.app.vault.adapter as unknown as { path: { sep: string } };
return desktopAdapter.path.sep;
}

messages = {} as Record<string, NoticeWithTimer>;
Expand Down Expand Up @@ -113,9 +114,8 @@ export default class DiffZipBackupPlugin extends Plugin {
delete this.messages[key];
}
}
logWrite(message: string, _key?: string) {
const dt = new Date().toLocaleString();
console.log(`${dt}\t${message}`);
logWrite(_message: string, _key?: string): void {
// Detailed operational logging is intentionally quiet in production.
}

async getFiles(path: string, ignoreList: string[], progress: ProgressFragment) {
Expand Down Expand Up @@ -158,9 +158,8 @@ export default class DiffZipBackupPlugin extends Plugin {
} else {
this.logWrite(`Backup information has been loaded`, "proc-index");
}
} catch (ex) {
} catch {
this.logMessage(`Something went wrong while parsing Backup information`, "proc-index");
console.warn(ex);
toc = {};
}
} else {
Expand Down Expand Up @@ -188,8 +187,8 @@ export default class DiffZipBackupPlugin extends Plugin {
}, 1000);
},
});
const noticeFragment = activeDocument.createDocumentFragment();
const noticeContainer = activeDocument.createElement("div");
const noticeFragment = createFragment();
const noticeContainer = noticeFragment.createDiv();
noticeContainer.classList.add("diffzip-progress-notice");
noticeContainer.appendChild(progress.fragment);
noticeFragment.appendChild(noticeContainer);
Expand Down
Loading
Loading