From dda92279471bd153cb17d3bc06a51d84d1eed702 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Fri, 24 May 2024 13:31:30 +0100 Subject: [PATCH] ESLint: Manually fix remaining no-var violations Change-Id: I4474bd0205e7a1ed8e60147e52675e3e0b93ccd9 --- modules/.eslintrc.json | 1 - modules/CommentController.js | 2 +- modules/CommentItem.js | 2 +- modules/HeadingItem.js | 4 ++-- modules/NewTopicController.js | 2 +- modules/Parser.js | 24 +++++++++---------- modules/ReplyLinksController.js | 4 ++-- modules/ThreadItem.js | 12 ++++++---- modules/ThreadItemSet.js | 6 ++--- modules/controller.js | 16 ++++++------- modules/debughighlighter.js | 6 ++--- modules/dt-ve/CommentTarget.js | 2 +- .../dt-ve/dt.ui.UsernameCompletionAction.js | 8 +++---- modules/dt-ve/dt.ui.registries.js | 10 ++++---- modules/dt.debug.js | 2 +- modules/dt.init.js | 10 ++++---- modules/dt.ui.ReplyWidget.js | 2 +- modules/dt.ui.ReplyWidgetPlain.js | 2 +- modules/dt.ui.ReplyWidgetVisual.js | 2 +- modules/highlighter.js | 6 ++--- modules/mobile.js | 10 ++++---- modules/modifier.js | 4 ++-- modules/topicsubscriptions.js | 8 +++---- modules/utils.js | 6 ++--- tests/qunit/ThreadItem.test.js | 2 +- tests/qunit/modifier.test.js | 2 +- tests/qunit/parser.test.js | 2 +- tests/qunit/testUtils.js | 2 +- tests/qunit/utils.test.js | 2 +- 29 files changed, 80 insertions(+), 81 deletions(-) diff --git a/modules/.eslintrc.json b/modules/.eslintrc.json index adf034733..7c9627ad0 100644 --- a/modules/.eslintrc.json +++ b/modules/.eslintrc.json @@ -11,7 +11,6 @@ }, "rules": { "no-implicit-globals": "off", - "no-var": "off", "prefer-const": "off", "max-len": "off", "prefer-arrow-callback": "error", diff --git a/modules/CommentController.js b/modules/CommentController.js index f5384509c..6babc2cb1 100644 --- a/modules/CommentController.js +++ b/modules/CommentController.js @@ -1,4 +1,4 @@ -var +const controller = require( './controller.js' ), modifier = require( './modifier.js' ), dtConf = require( './config.json' ), diff --git a/modules/CommentItem.js b/modules/CommentItem.js index 3a135360e..a42e70330 100644 --- a/modules/CommentItem.js +++ b/modules/CommentItem.js @@ -1,4 +1,4 @@ -var ThreadItem = require( './ThreadItem.js' ), +const ThreadItem = require( './ThreadItem.js' ), moment = require( './lib/moment-timezone/moment-timezone-with-data-1970-2030.js' ); /** diff --git a/modules/HeadingItem.js b/modules/HeadingItem.js index eb27ab6dd..6f5a1befb 100644 --- a/modules/HeadingItem.js +++ b/modules/HeadingItem.js @@ -1,6 +1,6 @@ -var ThreadItem = require( './ThreadItem.js' ); +const ThreadItem = require( './ThreadItem.js' ); // Placeholder headings must have a level higher than real headings (1-6) -var PLACEHOLDER_HEADING_LEVEL = 99; +const PLACEHOLDER_HEADING_LEVEL = 99; /** * A heading item diff --git a/modules/NewTopicController.js b/modules/NewTopicController.js index a0ffd06ba..d465e5ec6 100644 --- a/modules/NewTopicController.js +++ b/modules/NewTopicController.js @@ -1,4 +1,4 @@ -var +const CommentController = require( './CommentController.js' ), HeadingItem = require( './HeadingItem.js' ); diff --git a/modules/Parser.js b/modules/Parser.js index c6d0edc0b..ed2ac6bd6 100644 --- a/modules/Parser.js +++ b/modules/Parser.js @@ -1,7 +1,7 @@ 'use strict'; /* global $:off */ -var +const utils = require( './utils.js' ), charAt = require( 'mediawiki.String' ).charAt, codePointLength = require( 'mediawiki.String' ).codePointLength, @@ -30,7 +30,7 @@ function Parser( data ) { * * @constant {number} */ -var SIGNATURE_SCAN_LIMIT = 100; +const SIGNATURE_SCAN_LIMIT = 100; /** * Parse a discussion page. @@ -195,11 +195,12 @@ Parser.prototype.getTimestampRegexp = function ( contLangVariant, format, digits s += '"'; } break; - default: + default: { // Copy whole characters together, instead of single UTF-16 surrogates - var char = charAt( format, p ); + const char = charAt( format, p ); s += mw.util.escapeRegExp( char ); p += char.length - 1; + } } if ( num !== false ) { if ( raw ) { @@ -560,17 +561,16 @@ Parser.prototype.findTimestamp = function ( node, timestampRegexps ) { // have links), so we only concern ourselves with the first match. matchData = nodeText.match( timestampRegexps[ i ] ); if ( matchData ) { - var timestampLength = matchData[ 0 ].length; + const timestampLength = matchData[ 0 ].length; // Bytes at the end of the last node which aren't part of the match const tailLength = nodeText.length - timestampLength - matchData.index; // We are moving right to left, but we start to the right of the end of // the timestamp if there is trailing garbage, so that is a negative offset. - var count = -tailLength; + let count = -tailLength; const endContainer = nodes[ 0 ]; const endOffset = endContainer.nodeValue.length - tailLength; - var startContainer, startOffset; - // eslint-disable-next-line no-loop-func + let startContainer, startOffset; nodes.some( ( n ) => { count += n.nodeValue.length; // If we have counted to beyond the start of the timestamp, we are in the @@ -866,7 +866,7 @@ Parser.prototype.buildThreadItems = function () { let node; while ( ( node = treeWalker.nextNode() ) ) { - var match; + let match; if ( node.tagName && ( match = node.tagName.match( /^h([1-6])$/i ) ) ) { const headingNode = utils.getHeadlineNode( node ); range = { @@ -890,15 +890,15 @@ Parser.prototype.buildThreadItems = function () { continue; } - var sigRanges = []; - var timestampRanges = []; + const sigRanges = []; + const timestampRanges = []; sigRanges.push( adjustSigRange( foundSignature.nodes, match, node ) ); timestampRanges.push( match.range ); // Everything from the last comment up to here is the next comment const startNode = this.nextInterestingLeafNode( curCommentEnd ); - var endNode = foundSignature.nodes[ 0 ]; + let endNode = foundSignature.nodes[ 0 ]; // Skip to the end of the "paragraph". This only looks at tag names and can be fooled by CSS, but // avoiding that would be more difficult and slower. diff --git a/modules/ReplyLinksController.js b/modules/ReplyLinksController.js index 09d93e1e9..097e38224 100644 --- a/modules/ReplyLinksController.js +++ b/modules/ReplyLinksController.js @@ -1,9 +1,9 @@ -var +const // LanguageData::getLocalData() parserData = require( './parser/data.json' ), utils = require( './utils.js' ); -var featuresEnabled = mw.config.get( 'wgDiscussionToolsFeaturesEnabled' ) || {}; +const featuresEnabled = mw.config.get( 'wgDiscussionToolsFeaturesEnabled' ) || {}; function tryInfuse( $element ) { if ( $element.length ) { diff --git a/modules/ThreadItem.js b/modules/ThreadItem.js index 4333e83a9..326a54623 100644 --- a/modules/ThreadItem.js +++ b/modules/ThreadItem.js @@ -1,6 +1,6 @@ /* global moment */ -var utils = require( './utils.js' ); +const utils = require( './utils.js' ); /** * A thread item, either a heading or a comment @@ -65,9 +65,9 @@ ThreadItem.static.newFromJSON = function ( json, rootNode ) { let item; switch ( hash.type ) { - case 'comment': + case 'comment': { // Late require to avoid circular dependency - var CommentItem = require( './CommentItem.js' ); + const CommentItem = require( './CommentItem.js' ); item = new CommentItem( hash.level, hash.range, @@ -82,8 +82,9 @@ ThreadItem.static.newFromJSON = function ( json, rootNode ) { hash.displayName ); break; - case 'heading': - var HeadingItem = require( './HeadingItem.js' ); + } + case 'heading': { + const HeadingItem = require( './HeadingItem.js' ); // Cached HTML may still have the placeholder heading constant in it. // This code can be removed a few weeks after being deployed. if ( hash.headingLevel === 99 ) { @@ -94,6 +95,7 @@ ThreadItem.static.newFromJSON = function ( json, rootNode ) { hash.headingLevel ); break; + } default: throw new Error( 'Unknown ThreadItem type ' + hash.name ); } diff --git a/modules/ThreadItemSet.js b/modules/ThreadItemSet.js index 07aaee3b3..3c7033124 100644 --- a/modules/ThreadItemSet.js +++ b/modules/ThreadItemSet.js @@ -1,6 +1,6 @@ -var CommentItem = require( './CommentItem.js' ); -var HeadingItem = require( './HeadingItem.js' ); -var ThreadItem = require( './ThreadItem.js' ); +const CommentItem = require( './CommentItem.js' ); +const HeadingItem = require( './HeadingItem.js' ); +const ThreadItem = require( './ThreadItem.js' ); /** * Groups thread items (headings and comments) generated by parsing a discussion page. diff --git a/modules/controller.js b/modules/controller.js index 3a8874ff2..49d3e72f9 100644 --- a/modules/controller.js +++ b/modules/controller.js @@ -1,10 +1,6 @@ 'use strict'; -var - $pageContainer, linksController, - pageThreads, - lastControllerScrollOffset, - featuresEnabled = mw.config.get( 'wgDiscussionToolsFeaturesEnabled' ) || {}, +const featuresEnabled = mw.config.get( 'wgDiscussionToolsFeaturesEnabled' ) || {}, MemoryStorage = require( './MemoryStorage.js' ), STORAGE_EXPIRY = 60 * 60 * 24 * 30, Parser = require( './Parser.js' ), @@ -16,14 +12,18 @@ var highlighter = require( './highlighter.js' ), topicSubscriptions = require( './topicsubscriptions.js' ), permalinks = require( './permalinks.js' ), - pageHandlersSetup = false, - pageDataCache = {}, defaultEditMode = mw.user.options.get( 'discussiontools-editmode' ) || mw.config.get( 'wgDiscussionToolsFallbackEditMode' ), defaultVisual = defaultEditMode === 'visual', enable2017Wikitext = featuresEnabled.sourcemodetoolbar, overflowMenu = require( './overflowMenu.js' ); +let + $pageContainer, linksController, + pageThreads, + lastControllerScrollOffset, + pageDataCache = {}, + pageHandlersSetup = false; -var mobile = null; +let mobile = null; if ( OO.ui.isMobile() && mw.config.get( 'skin' ) === 'minerva' ) { mobile = require( './mobile.js' ); } diff --git a/modules/debughighlighter.js b/modules/debughighlighter.js index 2f9a21542..d2f1dafdb 100644 --- a/modules/debughighlighter.js +++ b/modules/debughighlighter.js @@ -1,9 +1,9 @@ 'use strict'; -var initialOffset, indentWidth, firstMarker; -var updaters = []; +let initialOffset, indentWidth, firstMarker; +const updaters = []; // eslint-disable-next-line no-jquery/no-global-selector -var isRtl = $( 'html' ).attr( 'dir' ) === 'rtl'; +const isRtl = $( 'html' ).attr( 'dir' ) === 'rtl'; function markTimestamp( parser, node, match ) { const dfParsers = parser.getLocalTimestampParsers(); diff --git a/modules/dt-ve/CommentTarget.js b/modules/dt-ve/CommentTarget.js index 7cd60ae30..45fb3a882 100644 --- a/modules/dt-ve/CommentTarget.js +++ b/modules/dt-ve/CommentTarget.js @@ -1,4 +1,4 @@ -var registries = require( './dt.ui.registries.js' ); +const registries = require( './dt.ui.registries.js' ); /** * DiscussionTools-specific target, inheriting from the stand-alone target diff --git a/modules/dt-ve/dt.ui.UsernameCompletionAction.js b/modules/dt-ve/dt.ui.UsernameCompletionAction.js index 8e62c139a..952b94e61 100644 --- a/modules/dt-ve/dt.ui.UsernameCompletionAction.js +++ b/modules/dt-ve/dt.ui.UsernameCompletionAction.js @@ -1,5 +1,5 @@ -var sequence, - controller = require( 'ext.discussionTools.init' ).controller; +const controller = require( 'ext.discussionTools.init' ).controller; +let sequence; function sortAuthors( a, b ) { return a.username < b.username ? -1 : ( a.username === b.username ? 0 : 1 ); @@ -238,11 +238,11 @@ MWUsernameCompletionAction.prototype.shouldAbandon = function ( input ) { ve.ui.actionFactory.register( MWUsernameCompletionAction ); -var openCommand = new ve.ui.Command( +const openCommand = new ve.ui.Command( 'openMWUsernameCompletions', MWUsernameCompletionAction.static.name, 'open', { supportedSelections: [ 'linear' ] } ); -var insertAndOpenCommand = new ve.ui.Command( +const insertAndOpenCommand = new ve.ui.Command( 'insertAndOpenMWUsernameCompletions', MWUsernameCompletionAction.static.name, 'insertAndOpen', { supportedSelections: [ 'linear' ] } ); diff --git a/modules/dt-ve/dt.ui.registries.js b/modules/dt-ve/dt.ui.registries.js index 3ba36a8f5..5ffa47926 100644 --- a/modules/dt-ve/dt.ui.registries.js +++ b/modules/dt-ve/dt.ui.registries.js @@ -13,14 +13,14 @@ function importRegistry( parent, child ) { // Create new registries so that we can override the behavior for signatures // without affecting normal VisualEditor. -var commandRegistry = new ve.ui.CommandRegistry(); +const commandRegistry = new ve.ui.CommandRegistry(); importRegistry( ve.ui.commandRegistry, commandRegistry ); -var sequenceRegistry = new ve.ui.SequenceRegistry(); +const sequenceRegistry = new ve.ui.SequenceRegistry(); importRegistry( ve.ui.sequenceRegistry, sequenceRegistry ); -var wikitextCommandRegistry = new ve.ui.MWWikitextCommandRegistry( commandRegistry ); +const wikitextCommandRegistry = new ve.ui.MWWikitextCommandRegistry( commandRegistry ); importRegistry( ve.ui.wikitextCommandRegistry, wikitextCommandRegistry ); -var wikitextSequenceRegistry = new ve.ui.SequenceRegistry(); +const wikitextSequenceRegistry = new ve.ui.SequenceRegistry(); importRegistry( ve.ui.wikitextSequenceRegistry, wikitextSequenceRegistry ); // Disable find-and-replace (T263570) @@ -58,7 +58,7 @@ sequenceRegistry.register( // TODO: Show a warning when typing ~~~~ in wikitext mode? // Show wikitext warnings for disabled sequences (disabled via excludeCommands): -var sequenceRegistryForReplyTool = new ve.ui.SequenceRegistry(); +const sequenceRegistryForReplyTool = new ve.ui.SequenceRegistry(); importRegistry( sequenceRegistry, sequenceRegistryForReplyTool ); // insertTable diff --git a/modules/dt.debug.js b/modules/dt.debug.js index 481b438da..27d2591a7 100644 --- a/modules/dt.debug.js +++ b/modules/dt.debug.js @@ -1,4 +1,4 @@ -var +const Parser = require( 'ext.discussionTools.init' ).Parser, modifier = require( 'ext.discussionTools.init' ).modifier, utils = require( 'ext.discussionTools.init' ).utils, diff --git a/modules/dt.init.js b/modules/dt.init.js index bf1059990..973196aee 100644 --- a/modules/dt.init.js +++ b/modules/dt.init.js @@ -1,4 +1,4 @@ -var controller = require( './controller.js' ), +const controller = require( './controller.js' ), url = new URL( location.href ); /** @@ -13,7 +13,7 @@ mw.dt.initState = { // A/B test for logged out users: if ( mw.user.isAnon() && mw.config.get( 'wgDiscussionToolsABTest' ) && mw.config.get( 'wgDiscussionToolsABTestBucket' ) ) { - var token = mw.cookie.get( 'DTABid', '', mw.user.generateRandomSessionId() ); + const token = mw.cookie.get( 'DTABid', '', mw.user.generateRandomSessionId() ); mw.cookie.set( 'DTAB', mw.config.get( 'wgDiscussionToolsABTestBucket' ), { path: '/', expires: 90 * 86400, prefix: '' } ); mw.cookie.set( 'DTABid', token, { path: '/', expires: 90 * 86400, prefix: '' } ); } @@ -77,15 +77,13 @@ if ( url.searchParams.get( 'dtdebug' ) ) { mw.hook( 'wikipage.content' ).add( mw.dt.init ); } -var topicSubscriptions; - if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'TopicSubscriptions' ) { - topicSubscriptions = require( './topicsubscriptions.js' ); + const topicSubscriptions = require( './topicsubscriptions.js' ); topicSubscriptions.initSpecialTopicSubscriptions(); } if ( mw.config.get( 'wgAction' ) === 'history' ) { - topicSubscriptions = require( './topicsubscriptions.js' ); + const topicSubscriptions = require( './topicsubscriptions.js' ); topicSubscriptions.initNewTopicsSubscription(); } diff --git a/modules/dt.ui.ReplyWidget.js b/modules/dt.ui.ReplyWidget.js index 016acbda9..5d4b6aef6 100644 --- a/modules/dt.ui.ReplyWidget.js +++ b/modules/dt.ui.ReplyWidget.js @@ -1,4 +1,4 @@ -var controller = require( 'ext.discussionTools.init' ).controller, +const controller = require( 'ext.discussionTools.init' ).controller, utils = require( 'ext.discussionTools.init' ).utils, ModeTabSelectWidget = require( './ModeTabSelectWidget.js' ), ModeTabOptionWidget = require( './ModeTabOptionWidget.js' ), diff --git a/modules/dt.ui.ReplyWidgetPlain.js b/modules/dt.ui.ReplyWidgetPlain.js index 9463c4082..68ad7278e 100644 --- a/modules/dt.ui.ReplyWidgetPlain.js +++ b/modules/dt.ui.ReplyWidgetPlain.js @@ -1,4 +1,4 @@ -var utils = require( 'ext.discussionTools.init' ).utils; +const utils = require( 'ext.discussionTools.init' ).utils; /** * DiscussionTools ReplyWidgetPlain class diff --git a/modules/dt.ui.ReplyWidgetVisual.js b/modules/dt.ui.ReplyWidgetVisual.js index 332197031..d9629b1b9 100644 --- a/modules/dt.ui.ReplyWidgetVisual.js +++ b/modules/dt.ui.ReplyWidgetVisual.js @@ -1,4 +1,4 @@ -var CommentTargetWidget = require( './dt-ve/CommentTargetWidget.js' ); +const CommentTargetWidget = require( './dt-ve/CommentTargetWidget.js' ); require( './dt-ve/dt.ui.MWSignatureContextItem.js' ); require( './dt-ve/dt.dm.MWSignatureNode.js' ); diff --git a/modules/highlighter.js b/modules/highlighter.js index 0c11d2ce6..c277b34a8 100644 --- a/modules/highlighter.js +++ b/modules/highlighter.js @@ -1,9 +1,9 @@ -var - lastHighlightedPublishedComment = null, +const featuresEnabled = mw.config.get( 'wgDiscussionToolsFeaturesEnabled' ) || {}, CommentItem = require( './CommentItem.js' ), HeadingItem = require( './HeadingItem.js' ), utils = require( './utils.js' ); +let lastHighlightedPublishedComment = null; /** * Draw a semi-transparent rectangle on the page to highlight the given thread item. @@ -165,7 +165,7 @@ Highlight.prototype.destroy = function () { window.removeEventListener( 'resize', this.updateDebounced ); }; -var highlightedTarget = null; +let highlightedTarget = null; /** * Highlight the thread item(s) on the page associated with the URL hash or query string * diff --git a/modules/mobile.js b/modules/mobile.js index f181cb1f0..784f0a754 100644 --- a/modules/mobile.js +++ b/modules/mobile.js @@ -1,9 +1,9 @@ -var newTopicButton, ledeSectionDialog; -var viewportScrollContainer = null; -var wasKeyboardOpen = null; -var initialClientHeight = null; +let newTopicButton, ledeSectionDialog; +let viewportScrollContainer = null; +let wasKeyboardOpen = null; +let initialClientHeight = null; // Copied from ve.init.Platform.static.isIos -var isIos = /ipad|iphone|ipod/i.test( navigator.userAgent ); +const isIos = /ipad|iphone|ipod/i.test( navigator.userAgent ); $( document.body ).toggleClass( 'ext-discussiontools-init-ios', isIos ); diff --git a/modules/modifier.js b/modules/modifier.js index 21fe88ab5..9c8fc441e 100644 --- a/modules/modifier.js +++ b/modules/modifier.js @@ -1,7 +1,7 @@ 'use strict'; /* global $:off */ -var +const utils = require( './utils.js' ); /** @@ -270,7 +270,7 @@ function addListItem( comment, replyIndentation ) { */ function removeAddedListItem( node ) { while ( node && node.discussionToolsModified ) { - var nextNode; + let nextNode; if ( node.discussionToolsModified === 'new' ) { nextNode = node.previousSibling || node.parentNode; diff --git a/modules/topicsubscriptions.js b/modules/topicsubscriptions.js index fab281d55..334b51e55 100644 --- a/modules/topicsubscriptions.js +++ b/modules/topicsubscriptions.js @@ -1,13 +1,13 @@ /* global moment */ -var - api, - seenAutoTopicSubPopup = !!+mw.user.options.get( 'discussiontools-seenautotopicsubpopup' ), +const STATE_UNSUBSCRIBED = 0, STATE_SUBSCRIBED = 1, STATE_AUTOSUBSCRIBED = 2, utils = require( './utils.js' ), CommentItem = require( './CommentItem.js' ), - HeadingItem = require( './HeadingItem.js' ), + HeadingItem = require( './HeadingItem.js' ); +let api, + seenAutoTopicSubPopup = !!+mw.user.options.get( 'discussiontools-seenautotopicsubpopup' ), linksByName = {}, buttonsByName = {}; diff --git a/modules/utils.js b/modules/utils.js index f32887322..67f5473b5 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -4,7 +4,7 @@ /** * @constant */ -var NEW_TOPIC_COMMENT_ID = 'new|' + mw.config.get( 'wgRelevantPageName' ); +const NEW_TOPIC_COMMENT_ID = 'new|' + mw.config.get( 'wgRelevantPageName' ); /** * @param {Node} node @@ -14,7 +14,7 @@ function isBlockElement( node ) { return node instanceof HTMLElement && ve.isBlockElement( node ); } -var solTransparentLinkRegexp = /(?:^|\s)mw:PageProp\/(?:Category|redirect|Language)(?=$|\s)/; +const solTransparentLinkRegexp = /(?:^|\s)mw:PageProp\/(?:Category|redirect|Language)(?=$|\s)/; /** * @param {Node} node @@ -59,7 +59,7 @@ function isOurGeneratedNode( node ) { } // Elements which can't have element children (but some may have text content). -var noElementChildrenElementTypes = [ +const noElementChildrenElementTypes = [ // https://html.spec.whatwg.org/multipage/syntax.html#elements-2 // Void elements 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', diff --git a/tests/qunit/ThreadItem.test.js b/tests/qunit/ThreadItem.test.js index 17b9b0f61..1785a80f9 100644 --- a/tests/qunit/ThreadItem.test.js +++ b/tests/qunit/ThreadItem.test.js @@ -1,4 +1,4 @@ -var +const CommentItem = require( 'ext.discussionTools.init' ).CommentItem, HeadingItem = require( 'ext.discussionTools.init' ).HeadingItem; diff --git a/tests/qunit/modifier.test.js b/tests/qunit/modifier.test.js index a37f9ae24..a278f8bba 100644 --- a/tests/qunit/modifier.test.js +++ b/tests/qunit/modifier.test.js @@ -1,4 +1,4 @@ -var +const testUtils = require( './testUtils.js' ), Parser = require( 'ext.discussionTools.init' ).Parser, modifier = require( 'ext.discussionTools.init' ).modifier; diff --git a/tests/qunit/parser.test.js b/tests/qunit/parser.test.js index 0b1f80bd3..8cd334958 100644 --- a/tests/qunit/parser.test.js +++ b/tests/qunit/parser.test.js @@ -1,5 +1,5 @@ /* global moment */ -var +const testUtils = require( './testUtils.js' ), Parser = require( 'ext.discussionTools.init' ).Parser; diff --git a/tests/qunit/testUtils.js b/tests/qunit/testUtils.js index 2634ec1dc..2708562fc 100644 --- a/tests/qunit/testUtils.js +++ b/tests/qunit/testUtils.js @@ -1,4 +1,4 @@ -var utils = require( 'ext.discussionTools.init' ).utils; +const utils = require( 'ext.discussionTools.init' ).utils; module.exports = {}; diff --git a/tests/qunit/utils.test.js b/tests/qunit/utils.test.js index 6ea969e98..80fe43876 100644 --- a/tests/qunit/utils.test.js +++ b/tests/qunit/utils.test.js @@ -1,4 +1,4 @@ -var utils = require( 'ext.discussionTools.init' ).utils; +const utils = require( 'ext.discussionTools.init' ).utils; QUnit.module( 'mw.dt.utils', QUnit.newMwEnvironment() );