"jsDoc": {
"checkParamNames": true,
"checkRedundantReturns": true,
+ "checkTypes": "strictNativeCase",
"requireNewlineAfterDescription": true,
"requireParamTypes": true,
"requireReturnTypes": true
// 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
} );
};
+// jscs:enable jsDoc
/**
* @class jQuery
* 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 ) {
* 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
* 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 ) ) {
* 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:
* 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 ) {
* 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 ) {
* 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 }`
*
* @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>
* 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,
* 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 () {
*
* @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 );
* 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;
*
* 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 ) {
*
* @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 ) {
*
* @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 ) {
*
* @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 () {
* 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;
* 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;
/**
* Register a hook handler
*
- * @param {Function...} handler Function to bind.
+ * @param {...Function} handler Function to bind.
* @chainable
*/
add: list.add,
/**
* Unregister a hook handler
*
- * @param {Function...} handler Function to unbind.
+ * @param {...Function} handler Function to unbind.
* @chainable
*/
remove: list.remove,
/**
* Run a hook.
*
- * @param {Mixed...} data
+ * @param {...Mixed} data
* @chainable
*/
fire: function () {
* 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
*
* @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 {
* 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 {
* 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( '.' );
/**
* 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 ) ? '&' : '?' )
/**
* 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
* 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 ) {
* Extract text from table.
*
* @param {jQuery} $table
- * @return {String[][]}
+ * @return {string[][]}
*/
function tableExtract( $table ) {
var data = [];
* 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 ) {
* 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 ) {
* @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( {