From a0a0a591bc4f9ceb93fe89fb0d8a451226b4e6f4 Mon Sep 17 00:00:00 2001 From: neobooru <50623835+neobooru@users.noreply.github.com> Date: Tue, 18 Aug 2026 23:25:03 +0200 Subject: [PATCH] Run prettier --- src/models/index.ts | 18 +++++++++--------- src/popup/pages/PopupMain.vue | 26 +++++++++++++++----------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/models/index.ts b/src/models/index.ts index 6d086fe..dcab416 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -8,7 +8,7 @@ export class TagDetails { public names: string[], public category?: string, public usages?: number, - ) { } + ) {} get name() { return this.names[0]; @@ -38,7 +38,7 @@ export class PoolDetails { public names: string[], public category?: string, public postCount?: number, - ) { } + ) {} get name() { return this.names[0]; @@ -109,7 +109,7 @@ export class SimilarPostInfo { constructor( public readonly id: number, public readonly percentage: number, - ) { } + ) {} } export type PostUploadState = "uploading" | "uploaded" | "error"; @@ -149,7 +149,7 @@ export class PostUploadCommandData { public readonly post: ScrapedPostDetails, public readonly selectedSite: SzuruSiteConfig, public readonly sendNotifications: boolean, - ) { } + ) {} } export class SetPostUploadInfoData { @@ -157,7 +157,7 @@ export class SetPostUploadInfoData { public instanceId: string, public postId: string, public info: PostUploadInfo, - ) { } + ) {} } export class SetExactPostId { @@ -165,7 +165,7 @@ export class SetExactPostId { public readonly instanceId: string, public readonly postId: string, public readonly exactPostId: number, - ) { } + ) {} } export class PostUpdateCommandData { @@ -173,14 +173,14 @@ export class PostUpdateCommandData { public readonly postId: number, public readonly updateRequest: UpdatePostRequest, public readonly selectedSite: SzuruSiteConfig, - ) { } + ) {} } export class FetchCommandData { constructor( public readonly url: string, public readonly options: RequestInit | undefined = undefined, - ) { } + ) {} } export class SzuruSiteConfig { @@ -194,7 +194,7 @@ export class TagCategoryColor { constructor( public name: string, public color: string, - ) { } + ) {} } export const getDefaultTagCategories = () => [ diff --git a/src/popup/pages/PopupMain.vue b/src/popup/pages/PopupMain.vue index 2a3993a..a3fb560 100644 --- a/src/popup/pages/PopupMain.vue +++ b/src/popup/pages/PopupMain.vue @@ -80,9 +80,7 @@ async function getSelectedTabIds(): Promise { }); if (selectedTabs.length > 0 && selectedTabs[0].id) { - return selectedTabs - .filter(tab => tab.id) - .map(tab => tab.id as number) + return selectedTabs.filter((tab) => tab.id).map((tab) => tab.id as number); } throw new Error("No active tab."); } @@ -92,16 +90,16 @@ async function grabPost() { const selectedTabIds = await getSelectedTabIds(); let scrapeResults: ScrapeResults = new ScrapeResults(); - for(const selectedTabId of selectedTabIds) { + for (const selectedTabId of selectedTabIds) { // Send 'grab_post' to the content script on the active tabs const x = await browser.tabs.sendMessage(selectedTabId, new BrowserCommand("grab_post")); // We need to create a new ScrapeResults object and fill it with our data, because the get_posts() // method gets 'lost' when sent from the contentscript to the popup (it gets JSON.stringified and any prototype defines are lost there) const results: ScrapeResults = Object.assign(new ScrapeResults(), x); - for(const result of results.results) { + for (const result of results.results) { const res = scrapeResults.results.find((r) => r.engine === result.engine); - if(res) res.posts.push(...result.posts); + if (res) res.posts.push(...result.posts); else scrapeResults.results.push(result); } } @@ -140,9 +138,11 @@ async function grabPost() { // Remove ignored tags // The complexity for this is quite bad but all the other ways I tried were even worse - vm.tags = vm.tags.filter(tag => cfg.value.tagIgnores.every( - ignoredTag => tag.name != ignoredTag.names[0] // no getters after deserializing - )); + vm.tags = vm.tags.filter((tag) => + cfg.value.tagIgnores.every( + (ignoredTag) => tag.name != ignoredTag.names[0], // no getters after deserializing + ), + ); pop.posts.push(vm); } @@ -190,7 +190,11 @@ async function upload() { await ensurePostHasContentToken(szuru.value!, post, cfg); } - const cmdData = new PostUploadCommandData(post, cloneDeep(selectedSite.value), cfg.value.sendUploadNotifications); + const cmdData = new PostUploadCommandData( + post, + cloneDeep(selectedSite.value), + cfg.value.sendUploadNotifications, + ); const cmd = new BrowserCommand("upload_post", cmdData); await browser.runtime.sendMessage(cmd); } catch (ex: any) { @@ -321,7 +325,7 @@ async function loadTagCounts() { for (let post of pop.posts) for (let tag of resp.results) { const postTag = post.tags.find((postTag) => tag.names.includes(postTag.name)); - if(postTag) postTag.usages = tag.usages; + if (postTag) postTag.usages = tag.usages; } } }