eslint: Re-enable valid-jsdoc and make a pass
authorEd Sanders <esanders@wikimedia.org>
Wed, 16 Nov 2016 13:02:22 +0000 (13:02 +0000)
committerJames D. Forrester <jforrester@wikimedia.org>
Thu, 17 Nov 2016 21:06:07 +0000 (13:06 -0800)
Change-Id: I5c3c942d5a9c51628619227c4bbaefd1d92a842d

49 files changed:
.eslintrc.json
resources/src/jquery/jquery.accessKeyLabel.js
resources/src/jquery/jquery.confirmable.js
resources/src/jquery/jquery.expandableField.js
resources/src/jquery/jquery.hidpi.js
resources/src/jquery/jquery.qunit.completenessTest.js
resources/src/jquery/jquery.tablesorter.js
resources/src/jquery/jquery.textSelection.js
resources/src/mediawiki.action/mediawiki.action.history.js
resources/src/mediawiki.legacy/protect.js
resources/src/mediawiki.legacy/wikibits.js
resources/src/mediawiki.special/mediawiki.special.apisandbox.js
resources/src/mediawiki.special/mediawiki.special.upload.js
resources/src/mediawiki.toolbar/toolbar.js
resources/src/mediawiki.widgets.datetime/CalendarWidget.js
resources/src/mediawiki.widgets.datetime/DateTimeFormatter.js
resources/src/mediawiki.widgets.datetime/DateTimeInputWidget.js
resources/src/mediawiki.widgets/mw.widgets.CalendarWidget.js
resources/src/mediawiki.widgets/mw.widgets.CategoryCapsuleItemWidget.js
resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js
resources/src/mediawiki.widgets/mw.widgets.NamespaceInputWidget.js
resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js
resources/src/mediawiki.widgets/mw.widgets.TitleInputWidget.js
resources/src/mediawiki.widgets/mw.widgets.TitleSearchWidget.js
resources/src/mediawiki.widgets/mw.widgets.UserInputWidget.js
resources/src/mediawiki/api.js
resources/src/mediawiki/api/upload.js
resources/src/mediawiki/api/watch.js
resources/src/mediawiki/htmlform/htmlform.Element.js
resources/src/mediawiki/mediawiki.ForeignStructuredUpload.BookletLayout.js
resources/src/mediawiki/mediawiki.ForeignStructuredUpload.js
resources/src/mediawiki/mediawiki.ForeignUpload.js
resources/src/mediawiki/mediawiki.Title.js
resources/src/mediawiki/mediawiki.Upload.Dialog.js
resources/src/mediawiki/mediawiki.Upload.js
resources/src/mediawiki/mediawiki.Uri.js
resources/src/mediawiki/mediawiki.confirmCloseWindow.js
resources/src/mediawiki/mediawiki.debug.js
resources/src/mediawiki/mediawiki.errorLogger.js
resources/src/mediawiki/mediawiki.inspect.js
resources/src/mediawiki/mediawiki.jqueryMsg.js
resources/src/mediawiki/mediawiki.js
resources/src/mediawiki/mediawiki.notification.js
resources/src/mediawiki/mediawiki.searchSuggest.js
resources/src/mediawiki/mediawiki.template.mustache.js
resources/src/mediawiki/mediawiki.util.js
resources/src/mediawiki/mediawiki.viewport.js
resources/src/mediawiki/page/gallery-slideshow.js
resources/src/startup.js

index 135d3b9..044dd72 100644 (file)
@@ -13,7 +13,6 @@
                "OO": false
        },
        "rules": {
-               "dot-notation": 0,
-               "valid-jsdoc": 0
+               "dot-notation": 0
        }
 }
index 63b599b..f25944c 100644 (file)
         *
         * @method updateTooltipAccessKeys_getAccessKeyPrefix
         * @deprecated since 1.27 Use #getAccessKeyModifiers
+        * @param {Object} [ua] An object with a 'userAgent' and 'platform' property.
+        * @return {string}
         */
        $.fn.updateTooltipAccessKeys.getAccessKeyPrefix = function ( ua ) {
                return getAccessKeyModifiers( ua ).join( '-' ) + '-';
index 1ecce6c..7931c81 100644 (file)
@@ -12,6 +12,7 @@
                return data;
        };
 
+       // eslint-disable-next-line valid-jsdoc
        /**
         * Enable inline confirmation for given clickable element (like `<a />` or `<button />`).
         *
index f9db72f..0bfa8f3 100644 (file)
@@ -19,6 +19,9 @@
        $.expandableField = {
                /**
                 * Expand the field, make the callback
+                *
+                * @param {jQuery.Event} e Event
+                * @param {Object} context
                 */
                expandField: function ( e, context ) {
                        context.config.beforeExpand.call( context.data.$field, context );
@@ -29,6 +32,9 @@
                },
                /**
                 * Condense the field, make the callback
+                *
+                * @param {jQuery.Event} e Event
+                * @param {Object} context
                 */
                condenseField: function ( e, context ) {
                        context.config.beforeCondense.call( context.data.$field, context );
index ed31240..7a7109c 100644 (file)
@@ -65,6 +65,7 @@
         *
         * @static
         * @inheritable
+        * @param {number} baseRatio Base ratio
         * @return {number} Device pixel ratio
         */
        $.bracketDevicePixelRatio = function ( baseRatio ) {
index 68bf830..4353dd7 100644 (file)
 
                        // Hard ignores
                        if ( this.ignoreFn( currVal, this, currPathArray ) ) {
-                               return null;
+                               return;
                        }
 
                        // Handle the lazy limit
                        this.lazyCounter++;
                        if ( this.lazyCounter > this.lazyLimit ) {
                                log( 'CompletenessTest.fn.walkTheObject> Limit reached: ' + this.lazyCounter, currPathArray );
-                               return null;
+                               return;
                        }
 
                        // Functions
index 3b85f9a..4da05e6 100644 (file)
         * in default (ascending) order when their header cell is clicked the next time.
         *
         * @param {jQuery} $headers
-        * @param {number[][]} sortList
-        * @param {number[][]} headerToColumns
+        * @param {Array} sortList 2D number array
+        * @param {Array} headerToColumns 2D number array
         */
        function setHeadersOrder( $headers, sortList, headerToColumns ) {
                // Loop through all headers to retrieve the indices of the columns the header spans across:
                /**
                 * @param {jQuery} $tables
                 * @param {Object} [settings]
+                * @return {jQuery}
                 */
                construct: function ( $tables, settings ) {
                        return $tables.each( function ( i, table ) {
index b6fbe35..c897302 100644 (file)
 
                /**
                 * Helper function to get an IE TextRange object for an element
+                *
+                * @param {HTMLElement} element
+                * @return {TextRange}
                 */
-               function rangeForElementIE( e ) {
+               function rangeForElementIE( element ) {
                        var sel;
-                       if ( e.nodeName.toLowerCase() === 'input' ) {
-                               return e.createTextRange();
+                       if ( element.nodeName.toLowerCase() === 'input' ) {
+                               return element.createTextRange();
                        } else {
                                sel = document.body.createTextRange();
-                               sel.moveToElementText( e );
+                               sel.moveToElementText( element );
                                return sel;
                        }
                }
@@ -48,6 +51,8 @@
                 * Helper function for IE for activating the textarea. Called only in the
                 * IE-specific code paths below; makes use of IE-specific non-standard
                 * function setActive() if possible to avoid screen flicker.
+                *
+                * @param {HTMLElement} element
                 */
                function activateElementOnIE( element ) {
                        if ( element.setActive ) {
                fn = {
                        /**
                         * Get the contents of the textarea
+                        *
+                        * @return {string}
                         */
                        getContents: function () {
                                return this.val();
                        },
                        /**
                         * Set the contents of the textarea, replacing anything that was there before
+                        *
+                        * @param {string} content
                         */
                        setContents: function ( content ) {
                                this.val( content );
@@ -73,6 +82,8 @@
                        /**
                         * Get the currently selected text in this textarea. Will focus the textarea
                         * in some browsers (IE/Opera)
+                        *
+                        * @return {string}
                         */
                        getSelection: function () {
                                var retval, range,
                         * Inserts text at the beginning and end of a text selection, optionally
                         * inserting text at the caret when selection is empty.
                         *
+                        * @param {Object} options Options
                         * FIXME document the options parameters
+                        * @return {jQuery}
                         */
                        encapsulateSelection: function ( options ) {
                                return this.each( function () {
                                         * Do the splitlines stuff.
                                         *
                                         * Wrap each line of the selected text with pre and post
+                                        *
+                                        * @param {string} selText Selected text
+                                        * @param {string} pre Text before
+                                        * @param {string} post Text after
+                                        * @return {string} Wrapped text
                                         */
                                        function doSplitLines( selText, pre, post ) {
                                                var i,
                         *
                         * Will focus the textarea in some browsers (IE/Opera)
                         *
+                        * @param {Object} options Options
                         * FIXME document the options parameters
+                        * @return {number} Position
                         */
                        getCaretPosition: function ( options ) {
                                function getCaret( e ) {
                                return getCaret( this.get( 0 ) );
                        },
                        /**
+                        * @param {Object} options options
                         * FIXME document the options parameters
+                        * @return {jQuery}
                         */
                        setSelection: function ( options ) {
                                return this.each( function () {
                         * Scroll a textarea to the current cursor position. You can set the cursor
                         * position with setSelection()
                         *
-                        * @param {boolean} options Whether to force a scroll even if the caret position
-                        *  is already visible. Defaults to false
-                        *
-                        * FIXME document the options parameters (function body suggests options.force is a boolean, not options itself)
+                        * @param {Object} options options
+                        * @cfg {boolean} [force=false] Whether to force a scroll even if the caret position
+                        *  is already visible.
+                        * FIXME document the options parameters
+                        * @return {jQuery}
                         */
                        scrollToCaretPosition: function ( options ) {
                                function getLineLength( e ) {
index 077d5e3..b3b0af2 100644 (file)
@@ -10,6 +10,7 @@ jQuery( function ( $ ) {
         * @ignore
         * @context {Element} input
         * @param {jQuery.Event} e
+        * @return {boolean} False to cancel the default event
         */
        function updateDiffRadios() {
                var nextState = 'before',
index fd3fb00..aa49ae1 100644 (file)
@@ -4,6 +4,8 @@
                /**
                 * Set up the protection chaining interface (i.e. "unlock move permissions" checkbox)
                 * on the protection form
+                *
+                * @return {boolean}
                 */
                init: function () {
                        var $cell = $( '<td>' ),
@@ -47,6 +49,7 @@
                        $( '#mwProtect-reason' ).byteLimit( 180 );
 
                        this.updateCascadeCheckbox();
+                       return true;
                },
 
                /**
index 70a2ecd..8062849 100644 (file)
 
        /**
         * @deprecated since 1.17 Use mw.loader instead. Warnings added in 1.25.
+        * @param {string} url
+        * @return {HTMLElement} Script tag
         */
        function importScriptURI( url ) {
                var s;
 
        /**
         * @deprecated since 1.17 Use mw.loader instead. Warnings added in 1.25.
+        * @param {string} url
+        * @param {string} media
+        * @return {HTMLElement} Link tag
         */
        function importStylesheetURI( url, media ) {
                var l = document.createElement( 'link' );
index 16c10fb..217bd92 100644 (file)
 
                /**
                 * Update the current query when the page hash changes
+                *
+                * @return {boolean} Successful
                 */
                loadFromHash: function () {
                        var params, m, re,
index 9e81c4e..f818096 100644 (file)
        $( function () {
                /**
                 * Is the FileAPI available with sufficient functionality?
+                *
+                * @return {boolean}
                 */
                function hasFileAPI() {
                        return window.FileReader !== undefined;
 
                /**
                 * Check if the file does not exceed the maximum size
+                *
+                * @param {File} file
+                * @return {boolean}
                 */
                function checkMaxUploadSize( file ) {
                        var maxSize, $error;
index bb26c0f..e9fc024 100644 (file)
         *  current cursor position.
         * @param {string} [button.imageId] `id` attribute of the button HTML element. Can be
         *  used to define the image with CSS if it's not provided as `imageFile`.
+        * @param {string} [speedTip]
+        * @param {string} [tagOpen]
+        * @param {string} [tagClose]
+        * @param {string} [sampleText]
+        * @param {string} [imageId]
         */
        function insertButton( button, speedTip, tagOpen, tagClose, sampleText, imageId ) {
                var $button;
index 31b1cd5..54a5a85 100644 (file)
                return this.selected;
        };
 
+       // eslint-disable-next-line valid-jsdoc
        /**
         * Set the selected dates
         *
                return this.focusedDate;
        };
 
+       // eslint-disable-next-line valid-jsdoc
        /**
         * Set the currently-focused date
         *
         *
         * @protected
         * @param {jQuery.Event} e Key down event
+        * @return {boolean} False to cancel the default event
         */
        mw.widgets.datetime.CalendarWidget.prototype.onKeyDown = function ( e ) {
                var focusedDate = this.getFocusedDate();
index 6e8dbf3..1793849 100644 (file)
                return this.local;
        };
 
+       // eslint-disable-next-line valid-jsdoc
        /**
         * Toggle whether dates are in local time or UTC
         *
index 9388f0d..e9bedf5 100644 (file)
         * @private
         * @param {jQuery} $field
         * @param {jQuery.Event} e Key down event
+        * @return {boolean} False to cancel the default event
         */
        mw.widgets.datetime.DateTimeInputWidget.prototype.onFieldKeyDown = function ( $field, e ) {
                var spec = $field.data( 'mw-widgets-datetime-dateTimeInputWidget-fieldSpec' );
         * @private
         * @param {jQuery} $field
         * @param {jQuery.Event} e Change event
+        * @return {boolean} False to cancel the default event
         */
        mw.widgets.datetime.DateTimeInputWidget.prototype.onFieldWheel = function ( $field, e ) {
                var delta = 0,
index 9fea5f8..57a3d9c 100644 (file)
         * what gets clicked.
         *
         * @private
+        * @param {jQuery.Event} e Click event
         */
        mw.widgets.CalendarWidget.prototype.onBodyClick = function ( e ) {
                var
         *
         * @private
         * @param {jQuery.Event} e Mouse click event
+        * @return {boolean} False to cancel the default event
         */
        mw.widgets.CalendarWidget.prototype.onClick = function ( e ) {
                if ( !this.isDisabled() && e.which === 1 ) {
         *
         * @private
         * @param {jQuery.Event} e Key down event
+        * @return {boolean} False to cancel the default event
         */
        mw.widgets.CalendarWidget.prototype.onKeyDown = function ( e ) {
                var
index c4a8664..488d9e0 100644 (file)
@@ -94,7 +94,8 @@
         * @extends mw.Title
         *
         * @constructor
-        * @inheritdoc
+        * @param {string} title
+        * @param {number} [namespace]
         */
        function ForeignTitle( title, namespace ) {
                // We only need to handle categories here... but we don't know the target language.
        };
 
        /**
-        * @class mw.widgets.CategoryCapsuleItemWidget
-        *
         * Category selector capsule item widget. Extends OO.ui.CapsuleItemWidget with the ability to link
         * to the given page, and to show its existence status (i.e., whether it is a redlink).
         *
+        * @class mw.widgets.CategoryCapsuleItemWidget
         * @uses mw.Api
         * @extends OO.ui.CapsuleItemWidget
         *
index 167cb4f..7f5e608 100644 (file)
         *
         * @private
         * @param {jQuery.Event} e Mouse click event
+        * @return {boolean} False to cancel the default event
         */
        mw.widgets.DateInputWidget.prototype.onClick = function ( e ) {
                if ( !this.isDisabled() && e.which === 1 ) {
         *
         * @private
         * @param {jQuery.Event} e Key press event
+        * @return {boolean} False to cancel the default event
         */
        mw.widgets.DateInputWidget.prototype.onKeyPress = function ( e ) {
                if ( !this.isDisabled() &&
         *
         * @private
         * @param {jQuery.Event} e Key press event
+        * @return {boolean} False to cancel the default event
         */
        mw.widgets.DateInputWidget.prototype.onCalendarKeyPress = function ( e ) {
                if ( !this.isDisabled() && e.which === OO.ui.Keys.ENTER ) {
         *
         * @private
         * @param {jQuery.Event} e Mouse click event
+        * @return {boolean} False to cancel the default event
         */
        mw.widgets.DateInputWidget.prototype.onCalendarClick = function ( e ) {
                if (
index c88395e..aa0c739 100644 (file)
@@ -36,6 +36,8 @@
 
        /**
         * @private
+        * @param {Object} [config] Configuration options
+        * @return {Object[]} Dropdown options
         */
        mw.widgets.NamespaceInputWidget.prototype.getNamespaceDropdownOptions = function ( config ) {
                var options,
index d816335..39bee7c 100755 (executable)
@@ -13,6 +13,7 @@
         * @extends mw.widgets.TitleInputWidget
         *
         * @constructor
+        * @param {Object} [config] Configuration options
         * @cfg {boolean} [pushPending=true] Visually mark the input field as "pending", while
         *  requesting suggestions.
         * @cfg {boolean} [performSearchOnClick=true] If true, the script will start a search when-
index 101a606..a78ad82 100644 (file)
@@ -15,6 +15,7 @@
         * @mixins OO.ui.mixin.LookupElement
         *
         * @constructor
+        * @param {Object} [config] Configuration options
         * @cfg {boolean} [suggestions=true] Display search suggestions
         * @cfg {RegExp|Function|string} [validate] Perform title validation
         */
index 96f9549..5ba9481 100644 (file)
@@ -15,6 +15,7 @@
         * @mixins mw.widgets.TitleWidget
         *
         * @constructor
+        * @param {Object} [config] Configuration options
         */
        mw.widgets.TitleSearchWidget = function MwWidgetsTitleSearchWidget( config ) {
                config = config || {};
index 164fd20..2b3a59f 100644 (file)
@@ -90,6 +90,7 @@
         *
         * @method
         * @param {Mixed} response Response from server
+        * @return {Object}
         */
        mw.widgets.UserInputWidget.prototype.getLookupCacheDataFromResponse = function ( response ) {
                return response.query.allusers || {};
index 529bd9f..b9e05c3 100644 (file)
                 *
                 * @since 1.22
                 * @param {string} type Token type
+                * @param {string} [assert]
                 * @return {jQuery.Promise} Received token.
                 */
                getToken: function ( type, assert ) {
index bf839ad..351ceb2 100644 (file)
@@ -46,6 +46,7 @@
         * Get new iframe object for an upload.
         *
         * @private
+        * @param {string} id
         * @return {HTMLIframeElement}
         */
        function getNewIframe( id ) {
@@ -59,6 +60,8 @@
         * Shortcut for getting hidden inputs
         *
         * @private
+        * @param {string} name
+        * @param {string} val
         * @return {jQuery}
         */
        function getHiddenInput( name, val ) {
                 *
                 * @param {string} filekey
                 * @param {Object} data
+                * @return {jQuery.Promise}
                 */
                uploadFromStash: function ( filekey, data ) {
                        data.filekey = filekey;
index a2ff129..687b475 100644 (file)
@@ -12,6 +12,7 @@
         * @param {string|mw.Title|string[]|mw.Title[]} pages Full page name or instance of mw.Title, or an
         *  array thereof. If an array is passed, the return value passed to the promise will also be an
         *  array of appropriate objects.
+        * @param {Object} [addParams]
         * @return {jQuery.Promise}
         * @return {Function} return.done
         * @return {Object|Object[]} return.done.watch Object or list of objects (depends on the `pages`
index 37474f6..4f672fc 100644 (file)
@@ -10,6 +10,7 @@
         * Currently only supports passing 'hide-if' data.
         *
         * @ignore
+        * @param {Object} [config] Configuration options
         */
        mw.htmlform.Element = function ( config ) {
                // Configuration initialization
index 390160d..a5cf1d8 100644 (file)
@@ -18,6 +18,9 @@
         * @class mw.ForeignStructuredUpload.BookletLayout
         * @uses mw.ForeignStructuredUpload
         * @extends mw.Upload.BookletLayout
+        *
+        * @constructor
+        * @param {Object} config Configuration options
         * @cfg {string} [target] Used to choose the target repository.
         *     If nothing is passed, the {@link mw.ForeignUpload#property-target default} is used.
         */
index 3a0a94b..0c572d4 100644 (file)
@@ -1,8 +1,5 @@
 ( function ( mw, $, OO ) {
        /**
-        * @class mw.ForeignStructuredUpload
-        * @extends mw.ForeignUpload
-        *
         * Used to represent an upload in progress on the frontend.
         *
         * This subclass will upload to a wiki using a structured metadata
         * **TODO: This currently only supports uploads under CC-BY-SA 4.0,
         * and should really have support for more licenses.**
         *
-        * @inheritdoc
+        * @class mw.ForeignStructuredUpload
+        * @extends mw.ForeignUpload
+        *
+        * @constructor
+        * @param {string} [target]
+        * @param {Object} [apiconfig]
         */
        function ForeignStructuredUpload( target, apiconfig ) {
                this.date = undefined;
index 781c1df..08fc01d 100644 (file)
@@ -1,8 +1,5 @@
 ( function ( mw, OO, $ ) {
        /**
-        * @class mw.ForeignUpload
-        * @extends mw.Upload
-        *
         * Used to represent an upload in progress on the frontend.
         *
         * Subclassed to upload to a foreign API, with no other goodies. Use
@@ -12,6 +9,9 @@
         * an object, we assume you want the default, and treat it as apiconfig
         * instead.
         *
+        * @class mw.ForeignUpload
+        * @extends mw.Upload
+        *
         * @constructor
         * @param {string} [target] Used to set up the target
         *     wiki. If not remote, this class behaves identically to mw.Upload (unless further subclassed)
 
        /**
         * Override from mw.Upload to make sure the API info is found and allowed
+        *
+        * @inheritdoc
         */
        ForeignUpload.prototype.upload = function () {
                var upload = this;
 
        /**
         * Override from mw.Upload to make sure the API info is found and allowed
+        *
+        * @inheritdoc
         */
        ForeignUpload.prototype.uploadToStash = function () {
                var upload = this;
index cda389f..9203e5e 100644 (file)
@@ -12,9 +12,6 @@
         * directly, passing invalid titles will result in an exception. Use #newFromText to use the
         * logic directly and get null for invalid titles which is easier to work with.
         *
-        * @class mw.Title
-        */
-       /**
         * Note that in the constructor and #newFromText method, `namespace` is the **default** namespace
         * only, and can be overridden by a namespace prefix in `title`. If you do not want this behavior,
         * use #makeTitle. Compare:
@@ -31,7 +28,8 @@
         *     mw.Title.newFromText( 'Template:Foo', NS_TEMPLATE ).getPrefixedText(); // => 'Template:Foo'
         *     mw.Title.makeTitle( NS_TEMPLATE, 'Template:Foo' ).getPrefixedText();   // => 'Template:Template:Foo'
         *
-        * @method constructor
+        * @class mw.Title
+        * @constructor
         * @param {string} title Title of the page. If no second argument given,
         *  this will be searched for a namespace
         * @param {number} [namespace=NS_MAIN] If given, will used as default namespace for the given title
@@ -47,8 +45,6 @@
                this.title = parsed.title;
                this.ext = parsed.ext;
                this.fragment = parsed.fragment;
-
-               return this;
        }
 
        /* Private members */
index 3873e9b..9d9c0a6 100644 (file)
@@ -29,6 +29,9 @@
         * @uses mw.Upload
         * @uses mw.Upload.BookletLayout
         * @extends OO.ui.ProcessDialog
+        *
+        * @constructor
+        * @param {Object} [config] Configuration options
         * @cfg {Function} [bookletClass=mw.Upload.BookletLayout] Booklet class to be
         *     used for the steps
         * @cfg {Object} [booklet] Booklet constructor configuration
index 23b0900..02df2a8 100644 (file)
@@ -2,8 +2,6 @@
        var UP;
 
        /**
-        * @class mw.Upload
-        *
         * Used to represent an upload in progress on the frontend.
         * Most of the functionality is implemented in mw.Api.plugin.upload,
         * but this model class will tie it together as well as let you perform
@@ -43,6 +41,8 @@
         *       } );
         *     } );
         *
+        * @class mw.Upload
+        *
         * @constructor
         * @param {Object|mw.Api} [apiconfig] A mw.Api object (or subclass), or configuration
         *     to pass to the constructor of mw.Api.
index d0ed659..0c47dbe 100644 (file)
         * @param {string|Function} documentLocation A full url, or function returning one.
         *  If passed a function, the return value may change over time and this will be honoured. (T74334)
         * @member mw
+        * @return {Function} Uri class
         */
        mw.UriRelative = function ( documentLocation ) {
                var getDefaultUri = ( function () {
index c005804..e3a8f7b 100644 (file)
@@ -1,8 +1,5 @@
 ( function ( mw, $ ) {
        /**
-        * @method confirmCloseWindow
-        * @member mw
-        *
         * Prevent the closing of a window with a confirm message (the onbeforeunload event seems to
         * work in most browsers.)
         *
@@ -24,6 +21,8 @@
         *         // do whatever you wanted to do
         *     }
         *
+        * @method confirmCloseWindow
+        * @member mw
         * @param {Object} [options]
         * @param {string} [options.namespace] Namespace for the event registration
         * @param {string} [options.message]
index cc5958d..3c1a668 100644 (file)
 
                /**
                 * Build the console panel
+                *
+                * @return {jQuery} Console panel
                 */
                buildConsoleTable: function () {
                        var $table, entryTypeText, i, length, entry;
index 46b8479..e86aff6 100644 (file)
                        /**
                         * Dumb window.onerror handler which forwards the errors via mw.track.
                         *
+                        * @param {string} errorMessage
+                        * @param {string} url
+                        * @param {number} lineNumber
+                        * @param {number} [columnNumber]
+                        * @param {Error|Mixed} [errorObject]
+                        * @return {boolean} True to prevent the default action
                         * @fires global_error
                         */
                        window.onerror = function ( errorMessage, url, lineNumber, columnNumber, errorObject ) {
index 2494305..fdaa989 100644 (file)
                        /**
                         * Generate a breakdown of all loaded modules and their size in
                         * kilobytes. Modules are ordered from largest to smallest.
+                        *
+                        * @return {Object[]} Size reports
                         */
                        size: function () {
                                // Map each module to a descriptor object.
                        /**
                         * For each module with styles, count the number of selectors, and
                         * count how many match against some element currently in the DOM.
+                        *
+                        * @return {Object[]} CSS reports
                         */
                        css: function () {
                                var modules = [];
                         * Report stats on mw.loader.store: the number of localStorage
                         * cache hits and misses, the number of items purged from the
                         * cache, and the total size of the module blob in localStorage.
+                        *
+                        * @return {Object[]} Store stats
                         */
                        store: function () {
                                var raw, stats = { enabled: mw.loader.store.enabled };
index 8504964..c82b9cb 100644 (file)
                        /**
                         * Starts the parse
                         *
-                        * @param {Function} rootExpression root parse function
+                        * @param {Function} rootExpression Root parse function
+                        * @return {Array|null}
                         */
                        function start( rootExpression ) {
                                var result = nOrMore( 0, rootExpression )();
 
        /**
         * htmlEmitter - object which primarily exists to emit HTML from parser ASTs
+        *
+        * @param {Object} language
+        * @param {Object} magic
         */
        mw.jqueryMsg.htmlEmitter = function ( language, magic ) {
                var jmsg = this;
                 * It may, though, if the wikitext appears in extension-controlled content.
                 *
                 * @param {string[]} nodes
+                * @return {jQuery}
                 */
                wikilink: function ( nodes ) {
                        var page, anchor, url, $el;
index 4dce192..c7993fd 100644 (file)
                        return mw.format.apply( null, [ this.map.get( this.key ) ].concat( this.parameters ) );
                },
 
+               // eslint-disable-next-line valid-jsdoc
                /**
                 * Add (does not replace) parameters for `$N` placeholder values.
                 *
                }
        };
 
+       /* eslint-disable no-console */
        log = ( function () {
                // Also update the restoration of methods in mediawiki.log.js
                // when adding or removing methods here.
 
                return log;
        }() );
+       /* eslint-enable no-console */
 
        /**
         * @class mw
                         * Utility function for execute()
                         *
                         * @ignore
+                        * @param {string} [media] Media attribute
+                        * @param {string} url URL
                         */
                        function addLink( media, url ) {
                                var el = document.createElement( 'link' );
                         * to a query string of the form foo.bar,baz|bar.baz,quux
                         *
                         * @private
+                        * @param {Object} moduleMap Module map
+                        * @return {string} Module query string
                         */
                        function buildModulesString( moduleMap ) {
                                var p, prefix,
                                 *
                                 * @protected
                                 * @since 1.27
+                                * @param {string} moduleName Module name
+                                * @return {Mixed} Exported value
                                 */
                                require: function ( moduleName ) {
                                        var state = mw.loader.getState( moduleName );
                                         *
                                         * @param {string} module Module name
                                         * @param {Object} descriptor The module's descriptor as set in the registry
+                                        * @return {boolean} Module was set
                                         */
                                        set: function ( module, descriptor ) {
                                                var args, key, src;
                                                        }
                                                } catch ( e ) {
                                                        mw.track( 'resourceloader.exception', { exception: e, source: 'store-localstorage-json' } );
-                                                       return;
+                                                       return false;
                                                }
 
                                                src = 'mw.loader.implement(' + args.join( ',' ) + ');';
                                                }
                                                mw.loader.store.items[ key ] = src;
                                                mw.loader.store.update();
+                                               return true;
                                        },
 
                                        /**
                                         * Iterate through the module store, removing any item that does not correspond
                                         * (in name and version) to an item in the module registry.
+                                        *
+                                        * @return {boolean} Store was pruned
                                         */
                                        prune: function () {
                                                var key, module;
                                                                delete mw.loader.store.items[ key ];
                                                        }
                                                }
+                                               return true;
                                        },
 
                                        /**
                                 * Wrapper object for raw HTML passed to mw.html.element().
                                 *
                                 * @class mw.html.Raw
+                                * @constructor
+                                * @param {string} value
                                 */
                                Raw: function ( value ) {
                                        this.value = value;
                                 * Wrapper object for CDATA element contents passed to mw.html.element()
                                 *
                                 * @class mw.html.Cdata
+                                * @constructor
+                                * @param {string} value
                                 */
                                Cdata: function ( value ) {
                                        this.value = value;
                                         */
                                        remove: list.remove,
 
+                                       // eslint-disable-next-line valid-jsdoc
                                        /**
                                         * Run a hook.
                                         *
         * @param {string} [data.module] Name of module which caused the error
         */
        function logError( topic, data ) {
+               /* eslint-disable no-console */
                var msg,
                        e = data.exception,
                        source = data.source,
                                console.error( String( e ), e );
                        }
                }
+               /* eslint-enable no-console */
        }
 
        // Subscribe to error streams
index 6c6f560..926f8c5 100644 (file)
@@ -23,6 +23,8 @@
         * @alternateClassName mw.Notification
         * @constructor
         * @private
+        * @param {mw.Message|jQuery|HTMLElement|string} message
+        * @param {Object} options
         */
        function Notification( message, options ) {
                var $notification, $notificationContent;
index 7c7aca3..cbbd254 100644 (file)
                }
 
                /**
-                * defines the location of autocomplete. Typically either
+                * Defines the location of autocomplete. Typically either
                 * header, which is in the top right of vector (for example)
                 * and content which identifies the main search bar on
-                * Special:Search.  Defaults to header for skins that don't set
+                * Special:Search. Defaults to header for skins that don't set
                 * explicitly.
                 *
                 * @ignore
+                * @param {Object} context
+                * @return {string}
                 */
                function getInputLocation( context ) {
                        return context.config.$region
                 * 'this' is the search input box (jQuery object)
                 *
                 * @ignore
+                * @param {Object} metadata
                 */
                function onAfterUpdate( metadata ) {
                        var context = this.data( 'suggestionsContext' );
index c5e96eb..9f5e5c4 100644 (file)
@@ -16,6 +16,7 @@
                                 * @param {Object} data Data to render
                                 * @param {Object} partialTemplates Map partial names to Mustache template objects
                                 *  returned by mw.template.get()
+                                * @return {jQuery} Rendered HTML
                                 */
                                render: function ( data, partialTemplates ) {
                                        var partials = {};
index bee22c7..a8188db 100644 (file)
@@ -50,6 +50,7 @@
                 * Encode the string like PHP's rawurlencode
                 *
                 * @param {string} str String to be encoded.
+                * @return {string} Encoded string
                 */
                rawurlencode: function ( str ) {
                        str = String( str );
@@ -62,6 +63,7 @@
                 * Encode the string like Sanitizer::escapeId in PHP
                 *
                 * @param {string} str String to be encoded.
+                * @return {string} Encoded string
                 */
                escapeId: function ( str ) {
                        str = String( str );
@@ -80,6 +82,7 @@
                 * of `wfUrlencode` in PHP.
                 *
                 * @param {string} str String to be encoded.
+                * @return {string} Encoded string
                 */
                wikiUrlencode: function ( str ) {
                        return util.rawurlencode( str )
index cb1e73f..b453ac8 100644 (file)
@@ -18,6 +18,7 @@
                 *
                 * @ignore
                 * @private
+                * @return {Object} Viewport positions
                 */
                makeViewportFromWindow: function () {
                        var $window = $( window ),
index be75a2e..094c4df 100644 (file)
        /**
         * Gets the height of the interface elements and the
         * gallery's caption.
+        *
+        * @return {number} Height
         */
        mw.GallerySlideshow.prototype.getChromeHeight = function () {
                return this.$interface.outerHeight() + this.$galleryCaption.outerHeight();
index e3094d2..2050ca9 100644 (file)
@@ -46,6 +46,9 @@ mwPerformance.mark( 'mwLoadStart' );
  * - Google Glass
  *
  * Other browsers that pass the check are considered Grade X.
+ *
+ * @param {string} [str] User agent, defaults to navigator.userAgent
+ * @return {boolean} User agent is compatible with MediaWiki JS
  */
 function isCompatible( str ) {
        var ua = str || navigator.userAgent;