mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Merge pull request #22615 from Chocobo1/webui_eslint
* WebUI: disallow unnecessary semicolons * WebUI: ensure consistent shorthand syntax * WebUI: disallow async functions which have no await expression * WebUI: remove unused variable
This commit is contained in:
commit
ad4bdc0653
14 changed files with 31 additions and 29 deletions
|
@ -34,12 +34,15 @@ export default [
|
||||||
"no-undef": "off",
|
"no-undef": "off",
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
|
"object-shorthand": ["error", "consistent"],
|
||||||
"operator-assignment": "error",
|
"operator-assignment": "error",
|
||||||
"prefer-arrow-callback": "error",
|
"prefer-arrow-callback": "error",
|
||||||
"prefer-const": "error",
|
"prefer-const": "error",
|
||||||
"prefer-template": "error",
|
"prefer-template": "error",
|
||||||
"radix": "error",
|
"radix": "error",
|
||||||
|
"require-await": "error",
|
||||||
"PreferArrowFunctions/prefer-arrow-functions": "error",
|
"PreferArrowFunctions/prefer-arrow-functions": "error",
|
||||||
|
"Stylistic/no-extra-semi": "error",
|
||||||
"Stylistic/no-mixed-operators": [
|
"Stylistic/no-mixed-operators": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
limit: limit
|
limit: limit
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(async (response) => {
|
.then((response) => {
|
||||||
if (!response.ok)
|
if (!response.ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
limit: limit
|
limit: limit
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(async (response) => {
|
.then((response) => {
|
||||||
if (!response.ok)
|
if (!response.ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
tags: tagName
|
tags: tagName
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(async (response) => {
|
.then((response) => {
|
||||||
if (!response.ok)
|
if (!response.ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
tags: tagName
|
tags: tagName
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(async (response) => {
|
.then((response) => {
|
||||||
if (!response.ok)
|
if (!response.ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ window.qBittorrent.Cache ??= (() => {
|
||||||
class BuildInfoCache {
|
class BuildInfoCache {
|
||||||
#m_store = {};
|
#m_store = {};
|
||||||
|
|
||||||
async init() {
|
init() {
|
||||||
return fetch("api/v2/app/buildInfo", {
|
return fetch("api/v2/app/buildInfo", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
cache: "no-store"
|
cache: "no-store"
|
||||||
|
@ -80,7 +80,7 @@ window.qBittorrent.Cache ??= (() => {
|
||||||
// onFailure: () => {},
|
// onFailure: () => {},
|
||||||
// onSuccess: () => {}
|
// onSuccess: () => {}
|
||||||
// }
|
// }
|
||||||
async init(obj = {}) {
|
init(obj = {}) {
|
||||||
return fetch("api/v2/app/preferences", {
|
return fetch("api/v2/app/preferences", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
cache: "no-store"
|
cache: "no-store"
|
||||||
|
@ -153,7 +153,7 @@ window.qBittorrent.Cache ??= (() => {
|
||||||
class QbtVersionCache {
|
class QbtVersionCache {
|
||||||
#m_store = "";
|
#m_store = "";
|
||||||
|
|
||||||
async init() {
|
init() {
|
||||||
return fetch("api/v2/app/version", {
|
return fetch("api/v2/app/version", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
cache: "no-store"
|
cache: "no-store"
|
||||||
|
|
|
@ -1818,5 +1818,5 @@ window.addEventListener("load", async () => {
|
||||||
console.error(`Unexpected 'selected_window_tab' value: ${previouslyUsedTab}`);
|
console.error(`Unexpected 'selected_window_tab' value: ${previouslyUsedTab}`);
|
||||||
document.getElementById("transfersTabLink").click();
|
document.getElementById("transfersTabLink").click();
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -292,7 +292,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
this.options.actions[action](element, this, action);
|
this.options.actions[action](element, this, action);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
class FilterListContextMenu extends ContextMenu {
|
class FilterListContextMenu extends ContextMenu {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
@ -316,7 +316,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
.setEnabled("stopTorrents", torrentsVisible)
|
.setEnabled("stopTorrents", torrentsVisible)
|
||||||
.setEnabled("deleteTorrents", torrentsVisible);
|
.setEnabled("deleteTorrents", torrentsVisible);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
class TorrentsTableContextMenu extends ContextMenu {
|
class TorrentsTableContextMenu extends ContextMenu {
|
||||||
updateMenuItems() {
|
updateMenuItems() {
|
||||||
|
@ -577,13 +577,13 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
contextTagList.appendChild(setTagItem);
|
contextTagList.appendChild(setTagItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
class StatusesFilterContextMenu extends FilterListContextMenu {
|
class StatusesFilterContextMenu extends FilterListContextMenu {
|
||||||
updateMenuItems() {
|
updateMenuItems() {
|
||||||
this.updateTorrentActions();
|
this.updateTorrentActions();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
class CategoriesFilterContextMenu extends FilterListContextMenu {
|
class CategoriesFilterContextMenu extends FilterListContextMenu {
|
||||||
updateMenuItems() {
|
updateMenuItems() {
|
||||||
|
@ -604,7 +604,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
|
|
||||||
this.updateTorrentActions();
|
this.updateTorrentActions();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
class TagsFilterContextMenu extends FilterListContextMenu {
|
class TagsFilterContextMenu extends FilterListContextMenu {
|
||||||
updateMenuItems() {
|
updateMenuItems() {
|
||||||
|
@ -616,7 +616,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
|
|
||||||
this.updateTorrentActions();
|
this.updateTorrentActions();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
class TrackersFilterContextMenu extends FilterListContextMenu {
|
class TrackersFilterContextMenu extends FilterListContextMenu {
|
||||||
updateMenuItems() {
|
updateMenuItems() {
|
||||||
|
@ -628,7 +628,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
|
|
||||||
this.updateTorrentActions();
|
this.updateTorrentActions();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
class SearchPluginsTableContextMenu extends ContextMenu {
|
class SearchPluginsTableContextMenu extends ContextMenu {
|
||||||
updateMenuItems() {
|
updateMenuItems() {
|
||||||
|
@ -642,7 +642,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
|
|
||||||
this.showItem("Uninstall");
|
this.showItem("Uninstall");
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
class RssFeedContextMenu extends ContextMenu {
|
class RssFeedContextMenu extends ContextMenu {
|
||||||
updateMenuItems() {
|
updateMenuItems() {
|
||||||
|
@ -715,9 +715,9 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
class RssArticleContextMenu extends ContextMenu {};
|
class RssArticleContextMenu extends ContextMenu {}
|
||||||
|
|
||||||
class RssDownloaderRuleContextMenu extends ContextMenu {
|
class RssDownloaderRuleContextMenu extends ContextMenu {
|
||||||
adjustMenuPosition(e) {
|
adjustMenuPosition(e) {
|
||||||
|
@ -765,7 +765,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -2858,7 +2858,6 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
|
|
||||||
// progress
|
// progress
|
||||||
this.columns["progress"].updateTd = function(td, row) {
|
this.columns["progress"].updateTd = function(td, row) {
|
||||||
const id = row.rowId;
|
|
||||||
const value = Number(this.getRowValue(row));
|
const value = Number(this.getRowValue(row));
|
||||||
|
|
||||||
const progressBar = td.firstElementChild;
|
const progressBar = td.firstElementChild;
|
||||||
|
@ -3128,7 +3127,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
img.height = "22";
|
img.height = "22";
|
||||||
td.append(img);
|
td.append(img);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
newColumn: function(name, style, caption, defaultWidth, defaultVisible) {
|
newColumn: function(name, style, caption, defaultWidth, defaultVisible) {
|
||||||
const column = {};
|
const column = {};
|
||||||
|
|
|
@ -61,7 +61,7 @@ window.qBittorrent.LocalPreferences ??= (() => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -85,7 +85,7 @@ window.qBittorrent.pathAutofill ??= (() => {
|
||||||
input.addEventListener("input", function() { showPathSuggestions(this, "all"); });
|
input.addEventListener("input", function() { showPathSuggestions(this, "all"); });
|
||||||
input.classList.add("pathAutoFillInitialized");
|
input.classList.add("pathAutoFillInitialized");
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -22,7 +22,7 @@ window.qBittorrent.MultiRename ??= (() => {
|
||||||
|
|
||||||
// Search Options
|
// Search Options
|
||||||
_inner_search: "",
|
_inner_search: "",
|
||||||
setSearch(val) {
|
setSearch: function(val) {
|
||||||
this._inner_search = val;
|
this._inner_search = val;
|
||||||
this._inner_update();
|
this._inner_update();
|
||||||
this.onChanged(this.matchedFiles);
|
this.onChanged(this.matchedFiles);
|
||||||
|
@ -33,7 +33,7 @@ window.qBittorrent.MultiRename ??= (() => {
|
||||||
|
|
||||||
// Replacement Options
|
// Replacement Options
|
||||||
_inner_replacement: "",
|
_inner_replacement: "",
|
||||||
setReplacement(val) {
|
setReplacement: function(val) {
|
||||||
this._inner_replacement = val;
|
this._inner_replacement = val;
|
||||||
this._inner_update();
|
this._inner_update();
|
||||||
this.onChanged(this.matchedFiles);
|
this.onChanged(this.matchedFiles);
|
||||||
|
|
|
@ -603,7 +603,7 @@ window.qBittorrent.Search ??= (() => {
|
||||||
option.value = category.id;
|
option.value = category.id;
|
||||||
option.textContent = category.name;
|
option.textContent = category.name;
|
||||||
categoryOptions.push(option);
|
categoryOptions.push(option);
|
||||||
};
|
}
|
||||||
|
|
||||||
// first category is "All Categories"
|
// first category is "All Categories"
|
||||||
if (categoryOptions.length > 1) {
|
if (categoryOptions.length > 1) {
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue
|
inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(async (response) => {
|
.then((response) => {
|
||||||
if (!response.ok)
|
if (!response.ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1891,7 +1891,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
case "other":
|
case "other":
|
||||||
other = document.getElementById(`cb_watch_txt_${i}`).value.trim();
|
other = document.getElementById(`cb_watch_txt_${i}`).value.trim();
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
folders[fpath] = other;
|
folders[fpath] = other;
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,7 @@
|
||||||
if ((row.full_data.dataPath.slice(0, selectedPath.length) === selectedPath) && (row.full_data.dataUid !== ""))
|
if ((row.full_data.dataPath.slice(0, selectedPath.length) === selectedPath) && (row.full_data.dataUid !== ""))
|
||||||
feedsToUpdate.add(row);
|
feedsToUpdate.add(row);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
feedsToUpdate.forEach((feed) => refreshFeed(feed.full_data.dataUid));
|
feedsToUpdate.forEach((feed) => refreshFeed(feed.full_data.dataUid));
|
||||||
},
|
},
|
||||||
markRead: markSelectedAsRead,
|
markRead: markSelectedAsRead,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue