Skip to content

Commit

Permalink
eslint: revert $.extend autofixes (#2107)
Browse files Browse the repository at this point in the history
Manual revert. Partial revert.

There's an upstream bug in the autofix ( wikimedia/eslint-plugin-no-jquery#343 ). I don't want to take any chances.

Fixes #2106
  • Loading branch information
NovemLinguae authored Dec 7, 2024
1 parent 6994d0b commit db0bcb7
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"new-cap": "warn",
"no-jquery/no-constructor-attributes": "warn",
"no-jquery/no-each-util": "warn",
"no-jquery/no-extend": "warn",
"no-jquery/no-grep": "warn",
"no-jquery/no-in-array": "warn",
"no-jquery/no-map-util": "warn",
Expand Down
4 changes: 2 additions & 2 deletions modules/twinklebatchdelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ Twinkle.batchdelete.callbacks = {
unlinker.setPageList(pages);
unlinker.run((pageName) => {
const wikipedia_page = new Morebits.wiki.Page(pageName, 'Unlinking on ' + pageName);
const params = Object.assign({}, apiobj.params);
const params = $.extend({}, apiobj.params);
params.title = pageName;
params.unlinker = unlinker;
wikipedia_page.setCallbackParameters(params);
Expand Down Expand Up @@ -648,7 +648,7 @@ Twinkle.batchdelete.callbacks = {
unlinker.setPageList(pages);
unlinker.run((pageName) => {
const wikipedia_page = new Morebits.wiki.Page(pageName, 'Removing file usages on ' + pageName);
const params = Object.assign({}, apiobj.params);
const params = $.extend({}, apiobj.params);
params.title = pageName;
params.unlinker = unlinker;
wikipedia_page.setCallbackParameters(params);
Expand Down
2 changes: 1 addition & 1 deletion modules/twinklebatchprotect.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ Twinkle.batchprotect.callback.evaluate = function twinklebatchprotectCallbackEva
};
const wikipedia_api = new Morebits.wiki.Api('Checking if page ' + pageName + ' exists', query,
Twinkle.batchprotect.callbacks.main, null, batchOperation.workerFailure);
wikipedia_api.params = Object.assign({
wikipedia_api.params = $.extend({
page: pageName,
batchOperation: batchOperation
}, input);
Expand Down
4 changes: 2 additions & 2 deletions modules/twinkleblock.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(function() {

let api = new mw.Api(), relevantUserName, blockedUserName;
const menuFormattedNamespaces = Object.assign({}, mw.config.get('wgFormattedNamespaces'));
const menuFormattedNamespaces = $.extend({}, mw.config.get('wgFormattedNamespaces'));
menuFormattedNamespaces[0] = '(Article)';

/*
Expand Down Expand Up @@ -1899,7 +1899,7 @@ Twinkle.block.callback.issue_template = function twinkleblockCallbackIssueTempla
// "talk page" of an IP range (which does not exist)
const userTalkPage = 'User_talk:' + mw.config.get('wgRelevantUserName');

const params = Object.assign(formData || {}, {
const params = $.extend(formData, {
messageData: Twinkle.block.blockPresetsInfo[formData.template],
reason: Twinkle.block.field_template_options.block_reason,
disabletalk: Twinkle.block.field_template_options.notalk,
Expand Down
2 changes: 1 addition & 1 deletion modules/twinkleimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Twinkle.image.callback.evaluate = function twinkleimageCallbackEvaluate(event) {
const lognomination = Twinkle.getPref('logSpeedyNominations') && Twinkle.getPref('noLogOnSpeedyNomination').indexOf(csdcrit.toLowerCase()) === -1;
const templatename = input.derivative ? 'dw ' + input.type : input.type;

const params = Object.assign({
const params = $.extend({
templatename: templatename,
normalized: csdcrit,
lognomination: lognomination
Expand Down
4 changes: 2 additions & 2 deletions modules/twinklespeedy.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ Twinkle.speedy.generateCsdList = function twinklespeedyGenerateCsdList(list, mod
};

return $.map(list, (critElement) => {
const criterion = Object.assign({}, critElement);
const criterion = $.extend({}, critElement);

if (mode.isMultiple) {
if (criterion.hideWhenMultiple) {
Expand Down Expand Up @@ -1068,7 +1068,7 @@ Twinkle.speedy.callbacks = {
code += '|' + i + '=' + parameters[i];
}
}
Object.assign(params.utparams, Twinkle.speedy.getUserTalkParameters(norm, parameters));
$.extend(params.utparams, Twinkle.speedy.getUserTalkParameters(norm, parameters));
});
code += '}}';
} else {
Expand Down
2 changes: 1 addition & 1 deletion modules/twinkleunlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Twinkle.unlink.callback.evaluate = function twinkleunlinkCallbackEvaluate(event)
unlinker.run((pageName) => {
const wikipedia_page = new Morebits.wiki.Page(pageName, 'Unlinking in page "' + pageName + '"');
wikipedia_page.setBotEdit(true); // unlink considered a floody operation
wikipedia_page.setCallbackParameters(Object.assign({
wikipedia_page.setCallbackParameters($.extend({
doBacklinks: input.backlinks.indexOf(pageName) !== -1,
doImageusage: input.imageusage.indexOf(pageName) !== -1
}, params));
Expand Down
6 changes: 3 additions & 3 deletions modules/twinklewarn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ Twinkle.warn.getTemplateProperty = function(templates, templateName, propertyNam
const level = isNumberedTemplate[0];
const numberedWarnings = {};
$.each(templates.levels, (key, val) => {
Object.assign(numberedWarnings, val);
$.extend(numberedWarnings, val);
});
$.each(numberedWarnings, (key) => {
if (key === unNumberedTemplateName) {
Expand All @@ -1376,7 +1376,7 @@ Twinkle.warn.getTemplateProperty = function(templates, templateName, propertyNam
const otherWarnings = {};
$.each(templates, (key, val) => {
if (key !== 'levels') {
Object.assign(otherWarnings, val);
$.extend(otherWarnings, val);
}
});
$.each(otherWarnings, (key) => {
Expand Down Expand Up @@ -1469,7 +1469,7 @@ Twinkle.warn.callback.change_category = function twinklewarnCallbackChangeCatego
createEntries(Twinkle.warn.messages[value], sub_group, true);
break;
case 'singlecombined':
var unSortedSinglets = Object.assign({}, Twinkle.warn.messages.singlenotice, Twinkle.warn.messages.singlewarn);
var unSortedSinglets = $.extend({}, Twinkle.warn.messages.singlenotice, Twinkle.warn.messages.singlewarn);
var sortedSingletMessages = {};
Object.keys(unSortedSinglets).sort().forEach((key) => {
sortedSingletMessages[key] = unSortedSinglets[key];
Expand Down
2 changes: 1 addition & 1 deletion modules/twinklexfd.js
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ Twinkle.xfd.callbacks = {

// Tag other template/module
wikipedia_otherpage.setFollowRedirect(true);
const otherParams = Object.assign({}, params);
const otherParams = $.extend({}, params);
otherParams.otherTemplateName = Morebits.pageNameNorm;
wikipedia_otherpage.setCallbackParameters(otherParams);
wikipedia_otherpage.load(Twinkle.xfd.callbacks.tfd.taggingTemplateForMerge);
Expand Down
6 changes: 3 additions & 3 deletions morebits.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ Morebits.quickForm.element.prototype.compute = function QuickFormElementCompute(
id: id + '_' + i + '_subgroup'
});
$.each(tmpgroup, (idx, el) => {
const newEl = Object.assign({}, el);
const newEl = $.extend({}, el);
if (!newEl.type) {
newEl.type = data.type;
}
Expand Down Expand Up @@ -758,7 +758,7 @@ Morebits.quickForm.element.prototype.compute = function QuickFormElementCompute(
node = document.createElement('div');

data.inputs.forEach((subdata) => {
const cell = new Morebits.quickForm.element(Object.assign(subdata || {}, { type: '_dyninput_cell' }));
const cell = new Morebits.quickForm.element($.extend(subdata, { type: '_dyninput_cell' }));
node.appendChild(cell.render());
});
if (data.remove) {
Expand Down Expand Up @@ -2363,7 +2363,7 @@ Morebits.wiki.api.prototype = {
}).join('&').replace(/^(.*?)(\btoken=[^&]*)&(.*)/, '$1$3&$2');
// token should always be the last item in the query string (bug TW-B-0013)

const ajaxparams = Object.assign({}, {
const ajaxparams = $.extend({}, {
context: this,
type: this.query.action === 'query' ? 'GET' : 'POST',
url: mw.util.wikiScript('api'),
Expand Down
2 changes: 1 addition & 1 deletion twinkle.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ $.ajax({
const options = JSON.parse(optionsText);
if (options) {
if (options.twinkle || options.friendly) { // Old preferences format
Twinkle.prefs = Object.assign(options.twinkle || {}, options.friendly);
Twinkle.prefs = $.extend(options.twinkle, options.friendly);
} else {
Twinkle.prefs = options;
}
Expand Down

0 comments on commit db0bcb7

Please sign in to comment.