build: Enable jscs jsDoc rule 'requireParamTypes' and make pass
authorJames D. Forrester <jforrester@wikimedia.org>
Sat, 5 Sep 2015 18:55:03 +0000 (11:55 -0700)
committerJforrester <jforrester@wikimedia.org>
Mon, 7 Sep 2015 18:32:10 +0000 (18:32 +0000)
Change-Id: Id0e10dba3548a981ba6d301bd3cd04adbe143e64

.jscsrc
resources/src/jquery/jquery.expandableField.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.special/mediawiki.special.preferences.js
resources/src/mediawiki/mediawiki.jqueryMsg.js
resources/src/mediawiki/mediawiki.util.js
tests/qunit/data/testrunner.js
tests/qunit/suites/resources/jquery/jquery.textSelection.test.js

diff --git a/.jscsrc b/.jscsrc
index 13f7f60..9ab6f3c 100644 (file)
--- a/.jscsrc
+++ b/.jscsrc
@@ -7,6 +7,7 @@
        "disallowQuotedKeysInObjects": "allButReserved",
        "requireDotNotation": { "allExcept": [ "keywords" ] },
        "jsDoc": {
+               "requireParamTypes": true,
                "requireReturnTypes": true
        },
 
index b9bb77a..10c11ea 100644 (file)
@@ -39,8 +39,8 @@
                },
                /**
                 * Sets the value of a property, and updates the widget accordingly
-                * @param property String Name of property
-                * @param value Mixed Value to set property with
+                * @param {String} property Name of property
+                * @param {Mixed} value Value to set property with
                 */
                configure: function ( context, property, value ) {
                        // TODO: Validate creation using fallback values
index e34592c..d890d95 100644 (file)
         *
         * @example
         *  var myTester = new CompletenessTest( myLib );
-        * @param masterVariable {Object} The root variable that contains all object
+        * @param {Object} masterVariable The root variable that contains all object
         *  members. CompletenessTest will recursively traverse objects and keep track
         *  of all methods.
-        * @param ignoreFn {Function} Optionally pass a function to filter out certain
+        * @param {Function} [ignoreFn] Optionally pass a function to filter out certain
         *  methods. Example: You may want to filter out instances of jQuery or some
         *  other constructor. Otherwise "missingTests" will include all methods that
         *  were not called from that instance.
                 * Depending on the action it either injects our listener into the methods, or
                 * reads from our tracker and records which methods have not been called by the test suite.
                 *
-                * @param currName {String|Null} Name of the given object member (Initially this is null).
-                * @param currVar {mixed} The variable to check (initially an object,
+                * @param {String|Null} currName Name of the given object member (Initially this is null).
+                * @param {mixed} currVar The variable to check (initially an object,
                 *  further down it could be anything).
-                * @param masterVariable {Object} Throughout our interation, always keep track of the master/root.
+                * @param {Object} masterVariable Throughout our interation, always keep track of the master/root.
                 *  Initially this is the same as currVar.
-                * @param parentPathArray {Array} Array of names that indicate our breadcrumb path starting at
+                * @param {Array} parentPathArray Array of names that indicate our breadcrumb path starting at
                 *  masterVariable. Not including currName.
                 */
                walkTheObject: function ( currObj, currName, masterVariable, parentPathArray ) {
                 * was called during the test suite (as far as the tracker knows).
                 * If not it adds it to missingTests.
                 *
-                * @param fnName {String}
+                * @param {String} fnName
                 * @return {Boolean}
                 */
                hasTest: function ( fnName ) {
                 * Injects a function (such as a spy that updates methodCallTracker when
                 * it's called) inside another function.
                 *
-                * @param masterVariable {Object}
-                * @param objectPathArray {Array}
-                * @param injectFn {Function}
+                * @param {Object} masterVariable
+                * @param {Array} objectPathArray
+                * @param {Function} injectFn
                 */
                injectCheck: function ( obj, key, injectFn ) {
                        var spy,
index 40c828a..81a20d0 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 $table jQuery object for a <table>
+        * @param {jQuery} $table jQuery object for a <table>
         */
        function emulateTHeadAndFoot( $table ) {
                var $thead, $tfoot, i, len,
         * Replace all rowspanned cells in the body with clones in each row, so sorting
         * need not worry about them.
         *
-        * @param $table jQuery object for a <table>
+        * @param {jQuery} $table jQuery object for a <table>
         */
        function explodeRowspans( $table ) {
                var spanningRealCellIndex, rowSpan, colSpan,
                        monthNames: {},
 
                        /**
-                        * @param $tables {jQuery}
-                        * @param settings {Object} (optional)
+                        * @param {jQuery} $tables
+                        * @param {Object} [settings]
                         */
                        construct: function ( $tables, settings ) {
                                return $tables.each( function ( i, table ) {
                                         * Passing an empty array will reset sorting (basically just reset the headers
                                         * making the table appear unsorted).
                                         *
-                                        * @param sortList {Array} (optional) List of sort objects.
+                                        * @param {Array} [sortList] List of sort objects.
                                         */
                                        $table.data( 'tablesorter' ).sort = function ( sortList ) {
 
index 2573813..95c0346 100644 (file)
                         *
                         * Scroll a textarea to the current cursor position. You can set the cursor
                         * position with setSelection()
-                        * @param options boolean Whether to force a scroll even if the caret position
+                        * @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)
index 2ebfe92..077d5e3 100644 (file)
@@ -9,7 +9,7 @@ jQuery( function ( $ ) {
        /**
         * @ignore
         * @context {Element} input
-        * @param e {jQuery.Event}
+        * @param {jQuery.Event} e
         */
        function updateDiffRadios() {
                var nextState = 'before',
index 57489fa..bad1c08 100644 (file)
@@ -51,8 +51,8 @@ jQuery( function ( $ ) {
         * It uses document.getElementById for security reasons (HTML injections in $()).
         *
         * @ignore
-        * @param String name: the name of a tab without the prefix ("mw-prefsection-")
-        * @param String mode: [optional] A hash will be set according to the current
+        * @param {String} name the name of a tab without the prefix ("mw-prefsection-")
+        * @param {String} [mode] A hash will be set according to the current
         *  open section. Set mode 'noHash' to surpress this.
         */
        function switchPrefTab( name, mode ) {
index 0502304..f778b7f 100644 (file)
                 * from the server, since the replacement is done at save time.
                 * It may, though, if the wikitext appears in extension-controlled content.
                 *
-                * @param nodes
+                * @param {String[]} nodes
                 */
                wikilink: function ( nodes ) {
                        var page, anchor, url;
index 2b4fa75..e6c98be 100644 (file)
                 * For index.php use `mw.config.get( 'wgScript' )`.
                 *
                 * @since 1.18
-                * @param str string Name of script (eg. 'api'), defaults to 'index'
-                * @return {string} Address to script (eg. '/w/api.php' )
+                * @param {string} str Name of script (e.g. 'api'), defaults to 'index'
+                * @return {string} Address to script (e.g. '/w/api.php' )
                 */
                wikiScript: function ( str ) {
                        str = str || 'index';
index fb4667a..b57b6cf 100644 (file)
@@ -8,7 +8,7 @@
        /**
         * Add bogus to url to prevent IE crazy caching
         *
-        * @param value {String} a relative path (eg. 'data/foo.js'
+        * @param {String} value a relative path (eg. 'data/foo.js'
         * or 'data/test.php?foo=bar').
         * @return {String} Such as 'data/foo.js?131031765087663960'
         */
        /**
         * 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 localEnv {Object} [optional]
+        * @param {Object} [localEnv]
         * @example (see test suite at the bottom of this file)
         * </code>
         */
index ad229ac..2e6f05e 100644 (file)
@@ -5,13 +5,13 @@
        /**
         * Test factory for $.fn.textSelection( 'encapsulateText' )
         *
-        * @param options {object} associative array containing:
-        *   description {string}
-        *   input {string}
-        *   output {string}
-        *   start {int} starting char for selection
-        *   end {int} ending char for selection
-        *   params {object} add'l parameters for $().textSelection( 'encapsulateText' )
+        * @param {Object} options Associative configuration array
+        * @param {string} options.description Description
+        * @param {string} options.input Input
+        * @param {string} options.output Output
+        * @param {int} options.start Starting char for selection
+        * @param {int} options.end Ending char for selection
+        * @param {object} options.params Additional parameters for $().textSelection( 'encapsulateText' )
         */
        function encapsulateTest( options ) {
                var opt = $.extend( {