mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-06-09 06:13:14 +00:00
Fix linting and formatting issues
- Run Prettier to fix code style in 7 files - Auto-fix ESLint errors with --fix flag - Replace ++ with += 1 in commandTracking.ts - Add eslint-disable comments for intentional console.error usage - Fix destructuring, array types, and template literals - Remove trivial type annotations
This commit is contained in:
@@ -6,9 +6,7 @@ interface CommandData {
|
||||
}
|
||||
|
||||
interface CommandStats {
|
||||
commands: {
|
||||
[key: string]: CommandData;
|
||||
};
|
||||
commands: Record<string, CommandData>;
|
||||
version: number;
|
||||
}
|
||||
|
||||
@@ -24,6 +22,7 @@ function getStats(): CommandStats {
|
||||
const parsed = JSON.parse(stored) as CommandStats;
|
||||
return parsed;
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error("Failed to parse command stats:", error);
|
||||
return { commands: {}, version: CURRENT_VERSION };
|
||||
}
|
||||
@@ -33,6 +32,7 @@ function saveStats(stats: CommandStats): void {
|
||||
try {
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(stats));
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error("Failed to save command stats:", error);
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ export function trackCommand(
|
||||
};
|
||||
}
|
||||
|
||||
stats.commands[id].count++;
|
||||
stats.commands[id].count += 1;
|
||||
stats.commands[id].lastUsed = new Date().toISOString();
|
||||
|
||||
if (metadata?.routePath) {
|
||||
@@ -80,9 +80,7 @@ export function getCommandScore(commandId: string): number {
|
||||
return command.count * 0.7 + recencyBonus * 0.3;
|
||||
}
|
||||
|
||||
export function getTopCommands(
|
||||
limit = 10
|
||||
): Array<{ id: string; score: number }> {
|
||||
export function getTopCommands(limit = 10): { id: string; score: number }[] {
|
||||
const stats = getStats();
|
||||
|
||||
const scored = Object.keys(stats.commands).map(id => ({
|
||||
|
||||
@@ -79,10 +79,8 @@ export function processLibraryItem(
|
||||
}
|
||||
}
|
||||
// For movies and other types, use thumb
|
||||
else {
|
||||
if (item.thumb) {
|
||||
posterUrl = `${serverUrl}${item.thumb}?X-Plex-Token=${authToken}`;
|
||||
}
|
||||
else if (item.thumb) {
|
||||
posterUrl = `${serverUrl}${item.thumb}?X-Plex-Token=${authToken}`;
|
||||
}
|
||||
|
||||
// Build Plex Web App URL
|
||||
@@ -120,7 +118,8 @@ export function processLibraryItem(
|
||||
...baseItem,
|
||||
episodes: item.leafCount || 0
|
||||
};
|
||||
} else if (libraryType === "music") {
|
||||
}
|
||||
if (libraryType === "music") {
|
||||
return {
|
||||
...baseItem,
|
||||
artist: item.parentTitle || "Unknown Artist",
|
||||
@@ -166,7 +165,7 @@ export function calculateDuration(metadata: any[], libraryType: string) {
|
||||
});
|
||||
|
||||
const hours = Math.round(totalDuration / (1000 * 60 * 60));
|
||||
const formattedDuration = hours.toLocaleString() + " hours";
|
||||
const formattedDuration = `${hours.toLocaleString()} hours`;
|
||||
|
||||
return {
|
||||
totalDuration: formattedDuration,
|
||||
|
||||
Reference in New Issue
Block a user