From c6465dee078d9e1974425e89af369a689ba8750d Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Thu, 4 May 2017 21:57:38 +0100 Subject: [PATCH] build: Update eslint to 0.4.0 and make pass Change-Id: I6e3e2f30615996c57650127cde9738d3a6dd9ae5 --- modules/ext.RevisionSlider.DiffPage.js | 4 +- modules/ext.RevisionSlider.HelpButtonView.js | 8 ++-- .../ext.RevisionSlider.RevisionListView.js | 4 +- modules/ext.RevisionSlider.SliderArrowView.js | 4 +- modules/ext.RevisionSlider.SliderView.js | 30 ++++++------ modules/ext.RevisionSlider.SliderViewTwo.js | 46 +++++++++---------- modules/ext.RevisionSlider.init.js | 2 +- package.json | 2 +- 8 files changed, 50 insertions(+), 50 deletions(-) diff --git a/modules/ext.RevisionSlider.DiffPage.js b/modules/ext.RevisionSlider.DiffPage.js index db09b149..341b1949 100644 --- a/modules/ext.RevisionSlider.DiffPage.js +++ b/modules/ext.RevisionSlider.DiffPage.js @@ -211,11 +211,11 @@ * @param {SliderView} sliderView */ addHandlersToCoreLinks: function ( sliderView ) { - $( '#differences-nextlink' ).click( function() { + $( '#differences-nextlink' ).click( function () { sliderView.showNextDiff(); return false; } ); - $( '#differences-prevlink' ).click( function() { + $( '#differences-prevlink' ).click( function () { sliderView.showPrevDiff(); return false; } ); diff --git a/modules/ext.RevisionSlider.HelpButtonView.js b/modules/ext.RevisionSlider.HelpButtonView.js index 6d86bdd2..9fa00184 100644 --- a/modules/ext.RevisionSlider.HelpButtonView.js +++ b/modules/ext.RevisionSlider.HelpButtonView.js @@ -9,7 +9,7 @@ * * @return {jQuery} the help button object */ - render: function() { + render: function () { var helpButton, helpPopup; helpButton = new OO.ui.ButtonWidget( { @@ -25,13 +25,13 @@ classes: [ 'mw-revslider-tooltip', 'mw-revslider-help-tooltip' ] } ); helpButton.$element - .click( function() { + .click( function () { mw.libs.revisionSlider.HelpDialog.show(); } ) - .mouseover( function() { + .mouseover( function () { helpPopup.toggle( true ); } ) - .mouseout( function() { + .mouseout( function () { helpPopup.toggle( false ); } ); diff --git a/modules/ext.RevisionSlider.RevisionListView.js b/modules/ext.RevisionSlider.RevisionListView.js index 24a0dc2c..d674d72d 100644 --- a/modules/ext.RevisionSlider.RevisionListView.js +++ b/modules/ext.RevisionSlider.RevisionListView.js @@ -117,7 +117,7 @@ } }, - calcRelativeChangeSize: function( diffSize, maxChangeSizeLogged ) { + calcRelativeChangeSize: function ( diffSize, maxChangeSizeLogged ) { if ( diffSize === 0 ) { return 0; } @@ -376,7 +376,7 @@ /** * @return {jQuery} */ - getElement: function() { + getElement: function () { return this.$html; } } ); diff --git a/modules/ext.RevisionSlider.SliderArrowView.js b/modules/ext.RevisionSlider.SliderArrowView.js index 17f0fe7c..8454d953 100644 --- a/modules/ext.RevisionSlider.SliderArrowView.js +++ b/modules/ext.RevisionSlider.SliderArrowView.js @@ -21,7 +21,7 @@ * * @return {OO.ui.ButtonWidget} */ - renderBackwardArrow: function() { + renderBackwardArrow: function () { var backwardArrowButton, backwardArrowPopup; @@ -62,7 +62,7 @@ * * @return {OO.ui.ButtonWidget} */ - renderForwardArrow: function() { + renderForwardArrow: function () { var forwardArrowButton, forwardArrowPopup; diff --git a/modules/ext.RevisionSlider.SliderView.js b/modules/ext.RevisionSlider.SliderView.js index 28fedd35..bcb470d8 100644 --- a/modules/ext.RevisionSlider.SliderView.js +++ b/modules/ext.RevisionSlider.SliderView.js @@ -141,7 +141,7 @@ * @param {jQuery} $revisions * @return {jQuery} the revisions container */ - renderRevisionsContainer: function( containerWidth, $revisions ) { + renderRevisionsContainer: function ( containerWidth, $revisions ) { return $( '
' ) .addClass( 'mw-revslider-revisions-container' ) .css( { @@ -156,7 +156,7 @@ * @param {number} containerWidth * @return {jQuery} the pointer container */ - renderPointerContainer: function( containerWidth ) { + renderPointerContainer: function ( containerWidth ) { var pointerContainerSideOffset = 53, pointerContainerWidth = containerWidth + this.revisionWidth - 1, pointerContainerStyle; @@ -182,13 +182,13 @@ * * @param {jQuery} $revisions */ - initPointers: function( $revisions ) { + initPointers: function ( $revisions ) { var $pointers, escapePressed = false; $pointers = this.$element.find( '.mw-revslider-pointer' ); - $( 'body' ).keydown( function( e ) { + $( 'body' ).keydown( function ( e ) { if ( e.which === 27 ) { escapePressed = true; $pointers.trigger( 'mouseup' ); @@ -206,7 +206,7 @@ * @param {string} containmentClass * @return {Object} */ - buildDraggableOptions: function( escapePressed, $revisions, containmentClass ) { + buildDraggableOptions: function ( escapePressed, $revisions, containmentClass ) { var lastValidLeftPos, self = this; @@ -214,13 +214,13 @@ axis: 'x', grid: [ this.revisionWidth, null ], containment: containmentClass, - start: function() { + start: function () { self.isDragged = true; self.setPointerDragCursor(); self.fadeOutPointerLines(); escapePressed = false; }, - stop: function() { + stop: function () { var $p = $( this ), relativeIndex = self.getRelativePointerIndex( $p ), pointer = self.whichPointer( $p ), @@ -253,7 +253,7 @@ self.redrawPointerLines(); }, - drag: function( event, ui ) { + drag: function ( event, ui ) { lastValidLeftPos = self.draggableDragAction( event, ui, @@ -261,13 +261,13 @@ lastValidLeftPos ); }, - revert: function() { + revert: function () { return escapePressed; } }; }, - draggableDragAction: function( event, ui, pointer, lastValidLeftPos ) { + draggableDragAction: function ( event, ui, pointer, lastValidLeftPos ) { var olderLeftPos, newerLeftPos, isNew = $( pointer ).hasClass( 'mw-revslider-pointer-newer' ); @@ -293,12 +293,12 @@ return lastValidLeftPos; }, - setPointerDragCursor: function() { + setPointerDragCursor: function () { $( '.mw-revslider-revision-wrapper' ) .addClass( 'mw-revslider-pointer-cursor' ); }, - removePointerDragCursor: function() { + removePointerDragCursor: function () { $( '.mw-revslider-revision-wrapper' ) .removeClass( 'mw-revslider-pointer-cursor' ); }, @@ -309,7 +309,7 @@ * @param {jQuery} $pointer * @return {number} */ - getRelativePointerIndex: function( $pointer ) { + getRelativePointerIndex: function ( $pointer ) { var pos = $pointer.position().left, pointer = this.whichPointer( $pointer ); @@ -319,7 +319,7 @@ return Math.ceil( ( pos + this.revisionWidth / 2 ) / this.revisionWidth ); }, - getNewestVisibleRevisonLeftPos: function() { + getNewestVisibleRevisonLeftPos: function () { return $( '.mw-revslider-revisions-container' ).width() - this.revisionWidth; }, @@ -394,7 +394,7 @@ this.resetAndRefreshRevisions(); }, - resetAndRefreshRevisions: function() { + resetAndRefreshRevisions: function () { this.slide( 0 ); this.resetPointerStylesBasedOnPosition(); this.resetRevisionStylesBasedOnPointerPosition( diff --git a/modules/ext.RevisionSlider.SliderViewTwo.js b/modules/ext.RevisionSlider.SliderViewTwo.js index aa055b8a..ca516a65 100644 --- a/modules/ext.RevisionSlider.SliderViewTwo.js +++ b/modules/ext.RevisionSlider.SliderViewTwo.js @@ -19,7 +19,7 @@ * @param {number} containerWidth * @return {jQuery} the pointer container */ - renderPointerContainer: function( containerWidth ) { + renderPointerContainer: function ( containerWidth ) { var pointerContainerPosition = 53, pointerContainerWidth = containerWidth + this.revisionWidth - 1, pointerContainerStyle, lastMouseMoveRevisionPos, @@ -39,7 +39,7 @@ .addClass( 'mw-revslider-pointer-container' ) .css( pointerContainerStyle ) .append( this.renderPointerContainers() ) - .mousemove( function( event ) { + .mousemove( function ( event ) { if ( !self.isDragged ) { lastMouseMoveRevisionPos = self.showTooltipsOnMouseMoveHandler( event, @@ -49,13 +49,13 @@ } ); }, - renderPointerContainers: function() { + renderPointerContainers: function () { var self = this; return [ $( '
' ) .addClass( 'mw-revslider-pointer-container-newer' ) - .click( function( event ) { + .click( function ( event ) { self.sliderLineClickHandler( event, $( this ) ); } ) .append( @@ -64,7 +64,7 @@ ), $( '
' ) .addClass( 'mw-revslider-pointer-container-older' ) - .click( function( event ) { + .click( function ( event ) { self.sliderLineClickHandler( event, $( this ) ); } ) .append( @@ -79,7 +79,7 @@ * * @param {jQuery} $revisions */ - initPointers: function( $revisions ) { + initPointers: function ( $revisions ) { var $pointers, $pointerOlder = this.pointerOlder.getView().getElement(), $pointerNewer = this.pointerNewer.getView().getElement(), @@ -87,7 +87,7 @@ $pointers = this.$element.find( '.mw-revslider-pointer' ); - $( 'body' ).keydown( function( e ) { + $( 'body' ).keydown( function ( e ) { if ( e.which === 27 ) { escapePressed = true; $pointers.trigger( 'mouseup' ); @@ -106,7 +106,7 @@ SliderViewTwo.super.prototype.resetPointerStylesBasedOnPosition.call( this ); }, - draggableDragAction: function( event, ui, pointer, lastValidLeftPos ) { + draggableDragAction: function ( event, ui, pointer, lastValidLeftPos ) { var pos, $revisions, $hoveredRevisionWrapper; pos = this.getRevisionPositionFromLeftOffset( @@ -124,7 +124,7 @@ return pos; }, - setPointerDragCursor: function() { + setPointerDragCursor: function () { $( '.mw-revslider-pointer, ' + '.mw-revslider-pointer-container, ' + '.mw-revslider-pointer-container-newer, ' + @@ -134,7 +134,7 @@ .addClass( 'mw-revslider-pointer-grabbing' ); }, - removePointerDragCursor: function() { + removePointerDragCursor: function () { $( '.mw-revslider-pointer, ' + '.mw-revslider-pointer-container, ' + '.mw-revslider-pointer-container-newer, ' + @@ -144,7 +144,7 @@ .removeClass( 'mw-revslider-pointer-grabbing' ); }, - showTooltipsOnMouseMoveHandler: function( event, lastValidPosition ) { + showTooltipsOnMouseMoveHandler: function ( event, lastValidPosition ) { var pos = this.getRevisionPositionFromLeftOffset( event.pageX ), $hoveredRevisionWrapper; @@ -158,7 +158,7 @@ return pos; }, - sliderLineClickHandler: function( event, $line ) { + sliderLineClickHandler: function ( event, $line ) { var pos = this.getRevisionPositionFromLeftOffset( event.pageX ), $clickedRev, pointerMoved, pointerOther, $revisions; @@ -187,7 +187,7 @@ this.alignPointers(); }, - getRevisionPositionFromLeftOffset: function( leftOffset ) { + getRevisionPositionFromLeftOffset: function ( leftOffset ) { var $revisions = this.getRevisionsElement(), revisionsX = $revisions.offset().left, pos = Math.ceil( Math.abs( leftOffset - revisionsX ) / this.revisionWidth ); @@ -204,15 +204,15 @@ return pos; }, - resetPointerStylesBasedOnPosition: function() { + resetPointerStylesBasedOnPosition: function () { this.updateOlderSliderLineCSS(); this.updateNewerSliderLineCSS(); }, - resetPointerColorsBasedOnValues: function() { + resetPointerColorsBasedOnValues: function () { }, - updateOlderSliderLineCSS: function() { + updateOlderSliderLineCSS: function () { var widthToSet = ( this.getOlderDistanceToOldest() + this.getDistanceBetweenPointers() ) * this.revisionWidth, marginToSet = -this.revisionWidth / 2; @@ -224,7 +224,7 @@ ); }, - updateNewerSliderLineCSS: function() { + updateNewerSliderLineCSS: function () { var widthToSet = ( this.getNewerDistanceToNewest() + this.getDistanceBetweenPointers() + 2 ) * this.revisionWidth, marginToSet = ( this.getOlderDistanceToOldest() * this.revisionWidth ) - @@ -238,7 +238,7 @@ ); }, - setSliderLineCSS: function( $lineContainer, widthToSet, marginToSet ) { + setSliderLineCSS: function ( $lineContainer, widthToSet, marginToSet ) { if ( this.dir === 'ltr' ) { $lineContainer.css( { width: widthToSet, @@ -252,23 +252,23 @@ } }, - getOlderDistanceToOldest: function() { + getOlderDistanceToOldest: function () { return this.pointerOlder.getPosition() - this.slider.getOldestVisibleRevisionIndex(); }, - getNewerDistanceToNewest: function() { + getNewerDistanceToNewest: function () { return this.slider.getNewestVisibleRevisionIndex() - this.pointerNewer.getPosition(); }, - getDistanceBetweenPointers: function() { + getDistanceBetweenPointers: function () { return this.pointerNewer.getPosition() - this.pointerOlder.getPosition(); }, - getRevisionsElement: function() { + getRevisionsElement: function () { return this.slider.getRevisions().getView().getElement(); }, - revisionWrapperClickHandler: function() { + revisionWrapperClickHandler: function () { } } ); diff --git a/modules/ext.RevisionSlider.init.js b/modules/ext.RevisionSlider.init.js index 24d8e18d..f964ef4e 100644 --- a/modules/ext.RevisionSlider.init.js +++ b/modules/ext.RevisionSlider.init.js @@ -4,7 +4,7 @@ expanded = autoExpand, autoExpandButton, toggleButton = OO.ui.ButtonWidget.static.infuse( $( '.mw-revslider-toggle-button' ) ), - initialize = function() { + initialize = function () { var startTime = mw.now(), api = new mw.libs.revisionSlider.Api( mw.util.wikiScript( 'api' ) ); diff --git a/package.json b/package.json index a78278f1..6c429cdf 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ }, "devDependencies": { "eslint": "3.12.2", - "eslint-config-wikimedia": "0.3.0", + "eslint-config-wikimedia": "0.4.0", "grunt": "1.0.1", "grunt-banana-checker": "0.5.0", "grunt-eslint": "19.0.0",