Compare commits

..

5 Commits

Author SHA1 Message Date
James Brunton
36e0442980
Merge branch 'V2' into V2-eslint-no-case-declarations 2025-09-04 16:05:40 +01:00
James Brunton
003285506f
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)
2025-09-04 15:04:49 +00:00
James Brunton
6d3b08d9b6
Enable ESLint no-empty rule (#4342)
# Description of Changes
Enable ESLint [no-empty
rule](https://eslint.org/docs/latest/rules/no-empty)
2025-09-04 15:59:31 +01:00
James Brunton
d20e8b6d1f
Merge branch 'V2' into V2-eslint-no-case-declarations 2025-09-04 15:15:32 +01:00
James Brunton
295e682e03
Add linting to frontend (#4341)
# Description of Changes
There's no current linter running over our TypeScript code, which means
we've got a bunch of dead code and other code smells around with nothing
notifying us. This PR adds ESLint with the typescript-eslint plugin and
enables the recommended settings as a starting point for us.

I've disabled all of the failing rules for the scope of this PR, just to
get linting running without causing a massive diff. I'll follow up with
future PRs that enable the failing rules one by one.

Also updates our version of TypeScript, which introduces a new type
error in the code (which I've had to fix)
2025-09-04 14:08:28 +01:00
4 changed files with 10 additions and 10 deletions

View File

@ -15,10 +15,8 @@ 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
"prefer-const": "off", // Temporarily disabled until codebase conformant
"@typescript-eslint/ban-ts-comment": "off", // Temporarily disabled until codebase conformant
"@typescript-eslint/no-empty-object-type": "off", // Temporarily disabled until codebase conformant

View File

@ -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]];
}

View File

@ -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 */ }
};
}

View File

@ -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();
export const pdfWorkerManager = PDFWorkerManager.getInstance();