Skip to content

Commit e7d4c6c

Browse files
authored
fix some no-jquery/no-extend autofixes (#2088)
* revert some no-jquery/no-extend autofixes Upstream, they caught a bug in the autofix algorithm. Basically, you should only change $.extend() to Object.assign() if you're sure the first argument isn't null or undefined. Else it will throw. This patch changes a couple back to $.extend, out of an abundance of caution. wikimedia/eslint-plugin-no-jquery@35d4489 Partial revert of #2079 * instead of reverting, add `|| {}`
1 parent d45aaac commit e7d4c6c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

modules/twinkleblock.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ Twinkle.block.callback.issue_template = function twinkleblockCallbackIssueTempla
18991899
// "talk page" of an IP range (which does not exist)
19001900
const userTalkPage = 'User_talk:' + mw.config.get('wgRelevantUserName');
19011901

1902-
const params = Object.assign(formData, {
1902+
const params = Object.assign(formData || {}, {
19031903
messageData: Twinkle.block.blockPresetsInfo[formData.template],
19041904
reason: Twinkle.block.field_template_options.block_reason,
19051905
disabletalk: Twinkle.block.field_template_options.notalk,

morebits.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ Morebits.quickForm.element.prototype.compute = function QuickFormElementCompute(
758758
node = document.createElement('div');
759759

760760
data.inputs.forEach((subdata) => {
761-
const cell = new Morebits.quickForm.element(Object.assign(subdata, { type: '_dyninput_cell' }));
761+
const cell = new Morebits.quickForm.element(Object.assign(subdata || {}, { type: '_dyninput_cell' }));
762762
node.appendChild(cell.render());
763763
});
764764
if (data.remove) {

twinkle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ $.ajax({
337337
const options = JSON.parse(optionsText);
338338
if (options) {
339339
if (options.twinkle || options.friendly) { // Old preferences format
340-
Twinkle.prefs = Object.assign(options.twinkle, options.friendly);
340+
Twinkle.prefs = Object.assign(options.twinkle || {}, options.friendly);
341341
} else {
342342
Twinkle.prefs = options;
343343
}

0 commit comments

Comments
 (0)