logancyang_obsidian-copilot/scripts/stubs/obsidian.ts
Zero Liu 6ca2dc01ea
chore(eslint): enable no-explicit-any; fix ~395 violations (#2452)
* chore(eslint): enable no-explicit-any; fix ~395 violations

Switches @typescript-eslint/no-explicit-any from "off" to "error" and
replaces explicit `any` with proper types or `unknown` + narrowing
across ~100 source files and 15 test files. Eleven eslint-disable
comments remain: one for a BaseLanguageModel prototype patch and ten
for Orama<any> API surfaces where typed alternatives poison Orama's
internal inference to `never`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(scripts): cast chainContext to ChainManager in printPromptDebugEntry

The earlier `as any` → `as unknown` rewrite left buildAgentPromptDebugReport's
chainManager argument typed as `unknown`, which CI's `tsc -noEmit` (without
`--skipLibCheck`) flagged. Restore the cast through the real ChainManager type.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(eslint): fix remaining no-explicit-any and unnecessary-type-assertion errors

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(eslint): drop redundant no-explicit-any rule

Already set to "error" by typescript-eslint/recommendedTypeChecked via
obsidianmd's recommended config.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 02:08:45 -07:00

93 lines
1.4 KiB
TypeScript

export class App {}
export class Notice {
constructor(public message?: string) {
if (message) {
console.warn(`[Notice] ${message}`);
}
}
}
export class TFile {
path: string;
basename: string;
extension: string;
constructor(path: string) {
this.path = path;
this.basename = path.split("/").pop() || path;
const parts = this.basename.split(".");
this.extension = parts.length > 1 ? parts.pop() || "" : "";
}
}
export class Vault {
getRoot() {
return { name: "root" };
}
getAbstractFileByPath() {
return null;
}
async read() {
return "";
}
getMarkdownFiles() {
return [];
}
getAllLoadedFiles() {
return [];
}
adapter = {
mkdir: async () => {
/* no-op */
},
};
}
export const Platform = {
isDesktop: true,
isMobile: false,
};
export function normalizePath(path: string): string {
return path;
}
export async function requestUrl(): Promise<never> {
throw new Error("requestUrl is not available in the CLI environment.");
}
export function getAllTags(): string[] {
return [];
}
export class MarkdownView {}
export class TAbstractFile {}
export class WorkspaceLeaf {
async openFile(): Promise<void> {
/* no-op */
}
}
export class ItemView {}
export class Modal {
open(): void {
/* no-op */
}
close(): void {
/* no-op */
}
}
export function parseYaml(_: string): unknown {
return {};
}