From 2c03d167fae59668053d895f0400641d4eeb2916 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 18 Jul 2017 14:02:42 +0100 Subject: [PATCH] build: Upgrade grunt-eslint from 19.0.0 to 20.0.0 Most indent and escaping fixes. Change-Id: I210e2fc3c0ce3148327ef81f824e1ce9f1e269b6 --- mw-config/config.js | 20 +++++------ package.json | 2 +- resources/src/jquery/jquery.badge.js | 3 +- resources/src/jquery/jquery.colorUtil.js | 2 +- .../src/jquery/jquery.makeCollapsible.js | 17 +++++----- resources/src/jquery/jquery.mwExtension.js | 4 +-- resources/src/jquery/jquery.suggestions.js | 4 +-- resources/src/jquery/jquery.tablesorter.js | 10 +++--- .../mediawiki.action.edit.preview.js | 4 +-- .../mediawiki.action.history.js | 6 ++-- .../mediawiki.action.view.metadata.js | 34 +++++++++---------- .../dm/mw.rcfilters.dm.FilterGroup.js | 22 ++++++------ .../ui/mw.rcfilters.ui.MenuSelectWidget.js | 3 +- .../mediawiki.special.preferences.js | 17 +++++----- ...i.special.search.commonsInterwikiWidget.js | 3 +- .../DateTimeFormatter.js | 2 +- .../mw.widgets.MediaSearchWidget.js | 2 +- .../mw.widgets.CalendarWidget.js | 20 +++++++---- resources/src/mediawiki/api/rollback.js | 3 +- resources/src/mediawiki/api/upload.js | 20 +++++------ resources/src/mediawiki/htmlform/hide-if.js | 2 +- ...i.ForeignStructuredUpload.BookletLayout.js | 6 ++-- resources/src/mediawiki/mediawiki.RegExp.js | 2 +- resources/src/mediawiki/mediawiki.Title.js | 14 ++++---- resources/src/mediawiki/mediawiki.debug.js | 11 +++--- resources/src/mediawiki/mediawiki.feedback.js | 12 +++---- .../src/mediawiki/mediawiki.jqueryMsg.js | 9 ++--- resources/src/mediawiki/mediawiki.js | 10 +++--- .../src/mediawiki/mediawiki.notification.js | 4 +-- .../mediawiki.requestIdleCallback.js | 3 +- .../src/mediawiki/mediawiki.searchSuggest.js | 9 +++-- resources/src/mediawiki/mediawiki.toc.js | 4 +-- resources/src/mediawiki/page/patrol.ajax.js | 6 ++-- resources/src/mediawiki/page/rollback.js | 4 +-- .../resources/jquery/jquery.byteLimit.test.js | 12 +++---- .../jquery/jquery.makeCollapsible.test.js | 12 +++---- .../mediawiki.api.options.test.js | 7 ++-- .../mediawiki.api/mediawiki.api.test.js | 6 ++-- .../mediawiki/mediawiki.jqueryMsg.test.js | 2 +- .../mediawiki/mediawiki.loader.test.js | 21 ++++++------ tests/selenium/wdio.conf.js | 13 ++++--- 41 files changed, 178 insertions(+), 189 deletions(-) diff --git a/mw-config/config.js b/mw-config/config.js index 8b2d6e5ab4..c745ce44a7 100644 --- a/mw-config/config.js +++ b/mw-config/config.js @@ -4,7 +4,7 @@ function syncText() { var value = $( this ).val() - .replace( /[\[\]\{\}|#<>%+? ]/g, '_' ) + .replace( /[\[\]{}|#<>%+? ]/g, '_' ) // eslint-disable-line no-useless-escape .replace( /&/, '&' ) .replace( /__+/g, '_' ) .replace( /^_+/, '' ) @@ -14,17 +14,13 @@ } // Set up the help system - $( '.config-help-field-data' ) - .hide() - .closest( '.config-help-field-container' ) - .find( '.config-help-field-hint' ) - .show() - .click( function () { - $( this ) - .closest( '.config-help-field-container' ) - .find( '.config-help-field-data' ) - .slideToggle( 'fast' ); - } ); + $( '.config-help-field-data' ).hide() + .closest( '.config-help-field-container' ).find( '.config-help-field-hint' ) + .show() + .click( function () { + $( this ).closest( '.config-help-field-container' ).find( '.config-help-field-data' ) + .slideToggle( 'fast' ); + } ); // Show/hide code for DB-specific options // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here? diff --git a/package.json b/package.json index fe3c910bd8..022910a81c 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "grunt-banana-checker": "0.6.0", "grunt-contrib-copy": "1.0.0", "grunt-contrib-watch": "1.0.0", - "grunt-eslint": "19.0.0", + "grunt-eslint": "20.0.0", "grunt-jsonlint": "1.1.0", "grunt-karma": "2.0.0", "grunt-stylelint": "0.7.0", diff --git a/resources/src/jquery/jquery.badge.js b/resources/src/jquery/jquery.badge.js index 777386612f..40b3baf0e9 100644 --- a/resources/src/jquery/jquery.badge.js +++ b/resources/src/jquery/jquery.badge.js @@ -64,8 +64,7 @@ if ( $badge.length ) { $badge .toggleClass( 'mw-badge-important', isImportant ) - .find( '.mw-badge-content' ) - .text( text ); + .find( '.mw-badge-content' ).text( text ); } else { // Otherwise, create a new badge with the specified text and style $badge = $( '
' ) diff --git a/resources/src/jquery/jquery.colorUtil.js b/resources/src/jquery/jquery.colorUtil.js index 2be1dbaea5..a5b136d969 100644 --- a/resources/src/jquery/jquery.colorUtil.js +++ b/resources/src/jquery/jquery.colorUtil.js @@ -42,7 +42,7 @@ // Look for rgb(num%,num%,num%) // eslint-disable-next-line no-cond-assign - if ( result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec( color ) ) { + if ( result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*,\s*([0-9]+(?:\.[0-9]+)?)%\s*\)/.exec( color ) ) { return [ parseFloat( result[ 1 ] ) * 2.55, parseFloat( result[ 2 ] ) * 2.55, diff --git a/resources/src/jquery/jquery.makeCollapsible.js b/resources/src/jquery/jquery.makeCollapsible.js index 5ce9b1f9bc..aa76d6dfbb 100644 --- a/resources/src/jquery/jquery.makeCollapsible.js +++ b/resources/src/jquery/jquery.makeCollapsible.js @@ -264,14 +264,15 @@ buildDefaultToggleLink = function () { return $( '' ) .text( collapseText ) - .wrap( '' ).parent() - .attr( { - role: 'button', - tabindex: 0 - } ) - .prepend( '[' ) - .append( ']' ) - .on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler ); + .wrap( '' ) + .parent() + .attr( { + role: 'button', + tabindex: 0 + } ) + .prepend( '[' ) + .append( ']' ) + .on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler ); }; // Check if this element has a custom position for the toggle link diff --git a/resources/src/jquery/jquery.mwExtension.js b/resources/src/jquery/jquery.mwExtension.js index 6d478bd355..4bcccdd5e6 100644 --- a/resources/src/jquery/jquery.mwExtension.js +++ b/resources/src/jquery/jquery.mwExtension.js @@ -11,7 +11,7 @@ }, trimRight: function ( str ) { return str === null ? - '' : str.toString().replace( /\s+$/, '' ); + '' : str.toString().replace( /\s+$/, '' ); }, ucFirst: function ( str ) { return str.charAt( 0 ).toUpperCase() + str.slice( 1 ); @@ -122,7 +122,7 @@ } ); mw.log.deprecate( $, 'escapeRE', function ( str ) { - return str.replace( /([\\{}()|.?*+\-\^$\[\]])/g, '\\$1' ); + return str.replace( /([\\{}()|.?*+\-^$\[\]])/g, '\\$1' ); // eslint-disable-line no-useless-escape }, 'Use mediawiki.RegExp instead.' ); }( jQuery, mediaWiki ) ); diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index 75f1ba6e8e..4f4edc96b5 100644 --- a/resources/src/jquery/jquery.suggestions.js +++ b/resources/src/jquery/jquery.suggestions.js @@ -19,7 +19,6 @@ * @class jQuery.plugin.suggestions */ - // jscs:disable checkParamNames /** * @method suggestions * @chainable @@ -94,7 +93,6 @@ * @param {boolean} [options.highlightInput=false] Whether to highlight matched portions of the * input or not. */ - // jscs:enable checkParamNames ( function ( $, mw ) { @@ -755,7 +753,7 @@ 27, // escape 13, // enter 46, // delete - 8 // backspace + 8 // backspace ]; if ( context.data.keypressedCount === 0 && e.which === context.data.keypressed && diff --git a/resources/src/jquery/jquery.tablesorter.js b/resources/src/jquery/jquery.tablesorter.js index 8d019e568c..ec917730db 100644 --- a/resources/src/jquery/jquery.tablesorter.js +++ b/resources/src/jquery/jquery.tablesorter.js @@ -542,7 +542,7 @@ // Build RegEx // Any date formated with . , ' - or / - ts.dateRegex[ 0 ] = new RegExp( /^\s*(\d{1,2})[\,\.\-\/'\s]{1,2}(\d{1,2})[\,\.\-\/'\s]{1,2}(\d{2,4})\s*?/i ); + ts.dateRegex[ 0 ] = new RegExp( /^\s*(\d{1,2})[,.\-/'\s]{1,2}(\d{1,2})[,.\-/'\s]{1,2}(\d{2,4})\s*?/i ); // Written Month name, dmy ts.dateRegex[ 1 ] = new RegExp( @@ -684,7 +684,7 @@ } columnToCell = []; - cellsInRow = ( $row[ 0 ].cells.length ) || 0; // all cells in this row + cellsInRow = ( $row[ 0 ].cells.length ) || 0; // all cells in this row index = 0; // real cell index in this row for ( j = 0; j < columns; index++ ) { if ( index === cellsInRow ) { @@ -725,7 +725,7 @@ } ts.rgx = { IPAddress: [ - new RegExp( /^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/ ) + new RegExp( /^\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3}$/ ) ], currency: [ new RegExp( /(^[£$€¥]|[£$€¥]$)/ ), @@ -736,7 +736,7 @@ new RegExp( /(https?|ftp|file):\/\// ) ], isoDate: [ - new RegExp( /^([-+]?\d{1,4})-([01]\d)-([0-3]\d)([T\s]((([01]\d|2[0-3])(:?[0-5]\d)?|24:?00)?(:?([0-5]\d|60))?([.,]\d+)?)([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?/ ), + new RegExp( /^([-+]?\d{1,4})-([01]\d)-([0-3]\d)([T\s]((([01]\d|2[0-3])(:?[0-5]\d)?|24:?00)?(:?([0-5]\d|60))?([.,]\d+)?)([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?/ ), new RegExp( /^([-+]?\d{1,4})-([01]\d)-([0-3]\d)/ ) ], usLongDate: [ @@ -1059,7 +1059,7 @@ return getParserById( id ); }, - getParsers: function () { // for table diagnosis + getParsers: function () { // for table diagnosis return parsers; } }; diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js index 53c1fbbe4b..2b6fc9d8aa 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js @@ -301,8 +301,8 @@ role: 'navigation', 'aria-labelledby': 'p-lang-label' } ) - .append( $( '

' ).attr( 'id', 'p-lang-label' ).text( mw.msg( 'otherlanguages' ) ) ) - .append( $( '
' ).addClass( 'body' ).append( '