diff --git a/.vscode/toolkit.code-snippets b/.vscode/toolkit.code-snippets index 425b7dd..c7034e6 100644 --- a/.vscode/toolkit.code-snippets +++ b/.vscode/toolkit.code-snippets @@ -18,13 +18,13 @@ "\tremoveIfExists: ${13:true},", "\tcustomCheck: (doc: Document, options: ElementOptions) => ${14:true},", "\tchildren: [$15]", - "}, ${16:container});" - ] + "}, ${16:container});", + ], }, "appendElement - minimum": { "scope": "javascript,typescript", "prefix": "appendElement", - "body": "appendElement({ tag: '$1' }, $2);" + "body": "appendElement({ tag: '$1' }, $2);", }, "register Notifier": { "scope": "javascript,typescript", @@ -39,7 +39,7 @@ "\t) => {", "\t\t$0", "\t}", - "});" - ] - } + "});", + ], + }, } diff --git a/src/hooks.ts b/src/hooks.ts index 86f7748..bb2c31c 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -123,7 +123,7 @@ function onUpdateItems(items: Zotero.Item[], forceFetch: boolean = false) { if (!item.getField("title")) { return false; } - if (!forceFetch && (item.key in tldrs.get())) { + if (!forceFetch && item.key in tldrs.get()) { return false; } return true; diff --git a/src/modules/dataStorage.ts b/src/modules/dataStorage.ts index 46aeb13..7e1506e 100644 --- a/src/modules/dataStorage.ts +++ b/src/modules/dataStorage.ts @@ -119,4 +119,6 @@ export class DataStorage { } } -export const tldrs = DataStorage.instance("fetchedItems.json"); +export const tldrs = DataStorage.instance( + "fetchedItems.json", +); diff --git a/src/modules/tldrFetcher.ts b/src/modules/tldrFetcher.ts index 9c035e9..f47d44a 100644 --- a/src/modules/tldrFetcher.ts +++ b/src/modules/tldrFetcher.ts @@ -38,21 +38,28 @@ export class TLDRFetcher { match = true; } if (match && info.tldr) { - let note = new Zotero.Item('note'); + let note = new Zotero.Item("note"); if (noteKey) { - const obj = Zotero.Items.getByLibraryAndKey(this.zoteroItem.libraryID, noteKey); - if (obj && obj instanceof Zotero.Item && this.zoteroItem.getNotes().includes(obj.id)) { + const obj = Zotero.Items.getByLibraryAndKey( + this.zoteroItem.libraryID, + noteKey, + ); + if ( + obj && + obj instanceof Zotero.Item && + this.zoteroItem.getNotes().includes(obj.id) + ) { note = obj; } } - note.setNote(`

TL;DR

\n

${info.tldr}

`) + note.setNote(`

TL;DR

\n

${info.tldr}

`); note.parentID = this.zoteroItem.id; await note.saveTx(); await tldrs.modify((data: any) => { data[this.zoteroItem.key] = note.key; return data; }); - return true + return true; } } await tldrs.modify((data: any) => { diff --git a/tsconfig.json b/tsconfig.json index a033072..74acb80 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,8 +5,8 @@ "target": "ES2016", "resolveJsonModule": true, "skipLibCheck": true, - "strict": true + "strict": true, }, "include": ["src", "typings", "node_modules/zotero-types"], - "exclude": ["build", "addon"] + "exclude": ["build", "addon"], }