From a08171c919c145bbbd32817f28faa0d394699187 Mon Sep 17 00:00:00 2001 From: Derek Chen Date: Tue, 5 Nov 2024 15:19:03 -0600 Subject: [PATCH] chore: linting --- src/shared/storage/CacheStore.ts | 2 +- src/views/lib/getGitHubStats.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/shared/storage/CacheStore.ts b/src/shared/storage/CacheStore.ts index e722e528..804001f7 100644 --- a/src/shared/storage/CacheStore.ts +++ b/src/shared/storage/CacheStore.ts @@ -1,4 +1,4 @@ -import { CachedData } from '@shared/types/CachedData'; +import type { CachedData } from '@shared/types/CachedData'; import { createLocalStore, debugStore } from 'chrome-extension-toolkit'; import { generateRandomId } from '../util/random'; diff --git a/src/views/lib/getGitHubStats.ts b/src/views/lib/getGitHubStats.ts index e2cc9689..62586ac7 100644 --- a/src/views/lib/getGitHubStats.ts +++ b/src/views/lib/getGitHubStats.ts @@ -1,6 +1,6 @@ import { Octokit } from '@octokit/rest'; -import { CachedData } from '@shared/types/CachedData'; import { CacheStore } from '@shared/storage/CacheStore'; +import type { CachedData } from '@shared/types/CachedData'; import { serialize } from 'chrome-extension-toolkit'; // Types @@ -74,7 +74,7 @@ export class GitHubStatsService { } private async getCachedData(key: string): Promise | null> { - if(Object.keys(this.cache).length === 0) { + if (Object.keys(this.cache).length === 0) { this.cache = await CacheStore.get('github') as Record>; } const cachedItem = this.cache[key]; @@ -85,7 +85,7 @@ export class GitHubStatsService { } private async setCachedData(key: string, data: T): Promise { - if(Object.keys(this.cache).length === 0) { + if (Object.keys(this.cache).length === 0) { this.cache = await CacheStore.get('github') as Record>; } this.cache[key] = { data, dataFetched: (new Date()).getTime() }; @@ -147,13 +147,13 @@ export class GitHubStatsService { const cachedName = await this.getCachedData(cacheKey); let name = `@${contributor}`; - if(cachedName) { + if (cachedName) { name = cachedName.data; } else { try { const response = await fetch(`https://api.github.com/users/${contributor}`); const json = await response.json(); - if(json.name) { + if (json.name) { name = json.name; } await this.setCachedData(cacheKey, name);