build: Enable jscs jsDoc rule 'checkTypes' and make pass
Change-Id: I64c3b5bd7afc4686355c80ef68009d978f7b3097
This commit is contained in:
parent
4d59cba3ab
commit
e8608b94a5
19 changed files with 54 additions and 50 deletions
1
.jscsrc
1
.jscsrc
|
|
@ -9,6 +9,7 @@
|
|||
"jsDoc": {
|
||||
"checkParamNames": true,
|
||||
"checkRedundantReturns": true,
|
||||
"checkTypes": "strictNativeCase",
|
||||
"requireNewlineAfterDescription": true,
|
||||
"requireParamTypes": true,
|
||||
"requireReturnTypes": true
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ var
|
|||
// Use a separate cache when match highlighting is enabled
|
||||
matchTextCache = {};
|
||||
|
||||
// Due to <https://github.com/jscs-dev/jscs-jsdoc/issues/136>
|
||||
// jscs:disable jsDoc
|
||||
/**
|
||||
* Automatically truncate the plain text contents of an element and add an ellipsis
|
||||
*
|
||||
* @param {Object} options
|
||||
* @param {'center'|'left'|'right'} [options.position='center'] Where to remove text.
|
||||
* @param {'left'|'center'|'right'} [options.position='center'] Where to remove text.
|
||||
* @param {boolean} [options.tooltip=false] Whether to show a tooltip with the remainder
|
||||
* of the text.
|
||||
* @param {boolean} [options.restoreText=false] Whether to save the text for restoring
|
||||
|
|
@ -159,6 +161,7 @@ $.fn.autoEllipsis = function ( options ) {
|
|||
|
||||
} );
|
||||
};
|
||||
// jscs:enable jsDoc
|
||||
|
||||
/**
|
||||
* @class jQuery
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
* Sets the value of a property, and updates the widget accordingly
|
||||
*
|
||||
* @param {Object} context
|
||||
* @param {String} property Name of property
|
||||
* @param {string} property Name of property
|
||||
* @param {Mixed} value Value to set property with
|
||||
*/
|
||||
configure: function ( context, property, value ) {
|
||||
|
|
|
|||
|
|
@ -186,9 +186,9 @@
|
|||
* 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 {mixed} currObj The variable to check (initially an object,
|
||||
* @param {Mixed} currObj The variable to check (initially an object,
|
||||
* further down it could be anything).
|
||||
* @param {String|Null} currName Name of the given object member (Initially this is null).
|
||||
* @param {string|null} currName Name of the given object member (Initially this is null).
|
||||
* @param {Object} masterVariable Throughout our interation, always keep track of the master/root.
|
||||
* Initially this is the same as currVar.
|
||||
* @param {Array} parentPathArray Array of names that indicate our breadcrumb path starting at
|
||||
|
|
@ -258,8 +258,8 @@
|
|||
* was called during the test suite (as far as the tracker knows).
|
||||
* If not it adds it to missingTests.
|
||||
*
|
||||
* @param {String} fnName
|
||||
* @return {Boolean}
|
||||
* @param {string} fnName
|
||||
* @return {boolean}
|
||||
*/
|
||||
hasTest: function ( fnName ) {
|
||||
if ( !( fnName in this.methodCallTracker ) ) {
|
||||
|
|
|
|||
|
|
@ -426,8 +426,8 @@
|
|||
* in default (ascending) order when their header cell is clicked the next time.
|
||||
*
|
||||
* @param {jQuery} $headers
|
||||
* @param {Number[][]} sortList
|
||||
* @param {Number[][]} headerToColumns
|
||||
* @param {number[][]} sortList
|
||||
* @param {number[][]} headerToColumns
|
||||
*/
|
||||
function setHeadersOrder( $headers, sortList, headerToColumns ) {
|
||||
// Loop through all headers to retrieve the indices of the columns the header spans across:
|
||||
|
|
|
|||
|
|
@ -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] 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 ) {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
* addButtons( [ { .. }, { .. }, { .. } ] );
|
||||
* addButtons( { .. }, { .. } );
|
||||
*
|
||||
* @param {Object|Array...} [buttons] An array of button objects or the first
|
||||
* @param {...Object|Array} [buttons] An array of button objects or the first
|
||||
* button object in a list of variadic arguments.
|
||||
*/
|
||||
addButtons: function ( buttons ) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
* Post a new section to the page.
|
||||
*
|
||||
* @see #postWithEditToken
|
||||
* @param {mw.Title|String} title Target page
|
||||
* @param {mw.Title|string} title Target page
|
||||
* @param {string} header
|
||||
* @param {string} message wikitext message
|
||||
* @param {Object} [additionalParams] Additional API parameters, e.g. `{ redirect: true }`
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
*
|
||||
* @see http://en.wikipedia.org/wiki/Jenkins_hash_function
|
||||
*
|
||||
* @param {String} string String to hash
|
||||
* @return {Number} The hash as a 32-bit unsigned integer
|
||||
* @param {string} string String to hash
|
||||
* @return {number} The hash as a 32-bit unsigned integer
|
||||
* @ignore
|
||||
*
|
||||
* @author Ori Livneh <ori@wikimedia.org>
|
||||
|
|
@ -68,15 +68,15 @@
|
|||
* This function is based on the deprecated `mw.user.bucket` function.
|
||||
*
|
||||
* @param {Object} experiment
|
||||
* @param {String} experiment.name The name of the experiment
|
||||
* @param {Boolean} experiment.enabled Whether or not the experiment is
|
||||
* @param {string} experiment.name The name of the experiment
|
||||
* @param {boolean} experiment.enabled Whether or not the experiment is
|
||||
* enabled. If the experiment is disabled, then the user is always assigned
|
||||
* to the control bucket
|
||||
* @param {Object} experiment.buckets A map of bucket name to probability
|
||||
* that the user will be assigned to that bucket
|
||||
* @param {String} token A token that uniquely identifies the user for the
|
||||
* @param {string} token A token that uniquely identifies the user for the
|
||||
* duration of the experiment
|
||||
* @returns {String} The bucket
|
||||
* @returns {string} The bucket
|
||||
*/
|
||||
getBucket: function ( experiment, token ) {
|
||||
var buckets = experiment.buckets,
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@
|
|||
* Generate and print one more reports. When invoked with no arguments,
|
||||
* print all reports.
|
||||
*
|
||||
* @param {string...} [reports] Report names to run, or unset to print
|
||||
* @param {...string} [reports] Report names to run, or unset to print
|
||||
* all available reports.
|
||||
*/
|
||||
runReports: function () {
|
||||
|
|
|
|||
|
|
@ -1008,7 +1008,7 @@
|
|||
*
|
||||
* @param {Array} nodes List of one element, integer, n >= 0
|
||||
* @param {Array} replacements List of at least n strings
|
||||
* @return {String} replacement
|
||||
* @return {string} replacement
|
||||
*/
|
||||
replace: function ( nodes, replacements ) {
|
||||
var index = parseInt( nodes[ 0 ], 10 );
|
||||
|
|
@ -1033,7 +1033,7 @@
|
|||
* from the server, since the replacement is done at save time.
|
||||
* It may, though, if the wikitext appears in extension-controlled content.
|
||||
*
|
||||
* @param {String[]} nodes
|
||||
* @param {string[]} nodes
|
||||
*/
|
||||
wikilink: function ( nodes ) {
|
||||
var page, anchor, url;
|
||||
|
|
@ -1097,7 +1097,7 @@
|
|||
*
|
||||
* TODO: throw an error if nodes.length > 2 ?
|
||||
*
|
||||
* @param {Array} nodes List of two elements, {jQuery|Function|String} and {String}
|
||||
* @param {Array} nodes List of two elements, {jQuery|Function|String} and {string}
|
||||
* @return {jQuery}
|
||||
*/
|
||||
extlink: function ( nodes ) {
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@
|
|||
*
|
||||
* @since 1.25
|
||||
* @param {string} formatString Format string
|
||||
* @param {Mixed...} parameters Values for $N replacements
|
||||
* @param {...Mixed} parameters Values for $N replacements
|
||||
* @return {string} Formatted string
|
||||
*/
|
||||
format: function ( formatString ) {
|
||||
|
|
@ -558,7 +558,7 @@
|
|||
*
|
||||
* @see mw.Message
|
||||
* @param {string} key Key of message to get
|
||||
* @param {Mixed...} parameters Values for $N replacements
|
||||
* @param {...Mixed} parameters Values for $N replacements
|
||||
* @return {mw.Message}
|
||||
*/
|
||||
message: function ( key ) {
|
||||
|
|
@ -573,7 +573,7 @@
|
|||
*
|
||||
* @see mw.Message
|
||||
* @param {string} key Key of message to get
|
||||
* @param {Mixed...} parameters Values for $N replacements
|
||||
* @param {...Mixed} parameters Values for $N replacements
|
||||
* @return {string}
|
||||
*/
|
||||
msg: function () {
|
||||
|
|
@ -599,7 +599,7 @@
|
|||
* Write a message the console's warning channel.
|
||||
* Actions not supported by the browser console are silently ignored.
|
||||
*
|
||||
* @param {string...} msg Messages to output to console
|
||||
* @param {...string} msg Messages to output to console
|
||||
*/
|
||||
log.warn = function () {
|
||||
var console = window.console;
|
||||
|
|
@ -615,7 +615,7 @@
|
|||
* is a caught Error object.
|
||||
*
|
||||
* @since 1.26
|
||||
* @param {Error|string...} msg Messages to output to console
|
||||
* @param {Error|...string} msg Messages to output to console
|
||||
*/
|
||||
log.error = function () {
|
||||
var console = window.console;
|
||||
|
|
@ -2528,7 +2528,7 @@
|
|||
/**
|
||||
* Register a hook handler
|
||||
*
|
||||
* @param {Function...} handler Function to bind.
|
||||
* @param {...Function} handler Function to bind.
|
||||
* @chainable
|
||||
*/
|
||||
add: list.add,
|
||||
|
|
@ -2536,7 +2536,7 @@
|
|||
/**
|
||||
* Unregister a hook handler
|
||||
*
|
||||
* @param {Function...} handler Function to unbind.
|
||||
* @param {...Function} handler Function to unbind.
|
||||
* @chainable
|
||||
*/
|
||||
remove: list.remove,
|
||||
|
|
@ -2544,7 +2544,7 @@
|
|||
/**
|
||||
* Run a hook.
|
||||
*
|
||||
* @param {Mixed...} data
|
||||
* @param {...Mixed} data
|
||||
* @chainable
|
||||
*/
|
||||
fire: function () {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* messages to that, instead of the console.
|
||||
*
|
||||
* @member mw.log
|
||||
* @param {string...} msg Messages to output to console.
|
||||
* @param {...string} msg Messages to output to console.
|
||||
*/
|
||||
mw.log = function () {
|
||||
// Turn arguments into an array
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* @param {string} key Key name to store under
|
||||
* @param {string} value Value to be stored
|
||||
* @returns {boolean} Whether the save succeeded or not
|
||||
* @return {boolean} Whether the save succeeded or not
|
||||
*/
|
||||
set: function ( key, value ) {
|
||||
try {
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
* Remove a value from device storage.
|
||||
*
|
||||
* @param {string} key Key of item to remove
|
||||
* @returns {boolean} Whether the save succeeded or not
|
||||
* @return {boolean} Whether the save succeeded or not
|
||||
*/
|
||||
remove: function ( key ) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
* Get the name of the compiler associated with a template based on its name.
|
||||
*
|
||||
* @param {string} templateName Name of template (including file suffix)
|
||||
* @return {String} Name of compiler
|
||||
* @return {string} Name of compiler
|
||||
*/
|
||||
getCompilerName: function ( templateName ) {
|
||||
var templateParts = templateName.split( '.' );
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
/**
|
||||
* Add bogus to url to prevent IE crazy caching
|
||||
*
|
||||
* @param {String} value 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'
|
||||
* @return {string} Such as 'data/foo.js?131031765087663960'
|
||||
*/
|
||||
QUnit.fixurl = function ( value ) {
|
||||
return value + ( /\?/.test( value ) ? '&' : '?' )
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@
|
|||
/**
|
||||
* For a value, check if the parser recognizes it and how it transforms it
|
||||
*
|
||||
* @param {String} msg text to pass on to qunit describing the test case
|
||||
* @param {String[]} parserId of the parser that will be tested
|
||||
* @param {String[][]} data Array of testcases. Each testcase, array of
|
||||
* @param {string} msg text to pass on to qunit describing the test case
|
||||
* @param {string[]} parserId of the parser that will be tested
|
||||
* @param {string[][]} data Array of testcases. Each testcase, array of
|
||||
* inputValue: The string value that we want to test the parser for
|
||||
* recognized: If we expect that this value's type is detectable by the parser
|
||||
* outputValue: The value the parser has converted the input to
|
||||
|
|
|
|||
|
|
@ -209,8 +209,8 @@
|
|||
* Create an HTML table from an array of row arrays containing text strings.
|
||||
* First row will be header row. No fancy rowspan/colspan stuff.
|
||||
*
|
||||
* @param {String[]} header
|
||||
* @param {String[][]} data
|
||||
* @param {string[]} header
|
||||
* @param {string[][]} data
|
||||
* @return {jQuery}
|
||||
*/
|
||||
function tableCreate( header, data ) {
|
||||
|
|
@ -242,7 +242,7 @@
|
|||
* Extract text from table.
|
||||
*
|
||||
* @param {jQuery} $table
|
||||
* @return {String[][]}
|
||||
* @return {string[][]}
|
||||
*/
|
||||
function tableExtract( $table ) {
|
||||
var data = [];
|
||||
|
|
@ -261,10 +261,10 @@
|
|||
* Run a table test by building a table with the given data,
|
||||
* running some callback on it, then checking the results.
|
||||
*
|
||||
* @param {String} msg text to pass on to qunit for the comparison
|
||||
* @param {String[]} header cols to make the table
|
||||
* @param {String[][]} data rows/cols to make the table
|
||||
* @param {String[][]} expected rows/cols to compare against at end
|
||||
* @param {string} msg text to pass on to qunit for the comparison
|
||||
* @param {string[]} header cols to make the table
|
||||
* @param {string[][]} data rows/cols to make the table
|
||||
* @param {string[][]} expected rows/cols to compare against at end
|
||||
* @param {function($table)} callback something to do with the table before we compare
|
||||
*/
|
||||
function tableTest( msg, header, data, expected, callback ) {
|
||||
|
|
@ -286,9 +286,9 @@
|
|||
* Run a table test by building a table with the given HTML,
|
||||
* running some callback on it, then checking the results.
|
||||
*
|
||||
* @param {String} msg text to pass on to qunit for the comparison
|
||||
* @param {String} html HTML to make the table
|
||||
* @param {String[][]} expected Rows/cols to compare against at end
|
||||
* @param {string} msg text to pass on to qunit for the comparison
|
||||
* @param {string} html HTML to make the table
|
||||
* @param {string[][]} expected Rows/cols to compare against at end
|
||||
* @param {function($table)} callback Something to do with the table before we compare
|
||||
*/
|
||||
function tableTestHTML( msg, html, expected, callback ) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @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' )
|
||||
* @param {Object} options.params Additional parameters for $().textSelection( 'encapsulateText' )
|
||||
*/
|
||||
function encapsulateTest( options ) {
|
||||
var opt = $.extend( {
|
||||
|
|
|
|||
Loading…
Reference in a new issue