ESLint: Replace some lets with consts by moving declarations

Change-Id: I710bff5fe04268172a40af75eb6ff5910eaf0255
This commit is contained in:
Ed Sanders 2024-05-24 13:33:02 +01:00
parent dda9227947
commit 44303de9cf
3 changed files with 5 additions and 8 deletions

View file

@ -1105,9 +1105,8 @@ Parser.prototype.buildThreads = function ( result ) {
let lastHeading = null;
const replies = [];
let i, threadItem;
for ( i = 0; i < result.threadItems.length; i++ ) {
threadItem = result.threadItems[ i ];
for ( let i = 0; i < result.threadItems.length; i++ ) {
const threadItem = result.threadItems[ i ];
if ( replies.length < threadItem.level ) {
// Someone skipped an indentation level (or several). Pretend that the previous reply

View file

@ -40,13 +40,12 @@ DmMWPingNode.static.matchFunction = function () {
DmMWPingNode.static.disallowedAnnotationTypes = [ 'link' ];
DmMWPingNode.static.toDomElements = function ( dataElement, doc, converter ) {
let domElements,
prefix = mw.msg( 'discussiontools-replywidget-mention-prefix' ),
const prefix = mw.msg( 'discussiontools-replywidget-mention-prefix' ),
suffix = mw.msg( 'discussiontools-replywidget-mention-suffix' ),
title = mw.Title.makeTitle( mw.config.get( 'wgNamespaceIds' ).user, dataElement.attributes.user );
dataElement = ve.dm.MWInternalLinkAnnotation.static.dataElementFromTitle( title );
domElements = ve.dm.MWInternalLinkAnnotation.static.toDomElements( dataElement, doc, converter );
const domElements = ve.dm.MWInternalLinkAnnotation.static.toDomElements( dataElement, doc, converter );
domElements[ 0 ].appendChild(
doc.createTextNode( title.getMainText() )
);

View file

@ -1,8 +1,7 @@
// Adapted from ve.ui.MWWikitextDataTransferHandlerFactory
function importRegistry( parent, child ) {
let name;
// Copy existing items
for ( name in parent.registry ) {
for ( const name in parent.registry ) {
child.register( parent.registry[ name ] );
}
// Copy any new items when they're added