From b685292d82ba1ee238a2eef9aa7122d6f75cd35e Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sat, 2 Feb 2019 11:05:04 -0800 Subject: [PATCH] build: Update eslint-config-wikimedia to 0.10.1 Change-Id: Id98af16c1ec1c6c4a790948a35e96e2fe925ebb5 --- package.json | 2 +- resources/src/jquery/jquery.makeCollapsible.js | 1 - resources/src/jquery/jquery.suggestions.js | 9 --------- resources/src/mediawiki.inspect.js | 7 ++++--- resources/src/mediawiki.notification/notification.js | 2 ++ .../src/mediawiki.rcfilters/mw.rcfilters.Controller.js | 4 ++++ resources/src/mediawiki.special.apisandbox/apisandbox.js | 2 -- resources/src/mediawiki.special.userrights.js | 1 - 8 files changed, 11 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index c0570cfb01..5b65a09d45 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "selenium-test": "wdio ./tests/selenium/wdio.conf.js" }, "devDependencies": { - "eslint-config-wikimedia": "0.10.0", + "eslint-config-wikimedia": "0.10.1", "grunt": "1.0.3", "grunt-banana-checker": "0.6.0", "grunt-contrib-copy": "1.0.0", diff --git a/resources/src/jquery/jquery.makeCollapsible.js b/resources/src/jquery/jquery.makeCollapsible.js index f5f047503d..09306f634c 100644 --- a/resources/src/jquery/jquery.makeCollapsible.js +++ b/resources/src/jquery/jquery.makeCollapsible.js @@ -82,7 +82,6 @@ } } - // eslint-disable-next-line jquery/no-animate-toggle $containers.toggle( action === 'expand' ); hookCallback(); } diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index 01d2ba5d83..d9a094ccfe 100644 --- a/resources/src/jquery/jquery.suggestions.js +++ b/resources/src/jquery/jquery.suggestions.js @@ -163,7 +163,6 @@ // Only fetch if the value in the textbox changed and is not empty, or if the results were hidden // if the textbox is empty then clear the result div, but leave other settings intouched if ( val.length === 0 ) { - // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); context.data.prevText = ''; } else if ( @@ -267,7 +266,6 @@ if ( context.data !== undefined ) { if ( context.data.$textbox.val().length === 0 ) { // Hide the div when no suggestion exist - // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); } else { // Rebuild the suggestions list @@ -530,7 +528,6 @@ break; // Escape case 27: - // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); $.suggestions.restore( context ); $.suggestions.cancel( context ); @@ -541,7 +538,6 @@ case 13: preventDefault = wasVisible; selected = context.data.$container.find( '.suggestions-result-current' ); - // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); if ( selected.length === 0 || context.data.selectedWithMouse ) { // If nothing is selected or if something was selected with the mouse @@ -676,7 +672,6 @@ // This will hide the link we're just clicking on, which causes problems // when done synchronously in at least Firefox 3.6 (T64858). setTimeout( function () { - // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); } ); } @@ -709,7 +704,6 @@ // This will hide the link we're just clicking on, which causes problems // when done synchronously in at least Firefox 3.6 (T64858). setTimeout( function () { - // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); } ); } @@ -736,7 +730,6 @@ } ) .on( 'keypress', function ( e ) { context.data.keypressedCount++; - // eslint-disable-next-line jquery/no-event-shorthand $.suggestions.keypress( e, context, context.data.keypressed ); } ) .on( 'keyup', function ( e ) { @@ -757,7 +750,6 @@ e.which === context.data.keypressed && allowed.indexOf( e.which ) !== -1 ) { - // eslint-disable-next-line jquery/no-event-shorthand $.suggestions.keypress( e, context, context.data.keypressed ); } } ) @@ -767,7 +759,6 @@ if ( context.data.mouseDownOn.length > 0 ) { return; } - // eslint-disable-next-line jquery/no-animate-toggle $.suggestions.hide( context ); $.suggestions.cancel( context ); } ); diff --git a/resources/src/mediawiki.inspect.js b/resources/src/mediawiki.inspect.js index 72a27fa57f..849ccbcb68 100644 --- a/resources/src/mediawiki.inspect.js +++ b/resources/src/mediawiki.inspect.js @@ -36,12 +36,13 @@ } ); } - function humanSize( bytes ) { + function humanSize( bytesInput ) { var i, + bytes = +bytesInput, units = [ '', ' KiB', ' MiB', ' GiB', ' TiB', ' PiB' ]; - if ( !$.isNumeric( bytes ) || bytes === 0 ) { - return bytes; + if ( bytes === 0 || isNaN( bytes ) ) { + return bytesInput; } for ( i = 0; bytes >= 1024; bytes /= 1024 ) { diff --git a/resources/src/mediawiki.notification/notification.js b/resources/src/mediawiki.notification/notification.js index 2765d07a49..e8450df396 100644 --- a/resources/src/mediawiki.notification/notification.js +++ b/resources/src/mediawiki.notification/notification.js @@ -247,6 +247,8 @@ $area.css( 'display', 'none' ); notif.$notification.remove(); } else { + // FIXME: Use CSS transition + // eslint-disable-next-line jquery/no-slide notif.$notification.slideUp( 'fast', function () { $( this ).remove(); } ); diff --git a/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js b/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js index 1651432df4..6eb8867e57 100644 --- a/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js +++ b/resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js @@ -135,6 +135,7 @@ title: '', // Because it's a hidden group, this title actually appears nowhere hidden: true, allowArbitrary: true, + // FIXME: $.isNumeric is deprecated validate: $.isNumeric, range: { min: 0, // The server normalizes negative numbers to 0 results @@ -153,6 +154,7 @@ title: '', // Because it's a hidden group, this title actually appears nowhere hidden: true, allowArbitrary: true, + // FIXME: $.isNumeric is deprecated validate: $.isNumeric, range: { min: 0, @@ -893,6 +895,8 @@ * @param {number|string} newValue New value */ mw.rcfilters.Controller.prototype.updateNumericPreference = function ( prefName, newValue ) { + // FIXME: $.isNumeric is deprecated + // eslint-disable-next-line jquery/no-is-numeric if ( !$.isNumeric( newValue ) ) { return; } diff --git a/resources/src/mediawiki.special.apisandbox/apisandbox.js b/resources/src/mediawiki.special.apisandbox/apisandbox.js index 19eac9804c..68c7ddc00f 100644 --- a/resources/src/mediawiki.special.apisandbox/apisandbox.js +++ b/resources/src/mediawiki.special.apisandbox/apisandbox.js @@ -977,7 +977,6 @@ // OO.ui.ButtonWidget doesn't take focus itself (T128054) $focus = $( '#mw-apisandbox-ui' ).find( document.activeElement ); if ( $focus.length ) { - // eslint-disable-next-line jquery/no-event-shorthand $focus[ 0 ].blur(); } @@ -1944,7 +1943,6 @@ } that.deprecatedItemsFieldset = new OO.ui.FieldsetLayout().addItems( deprecatedItems ).toggle( false ); - // eslint-disable-next-line jquery/no-animate-toggle tmp = $( '
' ) .toggle( !that.deprecatedItemsFieldset.isEmpty() ) .append( diff --git a/resources/src/mediawiki.special.userrights.js b/resources/src/mediawiki.special.userrights.js index 63d96234cc..a4f5d1aabc 100644 --- a/resources/src/mediawiki.special.userrights.js +++ b/resources/src/mediawiki.special.userrights.js @@ -12,7 +12,6 @@ // Dynamically show/hide the "other time" input under each dropdown $( '.mw-userrights-nested select' ).on( 'change', function ( e ) { - // eslint-disable-next-line jquery/no-animate-toggle $( e.target.parentNode ).find( 'input' ).toggle( $( e.target ).val() === 'other' ); } ); -- 2.20.1