Skip to content

Commit 68e7538

Browse files
Copilotlstein
andcommitted
Fix all ESLint errors - add missing browser globals and fix code issues
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
1 parent ae7fdaa commit 68e7538

5 files changed

Lines changed: 23 additions & 19 deletions

File tree

eslint.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ export default [
3131
clearInterval: 'readonly',
3232
alert: 'readonly',
3333
confirm: 'readonly',
34+
prompt: 'readonly',
3435
CustomEvent: 'readonly',
3536
Event: 'readonly',
3637
MouseEvent: 'readonly',
3738
KeyboardEvent: 'readonly',
39+
TouchEvent: 'readonly',
3840
ResizeObserver: 'readonly',
3941
IntersectionObserver: 'readonly',
4042
MutationObserver: 'readonly',
@@ -43,8 +45,13 @@ export default [
4345
Node: 'readonly',
4446
NodeList: 'readonly',
4547
Blob: 'readonly',
48+
File: 'readonly',
4649
FileReader: 'readonly',
4750
Image: 'readonly',
51+
navigator: 'readonly',
52+
performance: 'readonly',
53+
requestAnimationFrame: 'readonly',
54+
getComputedStyle: 'readonly',
4855
// Plotly global (used in umap.js)
4956
Plotly: 'readonly',
5057
// Swiper global (used in swiper.js)
@@ -91,6 +98,7 @@ export default [
9198
beforeAll: 'readonly',
9299
afterAll: 'readonly',
93100
jest: 'readonly',
101+
global: 'readonly',
94102
},
95103
},
96104
},

photomap/frontend/static/javascript/events.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ window.addEventListener("slideshowStartRequested", async () => {
130130
if (state.gridViewActive) {
131131
await toggleGridSwiperView(false);
132132
}
133-
await state.single_swiper.resetAllSlides(state.mode == "random");
133+
await state.single_swiper.resetAllSlides(state.mode === "random");
134134
if (isUmapFullscreen()) {
135135
toggleUmapWindow(false);
136136
}
@@ -235,9 +235,9 @@ export async function toggleGridSwiperView(gridView = null) {
235235
gridContainer.style.display = "none";
236236
gridContainer.classList.remove("fade-out");
237237

238-
if (singleContainer.style.display == "none") // if previous hidden, then reset
238+
if (singleContainer.style.display === "none") // if previous hidden, then reset
239239
{
240-
await state.single_swiper.resetAllSlides(slideShowRunning && state.mode == "random");
240+
await state.single_swiper.resetAllSlides(slideShowRunning && state.mode === "random");
241241
}
242242

243243
// Fade in single view

photomap/frontend/static/javascript/search.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ export async function fetchImageByIndex(index) {
1616
const spinnerTimeout = setTimeout(() => showSpinner(), 500); // Show spinner after 0.5s
1717

1818
try {
19-
let url;
20-
2119
// Album and index go into path
22-
url = `retrieve_image/${encodeURIComponent(state.album)}/${encodeURIComponent(index)}`;
20+
const url = `retrieve_image/${encodeURIComponent(state.album)}/${encodeURIComponent(index)}`;
2321

2422
response = await fetch(url, {
2523
method: "GET",

photomap/frontend/static/javascript/swiper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class SwiperManager {
380380
searchIndex = null;
381381
}
382382
// Check for valid globalIndex and that it doesn't already exist
383-
if (globalIndex != null && !existingIndices.has(globalIndex)) {
383+
if (globalIndex !== null && !existingIndices.has(globalIndex)) {
384384
break;
385385
}
386386
}
@@ -579,7 +579,9 @@ class SwiperManager {
579579
}
580580

581581
async seekToSlideIndex(event) {
582-
let { globalIndex, searchIndex, totalCount, isSearchMode } = event.detail;
582+
let { globalIndex, isSearchMode } = event.detail;
583+
const searchIndex = event.detail.searchIndex;
584+
const totalCount = event.detail.totalCount || slideState.totalAlbumImages;
583585

584586
if (isSearchMode) {
585587
globalIndex = slideState.searchToGlobal(searchIndex);

photomap/frontend/static/javascript/umap.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,6 @@ export async function fetchUmapData() {
350350
epsContainer.style.display = "block";
351351
}
352352

353-
// Add triangle trace and images after plot is created
354-
if (landmarksVisible && typeof landmarkTrace !== "undefined") {
355-
setTimeout(() => {
356-
Plotly.addTraces(gd, [landmarkTrace]);
357-
Plotly.relayout(gd, { images });
358-
}, 500);
359-
}
360-
361353
// After adding traces (e.g., landmarks), move the marker trace to the end
362354
const plotDiv = document.getElementById("umapPlot");
363355
const markerTraceIndex = plotDiv.data.findIndex((trace) => trace.name === "Current Image");
@@ -432,7 +424,7 @@ export async function fetchUmapData() {
432424
function findLandmarkCluster(point) {
433425
const plotDiv = document.getElementById("umapPlot");
434426
const landmarkTraceIndex = plotDiv.data.findIndex((trace) => trace.name === "LandmarkClickTargets");
435-
if (landmarkTraceIndex == -1) {
427+
if (landmarkTraceIndex === -1) {
436428
return null;
437429
}
438430

@@ -1267,7 +1259,9 @@ function proximityClusterOrder(clusterIndices, points, startIndex) {
12671259
// Shared function for cluster clicks
12681260
async function handleClusterClick(clickedIndex) {
12691261
const clickedPoint = points.find((p) => p.index === clickedIndex);
1270-
if (!clickedPoint) return;
1262+
if (!clickedPoint) {
1263+
return;
1264+
}
12711265

12721266
// Show spinner immediately to provide visual feedback
12731267
showUmapSpinner();
@@ -1312,7 +1306,9 @@ async function handleClusterClick(clickedIndex) {
13121306
// Handle single image selection (navigate to clicked image)
13131307
async function handleImageClick(clickedIndex) {
13141308
const clickedPoint = points.find((p) => p.index === clickedIndex);
1315-
if (!clickedPoint) return;
1309+
if (!clickedPoint) {
1310+
return;
1311+
}
13161312

13171313
// Show spinner immediately to provide visual feedback
13181314
showUmapSpinner();

0 commit comments

Comments
 (0)