Skip to content

Commit 79e0975

Browse files
committed
eslint: fix no-jquery/no-constructor-attributes
manual fixes
1 parent e7d4c6c commit 79e0975

File tree

4 files changed

+59
-62
lines changed

4 files changed

+59
-62
lines changed

Diff for: .eslintrc.json

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"es-x/no-object-values": "warn",
4747
"mediawiki/class-doc": "warn",
4848
"new-cap": "warn",
49-
"no-jquery/no-constructor-attributes": "warn",
5049
"no-jquery/no-each-util": "warn",
5150
"no-jquery/no-grep": "warn",
5251
"no-jquery/no-in-array": "warn",

Diff for: modules/twinklearv.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -369,18 +369,19 @@ Twinkle.arv.callback.changeCategory = function (e) {
369369
const pageid = data.query.pageids[0];
370370
const page = data.query.pages[pageid];
371371
if (!page.revisions) {
372-
$('<span class="entry">None found</span>').appendTo($field);
372+
$('<span>')
373+
.addClass('entry')
374+
.html('None found')
375+
.appendTo($field);
373376
} else {
374377
for (let i = 0; i < page.revisions.length; ++i) {
375378
const rev = page.revisions[i];
376-
const $entry = $('<div>', {
377-
class: 'entry'
378-
});
379-
const $input = $('<input>', {
380-
type: 'checkbox',
381-
name: 's_' + field,
382-
value: rev.revid
383-
});
379+
const $entry = $('<div>')
380+
.addClass('entry');
381+
const $input = $('<input>')
382+
.attr('type', 'checkbox')
383+
.attr('name', 's_' + field)
384+
.attr('value', rev.revid);
384385
$input.data('revinfo', rev);
385386
$input.appendTo($entry);
386387
let comment = '<span>';
@@ -397,22 +398,21 @@ Twinkle.arv.callback.changeCategory = function (e) {
397398

398399
// add free form input for resolves
399400
if (field === 'resolves') {
400-
const $free_entry = $('<div>', {
401-
class: 'entry'
402-
});
403-
const $free_input = $('<input>', {
404-
type: 'text',
405-
name: 's_resolves_free'
406-
});
407-
408-
const $free_label = $('<label>', {
409-
for: 's_resolves_free',
410-
html: 'URL link of diff with additional discussions: '
411-
});
401+
const $free_entry = $('<div>')
402+
.addClass('entry');
403+
const $free_input = $('<input>')
404+
.attr('type', 'text')
405+
.attr('name', 's_resolves_free');
406+
const $free_label = $('<label>')
407+
.attr('for', 's_resolves_free')
408+
.html('URL link of diff with additional discussions: ');
412409
$free_entry.append($free_label).append($free_input).appendTo($field);
413410
}
414411
}).fail(() => {
415-
$('<span class="entry">API failure, reload page and try again</span>').appendTo($field);
412+
$('<span>')
413+
.addClass('entry')
414+
.html('API failure, reload page and try again')
415+
.appendTo($field);
416416
});
417417
};
418418

Diff for: modules/twinklespeedy.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -1285,36 +1285,36 @@ Twinkle.speedy.callbacks = {
12851285
// promote Unlink tool
12861286
let $link, $bigtext;
12871287
if (mw.config.get('wgNamespaceNumber') === 6 && params.normalized !== 'f8') {
1288-
$link = $('<a>', {
1289-
href: '#',
1290-
text: 'click here to go to the Unlink tool',
1291-
css: { fontSize: '130%', fontWeight: 'bold' },
1292-
click: function() {
1288+
$link = $('<a>')
1289+
.attr('href', '#')
1290+
.text('click here to go to the Unlink tool')
1291+
.css('fontSize', '130%')
1292+
.css('fontWeight', 'bold')
1293+
.on('click', () => {
12931294
Morebits.wiki.actionCompleted.redirect = null;
12941295
Twinkle.speedy.dialog.close();
12951296
Twinkle.unlink.callback('Removing usages of and/or links to deleted file ' + Morebits.pageNameNorm);
1296-
}
1297-
});
1298-
$bigtext = $('<span>', {
1299-
text: 'To orphan backlinks and remove instances of file usage',
1300-
css: { fontSize: '130%', fontWeight: 'bold' }
1301-
});
1297+
});
1298+
$bigtext = $('<span>')
1299+
.text('To orphan backlinks and remove instances of file usage')
1300+
.css('fontSize', '130%')
1301+
.css('fontWeight', 'bold');
13021302
Morebits.Status.info($bigtext[0], $link[0]);
13031303
} else if (params.normalized !== 'f8') {
1304-
$link = $('<a>', {
1305-
href: '#',
1306-
text: 'click here to go to the Unlink tool',
1307-
css: { fontSize: '130%', fontWeight: 'bold' },
1308-
click: function() {
1304+
$link = $('<a>')
1305+
.attr('href', '#')
1306+
.text('click here to go to the Unlink tool')
1307+
.css('fontSize', '130%')
1308+
.css('fontWeight', 'bold')
1309+
.on('click', () => {
13091310
Morebits.wiki.actionCompleted.redirect = null;
13101311
Twinkle.speedy.dialog.close();
13111312
Twinkle.unlink.callback('Removing links to deleted page ' + Morebits.pageNameNorm);
1312-
}
1313-
});
1314-
$bigtext = $('<span>', {
1315-
text: 'To orphan backlinks',
1316-
css: { fontSize: '130%', fontWeight: 'bold' }
1317-
});
1313+
} );
1314+
$bigtext = $('<span>')
1315+
.text('To orphan backlinks')
1316+
.css('fontSize', '130%')
1317+
.css('fontWeight', 'bold');
13181318
Morebits.Status.info($bigtext[0], $link[0]);
13191319
}
13201320
},

Diff for: modules/twinklewarn.js

+15-17
Original file line numberDiff line numberDiff line change
@@ -1534,11 +1534,10 @@ Twinkle.warn.callback.change_category = function twinklewarnCallbackChangeCatego
15341534
// Catch and warn if the talkpage can't load,
15351535
// most likely because it's a cross-namespace redirect
15361536
// Supersedes the typical $autolevelMessage added in autolevelParseWikitext
1537-
const $noTalkPageNode = $('<strong>', {
1538-
text: 'Unable to load user talk page; it might be a cross-namespace redirect. Autolevel detection will not work.',
1539-
id: 'twinkle-warn-autolevel-message',
1540-
css: {color: 'red' }
1541-
});
1537+
const $noTalkPageNode = $('<strong>')
1538+
.text('Unable to load user talk page; it might be a cross-namespace redirect. Autolevel detection will not work.')
1539+
.attr('id', 'twinkle-warn-autolevel-message')
1540+
.css('color', 'red');
15421541
$noTalkPageNode.insertBefore($('#twinkle-warn-warning-messages'));
15431542
// If a preview was opened while in a different mode, close it
15441543
// Should nullify the need to catch the error in preview callback
@@ -1808,7 +1807,8 @@ Twinkle.warn.callbacks = {
18081807
}
18091808
}
18101809

1811-
const $autolevelMessage = $('<div>', {id: 'twinkle-warn-autolevel-message'});
1810+
const $autolevelMessage = $('<div>')
1811+
.attr('id', 'twinkle-warn-autolevel-message');
18121812

18131813
if (isNaN(level)) { // No prior warnings found, this is the first
18141814
level = 1;
@@ -1829,22 +1829,20 @@ Twinkle.warn.callbacks = {
18291829
// Basically indicates whether we're in the final Main evaluation or not,
18301830
// and thus whether we can continue or need to display the warning and link
18311831
if (!statelem) {
1832-
const $link = $('<a>', {
1833-
href: '#',
1834-
text: 'click here to open the ARV tool.',
1835-
css: { fontWeight: 'bold' },
1836-
click: function() {
1832+
const $link = $('<a>')
1833+
.attr('href', '#')
1834+
.text('click here to open the ARV tool.')
1835+
.css('fontWeight', 'bold')
1836+
.on('click', () => {
18371837
Morebits.wiki.actionCompleted.redirect = null;
18381838
Twinkle.warn.dialog.close();
18391839
Twinkle.arv.callback(mw.config.get('wgRelevantUserName'));
18401840
$('input[name=page]').val(params.article); // Target page
18411841
$('input[value=final]').prop('checked', true); // Vandalism after final
1842-
}
1843-
});
1844-
const $statusNode = $('<div>', {
1845-
text: mw.config.get('wgRelevantUserName') + ' recently received a level 4 warning (' + latest.type + ') so it might be better to report them instead; ',
1846-
css: {color: 'red' }
1847-
});
1842+
});
1843+
const $statusNode = $('<div>')
1844+
.text(mw.config.get('wgRelevantUserName') + ' recently received a level 4 warning (' + latest.type + ') so it might be better to report them instead; ')
1845+
.css('color', 'red');
18481846
$statusNode.append($link[0]);
18491847
$autolevelMessage.append($statusNode);
18501848
}

0 commit comments

Comments
 (0)