mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 06:28:03 -06:00
WebUI: prefer Number static properties over global ones
`Number` purpose is modularization of globals in ECMAScript 2015. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseInt#number.parseint_vs._parseint
This commit is contained in:
@@ -3,8 +3,9 @@ import Html from "eslint-plugin-html";
|
|||||||
import Js from "@eslint/js";
|
import Js from "@eslint/js";
|
||||||
import PluginQbtWebUI from "eslint-plugin-qbt-webui";
|
import PluginQbtWebUI from "eslint-plugin-qbt-webui";
|
||||||
import PreferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
|
import PreferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
|
||||||
import Stylistic from "@stylistic/eslint-plugin";
|
|
||||||
import * as RegexpPlugin from "eslint-plugin-regexp";
|
import * as RegexpPlugin from "eslint-plugin-regexp";
|
||||||
|
import Stylistic from "@stylistic/eslint-plugin";
|
||||||
|
import Unicorn from "eslint-plugin-unicorn";
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
Js.configs.recommended,
|
Js.configs.recommended,
|
||||||
@@ -27,7 +28,8 @@ export default [
|
|||||||
PluginQbtWebUI,
|
PluginQbtWebUI,
|
||||||
PreferArrowFunctions,
|
PreferArrowFunctions,
|
||||||
RegexpPlugin,
|
RegexpPlugin,
|
||||||
Stylistic
|
Stylistic,
|
||||||
|
Unicorn
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"curly": ["error", "multi-or-nest", "consistent"],
|
"curly": ["error", "multi-or-nest", "consistent"],
|
||||||
@@ -65,7 +67,8 @@ export default [
|
|||||||
],
|
],
|
||||||
"Stylistic/quote-props": ["error", "consistent-as-needed"],
|
"Stylistic/quote-props": ["error", "consistent-as-needed"],
|
||||||
"Stylistic/semi": "error",
|
"Stylistic/semi": "error",
|
||||||
"Stylistic/spaced-comment": ["error", "always", { exceptions: ["*"] }]
|
"Stylistic/spaced-comment": ["error", "always", { exceptions: ["*"] }],
|
||||||
|
"Unicorn/prefer-number-properties": "error"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
"eslint-plugin-prefer-arrow-functions": "*",
|
"eslint-plugin-prefer-arrow-functions": "*",
|
||||||
"eslint-plugin-qbt-webui": "https://github.com/Chocobo1/eslint-plugin-qbt-webui/tarball/v1",
|
"eslint-plugin-qbt-webui": "https://github.com/Chocobo1/eslint-plugin-qbt-webui/tarball/v1",
|
||||||
"eslint-plugin-regexp": "*",
|
"eslint-plugin-regexp": "*",
|
||||||
|
"eslint-plugin-unicorn": "*",
|
||||||
"happy-dom": "*",
|
"happy-dom": "*",
|
||||||
"html-validate": "*",
|
"html-validate": "*",
|
||||||
"js-beautify": "*",
|
"js-beautify": "*",
|
||||||
|
|||||||
@@ -1618,7 +1618,7 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
|||||||
},
|
},
|
||||||
column: "mainColumn",
|
column: "mainColumn",
|
||||||
onResize: window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
onResize: window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
||||||
const isHidden = (parseInt(document.getElementById("propertiesPanel").style.height, 10) === 0);
|
const isHidden = (Number.parseInt(document.getElementById("propertiesPanel").style.height, 10) === 0);
|
||||||
if (!isHidden)
|
if (!isHidden)
|
||||||
saveColumnSizes();
|
saveColumnSizes();
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||||||
const onStart = function(el, event) {
|
const onStart = function(el, event) {
|
||||||
if (this.canResize) {
|
if (this.canResize) {
|
||||||
this.currentHeaderAction = "resize";
|
this.currentHeaderAction = "resize";
|
||||||
this.startWidth = parseInt(this.resizeTh.style.width, 10);
|
this.startWidth = Number.parseInt(this.resizeTh.style.width, 10);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.currentHeaderAction = "drag";
|
this.currentHeaderAction = "drag";
|
||||||
|
|||||||
@@ -2928,7 +2928,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||||||
let maxRatio = -1;
|
let maxRatio = -1;
|
||||||
if (document.getElementById("maxRatioCheckbox").checked) {
|
if (document.getElementById("maxRatioCheckbox").checked) {
|
||||||
maxRatio = Number(document.getElementById("maxRatioValue").value);
|
maxRatio = Number(document.getElementById("maxRatioValue").value);
|
||||||
if (isNaN(maxRatio) || (maxRatio < 0)) {
|
if (Number.isNaN(maxRatio) || (maxRatio < 0)) {
|
||||||
alert("QBT_TR(Share ratio limit must not have a negative value.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Share ratio limit must not have a negative value.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user