build: Enable all remaining jsduck jsDoc rules except two
authorJames D. Forrester <jforrester@wikimedia.org>
Sat, 5 Sep 2015 20:16:23 +0000 (13:16 -0700)
committerJames D. Forrester <jforrester@wikimedia.org>
Sat, 7 Nov 2015 02:18:16 +0000 (18:18 -0800)
Enabling 'checkAnnotations' with a set of extra tags bespoke to this repo,
and 'checkRedudantAccess' means we're pretty close to compliant in core.
Leaving 'checkRedundantParams' and 'checkReturnTypes' off for now.

Change-Id: I89c4d5250fee30fdfd87a68e173cf222c08cab32

14 files changed:
.jscsrc
resources/src/jquery/jquery.placeholder.js
resources/src/jquery/jquery.tablesorter.js
resources/src/jquery/jquery.textSelection.js
resources/src/mediawiki.widgets/mw.widgets.CalendarWidget.js
resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js
resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
resources/src/mediawiki.widgets/mw.widgets.UserInputWidget.js
resources/src/mediawiki/mediawiki.Upload.BookletLayout.js
resources/src/mediawiki/mediawiki.Upload.Dialog.js
resources/src/mediawiki/mediawiki.Uri.js
resources/src/mediawiki/mediawiki.experiments.js
resources/src/mediawiki/mediawiki.feedback.js
resources/src/mediawiki/mediawiki.notification.js

diff --git a/.jscsrc b/.jscsrc
index c1fbc9a..3b94b90 100644 (file)
--- a/.jscsrc
+++ b/.jscsrc
@@ -7,7 +7,17 @@
        "disallowQuotedKeysInObjects": "allButReserved",
        "requireDotNotation": { "allExcept": [ "keywords" ] },
        "jsDoc": {
+               "checkAnnotations": {
+                       "preset": "jsduck5",
+                       "extra": {
+                               "context": true,
+                               "source": true,
+                               "see": true,
+                               "private": true
+                       }
+               },
                "checkParamNames": true,
+               "checkRedundantAccess": true,
                "checkRedundantReturns": true,
                "checkTypes": "strictNativeCase",
                "requireNewlineAfterDescription": true,
index 9c18a91..c472ac7 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*!
  * HTML5 placeholder emulation for jQuery plugin
  *
  * This will automatically use the HTML5 placeholder attribute if supported, or emulate this behavior if not.
@@ -13,6 +13,7 @@
  * @version 2.1.0
  * @license MIT
  */
+
 ( function ( $ ) {
 
        var isInputSupported = 'placeholder' in document.createElement( 'input' ),
index c39dc55..2318b33 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*!
  * TableSorter for MediaWiki
  *
  * Written 2011 Leo Koppelkamm
  * and mw.language.months.
  *
  * Uses 'tableSorterCollation' in mw.config (if available)
- */
-/**
  *
- * @description Create a sortable table with multi-column sorting capabilities
+ * Create a sortable table with multi-column sorting capabilities
  *
- * @example $( 'table' ).tablesorter();
- * @desc Create a simple tablesorter interface.
+ *      // Create a simple tablesorter interface
+ *      $( 'table' ).tablesorter();
  *
- * @example $( 'table' ).tablesorter( { sortList: [ { 0: 'desc' }, { 1: 'asc' } ] } );
- * @desc Create a tablesorter interface initially sorting on the first and second column.
+ *      // Create a tablesorter interface, initially sorting on the first and second column
+ *      $( 'table' ).tablesorter( { sortList: [ { 0: 'desc' }, { 1: 'asc' } ] } );
  *
- * @option String cssHeader ( optional ) A string of the class name to be appended
- *         to sortable tr elements in the thead of the table. Default value:
- *         "header"
+ * @param {string} [cssHeader="header"] A string of the class name to be appended to sortable
+ *         tr elements in the thead of the table.
  *
- * @option String cssAsc ( optional ) A string of the class name to be appended to
- *         sortable tr elements in the thead on a ascending sort. Default value:
- *         "headerSortUp"
+ * @param {string} [cssAsc="headerSortUp"] A string of the class name to be appended to
+ *         sortable tr elements in the thead on a ascending sort.
  *
- * @option String cssDesc ( optional ) A string of the class name to be appended
- *         to sortable tr elements in the thead on a descending sort. Default
- *         value: "headerSortDown"
+ * @param {string} [cssDesc="headerSortDown"] A string of the class name to be appended to
+ *         sortable tr elements in the thead on a descending sort.
  *
- * @option String sortMultisortKey ( optional ) A string of the multi-column sort
- *         key. Default value: "shiftKey"
+ * @param {string} [sortMultisortKey="shiftKey"] A string of the multi-column sort key.
  *
- * @option Boolean cancelSelection ( optional ) Boolean flag indicating if
- *         tablesorter should cancel selection of the table headers text.
- *         Default value: true
+ * @param {boolean} [cancelSelection=true] Boolean flag indicating iftablesorter should cancel
+ *         selection of the table headers text.
  *
- * @option Array sortList ( optional ) An array containing objects specifying sorting.
- *         By passing more than one object, multi-sorting will be applied. Object structure:
+ * @param {Array} [sortList] An array containing objects specifying sorting. By passing more
+ *         than one object, multi-sorting will be applied. Object structure:
  *         { <Integer column index>: <String 'asc' or 'desc'> }
- *         Default value: []
  *
  * @event sortEnd.tablesorter: Triggered as soon as any sorting has been applied.
  *
- * @type jQuery
- *
- * @name tablesorter
- *
- * @cat Plugins/Tablesorter
- *
  * @author Christian Bach/christian.bach@polyester.se
  */
-
 ( function ( $, mw ) {
        var ts,
                parsers = [];
index b901642..5e93ba6 100644 (file)
@@ -96,7 +96,7 @@
                         * Inserts text at the beginning and end of a text selection, optionally
                         * inserting text at the caret when selection is empty.
                         *
-                        * @fixme document the options parameters
+                        * FIXME document the options parameters
                         */
                        encapsulateSelection: function ( options ) {
                                return this.each( function () {
                         *
                         * Will focus the textarea in some browsers (IE/Opera)
                         *
-                        * @fixme document the options parameters
+                        * FIXME document the options parameters
                         */
                        getCaretPosition: function ( options ) {
                                function getCaret( e ) {
                                return getCaret( this.get( 0 ) );
                        },
                        /**
-                        * @fixme document the options parameters
+                        * FIXME document the options parameters
                         */
                        setSelection: function ( options ) {
                                return this.each( function () {
                         * @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)
+                        * FIXME document the options parameters (function body suggests options.force is a boolean, not options itself)
                         */
                        scrollToCaretPosition: function ( options ) {
                                function getLineLength( e ) {
index d5e5b96..7a7b9cd 100644 (file)
         * internally and for dates accepted by #setDate and returned by #getDate.
         *
         * @private
-        * @returns {string} Format
+        * @return {string} Format
         */
        mw.widgets.CalendarWidget.prototype.getDateFormat = function () {
                return {
         * Get the date precision this calendar uses, 'day' or 'month'.
         *
         * @private
-        * @returns {string} Precision, 'day' or 'month'
+        * @return {string} Precision, 'day' or 'month'
         */
        mw.widgets.CalendarWidget.prototype.getPrecision = function () {
                return this.precision;
         * Get list of possible display layers.
         *
         * @private
-        * @returns {string[]} Layers
+        * @return {string[]} Layers
         */
        mw.widgets.CalendarWidget.prototype.getDisplayLayers = function () {
                return [ 'month', 'year', 'duodecade' ].slice( this.precision === 'month' ? 1 : 0 );
         * Get current date, in the format 'YYYY-MM-DD' or 'YYYY-MM', depending on precision. Digits will
         * not be localised.
         *
-        * @returns {string|null} Date string
+        * @return {string|null} Date string
         */
        mw.widgets.CalendarWidget.prototype.getDate = function () {
                return this.date;
index b1e5151..1ffcc66 100644 (file)
         * @private
         * @param {string} date Date string, to be valid, must be in 'YYYY-MM-DD' or 'YYYY-MM' format or
         *     (unless the field is required) empty
-        * @returns {boolean}
+        * @return {boolean}
         */
        mw.widgets.DateInputWidget.prototype.validateDate = function ( date ) {
                var isValid;
        /**
         * @private
         * @param {string} date Date string, to be valid, must be in 'YYYY-MM-DD' or 'YYYY-MM' format
-        * @returns {boolean}
+        * @return {boolean}
         */
        mw.widgets.DateInputWidget.prototype.isValidDate = function ( date ) {
                // "Half-strict mode": for example, for the format 'YYYY-MM-DD', 2015-1-3 instead of 2015-01-03
         * @private
         * @param {string} date Date string, to be valid, must be empty (no date selected) or in
         *     'YYYY-MM-DD' or 'YYYY-MM' format to be valid
-        * @returns {boolean}
+        * @return {boolean}
         */
        mw.widgets.DateInputWidget.prototype.isInRange = function ( date ) {
                var momentDate = moment( date, 'YYYY-MM-DD' ),
index 76fe959..67f3e01 100644 (file)
         * Get option widgets from the server response
         *
         * @param {Object} data Query result
-        * @returns {OO.ui.OptionWidget[]} Menu items
+        * @return {OO.ui.OptionWidget[]} Menu items
         */
        mw.widgets.TitleWidget.prototype.getOptionsFromData = function ( data ) {
                var i, len, index, pageExists, pageExistsExact, suggestionPage, page, redirect, redirects,
         * Get title object corresponding to given value, or #getQueryValue if not given.
         *
         * @param {string} [value] Value to get a title for
-        * @returns {mw.Title|null} Title object, or null if value is invalid
+        * @return {mw.Title|null} Title object, or null if value is invalid
         */
        mw.widgets.TitleWidget.prototype.getTitle = function ( value ) {
                var title = value !== undefined ? value : this.getQueryValue(),
index 0d0fb73..164fd20 100644 (file)
@@ -99,7 +99,7 @@
         * Get list of menu items from a server response.
         *
         * @param {Object} data Query result
-        * @returns {OO.ui.MenuOptionWidget[]} Menu items
+        * @return {OO.ui.MenuOptionWidget[]} Menu items
         */
        mw.widgets.UserInputWidget.prototype.getLookupMenuOptionsFromData = function ( data ) {
                var len, i, user,
index c616829..4ce2c1a 100644 (file)
         *
         * @protected
         * @fires fileSaved
-        * @returns {jQuery.Promise} Rejects the promise with an
+        * @return {jQuery.Promise} Rejects the promise with an
         * {@link OO.ui.Error error}, or resolves if the upload was successful.
         */
        mw.Upload.BookletLayout.prototype.saveFile = function () {
         * state and state details.
         *
         * @protected
-        * @returns {OO.ui.Error} Error to display for given state and details.
+        * @return {OO.ui.Error} Error to display for given state and details.
         */
        mw.Upload.BookletLayout.prototype.getErrorMessageForStateDetails = function () {
                var message,
         *
         * @protected
         * @fires selectFile
-        * @returns {OO.ui.FormLayout}
+        * @return {OO.ui.FormLayout}
         */
        mw.Upload.BookletLayout.prototype.renderUploadForm = function () {
                var fieldset;
         * property.
         *
         * @protected
-        * @returns {OO.ui.FormLayout}
+        * @return {OO.ui.FormLayout}
         */
        mw.Upload.BookletLayout.prototype.renderInfoForm = function () {
                var fieldset;
         * sets the {@link #insertForm insertForm} property.
         *
         * @protected
-        * @returns {OO.ui.FormLayout}
+        * @return {OO.ui.FormLayout}
         */
        mw.Upload.BookletLayout.prototype.renderInsertForm = function () {
                var fieldset;
         * {@link #uploadForm upload form}.
         *
         * @protected
-        * @returns {File|null}
+        * @return {File|null}
         */
        mw.Upload.BookletLayout.prototype.getFile = function () {
                return this.selectFileWidget.getValue();
         * {@link #infoForm information form}.
         *
         * @protected
-        * @returns {string}
+        * @return {string}
         */
        mw.Upload.BookletLayout.prototype.getFilename = function () {
                return this.filenameWidget.getValue();
         * {@link #infoForm information form}.
         *
         * @protected
-        * @returns {string}
+        * @return {string}
         */
        mw.Upload.BookletLayout.prototype.getText = function () {
                return this.descriptionWidget.getValue();
index 53afca8..5f2569c 100644 (file)
                                this.uploadBooklet.clear();
                        }, this );
        };
-
 }( jQuery, mediaWiki ) );
index 9d29b4c..ba5ece8 100644 (file)
                }() );
 
                /**
-                * @class mw.Uri
-                * @constructor
-                *
                 * Construct a new URI object. Throws error if arguments are illegal/impossible, or
                 * otherwise don't parse.
                 *
+                * @class mw.Uri
+                * @constructor
                 * @param {Object|string} [uri] URI string, or an Object with appropriate properties (especially
                 *  another URI object to clone). Object must have non-blank `protocol`, `host`, and `path`
                 *  properties. If omitted (or set to `undefined`, `null` or empty string), then an object
index b62e8d1..ad1069f 100644 (file)
@@ -76,7 +76,7 @@
                 *  that the user will be assigned to that bucket
                 * @param {string} token A token that uniquely identifies the user for the
                 *  duration of the experiment
-                * @returns {string} The bucket
+                * @return {string} The bucket
                 */
                getBucket: function ( experiment, token ) {
                        var buckets = experiment.buckets,
index d226ed9..68818be 100644 (file)
        /**
         * Get the bug report link
         *
-        * @returns {string} Link to the external bug report form
+        * @return {string} Link to the external bug report form
         */
        mw.Feedback.Dialog.prototype.getBugReportLink = function () {
                return this.bugReportLink;
index 3f7b8fd..36b45f1 100644 (file)
         * The underscore in the name is to avoid a bug <https://github.com/senchalabs/jsduck/issues/304>.
         * It is not part of the actual class name.
         *
+        * The constructor is not publicly accessible; use mw.notification#notify instead.
+        * This does not insert anything into the document (see #start).
+        *
         * @class mw.Notification_
         * @alternateClassName mw.Notification
-        *
-        * @constructor The constructor is not publicly accessible; use mw.notification#notify instead.
-        *  This does not insert anything into the document (see #start).
+        * @constructor
         * @private
         */
        function Notification( message, options ) {