Skip to content

Commit

Permalink
eslinting
Browse files Browse the repository at this point in the history
  • Loading branch information
haouarihk committed Mar 8, 2024
1 parent 5f4b837 commit c00145f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
"electron": "^27.0.4",
"esbuild": "0.13.12",
"esbuild-plugin-wasm": "^1.1.0",
"eslint": "^8.57.0",
"eslint-plugin-tailwindcss": "^3.13.0",
"obsidian": "1.5.7-1",
"oxlint": "^0.2.13",
"prettier": "^3.0.3",
"prettier-eslint": "^16.3.0",
"prettier-plugin-tailwindcss": "^0.5.12",
"tslib": "2.6.2",
"typescript": "5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import ContentManagerCls from "./scope/content-manager";
import ContextManager from "./scope/context-manager";
import TGBlock from "./services/tgBlock";

// @ts-ignore
// @ts-ignore
let safeStorage: Electron.SafeStorage;

if (Platform.isDesktop) {
Expand Down
22 changes: 16 additions & 6 deletions src/scope/context-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,22 @@ export default class ContextManager {
yaml?: Record<string, any>;
metadata?: string;
content?: string;
headings?: AsyncReturnType<typeof this.getHeadingContent>;
children?: AsyncReturnType<typeof this.getChildrenContent>;
highlights?: ReturnType<typeof this.getHighlights>;
mentions?: AsyncReturnType<typeof this.getMentions>;
extractions?: AsyncReturnType<typeof this.getExtractions>;
keys?: AsyncReturnType<typeof this.plugin.getApiKeys>;
headings?: AsyncReturnType<
InstanceType<typeof ContextManager>["getHeadingContent"]
>;
children?: AsyncReturnType<
InstanceType<typeof ContextManager>["getChildrenContent"]
>;
highlights?: AsyncReturnType<
InstanceType<typeof ContextManager>["getHighlights"]
>;
mentions?: AsyncReturnType<
InstanceType<typeof ContextManager>["getMentions"]
>;
extractions?: AsyncReturnType<
InstanceType<typeof ContextManager>["getExtractions"]
>;
keys?: ReturnType<InstanceType<typeof TextGeneratorPlugin>["getApiKeys"]>;
_variables: Record<string, true>;
} = {
_variables: {},
Expand Down
9 changes: 5 additions & 4 deletions src/services/text-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,8 @@ export default class TextGenerator extends RequestHandler {
const [errorFile, file] = await safeAwait(
createFileWithInput(
path +
`/${text?.startsWith("FAILED:") ? "FAILED-" : ""}` +
files[i].path,
`/${text?.startsWith("FAILED:") ? "FAILED-" : ""}` +
files[i].path,
text,
this.plugin.app
)
Expand Down Expand Up @@ -882,8 +882,9 @@ ${removeYAML(content)}

const promptsPath = this.plugin.settings.promptsPath;

const guessPath = `${promptsPath}${promptsPath.endsWith("/") ? "" : "/"
}${id}.md`;
const guessPath = `${promptsPath}${
promptsPath.endsWith("/") ? "" : "/"
}${id}.md`;

// test if the guess is actually a file
if (await this.plugin.app.vault.adapter.exists(guessPath)) return guessPath;
Expand Down
5 changes: 3 additions & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function createFolder(folder: string, app: App): Promise<void> {
const folderExists = await app.vault.adapter.exists(folder);

if (!folderExists) {
await this.app.vault.createFolder(folder);
await app.vault.createFolder(folder);
}
logger("createFolder end");
}
Expand Down Expand Up @@ -432,6 +432,7 @@ export function debounce<T extends unknown[], R>(

logger("debounce", func, wait);
return function debouncedFunction(...args: T): Promise<R> {
// @ts-ignore
const context = this;

return new Promise((resolve, reject) => {
Expand All @@ -451,7 +452,7 @@ export function debounce<T extends unknown[], R>(
}

export function getFilePathByName(name: string): string | undefined {
return this.app.metadataCache.getFirstLinkpathDest(name, "")?.path;
return app.metadataCache.getFirstLinkpathDest(name, "")?.path;
}

export function currentDate() {
Expand Down

0 comments on commit c00145f

Please sign in to comment.