Skip to content

Commit

Permalink
fix linter error no-jquery/variable-pattern (#2081)
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae authored Nov 27, 2024
1 parent 001f236 commit b487aeb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"no-jquery/no-map-util": "warn",
"no-jquery/no-parse-html-literal": "warn",
"no-jquery/no-sizzle": "warn",
"no-jquery/variable-pattern": "warn",
"no-loop-func": "warn",
"no-new": "warn",
"no-return-assign": "warn",
Expand Down
10 changes: 5 additions & 5 deletions modules/twinklerollback.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,18 @@ Twinkle.rollback.addLinks = {
diff: function() {
// Autofill user talk links on diffs with vanarticle for easy warning, but don't autowarn
const warnFromTalk = function(xtitle) {
const talkLink = $('#mw-diff-' + xtitle + '2 .mw-usertoollinks a').first();
if (talkLink.length) {
const $talkLink = $('#mw-diff-' + xtitle + '2 .mw-usertoollinks a').first();
if ($talkLink.length) {
let extraParams = 'vanarticle=' + mw.util.rawurlencode(Morebits.pageNameNorm) + '&' + 'noautowarn=true';
// diffIDs for vanarticlerevid
extraParams += '&vanarticlerevid=';
extraParams += xtitle === 'otitle' ? mw.config.get('wgDiffOldId') : mw.config.get('wgDiffNewId');

const href = talkLink.attr('href');
const href = $talkLink.attr('href');
if (href.indexOf('?') === -1) {
talkLink.attr('href', href + '?' + extraParams);
$talkLink.attr('href', href + '?' + extraParams);
} else {
talkLink.attr('href', href + '&' + extraParams);
$talkLink.attr('href', href + '&' + extraParams);
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions modules/twinklewarn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1841,12 +1841,12 @@ Twinkle.warn.callbacks = {
$('input[value=final]').prop('checked', true); // Vandalism after final
}
});
const statusNode = $('<div>', {
const $statusNode = $('<div>', {
text: mw.config.get('wgRelevantUserName') + ' recently received a level 4 warning (' + latest.type + ') so it might be better to report them instead; ',
css: {color: 'red' }
});
statusNode.append($link[0]);
$autolevelMessage.append(statusNode);
$statusNode.append($link[0]);
$autolevelMessage.append($statusNode);
}
} else { // Automatically increase severity
level += 1;
Expand Down
24 changes: 12 additions & 12 deletions morebits.js
Original file line number Diff line number Diff line change
Expand Up @@ -1701,14 +1701,14 @@ Morebits.select2 = {
if (ev.which < 48) {
return;
}
let target = $(ev.target).closest('.select2-container');
if (!target.length) {
let $target = $(ev.target).closest('.select2-container');
if (!$target.length) {
return;
}
target = target.prev();
target.select2('open');
const search = target.data('select2').dropdown.$search ||
target.data('select2').selection.$search;
$target = $target.prev();
$target.select2('open');
const search = $target.data('select2').dropdown.$search ||
$target.data('select2').selection.$search;
// Use DOM .focus() to work around a jQuery 3.6.0 regression (https://github.com/select2/select2/issues/5993)
search[0].focus();
}
Expand Down Expand Up @@ -5423,16 +5423,16 @@ Morebits.checkboxShiftClickSupport = function (jQuerySelector, jQueryContext) {
function clickHandler(event) {
const thisCb = this;
if (event.shiftKey && lastCheckbox !== null) {
const cbs = $(jQuerySelector, jQueryContext); // can't cache them, obviously, if we want to support resorting
const $cbs = $(jQuerySelector, jQueryContext); // can't cache them, obviously, if we want to support re-sorting
let index = -1, lastIndex = -1, i;
for (i = 0; i < cbs.length; i++) {
if (cbs[i] === thisCb) {
for (i = 0; i < $cbs.length; i++) {
if ($cbs[i] === thisCb) {
index = i;
if (lastIndex > -1) {
break;
}
}
if (cbs[i] === lastCheckbox) {
if ($cbs[i] === lastCheckbox) {
lastIndex = i;
if (index > -1) {
break;
Expand All @@ -5453,8 +5453,8 @@ Morebits.checkboxShiftClickSupport = function (jQuerySelector, jQueryContext) {
}

for (i = start; i <= finish; i++) {
if (cbs[i].checked !== endState) {
cbs[i].click();
if ($cbs[i].checked !== endState) {
$cbs[i].click();
}
}
}
Expand Down

0 comments on commit b487aeb

Please sign in to comment.