From 8cab18b15d8f82b3cca090ac2897fbb94af74ec4 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Fri, 14 Apr 2017 14:39:00 -0700 Subject: [PATCH] Standardize @return, @param, type case. --- .eslintrc.json | 13 ++++++++++- lib/legacy/class.html | 4 ++-- lib/legacy/legacy-element-mixin.html | 30 ++++++++++++------------- lib/legacy/templatizer-behavior.html | 2 +- lib/mixins/element-mixin.html | 8 +++---- lib/mixins/property-effects.html | 4 ++-- lib/utils/flattened-nodes-observer.html | 2 +- lib/utils/gestures.html | 6 ++--- lib/utils/mixin.html | 2 +- test/unit/configure.html | 2 +- 10 files changed, 42 insertions(+), 31 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2f2f881d38..3c7fac3497 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,7 +6,18 @@ "no-var": "error", "strict": "error", "valid-jsdoc": ["error", { - "requireReturn": false + "requireReturn": false, + "prefer": { + "arg": "param", + "argument": "param", + "returns": "return" + }, + "preferType": { + "Boolean": "boolean", + "Number": "number", + "String": "string", + "object": "Object" + } }] }, "env": { diff --git a/lib/legacy/class.html b/lib/legacy/class.html index 2b74a68be5..a63c6a16a7 100644 --- a/lib/legacy/class.html +++ b/lib/legacy/class.html @@ -37,7 +37,7 @@ * * @param {Object|Array} behaviors Behavior object or array of behaviors. * @param {HTMLElement} klass Element class. - * @returns {HTMLElement} Returns a new Element class extended by the + * @return {HTMLElement} Returns a new Element class extended by the * passed in `behaviors` and also by `Polymer.LegacyElementMixin`. * @memberof Polymer */ @@ -110,7 +110,7 @@ * @param {Array} behaviors List of behaviors to flatten. * @param {Array=} list Target list to flatten behaviors into. * @param {Array=} exclude List of behaviors to exclude from the list. - * @returns {Array} Returns the list of flattened behaviors. + * @return {Array} Returns the list of flattened behaviors. */ function flattenBehaviors(behaviors, list, exclude) { list = list || []; diff --git a/lib/legacy/legacy-element-mixin.html b/lib/legacy/legacy-element-mixin.html index dc1ab55fd5..2add4236f4 100644 --- a/lib/legacy/legacy-element-mixin.html +++ b/lib/legacy/legacy-element-mixin.html @@ -192,7 +192,7 @@ * * @param {string} value String to deserialize * @param {*} type Type to deserialize the string to - * @returns {*} Returns the deserialized value in the `type` given. + * @return {*} Returns the deserialized value in the `type` given. */ deserialize(value, type) { return this._deserializeValue(value, type); @@ -276,7 +276,7 @@ * @param {Object} object The object on which to set the prototype. * @param {Object} prototype The prototype that will be set on the given * `object`. - * @returns {Object} Returns the given `object` with its prototype set + * @return {Object} Returns the given `object` with its prototype set * to the given `prototype` object. */ chainObject(object, prototype) { @@ -389,7 +389,7 @@ * - 'none': disable scrolling for this node * * @method setScrollDirection - * @param {String=} direction Direction to allow scrolling + * @param {string=} direction Direction to allow scrolling * Defaults to `all`. * @param {HTMLElement=} node Element to apply scroll direction setting. * Defaults to `this`. @@ -529,7 +529,7 @@ * an optional selector may be passed to choose the desired content. * * @method getContentChildNodes - * @param {String=} slctr CSS selector to choose the desired + * @param {string=} slctr CSS selector to choose the desired * ``. Defaults to `content`. * @return {Array} List of distributed nodes for the ``. */ @@ -548,7 +548,7 @@ * elements are returned. * * @method getContentChildNodes - * @param {String=} slctr CSS selector to choose the desired + * @param {string=} slctr CSS selector to choose the desired * ``. Defaults to `content`. * @return {Array} List of distributed nodes for the * ``. @@ -564,7 +564,7 @@ * * @method isLightDescendant * @param {?Node} node The element to be checked. - * @return {Boolean} true if node is in this element's light DOM tree. + * @return {boolean} true if node is in this element's light DOM tree. */ isLightDescendant(node) { return this !== node && this.contains(node) && @@ -588,8 +588,8 @@ /** * Returns the computed style value for the given property. - * @param {String} property The css property name. - * @returns {String} Returns the computed css property value for the given + * @param {string} property The css property name. + * @return {string} Returns the computed css property value for the given * `property`. */ getComputedStyleValue(property) { @@ -612,12 +612,12 @@ * } * * @method debounce - * @param {String} jobName String to indentify the debounce job. + * @param {string} jobName String to indentify the debounce job. * @param {function()} callback Function that is called (with `this` * context) when the wait time elapses. * @param {number} wait Optional wait time in milliseconds (ms) after the * last signal that must elapse before invoking `callback` - * @returns {Object} Returns a debouncer object on which exists the + * @return {Object} Returns a debouncer object on which exists the * following methods: `isActive()` returns true if the debouncer is * active; `cancel()` cancels the debouncer if it is active; * `flush()` immediately invokes the debounced callback if the debouncer @@ -635,7 +635,7 @@ * Returns whether a named debouncer is active. * * @method isDebouncerActive - * @param {String} jobName The name of the debouncer started with `debounce` + * @param {string} jobName The name of the debouncer started with `debounce` * @return {boolean} Whether the debouncer is active (has not yet fired). */ isDebouncerActive(jobName) { @@ -648,7 +648,7 @@ * Immediately calls the debouncer `callback` and inactivates it. * * @method flushDebouncer - * @param {String} jobName The name of the debouncer started with `debounce` + * @param {string} jobName The name of the debouncer started with `debounce` */ flushDebouncer(jobName) { this._debouncers = this._debouncers || {}; @@ -662,7 +662,7 @@ * Cancels an active debouncer. The `callback` will not be called. * * @method cancelDebouncer - * @param {String} jobName The name of the debouncer started with `debounce` + * @param {string} jobName The name of the debouncer started with `debounce` */ cancelDebouncer(jobName) { this._debouncers = this._debouncers || {} @@ -768,7 +768,7 @@ * Toggles an HTML attribute on or off. * * @method toggleAttribute - * @param {String} name HTML attribute name + * @param {string} name HTML attribute name * @param {boolean=} bool Boolean to force the attribute on or off. * When unspecified, the state of the attribute will be reversed. * @param {HTMLElement=} node Node to target. Defaults to `this`. @@ -790,7 +790,7 @@ * Toggles a CSS class on or off. * * @method toggleClass - * @param {String} name CSS class name + * @param {string} name CSS class name * @param {boolean=} bool Boolean to force the class on or off. * When unspecified, the state of the class will be reversed. * @param {HTMLElement=} node Node to target. Defaults to `this`. diff --git a/lib/legacy/templatizer-behavior.html b/lib/legacy/templatizer-behavior.html index 8673bba042..7a15533b65 100644 --- a/lib/legacy/templatizer-behavior.html +++ b/lib/legacy/templatizer-behavior.html @@ -84,7 +84,7 @@ * by `stamp` to create new instances of the template. * * @param {HTMLTemplateElement} template Template to prepare - * @param {Boolean=} mutableData When `true`, the generated class will skip + * @param {boolean=} mutableData When `true`, the generated class will skip * strict dirty-checking for objects and arrays (always consider them to * be "dirty"). Defaults to false. */ diff --git a/lib/mixins/element-mixin.html b/lib/mixins/element-mixin.html index 607c112dfc..6f5e2d8739 100644 --- a/lib/mixins/element-mixin.html +++ b/lib/mixins/element-mixin.html @@ -384,9 +384,9 @@ * @param {HTMLElement} proto Element class prototype to add accessors * and effects to * @param {string} name Name of the property. - * @param {object} info Info object from which to create property effects. + * @param {Object} info Info object from which to create property effects. * Supported keys: - * @param {object} allProps Flattened map of all properties defined in this + * @param {Object} allProps Flattened map of all properties defined in this * element (including inherited properties) * @private */ @@ -529,7 +529,7 @@ * } * } * - * @returns {HTMLTemplateElement|string} Template to be stamped + * @return {HTMLTemplateElement|string} Template to be stamped */ static get template() { if (!this.hasOwnProperty(goog.reflect.objectProperty('_template', this))) { @@ -551,7 +551,7 @@ * matching this element's static `is` property. * Note, this path should contain a trailing `/`. * - * @returns {string} The import path for this element class + * @return {string} The import path for this element class */ static get importPath() { if (!this.hasOwnProperty(goog.reflect.objectProperty('_importPath', this))) { diff --git a/lib/mixins/property-effects.html b/lib/mixins/property-effects.html index 1a21f9212d..92537dcac5 100644 --- a/lib/mixins/property-effects.html +++ b/lib/mixins/property-effects.html @@ -482,7 +482,7 @@ * @param {Object} templateInfo Template metadata for current template * @param {Object} binding Binding metadata * @param {Object} part Binding part metadata - * @param {Number} index Index into `nodeInfoList` for this node + * @param {number} index Index into `nodeInfoList` for this node */ function addEffectForBindingPart(constructor, templateInfo, binding, part, index) { if (!part.literal) { @@ -2280,7 +2280,7 @@ * - Inline computed method (supports negation): * `[[compute(a, 'literal', b)]]`, `[[!compute(a, 'literal', b)]]` * - * @param {String} text Text to parse from attribute or textContent + * @param {string} text Text to parse from attribute or textContent * @param {Object} templateInfo Current template metadata * @return {Array} Array of binding part metadata * @protected diff --git a/lib/utils/flattened-nodes-observer.html b/lib/utils/flattened-nodes-observer.html index 0a49b3ab0d..c1f75d038b 100644 --- a/lib/utils/flattened-nodes-observer.html +++ b/lib/utils/flattened-nodes-observer.html @@ -57,7 +57,7 @@ * `` elements assigned to it, these are flattened as well. * * @param {Node} node The node for which to return the list of flattened nodes. - * @returns {Array} The list of flattened nodes for the given `node`. + * @return {Array} The list of flattened nodes for the given `node`. */ static getFlattenedNodes(node) { if (isSlot(node)) { diff --git a/lib/utils/gestures.html b/lib/utils/gestures.html index 5d8183f848..4fe82a9ac0 100644 --- a/lib/utils/gestures.html +++ b/lib/utils/gestures.html @@ -263,7 +263,7 @@ * * @private * @param {Event} ev Event. - * @returns {HTMLElement} Returns the event target. + * @return {HTMLElement} Returns the event target. */ _findOriginalTarget: function(ev) { // shadowdom @@ -379,7 +379,7 @@ * @param {Node} node Node to add listener on * @param {string} evType Gesture type: `down`, `up`, `track`, or `tap` * @param {Function} handler Event listener function to call - * @returns {boolean} Returns true if a gesture event listener was added. + * @return {boolean} Returns true if a gesture event listener was added. */ addListener: function(node, evType, handler) { if (this.gestures[evType]) { @@ -396,7 +396,7 @@ * @param {string} evType Gesture type: `down`, `up`, `track`, or `tap` * @param {Function} handler Event listener function previously passed to * `addListener`. - * @returns {boolean} Returns true if a gesture event listener was removed. + * @return {boolean} Returns true if a gesture event listener was removed. */ removeListener: function(node, evType, handler) { if (this.gestures[evType]) { diff --git a/lib/utils/mixin.html b/lib/utils/mixin.html index 0285f7782c..e82cf6de4a 100644 --- a/lib/utils/mixin.html +++ b/lib/utils/mixin.html @@ -23,7 +23,7 @@ * Given a mixin producing function, memoize applications of mixin to base * @private * @param {Object} mixin Mixin for which to create a caching mixin. - * @returns {Object} Returns a mixin which when applied multiple times to the + * @return {Object} Returns a mixin which when applied multiple times to the * same base will always return the same extended class. */ function cachingMixin(mixin) { diff --git a/test/unit/configure.html b/test/unit/configure.html index 02d7921283..2ea7beeaf7 100644 --- a/test/unit/configure.html +++ b/test/unit/configure.html @@ -113,7 +113,7 @@