🔧 chore: let→const for never-reassigned Sets/Maps/objects
ESLint prefer-const auto-fix: 12 variables changed from let to const where the reference is never reassigned (Maps, Sets, sort state objects). All tools clean: - ESLint: 0 errors, 0 warnings - Tests: 70/70 pass - npm audit (runtime): 0 vulnerabilities Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
39b3971bbe
commit
94c3c5e4ac
2
main.js
2
main.js
@ -18,7 +18,7 @@ let dropTargetWindow = null;
|
|||||||
let tray = null;
|
let tray = null;
|
||||||
const configStore = new ConfigStore(app);
|
const configStore = new ConfigStore(app);
|
||||||
let uploadManager = null;
|
let uploadManager = null;
|
||||||
let folderMonitor = new FolderMonitor();
|
const folderMonitor = new FolderMonitor();
|
||||||
let remoteServer = null;
|
let remoteServer = null;
|
||||||
let captureWindow = null;
|
let captureWindow = null;
|
||||||
let captureWindowReady = false;
|
let captureWindowReady = false;
|
||||||
|
|||||||
@ -27,16 +27,16 @@ const AUTO_CHECK_PREF_KEY = 'autoHealthCheckBeforeUpload';
|
|||||||
|
|
||||||
// Queue state
|
// Queue state
|
||||||
let queueJobs = []; // { id, file, fileName, hoster, status, bytesUploaded, bytesTotal, speedKbs, elapsed, remaining, error, result, attempt, maxAttempts, link }
|
let queueJobs = []; // { id, file, fileName, hoster, status, bytesUploaded, bytesTotal, speedKbs, elapsed, remaining, error, result, attempt, maxAttempts, link }
|
||||||
let _jobIndexById = new Map(); // id -> job (O(1) lookup)
|
const _jobIndexById = new Map(); // id -> job (O(1) lookup)
|
||||||
let _jobIndexByUploadId = new Map(); // uploadId -> job
|
const _jobIndexByUploadId = new Map(); // uploadId -> job
|
||||||
let selectedJobIds = new Set();
|
const selectedJobIds = new Set();
|
||||||
let _sessionTotalBytes = 0; // Total bytes ever added to queue this session
|
let _sessionTotalBytes = 0; // Total bytes ever added to queue this session
|
||||||
let _sessionUploadedBytes = 0; // Bytes fully uploaded this session (done jobs)
|
let _sessionUploadedBytes = 0; // Bytes fully uploaded this session (done jobs)
|
||||||
let _sessionTrackedJobs = new Set(); // Job IDs already counted for totalBytes
|
const _sessionTrackedJobs = new Set(); // Job IDs already counted for totalBytes
|
||||||
let _sessionDoneJobs = new Set(); // Job IDs already counted for uploadedBytes
|
const _sessionDoneJobs = new Set(); // Job IDs already counted for uploadedBytes
|
||||||
let _completedUploadKeys = new Set(); // 'filepath|hoster' keys for done uploads (survives removeFromQueueOnDone)
|
const _completedUploadKeys = new Set(); // 'filepath|hoster' keys for done uploads (survives removeFromQueueOnDone)
|
||||||
let _deletedJobIds = new Set(); // IDs of jobs explicitly deleted by user (prevents re-creation from stale progress callbacks)
|
const _deletedJobIds = new Set(); // IDs of jobs explicitly deleted by user (prevents re-creation from stale progress callbacks)
|
||||||
let queueSortState = { key: 'filename', direction: 'asc' };
|
const queueSortState = { key: 'filename', direction: 'asc' };
|
||||||
|
|
||||||
// History state
|
// History state
|
||||||
let historyRowsData = [];
|
let historyRowsData = [];
|
||||||
@ -44,8 +44,8 @@ let historySortState = { key: 'date', direction: 'desc' };
|
|||||||
|
|
||||||
// Session-specific files for the "Files" panel (resets each session)
|
// Session-specific files for the "Files" panel (resets each session)
|
||||||
let sessionFilesData = [];
|
let sessionFilesData = [];
|
||||||
let recentSortState = { key: 'date', direction: 'desc' };
|
const recentSortState = { key: 'date', direction: 'desc' };
|
||||||
let selectedRecentIds = new Set();
|
const selectedRecentIds = new Set();
|
||||||
|
|
||||||
// --- Init ---
|
// --- Init ---
|
||||||
async function init() {
|
async function init() {
|
||||||
@ -2984,7 +2984,7 @@ function sortHistoryRows(rows) {
|
|||||||
const { key, direction } = historySortState;
|
const { key, direction } = historySortState;
|
||||||
const factor = direction === 'asc' ? 1 : -1;
|
const factor = direction === 'asc' ? 1 : -1;
|
||||||
return rows.slice().sort((a, b) => {
|
return rows.slice().sort((a, b) => {
|
||||||
let cmp = key === 'date' ? a.dateTs - b.dateTs : _collatorDE.compare(String(a[key] || ''), String(b[key] || ''));
|
const cmp = key === 'date' ? a.dateTs - b.dateTs : _collatorDE.compare(String(a[key] || ''), String(b[key] || ''));
|
||||||
return (cmp || a.order - b.order) * factor;
|
return (cmp || a.order - b.order) * factor;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user