build: Enable jscs jsDoc rule 'requireNewlineAfterDescription' and make pass
authorJames D. Forrester <jforrester@wikimedia.org>
Sat, 5 Sep 2015 19:11:47 +0000 (12:11 -0700)
committerJforrester <jforrester@wikimedia.org>
Mon, 7 Sep 2015 18:32:17 +0000 (18:32 +0000)
Change-Id: I14d699f66cef87f0d93d773902c0a5326025a58c

26 files changed:
.jscsrc
resources/src/jquery/jquery.expandableField.js
resources/src/jquery/jquery.localize.js
resources/src/jquery/jquery.qunit.completenessTest.js
resources/src/jquery/jquery.suggestions.js
resources/src/jquery/jquery.tablesorter.js
resources/src/jquery/jquery.textSelection.js
resources/src/mediawiki.api/mediawiki.api.edit.js
resources/src/mediawiki.api/mediawiki.api.login.js
resources/src/mediawiki.api/mediawiki.api.upload.js
resources/src/mediawiki.language/mediawiki.language.numbers.js
resources/src/mediawiki.legacy/protect.js
resources/src/mediawiki.page/mediawiki.page.gallery.js
resources/src/mediawiki.special/mediawiki.special.changeemail.js
resources/src/mediawiki.widgets/mw.widgets.CalendarWidget.js
resources/src/mediawiki/mediawiki.ForeignStructuredUpload.js
resources/src/mediawiki/mediawiki.Upload.js
resources/src/mediawiki/mediawiki.confirmCloseWindow.js
resources/src/mediawiki/mediawiki.errorLogger.js
resources/src/mediawiki/mediawiki.feedback.js
resources/src/mediawiki/mediawiki.jqueryMsg.js
resources/src/mediawiki/mediawiki.js
resources/src/mediawiki/mediawiki.notification.js
resources/src/mediawiki/mediawiki.searchSuggest.js
tests/qunit/data/testrunner.js
tests/qunit/suites/resources/mediawiki/mediawiki.test.js

diff --git a/.jscsrc b/.jscsrc
index 9ab6f3c..aaa876c 100644 (file)
--- a/.jscsrc
+++ b/.jscsrc
@@ -7,6 +7,7 @@
        "disallowQuotedKeysInObjects": "allButReserved",
        "requireDotNotation": { "allExcept": [ "keywords" ] },
        "jsDoc": {
+               "requireNewlineAfterDescription": true,
                "requireParamTypes": true,
                "requireReturnTypes": true
        },
index 10c11ea..221e6bb 100644 (file)
@@ -39,6 +39,7 @@
                },
                /**
                 * Sets the value of a property, and updates the widget accordingly
+                *
                 * @param {String} property Name of property
                 * @param {Mixed} value Value to set property with
                 */
index 2122146..f5932b2 100644 (file)
@@ -5,8 +5,8 @@
 
 /**
  * Gets a localized message, using parameters from options if present.
- * @ignore
  *
+ * @ignore
  * @param {Object} options
  * @param {string} key
  * @return {string} Localized message
index d890d95..785b273 100644 (file)
@@ -51,8 +51,8 @@
 
        /**
         * CompletenessTest
-        * @constructor
         *
+        * @constructor
         * @example
         *  var myTester = new CompletenessTest( myLib );
         * @param {Object} masterVariable The root variable that contains all object
index c43e0ff..dc1c779 100644 (file)
@@ -142,6 +142,7 @@ $.suggestions = {
         * call to this function still pending will be canceled. If the value in the
         * textbox is empty or hasn't changed since the last time suggestions were fetched,
         * this function does nothing.
+        *
         * @param {boolean} delayed Whether or not to delay this by the currently configured amount of time
         */
        update: function ( context, delayed ) {
@@ -229,6 +230,7 @@ $.suggestions = {
 
        /**
         * Sets the value of a property, and updates the widget accordingly
+        *
         * @param {string} property Name of property
         * @param {Mixed} value Value to set property with
         */
@@ -415,6 +417,7 @@ $.suggestions = {
 
        /**
         * Highlight a result in the results table
+        *
         * @param {jQuery|string} result `<tr>` to highlight, or 'prev' or 'next'
         * @param {boolean} updateTextbox If true, put the suggestion in the textbox
         */
@@ -484,6 +487,7 @@ $.suggestions = {
 
        /**
         * Respond to keypress event
+        *
         * @param {number} key Code of key pressed
         */
        keypress: function ( e, context, key ) {
index 81a20d0..23474c0 100644 (file)
         *
         * After this, it will look at all rows at the bottom for footer rows
         * And place these in a tfoot using similar rules.
+        *
         * @param {jQuery} $table jQuery object for a <table>
         */
        function emulateTHeadAndFoot( $table ) {
index 95c0346..b901642 100644 (file)
                         *
                         * 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
                         *
index e6161e4..e43285f 100644 (file)
@@ -31,6 +31,7 @@
 
                /**
                 * Post a new section to the page.
+                *
                 * @see #postWithEditToken
                 * @param {mw.Title|String} title Target page
                 * @param {string} header
index 2525792..2b709aa 100644 (file)
@@ -1,5 +1,6 @@
 /**
  * Make the two-step login easier.
+ *
  * @author Niklas Laxström
  * @class mw.Api.plugin.login
  * @since 1.22
index cc0bef0..4abff28 100644 (file)
@@ -1,5 +1,6 @@
 /**
  * Provides an interface for uploading files to MediaWiki.
+ *
  * @class mw.Api.plugin.upload
  * @singleton
  */
@@ -18,6 +19,7 @@
        /**
         * @private
         * Get nonce for iframe IDs on the page.
+        *
         * @return {number}
         */
        function getNonce() {
@@ -27,6 +29,7 @@
        /**
         * @private
         * Get new iframe object for an upload.
+        *
         * @return {HTMLIframeElement}
         */
        function getNewIframe( id ) {
@@ -39,6 +42,7 @@
        /**
         * @private
         * Shortcut for getting hidden inputs
+        *
         * @return {jQuery}
         */
        function getHiddenInput( name, val ) {
                 * This function will return a promise, which when resolved, will pass back a function
                 * to finish the stash upload. You can call that function with an argument containing
                 * more, or conflicting, data to pass to the server. For example:
+                *
                 *     // upload a file to the stash with a placeholder filename
                 *     api.uploadToStash( file, { filename: 'testing.png' } ).done( function ( finish ) {
                 *         // finish is now the function we can use to finalize the upload
                 *             // the upload is complete, data holds the API response
                 *         } );
                 *     } );
+                *
                 * @param {File|HTMLInputElement} file
                 * @param {Object} [data]
                 * @return {jQuery.Promise}
index 32df68c..268985f 100644 (file)
                },
 
                /**
-                * Get the  digit transform table for current UI language.
+                * Get the digit transform table for current UI language.
+                *
                 * @return {Object|Array}
                 */
                getDigitTransformTable: function () {
                },
 
                /**
-                * Get the  separator transform table for current UI language.
+                * Get the separator transform table for current UI language.
+                *
                 * @return {Object|Array}
                 */
                getSeparatorTransformTable: function () {
index d76b707..6226c90 100644 (file)
@@ -177,6 +177,7 @@ var ProtectionForm = window.ProtectionForm = {
 
        /**
         * Find the highest protection level in any selector
+        *
         * @return {number}
         */
        getMaxLevel: function () {
index bf34dec..dfccf21 100644 (file)
@@ -12,6 +12,7 @@
 
        /**
         * Perform the layout justification.
+        *
         * @ignore
         * @context {HTMLElement} A `ul.mw-gallery-*` element
         */
index 67531f7..06851b9 100644 (file)
@@ -4,6 +4,7 @@
 ( function ( mw, $ ) {
        /**
         * Given an email validity status (true, false, null) update the label CSS class
+        *
         * @ignore
         */
        function updateMailValidityLabel( mail ) {
index b914f36..d519c0d 100644 (file)
 
        /**
         * Handle click events on the "up" button, switching to less precise view.
+        *
         * @private
         */
        mw.widgets.CalendarWidget.prototype.onUpButtonClick = function () {
 
        /**
         * Handle click events on the "previous" button, switching to previous pane.
+        *
         * @private
         */
        mw.widgets.CalendarWidget.prototype.onPrevButtonClick = function () {
 
        /**
         * Handle click events on the "next" button, switching to next pane.
+        *
         * @private
         */
        mw.widgets.CalendarWidget.prototype.onNextButtonClick = function () {
         * Handle click events anywhere in the body of the widget, which contains the matrix of days,
         * months or years to choose. Maybe change the pane or switch to more precise view, depending on
         * what gets clicked.
+        *
         * @private
         */
        mw.widgets.CalendarWidget.prototype.onBodyClick = function ( e ) {
index 0c06a83..fe8520b 100644 (file)
@@ -28,6 +28,7 @@
 
        /**
         * Add categories to the upload.
+        *
         * @param {string[]} categories Array of categories to which this upload will be added.
         */
        ForeignStructuredUpload.prototype.addCategories = function ( categories ) {
@@ -41,6 +42,7 @@
 
        /**
         * Add a description to the upload.
+        *
         * @param {string} language The language code for the description's language. Must have a template on the target wiki to work properly.
         * @param {string} description The description of the file.
         */
@@ -53,6 +55,7 @@
 
        /**
         * Set the date of creation for the upload.
+        *
         * @param {Date} date
         */
        ForeignStructuredUpload.prototype.setDate = function ( date ) {
@@ -62,6 +65,7 @@
        /**
         * Get the text of the file page, to be created on upload. Brings together
         * several different pieces of information to create useful text.
+        *
         * @return {string}
         */
        ForeignStructuredUpload.prototype.getText = function () {
@@ -85,6 +89,7 @@
 
        /**
         * Gets the wikitext for the creation date of this upload.
+        *
         * @private
         * @return {string}
         */
        /**
         * Gets the name of the template to use for creating the file metadata.
         * Override in subclasses for other templates.
+        *
         * @private
         * @return {string}
         */
        /**
         * Fetches the wikitext for any descriptions that have been added
         * to the upload.
+        *
         * @private
         * @return {string}
         */
        /**
         * Fetches the wikitext for the categories to which the upload will
         * be added.
+        *
         * @private
         * @return {string}
         */
 
        /**
         * Gets the wikitext for the license of the upload. Abstract for now.
+        *
         * @private
         * @return {string}
         */
 
        /**
         * Get the username.
+        *
         * @private
         * @return {string}
         */
index 07a0b75..79628de 100644 (file)
@@ -64,6 +64,7 @@
 
        /**
         * Set the text of the file page, to be created on file upload.
+        *
         * @param {string} text
         */
        UP.setText = function ( text ) {
@@ -72,6 +73,7 @@
 
        /**
         * Set the filename, to be finalized on upload.
+        *
         * @param {string} filename
         */
        UP.setFilename = function ( filename ) {
@@ -94,6 +96,7 @@
 
        /**
         * Set the file to be uploaded.
+        *
         * @param {HTMLInputElement|File} file
         */
        UP.setFile = function ( file ) {
 
        /**
         * Set whether the file should be watchlisted after upload.
+        *
         * @param {boolean} watchlist
         */
        UP.setWatchlist = function ( watchlist ) {
 
        /**
         * Set the edit comment for the upload.
+        *
         * @param {string} comment
         */
        UP.setComment = function ( comment ) {
 
        /**
         * Get the text of the file page, to be created on file upload.
+        *
         * @return {string}
         */
        UP.getText = function () {
 
        /**
         * Get the filename, to be finalized on upload.
+        *
         * @return {string}
         */
        UP.getFilename = function () {
 
        /**
         * Get the file being uploaded.
+        *
         * @return {HTMLInputElement|File}
         */
        UP.getFile = function () {
 
        /**
         * Get the boolean for whether the file will be watchlisted after upload.
+        *
         * @return {boolean}
         */
        UP.getWatchlist = function () {
 
        /**
         * Get the current value of the edit comment for the upload.
+        *
         * @return {string}
         */
        UP.getComment = function () {
 
        /**
         * Gets the base filename from a path name.
+        *
         * @param {string} path
         * @return {string}
         */
 
        /**
         * Gets the state of the upload.
+        *
         * @return {mw.Upload.State}
         */
        UP.getState = function () {
         * Get the imageinfo object for the finished upload.
         * Only available once the upload is finished! Don't try to get it
         * beforehand.
+        *
         * @return {Object|undefined}
         */
        UP.getImageInfo = function () {
 
        /**
         * Upload the file directly.
+        *
         * @return {jQuery.Promise}
         */
        UP.upload = function () {
 
        /**
         * Upload the file to the stash to be completed later.
+        *
         * @return {jQuery.Promise}
         */
        UP.uploadToStash = function () {
 
        /**
         * Finish a stash upload.
+        *
         * @return {jQuery.Promise}
         */
        UP.finishStashUpload = function () {
index b3cb758..4d0c135 100644 (file)
 
                /**
                 * Return the object with functions to release and manually trigger the confirm alert
+                *
                 * @ignore
                 */
                return {
                        /**
                         * Remove all event listeners and don't show an alert anymore, if the user wants to leave
                         * the page.
+                        *
                         * @ignore
                         */
                        release: function () {
@@ -92,6 +94,7 @@
                         * Trigger the module's function manually: Check, if options.test() returns true and show
                         * an alert to the user if he/she want to leave this page. Returns false, if options.test() returns
                         * false or the user cancelled the alert window (~don't leave the page), true otherwise.
+                        *
                         * @ignore
                         * @return {boolean}
                         */
index 9f4f19d..46b8479 100644 (file)
@@ -1,5 +1,6 @@
 /**
  * Try to catch errors in modules which don't do their own error handling.
+ *
  * @class mw.errorLogger
  * @singleton
  */
@@ -24,6 +25,7 @@
                /**
                 * Install a window.onerror handler that will report via mw.track, while preserving
                 * any previous handler.
+                *
                 * @param {Object} window
                 */
                installGlobalHandler: function ( window ) {
@@ -35,6 +37,7 @@
 
                        /**
                         * Dumb window.onerror handler which forwards the errors via mw.track.
+                        *
                         * @fires global_error
                         */
                        window.onerror = function ( errorMessage, url, lineNumber, columnNumber, errorObject ) {
index d90ca4b..d226ed9 100644 (file)
@@ -86,6 +86,7 @@
         * Respond to dialog submit event. If the information was
         * submitted, either successfully or with an error, open
         * a MessageDialog to thank the user.
+        *
         * @param {string} [status] A status of the end of operation
         *  of the main feedback dialog. Empty if the dialog was
         *  dismissed with no action or the user followed the button
 
        /**
         * Set the bug report link
+        *
         * @param {string} link Link to the external bug report form
         */
        mw.Feedback.Dialog.prototype.setBugReportLink = function ( link ) {
 
        /**
         * Get the bug report link
+        *
         * @returns {string} Link to the external bug report form
         */
        mw.Feedback.Dialog.prototype.getBugReportLink = function () {
index f778b7f..ce92423 100644 (file)
         * Try to parse a key and optional replacements, returning a jQuery object that may be a tree of jQuery nodes.
         * If there was an error parsing, return the key and the error message (wrapped in jQuery). This should put the error right into
         * the interface, without causing the page to halt script execution, and it hopefully should be clearer how to fix it.
+        *
         * @private
         * @param {Object} options Parser options
         * @return {Function}
                 * Where the magic happens.
                 * Parses a message from the key, and swaps in replacements as necessary, wraps in jQuery
                 * If an error is thrown, returns original key, and logs the error
+                *
                 * @param {string} key Message key.
                 * @param {Array} replacements Variable replacements for $1, $2... $n
                 * @return {jQuery}
                /**
                 * Fetch the message string associated with a key, return parsed structure. Memoized.
                 * Note that we pass '[' + key + ']' back for a missing message here.
+                *
                 * @param {string} key
                 * @return {string|Array} string of '[key]' if message missing, simple string if possible, array of arrays if needs parsing
                 */
 
                        /**
                         * Try parsers until one works, if none work return null
+                        *
                         * @private
                         * @param {Function[]} ps
                         * @return {string|null}
                        /**
                         * Try several ps in a row, all must succeed or return null.
                         * This is the only eager one.
+                        *
                         * @private
                         * @param {Function[]} ps
                         * @return {string|null}
                        /**
                         * Run the same parser over and over until it fails.
                         * Must succeed a minimum of n times or return null.
+                        *
                         * @private
                         * @param {number} n
                         * @param {Function} p
 
                        /**
                         * Just make parsers out of simpler JS builtin types
+                        *
                         * @private
                         * @param {string} s
                         * @return {Function}
                /**
                 * (We put this method definition here, and not in prototype, to make sure it's not overwritten by any magic.)
                 * Walk entire node structure, applying replacements and template functions when appropriate
+                *
                 * @param {Mixed} node Abstract syntax tree (top node or subnode)
                 * @param {Array} replacements for $1, $2, ... $n
                 * @return {Mixed} single-string node or array of nodes suitable for jQuery appending
                 * Parsing has been applied depth-first we can assume that all nodes here are single nodes
                 * Must return a single node to parents -- a jQuery with synthetic span
                 * However, unwrap any other synthetic spans in our children and pass them upwards
+                *
                 * @param {Mixed[]} nodes Some single nodes, some arrays of nodes
                 * @return {jQuery}
                 */
                 * Transform parsed structure into pluralization
                 * n.b. The first node may be a non-integer (for instance, a string representing an Arabic number).
                 * So convert it back with the current language's convertNumber.
+                *
                 * @param {Array} nodes List of nodes, [ {string|number}, {string}, {string} ... ]
                 * @return {string} selected pluralized form according to current language
                 */
                /**
                 * Transform parsed structure into grammar conversion.
                 * Invoked by putting `{{grammar:form|word}}` in a message
+                *
                 * @param {Array} nodes List of nodes [{Grammar case eg: genitive}, {string word}]
                 * @return {string} selected grammatical form according to current language
                 */
                /**
                 * Tranform parsed structure into a int: (interface language) message include
                 * Invoked by putting `{{int:othermessage}}` into a message
+                *
                 * @param {Array} nodes List of nodes
                 * @return {string} Other message
                 */
                 * Takes an unformatted number (arab, no group separators and . as decimal separator)
                 * and outputs it in the localized digit script and formatted with decimal
                 * separator, according to the current language.
+                *
                 * @param {Array} nodes List of nodes
                 * @return {number|string} Formatted number
                 */
index ef6080b..93a2010 100644 (file)
 
                /**
                 * Dummy placeholder for {@link mw.log}
+                *
                 * @method
                 */
                log: ( function () {
                                /**
                                 * Define loop-function here for efficiency
                                 * and to avoid re-using badly scoped variables.
+                                *
                                 * @ignore
                                 */
                                function addLink( media, url ) {
                        /**
                         * Converts a module map of the form { foo: [ 'bar', 'baz' ], bar: [ 'baz, 'quux' ] }
                         * to a query string of the form foo.bar,baz|bar.baz,quux
+                        *
                         * @private
                         */
                        function buildModulesString( moduleMap ) {
 
                        /**
                         * Load modules from load.php
+                        *
                         * @private
                         * @param {Object} moduleMap Module map, see #buildModulesString
                         * @param {Object} currReqBase Object with other parameters (other than 'modules') to use in the request
 
                                        /**
                                         * Construct a JSON-serializable object representing the content of the store.
+                                        *
                                         * @return {Object} Module store contents.
                                         */
                                        toJSON: function () {
 
                                        /**
                                         * Get a key on which to vary the module cache.
+                                        *
                                         * @return {string} String of concatenated vary conditions.
                                         */
                                        getVary: function () {
 
                                /**
                                 * Wrapper object for raw HTML passed to mw.html.element().
+                                *
                                 * @class mw.html.Raw
                                 */
                                Raw: function ( value ) {
 
                                /**
                                 * Wrapper object for CDATA element contents passed to mw.html.element()
+                                *
                                 * @class mw.html.Cdata
                                 */
                                Cdata: function ( value ) {
                                return {
                                        /**
                                         * Register a hook handler
+                                        *
                                         * @param {Function...} handler Function to bind.
                                         * @chainable
                                         */
 
                                        /**
                                         * Unregister a hook handler
+                                        *
                                         * @param {Function...} handler Function to unbind.
                                         * @chainable
                                         */
 
                                        /**
                                         * Run a hook.
+                                        *
                                         * @param {Mixed...} data
                                         * @chainable
                                         */
index b5e8dae..f361ec8 100644 (file)
        /**
         * Initialisation.
         * Must only be called once, and not before the document is ready.
+        *
         * @ignore
         */
        function init() {
                /**
                 * Pause auto-hide timers for all notifications.
                 * Notifications will not auto-hide until resume is called.
+                *
                 * @see mw.Notification#pause
                 */
                pause: function () {
index 3c4f32e..6c7484e 100644 (file)
@@ -72,6 +72,7 @@
                /**
                 * Callback that's run when the user changes the search input text
                 * 'this' is the search input box (jQuery object)
+                *
                 * @ignore
                 */
                function onBeforeUpdate() {
@@ -88,6 +89,7 @@
                /**
                 * Callback that's run when suggestions have been updated either from the cache or the API
                 * 'this' is the search input box (jQuery object)
+                *
                 * @ignore
                 */
                function onAfterUpdate() {
index b57b6cf..01f9625 100644 (file)
        /**
         * Reset mw.config and others to a fresh copy of the live config for each test(),
         * and restore it back to the live one afterwards.
+        *
         * @param {Object} [localEnv]
         * @example (see test suite at the bottom of this file)
         * </code>
index f7ca45b..998887d 100644 (file)
         * The sync style load test (for @import). This is, in a way, also an open bug for
         * ResourceLoader ("execute js after styles are loaded"), but browsers don't offer a
         * way to get a callback from when a stylesheet is loaded (that is, including any
-        * @import rules inside). To work around this, we'll have a little time loop to check
+        * `@import` rules inside). To work around this, we'll have a little time loop to check
         * if the styles apply.
+        *
         * Note: This test originally used new Image() and onerror to get a callback
         * when the url is loaded, but that is fragile since it doesn't monitor the
         * same request as the css @import, and Safari 4 has issues with