diff --git a/modules/.eslintrc.json b/modules/.eslintrc.json index 07eed576..d022e3f0 100644 --- a/modules/.eslintrc.json +++ b/modules/.eslintrc.json @@ -10,7 +10,6 @@ }, "rules": { "max-len": "off", - "no-jquery/no-global-selector": "off", - "prefer-const": "warn" + "no-jquery/no-global-selector": "off" } } diff --git a/modules/jquery.wikiEditor.dialogs.config.js b/modules/jquery.wikiEditor.dialogs.config.js index 57145bca..8531cebd 100644 --- a/modules/jquery.wikiEditor.dialogs.config.js +++ b/modules/jquery.wikiEditor.dialogs.config.js @@ -476,7 +476,7 @@ module.exports = { } }, open: function () { - let magicWordsI18N = configData.magicWords, + const magicWordsI18N = configData.magicWords, fileData = { pre: '', post: '', @@ -550,7 +550,7 @@ module.exports = { // Pre-fill the text fields based on the current selection if ( selection !== '' ) { - fileData = Object.assign( fileData, parseFileSyntax( selection ) ); + Object.assign( fileData, parseFileSyntax( selection ) ); } // Initialize the form fields @@ -831,7 +831,6 @@ module.exports = { $( this ).data( 'offset', 0 ); } else { - let start, end; if ( mode === 'replace' ) { let actualReplacement; @@ -871,8 +870,8 @@ module.exports = { match = { index: 0, 0: { length: 0 } }; } } - start = offset + match.index; - end = start + match[ 0 ].length; + const start = offset + match.index; + const end = start + match[ 0 ].length; $( this ).data( 'matchIndex', start ); diff --git a/modules/jquery.wikiEditor.toolbar.config.js b/modules/jquery.wikiEditor.toolbar.config.js index 6b42b53f..e8f8149f 100644 --- a/modules/jquery.wikiEditor.toolbar.config.js +++ b/modules/jquery.wikiEditor.toolbar.config.js @@ -3,10 +3,9 @@ * * @private */ -let configData = require( './data.json' ), +const configData = require( './data.json' ), fileNamespace = mw.config.get( 'wgFormattedNamespaces' )[ 6 ], - specialCharacterGroups = require( 'mediawiki.language.specialCharacters' ), - toolbarConfig; + specialCharacterGroups = require( 'mediawiki.language.specialCharacters' ); /** * Replace link targets from example messages with hash @@ -26,7 +25,7 @@ function delink( $message ) { return $div.html(); } -toolbarConfig = { +const toolbarConfig = { toolbar: { // Main section main: { diff --git a/modules/jquery.wikiEditor.toolbar.js b/modules/jquery.wikiEditor.toolbar.js index a27a5c03..8dd46756 100644 --- a/modules/jquery.wikiEditor.toolbar.js +++ b/modules/jquery.wikiEditor.toolbar.js @@ -13,7 +13,6 @@ const toolbarModule = { addToToolbar: function ( context, data ) { for ( const type in data ) { - let i; switch ( type ) { case 'sections': { const $sections = context.modules.toolbar.$toolbar.find( 'div.sections' ); @@ -98,7 +97,7 @@ const toolbarModule = { 'div[rel="' + data.section + '"].section ' + 'div[rel="' + data.page + '"].page table' ); - for ( i = 0; i < data.rows.length; i++ ) { + for ( let i = 0; i < data.rows.length; i++ ) { // Row $table.append( toolbarModule.fn.buildRow( context, data.rows[ i ] ) ); } @@ -113,7 +112,7 @@ const toolbarModule = { 'div[rel="' + data.page + '"].page div' ); const actions = $characters.data( 'actions' ); - for ( i = 0; i < data.characters.length; i++ ) { + for ( let i = 0; i < data.characters.length; i++ ) { // Character $characters.append( $( toolbarModule.fn.buildCharacter( data.characters[ i ], actions ) ) @@ -502,7 +501,6 @@ const toolbarModule = { return $page; }, reallyBuildPage: function ( context, id, page, $page ) { - let i; switch ( page.layout ) { case 'table': { $page.addClass( 'page-table' ); @@ -511,7 +509,7 @@ const toolbarModule = { html += toolbarModule.fn.buildHeading( context, page.headings ); } if ( 'rows' in page ) { - for ( i = 0; i < page.rows.length; i++ ) { + for ( let i = 0; i < page.rows.length; i++ ) { html += toolbarModule.fn.buildRow( context, page.rows[ i ] ); } } @@ -535,7 +533,7 @@ const toolbarModule = { } if ( 'characters' in page ) { let html = ''; - for ( i = 0; i < page.characters.length; i++ ) { + for ( let i = 0; i < page.characters.length; i++ ) { html += toolbarModule.fn.buildCharacter( page.characters[ i ], actions ); } $characters @@ -769,8 +767,8 @@ const toolbarModule = { } }, updateBookletSelection: function ( context, id, $pages, $index ) { - let cookie = 'wikiEditor-' + context.instance + '-booklet-' + id + '-page', - selected = $.cookie( cookie ); + const cookie = 'wikiEditor-' + context.instance + '-booklet-' + id + '-page'; + let selected = $.cookie( cookie ); // Re-save cookie if ( selected !== null ) { $.cookie( cookie, selected, { expires: 30, path: '/' } );