diff --git a/src/webui/www/eslint.config.mjs b/src/webui/www/eslint.config.mjs index 650e18069..e23d11b87 100644 --- a/src/webui/www/eslint.config.mjs +++ b/src/webui/www/eslint.config.mjs @@ -34,6 +34,7 @@ export default [ "operator-assignment": "error", "prefer-arrow-callback": "error", "prefer-const": "error", + "radix": "error", "Stylistic/no-mixed-operators": [ "error", { diff --git a/src/webui/www/private/rename_files.html b/src/webui/www/private/rename_files.html index 70083f30c..6371245fa 100644 --- a/src/webui/www/private/rename_files.html +++ b/src/webui/www/private/rename_files.html @@ -28,7 +28,7 @@ menu: "multiRenameFilesMenu", actions: { ToggleSelection: function(element, ref) { - const rowId = parseInt(element.get("data-row-id")); + const rowId = parseInt(element.get("data-row-id"), 10); const row = bulkRenameFilesTable.getNode(rowId); const checkState = (row.checked === 1) ? 0 : 1; bulkRenameFilesTable.toggleNodeTreeCheckbox(rowId, checkState); @@ -128,7 +128,7 @@ $("include_folders").checked = fileRenamer.includeFolders; const multirename_fileEnumerationStart = LocalPreferences.get("multirename_fileEnumerationStart", 0); - fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart); + fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart, 10); $("file_counter").set("value", fileRenamer.fileEnumerationStart); const multirename_replaceAll = LocalPreferences.get("multirename_replaceAll", false); diff --git a/src/webui/www/private/scripts/misc.js b/src/webui/www/private/scripts/misc.js index d9654a08a..c338e945a 100644 --- a/src/webui/www/private/scripts/misc.js +++ b/src/webui/www/private/scripts/misc.js @@ -112,18 +112,18 @@ window.qBittorrent.Misc = (function() { return "QBT_TR(< 1m)QBT_TR[CONTEXT=misc]"; let minutes = seconds / 60; if (minutes < 60) - return "QBT_TR(%1m)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(minutes)); + return "QBT_TR(%1m)QBT_TR[CONTEXT=misc]".replace("%1", Math.floor(minutes)); let hours = minutes / 60; minutes %= 60; if (hours < 24) - return "QBT_TR(%1h %2m)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(hours)).replace("%2", parseInt(minutes)); + return "QBT_TR(%1h %2m)QBT_TR[CONTEXT=misc]".replace("%1", Math.floor(hours)).replace("%2", Math.floor(minutes)); let days = hours / 24; hours %= 24; if (days < 365) - return "QBT_TR(%1d %2h)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(days)).replace("%2", parseInt(hours)); + return "QBT_TR(%1d %2h)QBT_TR[CONTEXT=misc]".replace("%1", Math.floor(days)).replace("%2", Math.floor(hours)); const years = days / 365; days %= 365; - return "QBT_TR(%1y %2d)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(years)).replace("%2", parseInt(days)); + return "QBT_TR(%1y %2d)QBT_TR[CONTEXT=misc]".replace("%1", Math.floor(years)).replace("%2", Math.floor(days)); }; const friendlyPercentage = function(value) { diff --git a/src/webui/www/private/scripts/progressbar.js b/src/webui/www/private/scripts/progressbar.js index a17915354..21327c976 100644 --- a/src/webui/www/private/scripts/progressbar.js +++ b/src/webui/www/private/scripts/progressbar.js @@ -127,7 +127,7 @@ window.qBittorrent.ProgressBar = (function() { this.vals.dark.textContent = displayedValue; this.vals.light.textContent = displayedValue; - const r = parseInt(this.vals.width * (value / 100)); + const r = parseInt((this.vals.width * (value / 100)), 10); this.vals.dark.setStyle("clip", `rect(0, ${r}px, ${this.vals.height}px, 0)`); this.vals.light.setStyle("clip", `rect(0, ${this.vals.width}px, ${this.vals.height}px, ${r}px)`); } diff --git a/src/webui/www/private/scripts/prop-files.js b/src/webui/www/private/scripts/prop-files.js index 768bfae46..0e3cadc03 100644 --- a/src/webui/www/private/scripts/prop-files.js +++ b/src/webui/www/private/scripts/prop-files.js @@ -200,8 +200,7 @@ window.qBittorrent.PropFiles = (function() { const updatePriorityCombo = function(id, selectedPriority) { const combobox = $("comboPrio" + id); - - if (parseInt(combobox.value) !== selectedPriority) + if (parseInt(combobox.value, 10) !== selectedPriority) selectComboboxPriority(combobox, selectedPriority); }; @@ -209,7 +208,7 @@ window.qBittorrent.PropFiles = (function() { const options = combobox.options; for (let i = 0; i < options.length; ++i) { const option = options[i]; - if (parseInt(option.value) === priority) + if (parseInt(option.value, 10) === priority) option.selected = true; else option.selected = false; diff --git a/src/webui/www/private/shareratio.html b/src/webui/www/private/shareratio.html index b19143b80..26e0dcd0b 100644 --- a/src/webui/www/private/shareratio.html +++ b/src/webui/www/private/shareratio.html @@ -38,11 +38,11 @@ const values = { ratioLimit: window.qBittorrent.Misc.friendlyFloat(origValues[0], 2), - seedingTimeLimit: parseInt(origValues[1]), - inactiveSeedingTimeLimit: parseInt(origValues[2]), + seedingTimeLimit: parseInt(origValues[1], 10), + inactiveSeedingTimeLimit: parseInt(origValues[2], 10), maxRatio: window.qBittorrent.Misc.friendlyFloat(origValues[3], 2), - maxSeedingTime: parseInt(origValues[4]), - maxInactiveSeedingTime: parseInt(origValues[5]) + maxSeedingTime: parseInt(origValues[4], 10), + maxInactiveSeedingTime: parseInt(origValues[5], 10) }; // select default when orig values not passed. using double equals to compare string and int diff --git a/src/webui/www/private/views/rssDownloader.html b/src/webui/www/private/views/rssDownloader.html index 103b17c25..16bed2c0b 100644 --- a/src/webui/www/private/views/rssDownloader.html +++ b/src/webui/www/private/views/rssDownloader.html @@ -582,7 +582,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also rulesList[rule].mustNotContain = $("mustNotContainText").value; rulesList[rule].episodeFilter = $("episodeFilterText").value; rulesList[rule].smartFilter = $("useSmartFilter").checked; - rulesList[rule].ignoreDays = parseInt($("ignoreDaysValue").value); + rulesList[rule].ignoreDays = parseInt($("ignoreDaysValue").value, 10); rulesList[rule].affectedFeeds = rssDownloaderFeedSelectionTable.rows.filter((row) => row.full_data.checked) .map((row) => row.full_data.url) .getValues();