WebUI: remove redundant braces in switch statements

Braces are only required when there are variable/function declarations.
This commit is contained in:
Chocobo1
2025-08-24 20:15:51 +08:00
parent acab056fe4
commit 2bd0965906
3 changed files with 7 additions and 9 deletions

View File

@@ -69,7 +69,8 @@ export default [
"Stylistic/semi": "error",
"Stylistic/spaced-comment": ["error", "always", { exceptions: ["*"] }],
"Unicorn/no-zero-fractions": "error",
"Unicorn/prefer-number-properties": "error"
"Unicorn/prefer-number-properties": "error",
"Unicorn/switch-case-braces": ["error", "avoid"]
}
}
];

View File

@@ -183,18 +183,17 @@ window.qBittorrent.DynamicTable ??= (() => {
return;
switch (e.key) {
case "ArrowUp": {
case "ArrowUp":
e.preventDefault();
this.selectPreviousRow();
this.dynamicTableDiv.querySelector(".selected").scrollIntoView({ block: "nearest" });
break;
}
case "ArrowDown": {
case "ArrowDown":
e.preventDefault();
this.selectNextRow();
this.dynamicTableDiv.querySelector(".selected").scrollIntoView({ block: "nearest" });
break;
}
}
});
}
@@ -1632,7 +1631,7 @@ window.qBittorrent.DynamicTable ??= (() => {
return false;
break; // do nothing
default: {
default:
if (!useSubcategories) {
if (category !== row["full_data"].category)
return false;
@@ -1647,7 +1646,6 @@ window.qBittorrent.DynamicTable ??= (() => {
}
}
break;
}
}
switch (tag) {

View File

@@ -142,7 +142,7 @@ window.qBittorrent.Search ??= (() => {
document.getElementById("SearchPanel").addEventListener("keydown", (event) => {
switch (event.key) {
case "Enter": {
case "Enter":
event.preventDefault();
event.stopPropagation();
@@ -156,7 +156,6 @@ window.qBittorrent.Search ??= (() => {
}
break;
}
}
});