Skip to content

Commit

Permalink
chore: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
lovelyCARDINAL committed Apr 8, 2024
1 parent 4140d2d commit e1e15bf
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 29 deletions.
3 changes: 1 addition & 2 deletions src/gadgets/HotCat/MediaWiki:Gadget-HotCat.js
@@ -1,4 +1,4 @@
/* eslint-disable prefer-arrow-functions/prefer-arrow-functions, require-atomic-updates, no-use-before-define, camelcase */
/* eslint-disable no-unused-vars, prefer-arrow-functions/prefer-arrow-functions, require-atomic-updates, no-use-before-define, camelcase */
/**
* @source https://commons.wikimedia.org/wiki/_?oldid=818790002
* 更新后请同步更新上面链接到最新版本
Expand Down Expand Up @@ -2730,7 +2730,6 @@ window.hotcat_translations_from_commons = false; // 禁止从维基共享获取
}
return catTitle;
}
// eslint-disable-next-line no-unused-vars
function isOnPage(span) {
const catTitle = getTitle(span);
const result = {
Expand Down
Expand Up @@ -106,7 +106,7 @@
if (value.startsWith(`${type}|`)) {
try {
return decode(value.replace(`${type}|`, ""));
} catch (e) {
} catch (_e) {
console.error(`LocalObjectStorage can's transform value of key "${key}" to type "${type}" and skip...`);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gadgets/Navigation_popups/MediaWiki:Gadget-popups.js
@@ -1,4 +1,4 @@
/* eslint-disable prefer-arrow-functions/prefer-arrow-functions, no-use-before-define, camelcase */
/* eslint-disable no-unused-vars, prefer-arrow-functions/prefer-arrow-functions, no-use-before-define, camelcase */
/**
* @source https://en.wikipedia.org/wiki/_?oldid=1151460389
* 更新后请同步更新上面链接到最新版本
Expand Down
7 changes: 4 additions & 3 deletions src/gadgets/patrolCount/MediaWiki:Gadget-patrolCount.js
Expand Up @@ -55,7 +55,7 @@ $(() => {
if (plus) {
strCount += "+";
}
let title = page.title;
let { title } = page;
if (!page.confidence) {
title += '" class="patrollListNotConfident';
}
Expand Down Expand Up @@ -86,7 +86,7 @@ $(() => {
}
}
};
const length = pages.length;
const { length } = pages;
if (length > countMax && !showAll) {
addItem(0, countMax);
let $showAll = $("#patrollListShowAll");
Expand Down Expand Up @@ -309,7 +309,7 @@ $(() => {
const checkMissing = function (pages, plus) {
const missingQuery = [];
for (let idx = 0; idx < pages.length; ++idx) {
const title = pages[idx].title;
const { title } = pages[idx];
if (typeof title === "undefined") {
continue;
}
Expand Down Expand Up @@ -372,6 +372,7 @@ $(() => {
const uri = `${apiPrefix}?format=xml&action=patrol`;
$patrollinks.text("Marking as patrolled...");
$patrollinks = $patrollinks.parent();
// eslint-disable-next-line no-unused-vars
$.post(uri, data, (data, status) => {
// window.data = [data, status, request]; // DEBUG
if (status === "success") {
Expand Down
22 changes: 1 addition & 21 deletions src/gadgets/patrolPlus/MediaWiki:Gadget-patrolPlus.js
Expand Up @@ -9,31 +9,11 @@ $(() => {
let running = false;
const list = [];

const handlePatroll = async (title, _revid) => await api.postWithToken("patrol", {
const handlePatroll = async (_title, _revid) => await api.postWithToken("patrol", {
action: "patrol",
assertuser: mw.config.get("wgUserName"),
format: "json",
revid: _revid,
/* 在L57中更改了获取revid的方式,这段理论上应该不用了
revid: await (async () => {
if (typeof _revid !== "number") {
const data = await api.post({
action: "query",
assertuser: mw.config.get("wgUserName"),
prop: "revisions",
rvprop: "ids",
rvlimit: 1,
rvdir: "newer",
titles: title,
});
if (Reflect.has(data, "error")) {
throw data.error;
}
return Object.entries(data.query.pages)[0][1].revisions[0].revid;
}
return _revid;
})(),
*/
});
const sleep = (t) => new Promise((res) => setTimeout(res, t));
$("abbr.unpatrolled").each((_, ele) => {
Expand Down
2 changes: 1 addition & 1 deletion src/global/commons/MediaWiki:Common.js
Expand Up @@ -108,7 +108,7 @@
if (href) {
$(this).after(`<sub>[<a target="_blank" title="主站上的用户 ${href.replace(/user(_talk)?:/i, "")}" href="${mw.config.get("wgServer").replace("commons.moegirl", "zh.moegirl")}${mw.config.get("wgScriptPath")}/${href}">主</a>]</sub>`);
}
} catch (e) {
} catch (_e) {
return;
}
});
Expand Down

0 comments on commit e1e15bf

Please sign in to comment.