Esanders has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/327198 )

Change subject: Replace jshint/jscs with eslint
......................................................................

Replace jshint/jscs with eslint

Change-Id: I3b3f8c7b7c0856e00e7856bba87642ee4580cc2c
---
A .eslintrc.json
D .jscsrc
D .jshintignore
D .jshintrc
M Gruntfile.js
M package.json
M resources/controller/uw.controller.Details.js
M resources/details/uw.CampaignDetailsWidget.js
M resources/details/uw.CategoriesDetailsWidget.js
M resources/details/uw.DateDetailsWidget.js
M resources/details/uw.DeedChooserDetailsWidget.js
M resources/details/uw.DescriptionDetailsWidget.js
M resources/details/uw.DescriptionsDetailsWidget.js
M resources/details/uw.LocationDetailsWidget.js
M resources/details/uw.OtherDetailsWidget.js
M resources/details/uw.TitleDetailsWidget.js
M resources/handlers/mw.FirefoggHandler.js
M resources/jquery/jquery.morphCrossfade.js
M resources/mw.Escaper.js
M resources/mw.FlickrChecker.js
M resources/mw.GroupProgressBar.js
M resources/mw.QuickTitleChecker.js
M resources/mw.UploadWizard.js
M resources/mw.UploadWizardDeed.js
M resources/mw.UploadWizardDeedChooser.js
M resources/mw.UploadWizardDeedOwnWork.js
M resources/mw.UploadWizardDeedThirdParty.js
M resources/mw.UploadWizardDetails.js
M resources/mw.UploadWizardLicenseInput.js
M resources/mw.UploadWizardPage.js
M resources/mw.UploadWizardUpload.js
M resources/mw.UploadWizardUploadInterface.js
M resources/mw.canvas.js
M resources/transports/mw.FirefoggTransport.js
M resources/transports/mw.FormDataTransport.js
M resources/ui/steps/uw.ui.Thanks.js
M resources/ui/uw.ui.Wizard.js
M resources/uw.ConcurrentQueue.js
M resources/uw.CopyMetadataWidget.js
M resources/uw.DetailsWidget.js
M resources/uw.FieldLayout.js
M resources/uw.units.js
M tests/qunit/controller/uw.controller.Details.test.js
M tests/qunit/uw.TitleDetailsWidget.test.js
44 files changed, 124 insertions(+), 168 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/98/327198/1

diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..b0df7c7
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,17 @@
+{
+       "extends": "wikimedia",
+       "env": {
+               "browser": true,
+               "jquery": true,
+               "qunit": true
+       },
+       "globals": {
+               "OO": false,
+               "mediaWiki": false,
+               "sinon": false
+       },
+       "rules": {
+               "dot-notation": [ "error", { "allowKeywords": true } ],
+               "valid-jsdoc": 0
+       }
+}
diff --git a/.jscsrc b/.jscsrc
deleted file mode 100644
index 7ca08f2..0000000
--- a/.jscsrc
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-       "preset": "wikimedia",
-
-       "jsDoc": {
-               "checkAnnotations": {
-                       "preset": "jsduck5",
-                       "extra": {
-                               "see": true
-                       }
-               },
-               "checkParamNames": true,
-               "checkRedundantAccess": true,
-               "checkRedundantReturns": true,
-               "requireNewlineAfterDescription": true,
-               "requireParamTypes": true,
-               "requireReturnTypes": true
-       },
-
-       "excludeFiles": [ "resources/jquery/**" ]
-}
diff --git a/.jshintignore b/.jshintignore
deleted file mode 100644
index f78e88c..0000000
--- a/.jshintignore
+++ /dev/null
@@ -1 +0,0 @@
-resources/jquery/*.js
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 4425c1f..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,28 +0,0 @@
-{
-       // Enforcing
-       "bitwise": true,
-       "eqeqeq": true,
-       "freeze": true,
-       "latedef": "nofunc",
-       "futurehostile": true,
-       "noarg": true,
-       "nonew": true,
-       "undef": true,
-       "unused": true,
-       "forin": true,
-
-       "strict": false,
-
-       // Relaxing
-
-       // Environment
-       "browser": true,
-       "jquery": true,
-
-       "globals": {
-               "mediaWiki": false,
-               "OO": false,
-               "QUnit": false,
-               "sinon": false
-       }
-}
diff --git a/Gruntfile.js b/Gruntfile.js
index b7d07c8..ca8a08e 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -2,27 +2,26 @@
  * Grunt file
  */
 
-/*jshint node:true */
+/* eslint-env node */
+
 module.exports = function ( grunt ) {
-       grunt.loadNpmTasks( 'grunt-contrib-jshint' );
-       grunt.loadNpmTasks( 'grunt-contrib-watch' );
-       grunt.loadNpmTasks( 'grunt-jsonlint' );
        grunt.loadNpmTasks( 'grunt-banana-checker' );
-       grunt.loadNpmTasks( 'grunt-jscs' );
+       grunt.loadNpmTasks( 'grunt-contrib-watch' );
+       grunt.loadNpmTasks( 'grunt-eslint' );
+       grunt.loadNpmTasks( 'grunt-jsonlint' );
        grunt.loadNpmTasks( 'grunt-stylelint' );
 
        grunt.initConfig( {
-               jshint: {
+               eslint: {
                        options: {
-                               jshintrc: true
+                               fix: true
                        },
                        all: [
                                '*.js',
-                               '{resources,docs,tests}/**/*.js'
+                               '{resources,docs,tests}/**/*.js',
+                               // TODO: Move to a /lib folder
+                               '!resources/jquery/jquery.lazyload.js'
                        ]
-               },
-               jscs: {
-                       src: '<%= jshint.all %>'
                },
                stylelint: {
                        options: {
@@ -35,8 +34,8 @@
                },
                watch: {
                        files: [
-                               '.{stylelintrc,jscsrc,jshintignore,jshintrc}',
-                               '<%= jshint.all %>',
+                               '.{stylelintrc,eslintrc.json}',
+                               '<%= eslint.all %>',
                                '<%= stylelint.all %>'
                        ],
                        tasks: 'test'
@@ -49,6 +48,6 @@
                }
        } );
 
-       grunt.registerTask( 'test', [ 'jshint', 'jscs', 'stylelint', 
'jsonlint', 'banana' ] );
+       grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'jsonlint', 
'banana' ] );
        grunt.registerTask( 'default', 'test' );
 };
diff --git a/package.json b/package.json
index 39faa7f..196df70 100644
--- a/package.json
+++ b/package.json
@@ -10,11 +10,11 @@
   },
   "license": "GPL-2.0+",
   "devDependencies": {
+    "eslint-config-wikimedia": "0.3.0",
     "grunt": "1.0.1",
     "grunt-banana-checker": "0.5.0",
-    "grunt-contrib-jshint": "1.0.0",
     "grunt-contrib-watch": "1.0.0",
-    "grunt-jscs": "2.8.0",
+    "grunt-eslint": "19.0.0",
     "grunt-jsonlint": "1.0.7",
     "grunt-stylelint": "0.6.0",
     "stylelint-config-wikimedia": "0.3.0"
diff --git a/resources/controller/uw.controller.Details.js 
b/resources/controller/uw.controller.Details.js
index c64bede..b4f53c0 100644
--- a/resources/controller/uw.controller.Details.js
+++ b/resources/controller/uw.controller.Details.js
@@ -181,8 +181,8 @@
                                // warnings) and turn it into a one-dimensional 
warnings array
                                var args = Array.prototype.slice.call( 
arguments ),
                                        warnings = args.reduce( function ( 
result, warnings ) {
-                                       return result.concat( warnings );
-                               }, [] );
+                                               return result.concat( warnings 
);
+                                       }, [] );
 
                                if ( warnings.length ) {
                                        // One of the DetailsWidgets has 
warnings
diff --git a/resources/details/uw.CampaignDetailsWidget.js 
b/resources/details/uw.CampaignDetailsWidget.js
index e558e2d..5b54610 100644
--- a/resources/details/uw.CampaignDetailsWidget.js
+++ b/resources/details/uw.CampaignDetailsWidget.js
@@ -87,4 +87,4 @@
                this.input.setValue( serialized.value );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/details/uw.CategoriesDetailsWidget.js 
b/resources/details/uw.CategoriesDetailsWidget.js
index dc5926a..ad5a5f7 100644
--- a/resources/details/uw.CategoriesDetailsWidget.js
+++ b/resources/details/uw.CategoriesDetailsWidget.js
@@ -129,4 +129,4 @@
                this.categoriesWidget.setItemsFromData( serialized.value );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/details/uw.DateDetailsWidget.js 
b/resources/details/uw.DateDetailsWidget.js
index b2fca31..a3aa084 100644
--- a/resources/details/uw.DateDetailsWidget.js
+++ b/resources/details/uw.DateDetailsWidget.js
@@ -207,4 +207,4 @@
                this.dateInputWidget.setValue( serialized.value );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/details/uw.DeedChooserDetailsWidget.js 
b/resources/details/uw.DeedChooserDetailsWidget.js
index 3f890fa..6370bb7 100644
--- a/resources/details/uw.DeedChooserDetailsWidget.js
+++ b/resources/details/uw.DeedChooserDetailsWidget.js
@@ -103,8 +103,7 @@
                        getSerialized: function () {
                                return {};
                        },
-                       setSerialized: function ( serialized ) {
-                               /* jshint unused:false */
+                       setSerialized: function () {
                        }
                }, overrides );
        };
@@ -142,4 +141,4 @@
                }
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/details/uw.DescriptionDetailsWidget.js 
b/resources/details/uw.DescriptionDetailsWidget.js
index 39522d7..c453927 100644
--- a/resources/details/uw.DescriptionDetailsWidget.js
+++ b/resources/details/uw.DescriptionDetailsWidget.js
@@ -181,4 +181,4 @@
                this.descriptionInput.setValue( serialized.description );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/details/uw.DescriptionsDetailsWidget.js 
b/resources/details/uw.DescriptionsDetailsWidget.js
index c126582..08a65c9 100644
--- a/resources/details/uw.DescriptionsDetailsWidget.js
+++ b/resources/details/uw.DescriptionsDetailsWidget.js
@@ -159,4 +159,4 @@
                this.recountDescriptions();
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/details/uw.LocationDetailsWidget.js 
b/resources/details/uw.LocationDetailsWidget.js
index 0727fc6..d6f6bf3 100644
--- a/resources/details/uw.LocationDetailsWidget.js
+++ b/resources/details/uw.LocationDetailsWidget.js
@@ -197,4 +197,4 @@
                return ( degrees * 1 ) + ( minutes / 60.0 ) + ( seconds / 
3600.0 );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/details/uw.OtherDetailsWidget.js 
b/resources/details/uw.OtherDetailsWidget.js
index 16db68f..9585ea0 100644
--- a/resources/details/uw.OtherDetailsWidget.js
+++ b/resources/details/uw.OtherDetailsWidget.js
@@ -52,4 +52,4 @@
                this.textInput.setValue( serialized.other );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/details/uw.TitleDetailsWidget.js 
b/resources/details/uw.TitleDetailsWidget.js
index 9da1a81..59d7f20 100644
--- a/resources/details/uw.TitleDetailsWidget.js
+++ b/resources/details/uw.TitleDetailsWidget.js
@@ -225,4 +225,4 @@
                this.titleInput.setValue( serialized.title );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/handlers/mw.FirefoggHandler.js 
b/resources/handlers/mw.FirefoggHandler.js
index 6746928..dca4123 100644
--- a/resources/handlers/mw.FirefoggHandler.js
+++ b/resources/handlers/mw.FirefoggHandler.js
@@ -59,6 +59,7 @@
                                upload = this.upload;
 
                        // Bail on non-ASCII filenames
+                       // eslint-disable-next-line no-control-regex
                        if ( !this.upload.title || !( /^[\x00-\x7F]*$/.test( 
this.upload.title.getMain() ) ) ) {
                                this.upload.setError( 'firefogg-nonascii', '' );
                                this.upload.ui.setStatus( 
'mwe-upwiz-firefogg-nonascii' );
diff --git a/resources/jquery/jquery.morphCrossfade.js 
b/resources/jquery/jquery.morphCrossfade.js
index ddc6e2e..5a778f5 100644
--- a/resources/jquery/jquery.morphCrossfade.js
+++ b/resources/jquery/jquery.morphCrossfade.js
@@ -83,7 +83,7 @@
                                $newPanel = ( typeof newPanelSelector === 
'string' ) ?
                                        $container.find( newPanelSelector ) : 
$( newPanelSelector );
 
-                       if ( $oldPanel.get(0) !== $newPanel.get(0) ) {
+                       if ( $oldPanel.get( 0 ) !== $newPanel.get( 0 ) ) {
                                if ( $oldPanel.length ) {
                                        // remove auto setting of height from 
container, and
                                        // make doubly sure that the container 
height is equal to oldPanel,
@@ -112,4 +112,4 @@
                return this;
        };
 
-} )( jQuery );
+}( jQuery ) );
diff --git a/resources/mw.Escaper.js b/resources/mw.Escaper.js
index cd7d01e..42e9459 100644
--- a/resources/mw.Escaper.js
+++ b/resources/mw.Escaper.js
@@ -148,4 +148,4 @@
                        return wikitext.replace( searchRegex, callback );
                }
        };
-} )( mediaWiki, OO );
+}( mediaWiki, OO ) );
diff --git a/resources/mw.FlickrChecker.js b/resources/mw.FlickrChecker.js
index aea0df0..04cc8a5 100644
--- a/resources/mw.FlickrChecker.js
+++ b/resources/mw.FlickrChecker.js
@@ -1,5 +1,4 @@
-// Only turning these jscs options off for ''this file''
-/* jscs:disable disallowDanglingUnderscores, 
requireCamelCaseOrUpperCaseIdentifiers */
+/* eslint-disable camelcase, no-underscore-dangle */
 ( function ( mw, $, OO ) {
        mw.FlickrChecker = function ( ui, selectButton ) {
                this.ui = ui;
@@ -755,4 +754,4 @@
                }
        };
 
-} )( mediaWiki, jQuery, OO );
+}( mediaWiki, jQuery, OO ) );
diff --git a/resources/mw.GroupProgressBar.js b/resources/mw.GroupProgressBar.js
index 4403f12..1718129 100644
--- a/resources/mw.GroupProgressBar.js
+++ b/resources/mw.GroupProgressBar.js
@@ -1,4 +1,4 @@
-/*global moment*/
+/* global moment */
 ( function ( mw, $, moment ) {
        /**
         * this is a progress bar for monitoring multiple objects, giving 
summary view
@@ -119,7 +119,7 @@
                 * @param {number} [time] The time this bar is presumed to have 
started (epoch milliseconds)
                 */
                setBeginTime: function ( time ) {
-                       this.beginTime = time ? time : ( new Date() ).getTime();
+                       this.beginTime = time || ( new Date() ).getTime();
                },
 
                /**
diff --git a/resources/mw.QuickTitleChecker.js 
b/resources/mw.QuickTitleChecker.js
index 7bd068c..785531b 100644
--- a/resources/mw.QuickTitleChecker.js
+++ b/resources/mw.QuickTitleChecker.js
@@ -23,6 +23,7 @@
                invalid: [
                        
/[\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]/, // NBSP and 
other unusual spaces
                        /[\u202A-\u202E]/, // BiDi overrides
+                       // eslint-disable-next-line no-control-regex
                        /[\x00-\x1f]/, // Control characters
                        /\uFEFF/, // Byte order mark
                        /\u00AD/, // Soft-hyphen
@@ -80,4 +81,4 @@
                return errors;
        };
 
-} )( mediaWiki, jQuery );
+}( mediaWiki, jQuery ) );
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index 7b88660..a76abfb 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -169,4 +169,4 @@
                        );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery ) );
diff --git a/resources/mw.UploadWizardDeed.js b/resources/mw.UploadWizardDeed.js
index 18d9378..8d6b08d 100644
--- a/resources/mw.UploadWizardDeed.js
+++ b/resources/mw.UploadWizardDeed.js
@@ -62,4 +62,4 @@
                }
        };
 
-} )( mediaWiki );
+}( mediaWiki ) );
diff --git a/resources/mw.UploadWizardDeedChooser.js 
b/resources/mw.UploadWizardDeedChooser.js
index d76d266..d024a39 100644
--- a/resources/mw.UploadWizardDeedChooser.js
+++ b/resources/mw.UploadWizardDeedChooser.js
@@ -47,7 +47,7 @@
                                        chooser.onLayoutReady = 
chooser.selectDeed.bind( chooser, deed );
                                }
                                $deedInterface.find( 
'span.mwe-upwiz-deed-header input' ).click( function () {
-                                       if ( $( this ).is( ':checked' )  ) {
+                                       if ( $( this ).is( ':checked' ) ) {
                                                chooser.selectDeed( deed );
                                        }
                                } );
@@ -160,4 +160,4 @@
 
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery ) );
diff --git a/resources/mw.UploadWizardDeedOwnWork.js 
b/resources/mw.UploadWizardDeedOwnWork.js
index df5664b..aee90c1 100644
--- a/resources/mw.UploadWizardDeedOwnWork.js
+++ b/resources/mw.UploadWizardDeedOwnWork.js
@@ -25,7 +25,7 @@
                        deed = new mw.UploadWizardDeed(),
                        ownWork = config.licensing.ownWork;
 
-               uploadCount = uploadCount ? uploadCount : 1;
+               uploadCount = uploadCount || 1;
 
                deed.authorInput = new OO.ui.TextInputWidget( {
                        name: 'author',
@@ -295,4 +295,4 @@
                } );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery ) );
diff --git a/resources/mw.UploadWizardDeedThirdParty.js 
b/resources/mw.UploadWizardDeedThirdParty.js
index 973125d..e57ba63 100644
--- a/resources/mw.UploadWizardDeedThirdParty.js
+++ b/resources/mw.UploadWizardDeedThirdParty.js
@@ -36,7 +36,7 @@
                var
                        deed = new mw.UploadWizardDeed();
 
-               deed.uploadCount = uploadCount ? uploadCount : 1;
+               deed.uploadCount = uploadCount || 1;
 
                deed.sourceInput = new OO.ui.TextInputWidget( {
                        multiline: true,
@@ -204,4 +204,4 @@
                } );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery ) );
diff --git a/resources/mw.UploadWizardDetails.js 
b/resources/mw.UploadWizardDetails.js
index 262808a..d879893 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -1030,4 +1030,4 @@
                }
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/mw.UploadWizardLicenseInput.js 
b/resources/mw.UploadWizardLicenseInput.js
index 6f9d962..1777c8f 100644
--- a/resources/mw.UploadWizardLicenseInput.js
+++ b/resources/mw.UploadWizardLicenseInput.js
@@ -15,7 +15,7 @@
                this.content = new OO.ui.PanelLayout( { padded: true, expanded: 
false } );
                this.$body.append( this.content.$element );
                this.$spinner = $.createSpinner( { size: 'large', type: 'block' 
} )
-                       .css( { width: 200, padding: 20, float: 'none', margin: 
'0 auto' } );
+                       .css( { width: 200, padding: 20, 'float': 'none', 
margin: '0 auto' } );
 
                $( 'body' ).on( 'click', function ( e ) {
                        if ( !$.contains( dialog.$body.get( 0 ), e.target ) ) {
@@ -250,7 +250,7 @@
                        var input = this,
 
                                attrs = {
-                                       id:  this.name + '_' + 
this.inputs.length, // unique id
+                                       id: this.name + '_' + 
this.inputs.length, // unique id
                                        name: this.name, // name of input, 
shared among all checkboxes or radio buttons.
                                        type: this.type, // kind of input
                                        value: 
this.createInputValueFromTemplateConfig( templates, config )
@@ -659,4 +659,4 @@
 
        } );
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/mw.UploadWizardPage.js b/resources/mw.UploadWizardPage.js
index daf4b89..fabdbab 100644
--- a/resources/mw.UploadWizardPage.js
+++ b/resources/mw.UploadWizardPage.js
@@ -56,4 +56,4 @@
                mw.UploadWizardPage();
        } );
 
-} )( mediaWiki, jQuery );
+}( mediaWiki, jQuery ) );
diff --git a/resources/mw.UploadWizardUpload.js 
b/resources/mw.UploadWizardUpload.js
index a3a00b1..d08feed 100644
--- a/resources/mw.UploadWizardUpload.js
+++ b/resources/mw.UploadWizardUpload.js
@@ -202,7 +202,7 @@
                        } else if ( result.error.info ) {
                                info = result.error.info;
                        }
-                       this.setError( code, info );
+                       this.setError( code, info, $extra );
                        return;
                }
 
@@ -407,6 +407,7 @@
                                        binStr = binReader.result;
                                } else {
                                        // Array buffer; convert to binary 
string for the library.
+                                       /* global Uint8Array */
                                        arr = new Uint8Array( binReader.result 
);
                                        binStr = '';
                                        for ( i = 0; i < arr.byteLength; i++ ) {
@@ -415,9 +416,8 @@
                                }
                                try {
                                        meta = mw.libs.jpegmeta( binStr, 
upload.file.fileName );
-                                       // jscs:disable 
requireCamelCaseOrUpperCaseIdentifiers, disallowDanglingUnderscores
+                                       // eslint-disable-next-line camelcase, 
no-underscore-dangle
                                        meta._binary_data = null;
-                                       // jscs:enable
                                } catch ( e ) {
                                        meta = null;
                                }
@@ -697,6 +697,13 @@
                                                return;
                                        }
 
+                                       // executing this should cause a 
.load() or .error() event on the image
+                                       function setSrc() {
+                                               // IE 11 and Opera 12 will not, 
ever, re-request an image that they have already loaded
+                                               // once, regardless of caching 
headers. Append bogus stuff to the URL to make it work.
+                                               image.src = thumb.thumburl + 
'?' + Math.random();
+                                       }
+
                                        // try to load this image with 
exponential backoff
                                        // if the delay goes past 8 seconds, it 
gives up and publishes the event with null
                                        timeoutMs = 100;
@@ -719,13 +726,6 @@
                                                                
deferred.resolve( null );
                                                        }
                                                } );
-
-                                       // executing this should cause a 
.load() or .error() event on the image
-                                       function setSrc() {
-                                               // IE 11 and Opera 12 will not, 
ever, re-request an image that they have already loaded
-                                               // once, regardless of caching 
headers. Append bogus stuff to the URL to make it work.
-                                               image.src = thumb.thumburl + 
'?' + Math.random();
-                                       }
 
                                        // and, go!
                                        setSrc();
@@ -900,7 +900,7 @@
                var scaling = this.getScalingFromConstraints( image, 
constraints );
                return $( '<img/>' )
                        .attr( {
-                               width:  parseInt( image.width * scaling, 10 ),
+                               width: parseInt( image.width * scaling, 10 ),
                                height: parseInt( image.height * scaling, 10 ),
                                src:    image.src
                        } )
@@ -1107,4 +1107,4 @@
                return mw.fileApi.isPreviewableVideo( this.file );
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/mw.UploadWizardUploadInterface.js 
b/resources/mw.UploadWizardUploadInterface.js
index f557105..89b0611 100644
--- a/resources/mw.UploadWizardUploadInterface.js
+++ b/resources/mw.UploadWizardUploadInterface.js
@@ -1,4 +1,4 @@
-       ( function ( mw, uw, $, OO ) {
+( function ( mw, uw, $, OO ) {
        /**
         * Create an interface fragment corresponding to a file input, suitable 
for Upload Wizard.
         *
@@ -174,13 +174,13 @@
         */
        mw.UploadWizardUploadInterface.prototype.showError = function ( code, 
info, $additionalStatus ) {
                var msgKey, args, moreErrorCodes = [
-                       'unknown-warning',
-                       'abusefilter-disallowed',
-                       'abusefilter-warning',
-                       'spamblacklist',
-                       'offline',
-                       'parsererror'
-               ];
+                               'unknown-warning',
+                               'abusefilter-disallowed',
+                               'abusefilter-warning',
+                               'spamblacklist',
+                               'offline',
+                               'parsererror'
+                       ];
 
                this.showIndicator( 'error' );
                // is this an error that we expect to have a message for?
@@ -278,15 +278,15 @@
        */
        mw.UploadWizardUploadInterface.prototype.createImagePickerField = 
function ( index, setDisabled ) {
                var $fieldContainer = $( '<div>' ).attr( {
-                       'class': 'mwe-upwiz-objref-pick-image'
-               } ),
-               attributes = {
-                       type: 'checkbox',
-                       'class': 'imgPicker',
-                       id: 'imgPicker' + index,
-                       disabled: false,
-                       checked: false
-               };
+                               'class': 'mwe-upwiz-objref-pick-image'
+                       } ),
+                       attributes = {
+                               type: 'checkbox',
+                               'class': 'imgPicker',
+                               id: 'imgPicker' + index,
+                               disabled: false,
+                               checked: false
+                       };
 
                if ( setDisabled ) {
                        attributes.disabled = 'disabled';
diff --git a/resources/mw.canvas.js b/resources/mw.canvas.js
index 43b09e3..29c360e 100644
--- a/resources/mw.canvas.js
+++ b/resources/mw.canvas.js
@@ -10,4 +10,4 @@
 
        };
 
-} )( mediaWiki );
+}( mediaWiki ) );
diff --git a/resources/transports/mw.FirefoggTransport.js 
b/resources/transports/mw.FirefoggTransport.js
index e2e76b7..a7a9078 100644
--- a/resources/transports/mw.FirefoggTransport.js
+++ b/resources/transports/mw.FirefoggTransport.js
@@ -180,7 +180,7 @@
                // Update the format:
                this.fogg.setFormat( ( this.getEncodeExt() === 'webm' ) ? 
'webm' : 'ogg' );
 
-               mw.log( 'FirefoggTransport::getEncodeSettings> ' +  
JSON.stringify(  encodeSettings ) );
+               mw.log( 'FirefoggTransport::getEncodeSettings> ' + 
JSON.stringify( encodeSettings ) );
                return encodeSettings;
        };
 }( mediaWiki, jQuery ) );
diff --git a/resources/transports/mw.FormDataTransport.js 
b/resources/transports/mw.FormDataTransport.js
index 6208577..e49c848 100644
--- a/resources/transports/mw.FormDataTransport.js
+++ b/resources/transports/mw.FormDataTransport.js
@@ -171,8 +171,8 @@
                        transport = this;
 
                for ( offset = 0; offset < fileSize; offset += chunkSize ) {
-                       /*jshint loopfunc:true */
                        // Capture offset in a closure
+                       // eslint-disable-next-line no-loop-func
                        ( function ( offset ) {
                                var
                                        newPromise = $.Deferred(),
@@ -189,7 +189,7 @@
                                                } );
                                } );
                                prevPromise = newPromise;
-                       } )( offset );
+                       }( offset ) );
                }
 
                return deferred.promise();
@@ -378,8 +378,8 @@
                $.each( this.formData, function ( key, value ) {
                        params[ key ] = value;
                } );
-               params.checkstatus =  true;
-               params.filekey =  this.filekey;
+               params.checkstatus = true;
+               params.filekey = this.filekey;
                return this.api.post( params )
                        .then( function ( response ) {
                                if ( response.upload && response.upload.result 
=== 'Poll' ) {
diff --git a/resources/ui/steps/uw.ui.Thanks.js 
b/resources/ui/steps/uw.ui.Thanks.js
index 5759c58..40de56c 100644
--- a/resources/ui/steps/uw.ui.Thanks.js
+++ b/resources/ui/steps/uw.ui.Thanks.js
@@ -64,7 +64,7 @@
                } );
 
                this.beginButton = new OO.ui.ButtonWidget( {
-                       label: this.getButtonConfig( 'beginButton', 'label' ) 
||  mw.message( 'mwe-upwiz-upload-another' ).text(),
+                       label: this.getButtonConfig( 'beginButton', 'label' ) 
|| mw.message( 'mwe-upwiz-upload-another' ).text(),
                        flags: [ 'progressive', 'primary' ]
                } );
 
@@ -99,10 +99,10 @@
                var thumbWikiText, $thanksDiv, $thumbnailWrapDiv, 
$thumbnailDiv, $thumbnailCaption, $thumbnailLink;
 
                thumbWikiText = '[[' + [
-                               upload.details.getTitle().getPrefixedText(),
-                               'thumb',
-                               upload.details.getThumbnailCaption()
-                       ].join( '|' ) + ']]';
+                       upload.details.getTitle().getPrefixedText(),
+                       'thumb',
+                       upload.details.getThumbnailCaption()
+               ].join( '|' ) + ']]';
 
                $thanksDiv = $( '<div>' )
                        .addClass( 'mwe-upwiz-thanks ui-helper-clearfix' );
diff --git a/resources/ui/uw.ui.Wizard.js b/resources/ui/uw.ui.Wizard.js
index 5337de1..e805e74 100644
--- a/resources/ui/uw.ui.Wizard.js
+++ b/resources/ui/uw.ui.Wizard.js
@@ -91,7 +91,7 @@
         * @param {Object|string} configAltUploadForm A link or map of 
languages to links, pointing at an alternate form.
         */
        uw.ui.Wizard.prototype.initAltUploadForm = function ( 
configAltUploadForm ) {
-               var altUploadForm, userLanguage, title, $altLink;
+               var altUploadForm, userLanguage, title;
 
                if ( typeof configAltUploadForm === 'object' ) {
                        userLanguage = mw.config.get( 'wgUserLanguage' );
@@ -110,7 +110,7 @@
                        try {
                                title = new mw.Title( altUploadForm );
 
-                               $altLink = $( '<a>' )
+                               $( '<a>' )
                                        .msg( 'mwe-upwiz-subhead-alt-upload' )
                                        .addClass( 'contentSubLink' )
                                        .attr( 'href', title.getUrl() )
diff --git a/resources/uw.ConcurrentQueue.js b/resources/uw.ConcurrentQueue.js
index fc79cb5..a8e94a8 100644
--- a/resources/uw.ConcurrentQueue.js
+++ b/resources/uw.ConcurrentQueue.js
@@ -191,4 +191,4 @@
                }
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/uw.CopyMetadataWidget.js 
b/resources/uw.CopyMetadataWidget.js
index 3ac153f..6545ab3 100644
--- a/resources/uw.CopyMetadataWidget.js
+++ b/resources/uw.CopyMetadataWidget.js
@@ -181,8 +181,8 @@
                                // number in the title. Note: We ignore numbers 
with more than three digits, because these
                                // are more likely to be years ("Wikimania 2011 
Celebration") or other non-sequence
                                // numbers.
-                               /*jshint loopfunc:true */
                                sourceValue.title.title = titleZero.replace( 
/(\D+)(\d{1,3})(\D*)$/,
+                                       // eslint-disable-next-line no-loop-func
                                        function ( str, m1, m2, m3 ) {
                                                var newstr = String( +m2 + i );
                                                return m1 + new Array( 
m2.length + 1 - newstr.length )
@@ -208,4 +208,4 @@
                }
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/uw.DetailsWidget.js b/resources/uw.DetailsWidget.js
index bebbd5f..cf1f4ac 100644
--- a/resources/uw.DetailsWidget.js
+++ b/resources/uw.DetailsWidget.js
@@ -57,38 +57,27 @@
        /**
         * Get a wikitext snippet generated from current state of the widget.
         *
+        * @method
         * @return {string} Wikitext
         */
-       uw.DetailsWidget.prototype.getWikiText = function () {
-               // To satisfy JSCS check for @return without upsetting JSHint 
check for unreachable code:
-               if ( false ) {
-                       return '';
-               }
-               throw new Error( 'Not implemented' );
-       };
+       uw.DetailsWidget.prototype.getWikiText = null;
 
        /**
         * Get a machine-readable representation of the current state of the 
widget. It can be passed to
         * #setSerialized to restore this state (or to set it for another 
instance of the same class).
         *
+        * @method
         * @return {Object}
         */
-       uw.DetailsWidget.prototype.getSerialized = function () {
-               // To satisfy JSCS check for @return without upsetting JSHint 
check for unreachable code:
-               if ( false ) {
-                       return {};
-               }
-               throw new Error( 'Not implemented' );
-       };
+       uw.DetailsWidget.prototype.getSerialized = null;
 
        /**
         * Set the state of this widget from machine-readable representation, 
as returned by
         * #getSerialized.
         *
+        * @method
         * @param {Object} serialized
         */
-       uw.DetailsWidget.prototype.setSerialized = function () {
-               throw new Error( 'Not implemented' );
-       };
+       uw.DetailsWidget.prototype.setSerialized = null;
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/uw.FieldLayout.js b/resources/uw.FieldLayout.js
index 1e24a04..be8535f 100644
--- a/resources/uw.FieldLayout.js
+++ b/resources/uw.FieldLayout.js
@@ -93,4 +93,4 @@
                return $listItem;
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery, OO );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );
diff --git a/resources/uw.units.js b/resources/uw.units.js
index d5e9ef0..c8ee73e 100644
--- a/resources/uw.units.js
+++ b/resources/uw.units.js
@@ -22,4 +22,4 @@
                }
        };
 
-} )( mediaWiki, mediaWiki.uploadWizard );
+}( mediaWiki, mediaWiki.uploadWizard ) );
diff --git a/tests/qunit/controller/uw.controller.Details.test.js 
b/tests/qunit/controller/uw.controller.Details.test.js
index 8270d72..887399f 100644
--- a/tests/qunit/controller/uw.controller.Details.test.js
+++ b/tests/qunit/controller/uw.controller.Details.test.js
@@ -106,7 +106,7 @@
        } );
 
        QUnit.asyncTest( 'transitionAll', 4, function ( assert ) {
-               var tostub, promise,
+               var tostub,
                        donestub = this.sandbox.stub(),
                        ds = [ $.Deferred(), $.Deferred(), $.Deferred() ],
                        ps = [ ds[ 0 ].promise(), ds[ 1 ].promise(), ds[ 2 
].promise() ],
@@ -131,7 +131,7 @@
                        { id: 'aoeu' }
                ];
 
-               promise = step.transitionAll().done( donestub );
+               step.transitionAll().done( donestub );
                setTimeout( function () {
                        calls = [ tostub.getCall( 0 ), tostub.getCall( 1 ), 
tostub.getCall( 2 ) ];
 
diff --git a/tests/qunit/uw.TitleDetailsWidget.test.js 
b/tests/qunit/uw.TitleDetailsWidget.test.js
index a334557..fa7d016 100644
--- a/tests/qunit/uw.TitleDetailsWidget.test.js
+++ b/tests/qunit/uw.TitleDetailsWidget.test.js
@@ -41,4 +41,4 @@
                        );
                } );
        } );
-} )( mediaWiki, mediaWiki.uploadWizard, jQuery );
+}( mediaWiki, mediaWiki.uploadWizard, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/327198
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b3f8c7b7c0856e00e7856bba87642ee4580cc2c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to