Browse Source

eslint jsdoc fixes

Artur Paikin 5 years ago
parent
commit
81a45a01ed

+ 1 - 1
packages/@uppy/core/src/Plugin.js

@@ -92,7 +92,7 @@ module.exports = class Plugin {
    * If it’s an object — target is a plugin, and we search `plugins`
    * for a plugin with same name and return its target.
    *
-   * @param {String|Object} target
+   * @param {string|Object} target
    *
    */
   mount (target, plugin) {

+ 3 - 3
packages/@uppy/dashboard/src/utils/copyToClipboard.js

@@ -4,9 +4,9 @@
  * Falls back to prompt() when the easy way fails (hello, Safari!)
  * From http://stackoverflow.com/a/30810322
  *
- * @param {String} textToCopy
- * @param {String} fallbackString
- * @return {Promise}
+ * @param {string} textToCopy
+ * @param {string} fallbackString
+ * @returns {Promise}
  */
 module.exports = function copyToClipboard (textToCopy, fallbackString) {
   fallbackString = fallbackString || 'Copy the URL below'

+ 2 - 2
packages/@uppy/thumbnail-generator/src/index.js

@@ -41,7 +41,7 @@ module.exports = class ThumbnailGenerator extends Plugin {
    *
    * @param {{data: Blob}} file
    * @param {number} width
-   * @return {Promise}
+   * @returns {Promise}
    */
   createThumbnail (file, targetWidth, targetHeight) {
     const originalUrl = URL.createObjectURL(file.data)
@@ -208,7 +208,7 @@ module.exports = class ThumbnailGenerator extends Plugin {
    * Save a <canvas> element's content to a Blob object.
    *
    * @param {HTMLCanvasElement} canvas
-   * @return {Promise}
+   * @returns {Promise}
    */
   canvasToBlob (canvas, type, quality) {
     try {

+ 4 - 4
packages/@uppy/transloadit/src/Client.js

@@ -11,7 +11,7 @@ module.exports = class Client {
   /**
    * Create a new assembly.
    *
-   * @param {object} options
+   * @param {Object} options
    */
   createAssembly ({
     templateId,
@@ -52,7 +52,7 @@ module.exports = class Client {
   /**
    * Reserve resources for a file in an Assembly. Then addFile can be used later.
    *
-   * @param {object} assembly
+   * @param {Object} assembly
    * @param {UppyFile} file
    */
   reserveFile (assembly, file) {
@@ -66,7 +66,7 @@ module.exports = class Client {
   /**
    * Import a remote file to an Assembly.
    *
-   * @param {object} assembly
+   * @param {Object} assembly
    * @param {UppyFile} file
    */
   addFile (assembly, file) {
@@ -88,7 +88,7 @@ module.exports = class Client {
   /**
    * Cancel a running Assembly.
    *
-   * @param {object} assembly
+   * @param {Object} assembly
    */
   cancelAssembly (assembly) {
     const url = assembly.assembly_ssl_url

+ 1 - 1
packages/@uppy/transloadit/src/index.js

@@ -361,7 +361,7 @@ module.exports = class Transloadit extends Plugin {
    * Custom state serialization for the Golden Retriever plugin.
    * It will pass this back to the `_onRestored` function.
    *
-   * @param {function} setData
+   * @param {Function} setData
    */
   _getPersistentData (setData) {
     const state = this.getPluginState()

+ 1 - 1
packages/@uppy/tus/src/index.js

@@ -119,7 +119,7 @@ module.exports = class Tus extends Plugin {
   /**
    * Create a new Tus upload
    *
-   * @param {object} file for use with upload
+   * @param {Object} file for use with upload
    * @param {integer} current file in a queue
    * @param {integer} total number of files in a queue
    * @returns {Promise}

+ 7 - 6
packages/@uppy/utils/src/Translator.js

@@ -50,8 +50,8 @@ module.exports = class Translator {
    * taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
    *
    * @param {string} phrase that needs interpolation, with placeholders
-   * @param {object} options with values that will be used to replace placeholders
-   * @return {string} interpolated
+   * @param {Object} options with values that will be used to replace placeholders
+   * @returns {string} interpolated
    */
   interpolate (phrase, options) {
     const { split, replace } = String.prototype
@@ -99,8 +99,8 @@ module.exports = class Translator {
    * Public translate method
    *
    * @param {string} key
-   * @param {object} options with values that will be used later to replace placeholders in string
-   * @return {string} translated (and interpolated)
+   * @param {Object} options with values that will be used later to replace placeholders in string
+   * @returns {string} translated (and interpolated)
    */
   translate (key, options) {
     return this.translateArray(key, options).join('')
@@ -108,9 +108,10 @@ module.exports = class Translator {
 
   /**
    * Get a translation and return the translated and interpolated parts as an array.
+   *
    * @param {string} key
-   * @param {object} options with values that will be used to replace placeholders
-   * @return {Array} The translated and interpolated parts, in order.
+   * @param {Object} options with values that will be used to replace placeholders
+   * @returns {Array} The translated and interpolated parts, in order.
    */
   translateArray (key, options) {
     if (options && typeof options.smart_count !== 'undefined') {

+ 1 - 1
packages/@uppy/utils/src/canvasToBlob.js

@@ -4,7 +4,7 @@ const dataURItoBlob = require('./dataURItoBlob')
  * Save a <canvas> element's content to a Blob object.
  *
  * @param {HTMLCanvasElement} canvas
- * @return {Promise}
+ * @returns {Promise}
  */
 module.exports = function canvasToBlob (canvas, type, quality) {
   if (canvas.toBlob) {

+ 1 - 1
packages/@uppy/utils/src/findAllDOMElements.js

@@ -4,7 +4,7 @@ const isDOMElement = require('./isDOMElement')
  * Find one or more DOM elements.
  *
  * @param {string} element
- * @return {Array|null}
+ * @returns {Array|null}
  */
 module.exports = function findAllDOMElements (element) {
   if (typeof element === 'string') {

+ 1 - 1
packages/@uppy/utils/src/findDOMElement.js

@@ -4,7 +4,7 @@ const isDOMElement = require('./isDOMElement')
  * Find a DOM element.
  *
  * @param {Node|string} element
- * @return {Node|null}
+ * @returns {Node|null}
  */
 module.exports = function findDOMElement (element, context = document) {
   if (typeof element === 'string') {

+ 1 - 1
packages/@uppy/utils/src/generateFileID.js

@@ -3,7 +3,7 @@
  * removing extra characters and adding type, size and lastModified
  *
  * @param {Object} file
- * @return {String} the fileID
+ * @returns {string} the fileID
  *
  */
 module.exports = function generateFileID (file) {

+ 1 - 1
packages/@uppy/utils/src/getFileNameAndExtension.js

@@ -2,7 +2,7 @@
 * Takes a full filename string and returns an object {name, extension}
 *
 * @param {string} fullFileName
-* @return {object} {name, extension}
+* @returns {Object} {name, extension}
 */
 module.exports = function getFileNameAndExtension (fullFileName) {
   var re = /(?:\.([^.]+))?$/

+ 1 - 1
packages/@uppy/utils/src/isDragDropSupported.js

@@ -1,7 +1,7 @@
 /**
  * Checks if the browser supports Drag & Drop (not supported on mobile devices, for example).
  *
- * @return {Boolean}
+ * @returns {boolean}
  */
 module.exports = function isDragDropSupported () {
   const div = document.createElement('div')

+ 1 - 1
packages/@uppy/utils/src/isObjectURL.js

@@ -2,7 +2,7 @@
  * Check if a URL string is an object URL from `URL.createObjectURL`.
  *
  * @param {string} url
- * @return {boolean}
+ * @returns {boolean}
  */
 module.exports = function isObjectURL (url) {
   return url.indexOf('blob:') === 0

+ 1 - 1
packages/@uppy/utils/src/limitPromises.js

@@ -4,7 +4,7 @@
  * will make sure that at most `limit` calls to `fn` are pending.
  *
  * @param {number} limit
- * @return {function()}
+ * @returns {function()}
  */
 module.exports = function limitPromises (limit) {
   let pending = 0

+ 4 - 2
website/build-examples.js

@@ -111,8 +111,9 @@ glob(srcPattern, (err, files) => {
     /**
      * Creates bundle and writes it to static and public folders.
      * Changes to
+     *
      * @param  {[type]} ids [description]
-     * @return {[type]}     [description]
+     * @returns {[type]}     [description]
      */
     function bundle (ids = []) {
       ids.forEach((id) => {
@@ -144,7 +145,8 @@ glob(srcPattern, (err, files) => {
 /**
  * Logs to console and shows desktop notification on error.
  * Calls `this.emit(end)` to stop bundling.
- * @param  {object} err Error object
+ *
+ * @param  {Object} err Error object
  */
 function onError (err) {
   console.error(chalk.red('✗ error:'), chalk.red(err.message))