From 3516b609f6835db775848a0d56c1374deb51ecb3 Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Thu, 11 Dec 2025 14:11:35 +0100 Subject: [PATCH] Fix ESLint configuration and resolve all linting issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename eslint.config.js to eslint.config.mjs to support ES modules - Remove unused parameters from interface implementations - Fix refs access during render in WorkflowStepper by removing redundant check - Wrap colorBlocks computation in useMemo to fix exhaustive-deps warning All linting errors and warnings are now resolved. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- eslint.config.js => eslint.config.mjs | 0 src/components/ProgressMonitor.tsx | 86 +++++++++---------- src/components/WorkflowStepper.tsx | 2 +- src/platform/browser/BrowserFileService.ts | 2 +- src/platform/electron/ElectronFileService.ts | 2 +- .../electron/ElectronStorageService.ts | 2 +- 6 files changed, 47 insertions(+), 47 deletions(-) rename eslint.config.js => eslint.config.mjs (100%) diff --git a/eslint.config.js b/eslint.config.mjs similarity index 100% rename from eslint.config.js rename to eslint.config.mjs diff --git a/src/components/ProgressMonitor.tsx b/src/components/ProgressMonitor.tsx index 554614e..6697e95 100644 --- a/src/components/ProgressMonitor.tsx +++ b/src/components/ProgressMonitor.tsx @@ -1,4 +1,4 @@ -import { useRef, useEffect, useState } from "react"; +import { useRef, useEffect, useState, useMemo } from "react"; import { CheckCircleIcon, ArrowRightIcon, @@ -58,53 +58,53 @@ export function ProgressMonitor({ : 0; // Calculate color block information from pesData - const colorBlocks = pesData - ? (() => { - const blocks: Array<{ - colorIndex: number; - threadHex: string; - startStitch: number; - endStitch: number; - stitchCount: number; - threadCatalogNumber: string | null; - threadBrand: string | null; - threadDescription: string | null; - threadChart: string | null; - }> = []; + const colorBlocks = useMemo(() => { + if (!pesData) return []; - let currentColorIndex = pesData.stitches[0]?.[3] ?? 0; - let blockStartStitch = 0; + const blocks: Array<{ + colorIndex: number; + threadHex: string; + startStitch: number; + endStitch: number; + stitchCount: number; + threadCatalogNumber: string | null; + threadBrand: string | null; + threadDescription: string | null; + threadChart: string | null; + }> = []; - for (let i = 0; i < pesData.stitches.length; i++) { - const stitchColorIndex = pesData.stitches[i][3]; + let currentColorIndex = pesData.stitches[0]?.[3] ?? 0; + let blockStartStitch = 0; - // When color changes, save the previous block - if ( - stitchColorIndex !== currentColorIndex || - i === pesData.stitches.length - 1 - ) { - const endStitch = i === pesData.stitches.length - 1 ? i + 1 : i; - const thread = pesData.threads[currentColorIndex]; - blocks.push({ - colorIndex: currentColorIndex, - threadHex: thread?.hex || "#000000", - threadCatalogNumber: thread?.catalogNumber ?? null, - threadBrand: thread?.brand ?? null, - threadDescription: thread?.description ?? null, - threadChart: thread?.chart ?? null, - startStitch: blockStartStitch, - endStitch: endStitch, - stitchCount: endStitch - blockStartStitch, - }); + for (let i = 0; i < pesData.stitches.length; i++) { + const stitchColorIndex = pesData.stitches[i][3]; - currentColorIndex = stitchColorIndex; - blockStartStitch = i; - } - } + // When color changes, save the previous block + if ( + stitchColorIndex !== currentColorIndex || + i === pesData.stitches.length - 1 + ) { + const endStitch = i === pesData.stitches.length - 1 ? i + 1 : i; + const thread = pesData.threads[currentColorIndex]; + blocks.push({ + colorIndex: currentColorIndex, + threadHex: thread?.hex || "#000000", + threadCatalogNumber: thread?.catalogNumber ?? null, + threadBrand: thread?.brand ?? null, + threadDescription: thread?.description ?? null, + threadChart: thread?.chart ?? null, + startStitch: blockStartStitch, + endStitch: endStitch, + stitchCount: endStitch - blockStartStitch, + }); - return blocks; - })() - : []; + currentColorIndex = stitchColorIndex; + blockStartStitch = i; + } + } + + return blocks; + }, [pesData]); // Determine current color block based on current stitch const currentStitch = sewingProgress?.currentStitch || 0; diff --git a/src/components/WorkflowStepper.tsx b/src/components/WorkflowStepper.tsx index 5764428..f55df37 100644 --- a/src/components/WorkflowStepper.tsx +++ b/src/components/WorkflowStepper.tsx @@ -375,7 +375,7 @@ export function WorkflowStepper({ {/* Popover */} - {showPopover && popoverStep !== null && stepRefs.current[popoverStep] && ( + {showPopover && popoverStep !== null && (
{ + async saveFileDialog(): Promise { // No-op in browser - could implement download if needed in the future console.warn('saveFileDialog not implemented in browser'); } diff --git a/src/platform/electron/ElectronFileService.ts b/src/platform/electron/ElectronFileService.ts index 230f034..cd86235 100644 --- a/src/platform/electron/ElectronFileService.ts +++ b/src/platform/electron/ElectronFileService.ts @@ -4,7 +4,7 @@ import type { IFileService } from '../interfaces/IFileService'; * Electron implementation of file service using native dialogs via IPC */ export class ElectronFileService implements IFileService { - async openFileDialog(_options: { accept: string }): Promise { + async openFileDialog(): Promise { if (!window.electronAPI) { throw new Error('Electron API not available'); } diff --git a/src/platform/electron/ElectronStorageService.ts b/src/platform/electron/ElectronStorageService.ts index d53c77a..5ccf44c 100644 --- a/src/platform/electron/ElectronStorageService.ts +++ b/src/platform/electron/ElectronStorageService.ts @@ -68,7 +68,7 @@ export class ElectronStorageService implements IStorageService { } } - async hasPattern(_uuid: string): Promise { + async hasPattern(): Promise { // Since this is async in Electron, we can't truly implement this synchronously // Returning false as a safe default console.warn('[ElectronStorage] hasPattern called synchronously, returning false');