From 6d3b08d9b6674a8c6ccab2e84474e560f4a0a159 Mon Sep 17 00:00:00 2001 From: James Brunton Date: Thu, 4 Sep 2025 15:59:31 +0100 Subject: [PATCH 1/2] Enable ESLint no-empty rule (#4342) # Description of Changes Enable ESLint [no-empty rule](https://eslint.org/docs/latest/rules/no-empty) --- frontend/eslint.config.mjs | 1 - frontend/src/components/shared/fitText/textFit.ts | 4 ++-- frontend/src/services/pdfWorkerManager.ts | 12 +++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs index 7922013cb..a8042355f 100644 --- a/frontend/eslint.config.mjs +++ b/frontend/eslint.config.mjs @@ -15,7 +15,6 @@ export default defineConfig( }, { rules: { - "no-empty": "off", // Temporarily disabled until codebase conformant "no-empty-pattern": "off", // Temporarily disabled until codebase conformant "no-undef": "off", // Temporarily disabled until codebase conformant "no-useless-escape": "off", // Temporarily disabled until codebase conformant diff --git a/frontend/src/components/shared/fitText/textFit.ts b/frontend/src/components/shared/fitText/textFit.ts index 37da2dc78..7a695ed77 100644 --- a/frontend/src/components/shared/fitText/textFit.ts +++ b/frontend/src/components/shared/fitText/textFit.ts @@ -82,8 +82,8 @@ export function adjustFontSizeToFit( return () => { cancelAnimationFrame(raf); - try { ro.disconnect(); } catch {} - try { mo.disconnect(); } catch {} + try { ro.disconnect(); } catch { /* Ignore errors */ } + try { mo.disconnect(); } catch { /* Ignore errors */ } }; } diff --git a/frontend/src/services/pdfWorkerManager.ts b/frontend/src/services/pdfWorkerManager.ts index 0999c5c29..57fc841e0 100644 --- a/frontend/src/services/pdfWorkerManager.ts +++ b/frontend/src/services/pdfWorkerManager.ts @@ -1,6 +1,6 @@ /** * PDF.js Worker Manager - Centralized worker lifecycle management - * + * * Prevents infinite worker creation by managing PDF.js workers globally * and ensuring proper cleanup when operations complete. */ @@ -86,7 +86,7 @@ class PDFWorkerManager { const pdf = await loadingTask.promise; this.activeDocuments.add(pdf); this.workerCount++; - + return pdf; } catch (error) { // If document creation fails, make sure to clean up the loading task @@ -94,6 +94,7 @@ class PDFWorkerManager { try { loadingTask.destroy(); } catch (destroyError) { + // Ignore errors } } throw error; @@ -125,7 +126,7 @@ class PDFWorkerManager { documentsToDestroy.forEach(pdf => { this.destroyDocument(pdf); }); - + this.activeDocuments.clear(); this.workerCount = 0; } @@ -166,9 +167,10 @@ class PDFWorkerManager { try { pdf.destroy(); } catch (error) { + // Ignore errors } }); - + this.activeDocuments.clear(); this.workerCount = 0; } @@ -182,4 +184,4 @@ class PDFWorkerManager { } // Export singleton instance -export const pdfWorkerManager = PDFWorkerManager.getInstance(); \ No newline at end of file +export const pdfWorkerManager = PDFWorkerManager.getInstance(); From 003285506f0d06e9ba5e58334f93b4ed0959ab3b Mon Sep 17 00:00:00 2001 From: James Brunton Date: Thu, 4 Sep 2025 16:04:49 +0100 Subject: [PATCH 2/2] Enable ESLint no-useless-escape rule (#4344) # Description of Changes Enable ESLint [no-useless-escape rule](https://eslint.org/docs/latest/rules/no-useless-escape) --- frontend/eslint.config.mjs | 1 - frontend/scripts/generate-licenses.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs index a8042355f..d39d66276 100644 --- a/frontend/eslint.config.mjs +++ b/frontend/eslint.config.mjs @@ -17,7 +17,6 @@ export default defineConfig( rules: { "no-empty-pattern": "off", // Temporarily disabled until codebase conformant "no-undef": "off", // Temporarily disabled until codebase conformant - "no-useless-escape": "off", // Temporarily disabled until codebase conformant "no-case-declarations": "off", // Temporarily disabled until codebase conformant "prefer-const": "off", // Temporarily disabled until codebase conformant "@typescript-eslint/ban-ts-comment": "off", // Temporarily disabled until codebase conformant diff --git a/frontend/scripts/generate-licenses.js b/frontend/scripts/generate-licenses.js index aaac69800..7ab425e19 100644 --- a/frontend/scripts/generate-licenses.js +++ b/frontend/scripts/generate-licenses.js @@ -224,7 +224,7 @@ function getLicenseUrl(licenseType) { // Handle complex SPDX expressions like "(MIT AND Zlib)" or "(MIT OR CC0-1.0)" if (licenseType.includes('AND') || licenseType.includes('OR')) { // Extract the first license from compound expressions for URL - const match = licenseType.match(/\(?\s*([A-Za-z0-9\-\.]+)/); + const match = licenseType.match(/\(?\s*([A-Za-z0-9\-.]+)/); if (match && licenseUrls[match[1]]) { return licenseUrls[match[1]]; }