From 74b980310852a0b406fa9d073870f92c409d5444 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Thu, 2 Dec 2021 18:32:57 +0100 Subject: Eslint fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- core/src/OC/admin.js | 2 +- core/src/OC/apps.js | 10 ++++-- core/src/OC/capabilities.js | 2 +- core/src/OC/get_set.js | 3 +- core/src/OC/host.js | 6 ++-- core/src/OC/index.js | 12 ++++--- core/src/OC/l10n-registry.js | 22 ++++++------- core/src/OC/l10n.js | 34 ++++++++++--------- core/src/OC/legacy-loader.js | 4 ++- core/src/OC/menu.js | 8 ++--- core/src/OC/msg.js | 20 ++++++------ core/src/OC/navigation.js | 1 + core/src/OC/notification.js | 17 +++++----- core/src/OC/password-confirmation.js | 2 +- core/src/OC/plugins.js | 18 +++++----- core/src/OC/query-string.js | 8 +++-- core/src/OC/requesttoken.js | 6 ++-- core/src/OC/routing.js | 3 +- core/src/OC/util-history.js | 11 ++++--- core/src/OC/util.js | 24 +++++++++----- core/src/OC/xhr-error.js | 1 + core/src/OCA/index.js | 1 + core/src/OCP/appconfig.js | 38 +++++++++++----------- core/src/OCP/collaboration.js | 9 ++--- core/src/OCP/comments.js | 12 +++++++ core/src/OCP/loader.js | 4 +-- core/src/OCP/toast.js | 10 +++--- core/src/OCP/whatsnew.js | 24 ++++++++++++++ core/src/Util/get-url-parameter.js | 3 ++ core/src/components/setup/RecommendedApps.vue | 6 ++-- core/src/globals.js | 6 ++-- core/src/jquery/exists.js | 3 +- core/src/jquery/filterattr.js | 2 +- core/src/jquery/selectrange.js | 3 +- core/src/services/UnifiedSearchService.js | 11 ++++--- core/src/services/WebAuthnAuthenticationService.js | 6 ++++ core/src/session-heartbeat.js | 12 ++++--- core/src/systemtags/systemtagsmappingcollection.js | 36 ++++++++++---------- core/src/views/UnifiedSearch.vue | 37 ++++++++++++++------- 39 files changed, 267 insertions(+), 170 deletions(-) (limited to 'core') diff --git a/core/src/OC/admin.js b/core/src/OC/admin.js index bb947573490..96ad6cd4048 100644 --- a/core/src/OC/admin.js +++ b/core/src/OC/admin.js @@ -26,7 +26,7 @@ const isAdmin = !!window._oc_isadmin /** * Returns whether the current user is an administrator * - * @returns {bool} true if the user is an admin, false otherwise + * @return {bool} true if the user is an admin, false otherwise * @since 9.0.0 */ export const isUserAdmin = () => isAdmin diff --git a/core/src/OC/apps.js b/core/src/OC/apps.js index d504a99eaac..89b7b10247e 100644 --- a/core/src/OC/apps.js +++ b/core/src/OC/apps.js @@ -34,7 +34,7 @@ const Apps = { /** * Shows the #app-sidebar and add .with-app-sidebar to subsequent siblings * - * @param {Object} [$el] sidebar element to show, defaults to $('#app-sidebar') + * @param {object} [$el] sidebar element to show, defaults to $('#app-sidebar') */ Apps.showAppSidebar = function($el) { const $appSidebar = $el || $('#app-sidebar') @@ -46,7 +46,7 @@ Apps.showAppSidebar = function($el) { * Shows the #app-sidebar and removes .with-app-sidebar from subsequent * siblings * - * @param {Object} [$el] sidebar element to hide, defaults to $('#app-sidebar') + * @param {object} [$el] sidebar element to hide, defaults to $('#app-sidebar') */ Apps.hideAppSidebar = function($el) { const $appSidebar = $el || $('#app-sidebar') @@ -81,6 +81,9 @@ export const registerAppsSlideToggle = () => { const areaSelector = $(button).data('apps-slide-toggle') const area = $(areaSelector) + /** + * + */ function hideArea() { area.slideUp(OC.menuSpeed * 4, function() { area.trigger(new $.Event('hide')) @@ -89,6 +92,9 @@ export const registerAppsSlideToggle = () => { $(button).removeClass('opened') } + /** + * + */ function showArea() { area.slideDown(OC.menuSpeed * 4, function() { area.trigger(new $.Event('show')) diff --git a/core/src/OC/capabilities.js b/core/src/OC/capabilities.js index 50b919d0ea3..01405ec9b29 100644 --- a/core/src/OC/capabilities.js +++ b/core/src/OC/capabilities.js @@ -27,7 +27,7 @@ import { getCapabilities as realGetCapabilities } from '@nextcloud/capabilities' /** * Returns the capabilities * - * @returns {Array} capabilities + * @return {Array} capabilities * * @since 14.0 */ diff --git a/core/src/OC/get_set.js b/core/src/OC/get_set.js index e5d5bd5c5fd..082cef67ca8 100644 --- a/core/src/OC/get_set.js +++ b/core/src/OC/get_set.js @@ -36,8 +36,9 @@ export const get = context => name => { /** * Set a variable by name + * * @param {string} context context - * @returns {Function} setter + * @return {Function} setter * @deprecated 19.0.0 use https://lodash.com/docs#set */ export const set = context => (name, value) => { diff --git a/core/src/OC/host.js b/core/src/OC/host.js index 44623b27399..d525818a6ca 100644 --- a/core/src/OC/host.js +++ b/core/src/OC/host.js @@ -32,7 +32,7 @@ export const getProtocol = () => window.location.protocol.split(':')[0] * https://example.com => example.com * http://example.com:8080 => example.com:8080 * - * @returns {string} host + * @return {string} host * * @since 8.2 * @deprecated 17.0.0 use window.location.host directly @@ -43,7 +43,7 @@ export const getHost = () => window.location.host * Returns the hostname used to access this Nextcloud instance * The hostname is always stripped of the port * - * @returns {string} hostname + * @return {string} hostname * @since 9.0 * @deprecated 17.0.0 use window.location.hostname directly */ @@ -52,7 +52,7 @@ export const getHostName = () => window.location.hostname /** * Returns the port number used to access this Nextcloud instance * - * @returns {int} port number + * @return {int} port number * * @since 8.2 * @deprecated 17.0.0 use window.location.port directly diff --git a/core/src/OC/index.js b/core/src/OC/index.js index ebf9171bada..7f811c51a56 100644 --- a/core/src/OC/index.js +++ b/core/src/OC/index.js @@ -133,8 +133,9 @@ export default { */ /** * Check if a user file is allowed to be handled. + * * @param {string} file to check - * @returns {Boolean} + * @return {boolean} * @deprecated 17.0.0 */ fileIsBlacklisted: file => !!(file.match(Config.blacklist_files_regex)), @@ -171,6 +172,7 @@ export default { /** * Ajax error handlers + * * @todo remove from here and keep internally -> requires new tests */ _ajaxConnectionLostHandler: ajaxConnectionLostHandler, @@ -234,7 +236,7 @@ export default { /** * Loads translations for the given app asynchronously. * - * @param {String} app app name + * @param {string} app app name * @param {Function} callback callback to call after loading * @return {Promise} * @deprecated 17.0.0 use OC.L10N.load instead @@ -286,9 +288,9 @@ export default { */ linkTo, /** - * @param {String} service service name - * @param {Number} version OCS API version - * @returns {String} OCS API base path + * @param {string} service service name + * @param {number} version OCS API version + * @return {string} OCS API base path * @deprecated 19.0.0 use `generateOcsUrl` from https://www.npmjs.com/package/@nextcloud/router */ linkToOCS: (service, version) => { diff --git a/core/src/OC/l10n-registry.js b/core/src/OC/l10n-registry.js index 5ed463275a9..b2579fd67cf 100644 --- a/core/src/OC/l10n-registry.js +++ b/core/src/OC/l10n-registry.js @@ -26,8 +26,8 @@ window._oc_l10n_registry_translations = window._oc_l10n_registry_translations || window._oc_l10n_registry_plural_functions = window._oc_l10n_registry_plural_functions || {} /** - * @param {String} appId the app id - * @param {Object} translations the translations list + * @param {string} appId the app id + * @param {object} translations the translations list * @param {Function} pluralFunction the translations list */ const register = (appId, translations, pluralFunction) => { @@ -36,8 +36,8 @@ const register = (appId, translations, pluralFunction) => { } /** - * @param {String} appId the app id - * @param {Object} translations the translations list + * @param {string} appId the app id + * @param {object} translations the translations list * @param {Function} pluralFunction the translations list */ const extend = (appId, translations, pluralFunction) => { @@ -49,8 +49,8 @@ const extend = (appId, translations, pluralFunction) => { } /** - * @param {String} appId the app id - * @param {Object} translations the translations list + * @param {string} appId the app id + * @param {object} translations the translations list * @param {Function} pluralFunction the translations list */ export const registerAppTranslations = (appId, translations, pluralFunction) => { @@ -62,7 +62,7 @@ export const registerAppTranslations = (appId, translations, pluralFunction) => } /** - * @param {String} appId the app id + * @param {string} appId the app id */ export const unregisterAppTranslations = appId => { delete window._oc_l10n_registry_translations[appId] @@ -70,8 +70,8 @@ export const unregisterAppTranslations = appId => { } /** - * @param {String} appId the app id - * @returns {Boolean} + * @param {string} appId the app id + * @return {boolean} */ export const hasAppTranslations = appId => { return window._oc_l10n_registry_translations[appId] !== undefined @@ -79,8 +79,8 @@ export const hasAppTranslations = appId => { } /** - * @param {String} appId the app id - * @returns {Object} + * @param {string} appId the app id + * @return {object} */ export const getAppTranslations = appId => { return { diff --git a/core/src/OC/l10n.js b/core/src/OC/l10n.js index 0704269ce4b..48dfe6c1785 100644 --- a/core/src/OC/l10n.js +++ b/core/src/OC/l10n.js @@ -1,7 +1,7 @@ /** * Copyright (c) 2014 Vincent Petry - * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * * @author Christoph Wurst * @author Daniel Kesselberg @@ -54,10 +54,10 @@ const L10n = { /** * Load an app's translation bundle if not loaded already. * - * @param {String} appName name of the app + * @param {string} appName name of the app * @param {Function} callback callback to be called when * the translations are loaded - * @returns {Promise} promise + * @return {Promise} promise */ load(appName, callback) { // already available ? @@ -86,28 +86,29 @@ const L10n = { /** * Register an app's translation bundle. * - * @param {String} appName name of the app - * @param {Object} bundle bundle + * @param {string} appName name of the app + * @param {object} bundle bundle */ register(appName, bundle) { registerAppTranslations(appName, bundle, this._getPlural) }, /** - * @private do not use this + * @private */ _unregister: unregisterAppTranslations, /** * Translate a string + * * @param {string} app the id of the app for which to translate the string * @param {string} text the string to translate - * @param {Object} [vars] map of placeholder key to value + * @param {object} [vars] map of placeholder key to value * @param {number} [count] number to replace %n with - * @param {array} [options] options array + * @param {Array} [options] options array * @param {bool} [options.escape=true] enable/disable auto escape of placeholders (by default enabled) * @param {bool} [options.sanitize=true] enable/disable sanitization (by default enabled) - * @returns {string} + * @return {string} */ translate(app, text, vars, count, options) { const defaultOptions = { @@ -151,14 +152,15 @@ const L10n = { /** * Translate a plural string + * * @param {string} app the id of the app for which to translate the string * @param {string} textSingular the string to translate for exactly one object * @param {string} textPlural the string to translate for n objects * @param {number} count number to determine whether to use singular or plural - * @param {Object} [vars] map of placeholder key to value - * @param {array} [options] options array + * @param {object} [vars] map of placeholder key to value + * @param {Array} [options] options array * @param {bool} [options.escape=true] enable/disable auto escape of placeholders (by default enabled) - * @returns {string} Translated string + * @return {string} Translated string */ translatePlural(app, textSingular, textPlural, count, vars, options) { const identifier = '_' + textSingular + '_::_' + textPlural + '_' @@ -183,7 +185,7 @@ const L10n = { * The plural function taken from symfony * * @param {number} number the number of elements - * @returns {number} + * @return {number} * @private */ _getPlural(number) { @@ -346,14 +348,14 @@ export default L10n /** * Returns the user's locale * - * @returns {String} locale string + * @return {string} locale string */ export const getLocale = () => $('html').data('locale') ?? 'en' /** * Returns the user's language * - * @returns {String} language string + * @return {string} language string */ export const getLanguage = () => $('html').prop('lang') diff --git a/core/src/OC/legacy-loader.js b/core/src/OC/legacy-loader.js index 3fedc07a081..07efbef0fc6 100644 --- a/core/src/OC/legacy-loader.js +++ b/core/src/OC/legacy-loader.js @@ -31,10 +31,11 @@ const loadedStyles = [] /** * Load a script for the server and load it. If the script is already loaded, * the event handler will be called directly + * * @param {string} app the app id to which the script belongs * @param {string} script the filename of the script * @param {Function} ready event handler to be called when the script is loaded - * @returns {jQuery.Deferred} + * @return {jQuery.Deferred} * @deprecated 16.0.0 Use OCP.Loader.loadScript */ export const addScript = (app, script, ready) => { @@ -56,6 +57,7 @@ export const addScript = (app, script, ready) => { /** * Loads a CSS file + * * @param {string} app the app id to which the css style belongs * @param {string} style the filename of the css file * @deprecated 16.0.0 Use OCP.Loader.loadStylesheet diff --git a/core/src/OC/menu.js b/core/src/OC/menu.js index 26d139b5f08..669b1f1566b 100644 --- a/core/src/OC/menu.js +++ b/core/src/OC/menu.js @@ -35,9 +35,9 @@ export let currentMenuToggle = null * * @param {jQuery} $toggle the toggle element * @param {jQuery} $menuEl the menu container element - * @param {function|undefined} toggle callback invoked everytime the menu is opened + * @param {Function | undefined} toggle callback invoked everytime the menu is opened * @param {boolean} headerMenu is this a top right header menu? - * @returns {undefined} + * @return {undefined} */ export const registerMenu = function($toggle, $menuEl, toggle, headerMenu) { $menuEl.addClass('menu') @@ -119,8 +119,8 @@ export const hideMenus = function(complete) { /** * Shows a given element as menu * - * @param {Object} [$toggle=null] menu toggle - * @param {Object} $menuEl menu element + * @param {object} [$toggle=null] menu toggle + * @param {object} $menuEl menu element * @param {Function} complete callback when the showing animation is done */ export const showMenu = ($toggle, $menuEl, complete) => { diff --git a/core/src/OC/msg.js b/core/src/OC/msg.js index bb28d873c98..861fe2b9086 100644 --- a/core/src/OC/msg.js +++ b/core/src/OC/msg.js @@ -35,7 +35,7 @@ export default { /** * Displayes a "Saving..." message in the given message placeholder * - * @param {Object} selector Placeholder to display the message in + * @param {object} selector Placeholder to display the message in */ startSaving(selector) { this.startAction(selector, t('core', 'Saving …')) @@ -44,7 +44,7 @@ export default { /** * Displayes a custom message in the given message placeholder * - * @param {Object} selector Placeholder to display the message in + * @param {object} selector Placeholder to display the message in * @param {string} message Plain text message to display (no HTML allowed) */ startAction(selector, message) { @@ -58,9 +58,9 @@ export default { /** * Displayes an success/error message in the given selector * - * @param {Object} selector Placeholder to display the message in - * @param {Object} response Response of the server - * @param {Object} response.data Data of the servers response + * @param {object} selector Placeholder to display the message in + * @param {object} response Response of the server + * @param {object} response.data Data of the servers response * @param {string} response.data.message Plain text message to display (no HTML allowed) * @param {string} response.status is being used to decide whether the message * is displayed as an error/success @@ -72,9 +72,9 @@ export default { /** * Displayes an success/error message in the given selector * - * @param {Object} selector Placeholder to display the message in - * @param {Object} response Response of the server - * @param {Object} response.data Data of the servers response + * @param {object} selector Placeholder to display the message in + * @param {object} response Response of the server + * @param {object} response.data Data of the servers response * @param {string} response.data.message Plain text message to display (no HTML allowed) * @param {string} response.status is being used to decide whether the message * is displayed as an error/success @@ -90,7 +90,7 @@ export default { /** * Displayes an success message in the given selector * - * @param {Object} selector Placeholder to display the message in + * @param {object} selector Placeholder to display the message in * @param {string} message Plain text success message to display (no HTML allowed) */ finishedSuccess(selector, message) { @@ -106,7 +106,7 @@ export default { /** * Displayes an error message in the given selector * - * @param {Object} selector Placeholder to display the message in + * @param {object} selector Placeholder to display the message in * @param {string} message Plain text error message to display (no HTML allowed) */ finishedError(selector, message) { diff --git a/core/src/OC/navigation.js b/core/src/OC/navigation.js index a4ccb9ced51..4c72e9e71db 100644 --- a/core/src/OC/navigation.js +++ b/core/src/OC/navigation.js @@ -25,6 +25,7 @@ export const redirect = targetURL => { window.location = targetURL } /** * Reloads the current page + * * @deprecated 17.0.0 use window.location.reload directly */ export const reload = () => { window.location.reload() } diff --git a/core/src/OC/notification.js b/core/src/OC/notification.js index a0b289b6a87..02383af81df 100644 --- a/core/src/OC/notification.js +++ b/core/src/OC/notification.js @@ -95,10 +95,10 @@ export default { * Consider using show() instead of showHTML() * * @param {string} html Message to display - * @param {Object} [options] options + * @param {object} [options] options * @param {string} [options.type] notification type * @param {int} [options.timeout=0] timeout value, defaults to 0 (permanent) - * @returns {jQuery} jQuery element for notification row + * @return {jQuery} jQuery element for notification row * @deprecated 17.0.0 use the `@nextcloud/dialogs` package */ showHtml(html, options) { @@ -114,10 +114,10 @@ export default { * Shows a sanitized notification * * @param {string} text Message to display - * @param {Object} [options] options + * @param {object} [options] options * @param {string} [options.type] notification type * @param {int} [options.timeout=0] timeout value, defaults to 0 (permanent) - * @returns {jQuery} jQuery element for notification row + * @return {jQuery} jQuery element for notification row * @deprecated 17.0.0 use the `@nextcloud/dialogs` package */ show(text, options) { @@ -141,7 +141,7 @@ export default { * Updates (replaces) a sanitized notification. * * @param {string} text Message to display - * @returns {jQuery} JQuery element for notificaiton row + * @return {jQuery} JQuery element for notificaiton row * @deprecated 17.0.0 use the `@nextcloud/dialogs` package */ showUpdate(text) { @@ -158,11 +158,11 @@ export default { * 7 seconds * * @param {string} text Message to show - * @param {array} [options] options array + * @param {Array} [options] options array * @param {int} [options.timeout=7] timeout in seconds, if this is 0 it will show the message permanently * @param {boolean} [options.isHTML=false] an indicator for HTML notifications (true) or text (false) * @param {string} [options.type] notification type - * @returns {JQuery} the toast element + * @return {JQuery} the toast element * @deprecated 17.0.0 use the `@nextcloud/dialogs` package */ showTemporary(text, options) { @@ -175,7 +175,8 @@ export default { /** * Returns whether a notification is hidden. - * @returns {boolean} + * + * @return {boolean} * @deprecated 17.0.0 use the `@nextcloud/dialogs` package */ isHidden() { diff --git a/core/src/OC/password-confirmation.js b/core/src/OC/password-confirmation.js index ec70720b4d2..e387de74ae3 100644 --- a/core/src/OC/password-confirmation.js +++ b/core/src/OC/password-confirmation.js @@ -52,7 +52,7 @@ export default { /** * @param {Function} callback success callback function - * @param {Object} options options + * @param {object} options options * @param {Function} rejectCallback error callback function */ requirePasswordConfirmation(callback, options, rejectCallback) { diff --git a/core/src/OC/plugins.js b/core/src/OC/plugins.js index dab74db11e9..6be76a2d5a4 100644 --- a/core/src/OC/plugins.js +++ b/core/src/OC/plugins.js @@ -31,7 +31,7 @@ export default { /** * Register plugin * - * @param {String} targetName app name / class name to hook into + * @param {string} targetName app name / class name to hook into * @param {OC.Plugin} plugin plugin */ register(targetName, plugin) { @@ -46,8 +46,8 @@ export default { * Returns all plugin registered to the given target * name / app name / class name. * - * @param {String} targetName app name / class name to hook into - * @returns {Array.} array of plugins + * @param {string} targetName app name / class name to hook into + * @return {Array.} array of plugins */ getPlugins(targetName) { return this._plugins[targetName] || [] @@ -56,9 +56,9 @@ export default { /** * Call attach() on all plugins registered to the given target name. * - * @param {String} targetName app name / class name - * @param {Object} targetObject to be extended - * @param {Object} [options] options + * @param {string} targetName app name / class name + * @param {object} targetObject to be extended + * @param {object} [options] options */ attach(targetName, targetObject, options) { const plugins = this.getPlugins(targetName) @@ -72,9 +72,9 @@ export default { /** * Call detach() on all plugins registered to the given target name. * - * @param {String} targetName app name / class name - * @param {Object} targetObject to be extended - * @param {Object} [options] options + * @param {string} targetName app name / class name + * @param {object} targetObject to be extended + * @param {object} [options] options */ detach(targetName, targetObject, options) { const plugins = this.getPlugins(targetName) diff --git a/core/src/OC/query-string.js b/core/src/OC/query-string.js index 3b71ebb5a8d..b61f84c7a6b 100644 --- a/core/src/OC/query-string.js +++ b/core/src/OC/query-string.js @@ -26,8 +26,9 @@ import $ from 'jquery' /** * Parses a URL query string into a JS map + * * @param {string} queryString query string in the format param1=1234¶m2=abcde¶m3=xyz - * @returns {Object.} map containing key/values matching the URL parameters + * @return {object.} map containing key/values matching the URL parameters */ export const parse = queryString => { let pos @@ -75,8 +76,9 @@ export const parse = queryString => { /** * Builds a URL query from a JS map. - * @param {Object.} params map containing key/values matching the URL parameters - * @returns {string} String containing a URL query (without question) mark + * + * @param {object.} params map containing key/values matching the URL parameters + * @return {string} String containing a URL query (without question) mark */ export const build = params => { if (!params) { diff --git a/core/src/OC/requesttoken.js b/core/src/OC/requesttoken.js index 06ccdffd00d..f532b6f19d6 100644 --- a/core/src/OC/requesttoken.js +++ b/core/src/OC/requesttoken.js @@ -27,7 +27,7 @@ import { emit } from '@nextcloud/event-bus' * @private * @param {Document} global the document to read the initial value from * @param {Function} emit the function to invoke for every new token - * @returns {Object} + * @return {object} */ export const manageToken = (global, emit) => { let token = global.getElementsByTagName('head')[0].getAttribute('data-requesttoken') @@ -47,11 +47,11 @@ export const manageToken = (global, emit) => { const manageFromDocument = manageToken(document, emit) /** - * @returns {string} + * @return {string} */ export const getToken = manageFromDocument.getToken /** - * @param {String} newToken new token + * @param {string} newToken new token */ export const setToken = manageFromDocument.setToken diff --git a/core/src/OC/routing.js b/core/src/OC/routing.js index 0531a6776a4..b978d92c500 100644 --- a/core/src/OC/routing.js +++ b/core/src/OC/routing.js @@ -28,8 +28,9 @@ import { /** * Creates a relative url for remote use + * * @param {string} service id - * @returns {string} the url + * @return {string} the url */ export const linkToRemoteBase = service => { return realGetRootUrl() + '/remote.php/' + service diff --git a/core/src/OC/util-history.js b/core/src/OC/util-history.js index de40a9c4eed..64d15997ecc 100644 --- a/core/src/OC/util-history.js +++ b/core/src/OC/util-history.js @@ -41,7 +41,7 @@ export default { * Note: this includes a workaround for IE8/IE9 that uses * the hash part instead of the search part. * - * @param {Object|string} params to append to the URL, can be either a string + * @param {object | string} params to append to the URL, can be either a string * or a map * @param {string} [url] URL to be used, otherwise the current URL will be used, * using the params as query string @@ -92,7 +92,7 @@ export default { * Note: this includes a workaround for IE8/IE9 that uses * the hash part instead of the search part. * - * @param {Object|string} params to append to the URL, can be either a string or a map + * @param {object | string} params to append to the URL, can be either a string or a map * @param {string} [url] URL to be used, otherwise the current URL will be used, using the params as query string */ pushState(params, url) { @@ -105,7 +105,7 @@ export default { * Note: this includes a workaround for IE8/IE9 that uses * the hash part instead of the search part. * - * @param {Object|string} params to append to the URL, can be either a string + * @param {object | string} params to append to the URL, can be either a string * or a map * @param {string} [url] URL to be used, otherwise the current URL will be used, * using the params as query string @@ -126,7 +126,8 @@ export default { /** * Parse a query string from the hash part of the URL. * (workaround for IE8 / IE9) - * @returns {string} + * + * @return {string} */ _parseHashQuery() { const hash = window.location.hash @@ -149,7 +150,7 @@ export default { * Parse the query/search part of the URL. * Also try and parse it from the URL hash (for IE8) * - * @returns {Object} map of parameters + * @return {object} map of parameters */ parseUrlQuery() { const query = this._parseHashQuery() diff --git a/core/src/OC/util.js b/core/src/OC/util.js index cd7d7c42a3b..e3e3e2a3171 100644 --- a/core/src/OC/util.js +++ b/core/src/OC/util.js @@ -27,6 +27,9 @@ import History from './util-history' import OC from './index' import { formatFileSize as humanFileSize } from '@nextcloud/files' +/** + * @param t + */ function chunkify(t) { // Adapted from http://my.opera.com/GreyWyvern/blog/show.dml/1671288 const tz = [] @@ -53,6 +56,7 @@ function chunkify(t) { /** * Utility functions + * * @namespace OC.Util */ export default { @@ -68,8 +72,9 @@ export default { * Returns a file size in bytes from a humanly readable string * Makes 2kB to 2048. * Inspired by computerFileSize in helper.php + * * @param {string} string file size in human readable format - * @returns {number} or null if string could not be parsed + * @return {number} or null if string could not be parsed * * */ @@ -115,7 +120,7 @@ export default { /** * @param {string|number} timestamp timestamp * @param {string} format date format, see momentjs docs - * @returns {string} timestamp formatted as requested + * @return {string} timestamp formatted as requested */ formatDate(timestamp, format) { if (window.TESTING === undefined) { @@ -127,7 +132,7 @@ export default { /** * @param {string|number} timestamp timestamp - * @returns {string} human readable difference from now + * @return {string} human readable difference from now */ relativeModifiedDate(timestamp) { if (window.TESTING === undefined) { @@ -143,7 +148,7 @@ export default { /** * Returns the width of a generic browser scrollbar * - * @returns {int} width of scrollbar + * @return {int} width of scrollbar */ getScrollBarWidth() { if (this._scrollBarWidth) { @@ -183,7 +188,7 @@ export default { * Remove the time component from a given date * * @param {Date} date date - * @returns {Date} date with stripped time + * @return {Date} date with stripped time */ stripTime(date) { // FIXME: likely to break when crossing DST @@ -193,9 +198,10 @@ export default { /** * Compare two strings to provide a natural sort + * * @param {string} a first string to compare * @param {string} b second string to compare - * @returns {number} -1 if b comes before a, 1 if a comes before b + * @return {number} -1 if b comes before a, 1 if a comes before b * or 0 if the strings are identical */ naturalSortCompare(a, b) { @@ -222,7 +228,8 @@ export default { /** * Calls the callback in a given interval until it returns true - * @param {function} callback function to call on success + * + * @param {Function} callback function to call on success * @param {integer} interval in milliseconds */ waitFor(callback, interval) { @@ -237,9 +244,10 @@ export default { /** * Checks if a cookie with the given name is present and is set to the provided value. + * * @param {string} name name of the cookie * @param {string} value value of the cookie - * @returns {boolean} true if the cookie with the given name has the given value + * @return {boolean} true if the cookie with the given name has the given value */ isCookieSetToValue(name, value) { const cookies = document.cookie.split(';') diff --git a/core/src/OC/xhr-error.js b/core/src/OC/xhr-error.js index 660651dd0d9..3bf31e649e8 100644 --- a/core/src/OC/xhr-error.js +++ b/core/src/OC/xhr-error.js @@ -41,6 +41,7 @@ export const ajaxConnectionLostHandler = _.throttle(() => { /** * Process ajax error, redirects to main page * if an error/auth error status was returned. + * * @param {XMLHttpRequest} xhr xhr request */ export const processAjaxError = xhr => { diff --git a/core/src/OCA/index.js b/core/src/OCA/index.js index 2f92eff367b..1db47ba0d31 100644 --- a/core/src/OCA/index.js +++ b/core/src/OCA/index.js @@ -24,6 +24,7 @@ import Search from './search' /** * Namespace for apps + * * @namespace OCA */ export default { diff --git a/core/src/OCP/appconfig.js b/core/src/OCP/appconfig.js index d8c8c152a37..b4062bdf850 100644 --- a/core/src/OCP/appconfig.js +++ b/core/src/OCP/appconfig.js @@ -29,10 +29,10 @@ import OC from '../OC/index' /** * @param {string} method 'post' or 'delete' * @param {string} endpoint endpoint - * @param {Object} [options] destructuring object - * @param {Object} [options.data] option data - * @param {function} [options.success] success callback - * @param {function} [options.error] error callback + * @param {object} [options] destructuring object + * @param {object} [options.data] option data + * @param {Function} [options.success] success callback + * @param {Function} [options.error] error callback * @internal */ function call(method, endpoint, options) { @@ -52,8 +52,8 @@ function call(method, endpoint, options) { } /** - * @param {Object} [options] destructuring object - * @param {function} [options.success] success callback + * @param {object} [options] destructuring object + * @param {Function} [options.success] success callback * @since 11.0.0 */ export function getApps(options) { @@ -62,9 +62,9 @@ export function getApps(options) { /** * @param {string} app app id - * @param {Object} [options] destructuring object - * @param {function} [options.success] success callback - * @param {function} [options.error] error callback + * @param {object} [options] destructuring object + * @param {Function} [options.success] success callback + * @param {Function} [options.error] error callback * @since 11.0.0 */ export function getKeys(app, options) { @@ -74,10 +74,10 @@ export function getKeys(app, options) { /** * @param {string} app app id * @param {string} key key - * @param {string|function} defaultValue default value - * @param {Object} [options] destructuring object - * @param {function} [options.success] success callback - * @param {function} [options.error] error callback + * @param {string | Function} defaultValue default value + * @param {object} [options] destructuring object + * @param {Function} [options.success] success callback + * @param {Function} [options.error] error callback * @since 11.0.0 */ export function getValue(app, key, defaultValue, options) { @@ -93,9 +93,9 @@ export function getValue(app, key, defaultValue, options) { * @param {string} app app id * @param {string} key key * @param {string} value value - * @param {Object} [options] destructuring object - * @param {function} [options.success] success callback - * @param {function} [options.error] error callback + * @param {object} [options] destructuring object + * @param {Function} [options.success] success callback + * @param {Function} [options.error] error callback * @since 11.0.0 */ export function setValue(app, key, value, options) { @@ -110,9 +110,9 @@ export function setValue(app, key, value, options) { /** * @param {string} app app id * @param {string} key key - * @param {Object} [options] destructuring object - * @param {function} [options.success] success callback - * @param {function} [options.error] error callback + * @param {object} [options] destructuring object + * @param {Function} [options.success] success callback + * @param {Function} [options.error] error callback * @since 11.0.0 */ export function deleteKey(app, key, options) { diff --git a/core/src/OCP/collaboration.js b/core/src/OCP/collaboration.js index 06ff7b6b570..129440033e3 100644 --- a/core/src/OCP/collaboration.js +++ b/core/src/OCP/collaboration.js @@ -25,20 +25,21 @@ import escapeHTML from 'escape-html' /** * @typedef TypeDefinition - * @method {callback} action This action is executed to let the user select a resource + * @function {callback} action This action is executed to let the user select a resource * @param {string} icon Contains the icon css class for the type - * @constructor + * @function Object() { [native code] } */ /** * @type {TypeDefinition[]} - **/ + */ const types = {} /** * Those translations will be used by the vue component but they should be shipped with the server * FIXME: Those translations should be added to the library - * @returns {Array} + * + * @return {Array} */ export const l10nProjects = () => { return [ diff --git a/core/src/OCP/comments.js b/core/src/OCP/comments.js index 5d346a80ba0..9f30557d231 100644 --- a/core/src/OCP/comments.js +++ b/core/src/OCP/comments.js @@ -34,14 +34,23 @@ import $ from 'jquery' */ const urlRegex = /(\s|^)(https?:\/\/)?((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|$)/ig +/** + * @param content + */ export function plainToRich(content) { return this.formatLinksRich(content) } +/** + * @param content + */ export function richToPlain(content) { return this.formatLinksPlain(content) } +/** + * @param content + */ export function formatLinksRich(content) { return content.replace(urlRegex, function(_, leadingSpace, protocol, url, trailingSpace) { let linkText = url @@ -55,6 +64,9 @@ export function formatLinksRich(content) { }) } +/** + * @param content + */ export function formatLinksPlain(content) { const $content = $('
').html(content) $content.find('a').each(function() { diff --git a/core/src/OCP/loader.js b/core/src/OCP/loader.js index 9a41fa7910f..354475b7fc1 100644 --- a/core/src/OCP/loader.js +++ b/core/src/OCP/loader.js @@ -35,7 +35,7 @@ export default { * * @param {string} app the app name * @param {string} file the script file name - * @returns {Promise} + * @return {Promise} */ loadScript(app, file) { const key = app + file @@ -59,7 +59,7 @@ export default { * * @param {string} app the app name * @param {string} file the script file name - * @returns {Promise} + * @return {Promise} */ loadStylesheet(app, file) { const key = app + file diff --git a/core/src/OCP/toast.js b/core/src/OCP/toast.js index 9fde3884987..ad1c572e0a1 100644 --- a/core/src/OCP/toast.js +++ b/core/src/OCP/toast.js @@ -34,7 +34,7 @@ export default { * * @param {string} text the toast text * @param {object} options options - * @returns {Toast} + * @return {Toast} */ success(text, options) { return showSuccess(text, options) @@ -44,7 +44,7 @@ export default { * * @param {string} text the toast text * @param {object} options options - * @returns {Toast} + * @return {Toast} */ warning(text, options) { return showWarning(text, options) @@ -54,7 +54,7 @@ export default { * * @param {string} text the toast text * @param {object} options options - * @returns {Toast} + * @return {Toast} */ error(text, options) { return showError(text, options) @@ -64,7 +64,7 @@ export default { * * @param {string} text the toast text * @param {object} options options - * @returns {Toast} + * @return {Toast} */ info(text, options) { return showInfo(text, options) @@ -74,7 +74,7 @@ export default { * * @param {string} text the toast text * @param {object} options options - * @returns {Toast} + * @return {Toast} */ message(text, options) { return showMessage(text, options) diff --git a/core/src/OCP/whatsnew.js b/core/src/OCP/whatsnew.js index ac455ffc08b..d125f85e11a 100644 --- a/core/src/OCP/whatsnew.js +++ b/core/src/OCP/whatsnew.js @@ -25,6 +25,9 @@ import _ from 'underscore' import $ from 'jquery' import { generateOcsUrl } from '@nextcloud/router' +/** + * @param options + */ export function query(options) { options = options || {} const dismissOptions = options.dismiss || {} @@ -38,6 +41,10 @@ export function query(options) { }) } +/** + * @param version + * @param options + */ export function dismiss(version, options) { options = options || {} $.ajax({ @@ -51,6 +58,12 @@ export function dismiss(version, options) { $('.whatsNewPopover').remove() } +/** + * @param data + * @param statusText + * @param xhr + * @param dismissOptions + */ function onQuerySuccess(data, statusText, xhr, dismissOptions) { console.debug('querying Whats New data was successful: ' + statusText) console.debug(data) @@ -131,15 +144,26 @@ function onQuerySuccess(data, statusText, xhr, dismissOptions) { document.body.appendChild(div) } +/** + * @param x + * @param t + * @param e + */ function onQueryError(x, t, e) { console.debug('querying Whats New Data resulted in an error: ' + t + e) console.debug(x) } +/** + * @param data + */ function onDismissSuccess(data) { // noop } +/** + * @param data + */ function onDismissError(data) { console.debug('dismissing Whats New data resulted in an error: ' + data) } diff --git a/core/src/Util/get-url-parameter.js b/core/src/Util/get-url-parameter.js index 1bde89ed7b1..32214d6bfe3 100644 --- a/core/src/Util/get-url-parameter.js +++ b/core/src/Util/get-url-parameter.js @@ -21,6 +21,9 @@ * */ +/** + * @param name + */ export default function getURLParameter(name) { return decodeURIComponent( // eslint-disable-next-line no-sparse-arrays diff --git a/core/src/components/setup/RecommendedApps.vue b/core/src/components/setup/RecommendedApps.vue index 719828b59a5..9ec5b9ceba7 100644 --- a/core/src/components/setup/RecommendedApps.vue +++ b/core/src/components/setup/RecommendedApps.vue @@ -81,15 +81,15 @@ const recommended = { }, spreed: { description: t('core', 'Chatting, video calls, screensharing, online meetings and web conferencing – in your browser and with mobile apps.'), - icon: imagePath('core', 'apps/spreed.svg') + icon: imagePath('core', 'apps/spreed.svg'), }, richdocuments: { description: t('core', 'Collaboratively edit office documents.'), - icon: imagePath('core', 'apps/richdocuments.svg') + icon: imagePath('core', 'apps/richdocuments.svg'), }, richdocumentscode: { description: t('core', 'Local document editing back-end used by the Collabora Online app.'), - icon: imagePath('core', 'apps/richdocumentscode.svg') + icon: imagePath('core', 'apps/richdocumentscode.svg'), }, } const recommendedIds = Object.keys(recommended) diff --git a/core/src/globals.js b/core/src/globals.js index 32a14fa12f4..45a2fba3dd4 100644 --- a/core/src/globals.js +++ b/core/src/globals.js @@ -68,9 +68,9 @@ const warnIfNotTesting = function() { * warn if used! * * @param {Function} func the library to deprecate - * @param {String} funcName the name of the library + * @param {string} funcName the name of the library * @param {Int} version the version this gets removed - * @returns {function} + * @return {Function} */ const deprecate = (func, funcName, version) => { const oldFunc = func @@ -128,6 +128,7 @@ $.fn.select2 = deprecate($.fn.select2, 'select2', 19) /** * translate a string + * * @param {string} app the id of the app for which to translate the string * @param {string} text the string to translate * @param [vars] map of placeholder key to value @@ -138,6 +139,7 @@ window.t = _.bind(OC.L10N.translate, OC.L10N) /** * translate a string + * * @param {string} app the id of the app for which to translate the string * @param {string} text_singular the string to translate for exactly one object * @param {string} text_plural the string to translate for n objects diff --git a/core/src/jquery/exists.js b/core/src/jquery/exists.js index 22fed55badb..4006982a8b6 100644 --- a/core/src/jquery/exists.js +++ b/core/src/jquery/exists.js @@ -26,8 +26,9 @@ import $ from 'jquery' /** * check if an element exists. * allows you to write if ($('#myid').exists()) to increase readability + * * @link http://stackoverflow.com/questions/31044/is-there-an-exists-function-for-jquery - * @returns {boolean} + * @return {boolean} */ $.fn.exists = function() { return this.length > 0 diff --git a/core/src/jquery/filterattr.js b/core/src/jquery/filterattr.js index 2bd4af417ac..fb8d45c4dd3 100644 --- a/core/src/jquery/filterattr.js +++ b/core/src/jquery/filterattr.js @@ -28,7 +28,7 @@ import $ from 'jquery' * * @param {string} attrName attribute name * @param {string} attrValue attribute value - * @returns {Void} + * @return {Void} */ $.fn.filterAttr = function(attrName, attrValue) { return this.filter(function() { diff --git a/core/src/jquery/selectrange.js b/core/src/jquery/selectrange.js index 914832d4538..b8f0d3dc122 100644 --- a/core/src/jquery/selectrange.js +++ b/core/src/jquery/selectrange.js @@ -25,10 +25,11 @@ import $ from 'jquery' /** * select a range in an input field + * * @link http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area * @param {int} start start selection from * @param {int} end number of char from start - * @returns {Void} + * @return {Void} */ $.fn.selectRange = function(start, end) { return this.each(function() { diff --git a/core/src/services/UnifiedSearchService.js b/core/src/services/UnifiedSearchService.js index a838d61bfd6..1c2b5d617c8 100644 --- a/core/src/services/UnifiedSearchService.js +++ b/core/src/services/UnifiedSearchService.js @@ -34,14 +34,15 @@ export const regexFilterNot = /-in:([a-z_-]+)/ig /** * Create a cancel token - * @returns {CancelTokenSource} + * + * @return {CancelTokenSource} */ const createCancelToken = () => axios.CancelToken.source() /** * Get the list of available search providers * - * @returns {Array} + * @return {Array} */ export async function getTypes() { try { @@ -64,11 +65,11 @@ export async function getTypes() { /** * Get the list of available search providers * - * @param {Object} options destructuring object + * @param {object} options destructuring object * @param {string} options.type the type to search * @param {string} options.query the search * @param {int|string|undefined} options.cursor the offset for paginated searches - * @returns {Object} {request: Promise, cancel: Promise} + * @return {object} {request: Promise, cancel: Promise} */ export function search({ type, query, cursor }) { /** @@ -76,7 +77,7 @@ export function search({ type, query, cursor }) { */ const cancelToken = createCancelToken() - const request = async() => axios.get(generateOcsUrl('search/providers/{type}/search', { type }), { + const request = async () => axios.get(generateOcsUrl('search/providers/{type}/search', { type }), { cancelToken: cancelToken.token, params: { term: query, diff --git a/core/src/services/WebAuthnAuthenticationService.js b/core/src/services/WebAuthnAuthenticationService.js index db05e7ca3fe..1e33dc78b3b 100644 --- a/core/src/services/WebAuthnAuthenticationService.js +++ b/core/src/services/WebAuthnAuthenticationService.js @@ -23,6 +23,9 @@ import Axios from '@nextcloud/axios' import { generateUrl } from '@nextcloud/router' +/** + * @param loginName + */ export function startAuthentication(loginName) { const url = generateUrl('/login/webauthn/start') @@ -30,6 +33,9 @@ export function startAuthentication(loginName) { .then(resp => resp.data) } +/** + * @param data + */ export function finishAuthentication(data) { const url = generateUrl('/login/webauthn/finish') diff --git a/core/src/session-heartbeat.js b/core/src/session-heartbeat.js index 828896f9fae..3dc6792f522 100644 --- a/core/src/session-heartbeat.js +++ b/core/src/session-heartbeat.js @@ -48,7 +48,8 @@ const loadConfig = () => { /** * session heartbeat (defaults to enabled) - * @returns {boolean} + * + * @return {boolean} */ const keepSessionAlive = () => { return config.session_keepalive === undefined @@ -57,7 +58,8 @@ const keepSessionAlive = () => { /** * get interval in seconds - * @returns {Number} + * + * @return {number} */ const getInterval = () => { let interval = NaN @@ -75,7 +77,7 @@ const getInterval = () => { ) } -const getToken = async() => { +const getToken = async () => { const url = generateUrl('/csrftoken') // Not using Axios here as Axios is not stubbable with the sinon fake server @@ -86,7 +88,7 @@ const getToken = async() => { return resp.token } -const poll = async() => { +const poll = async () => { try { const token = await getToken() setRequestToken(token) @@ -151,7 +153,7 @@ export const initSessionHeartBeat = () => { } let interval = startPolling() - window.addEventListener('online', async() => { + window.addEventListener('online', async () => { console.info('browser is online again, resuming heartbeat') interval = startPolling() try { diff --git a/core/src/systemtags/systemtagsmappingcollection.js b/core/src/systemtags/systemtagsmappingcollection.js index 6c6b6578608..f47b6a81ec2 100644 --- a/core/src/systemtags/systemtagsmappingcollection.js +++ b/core/src/systemtags/systemtagsmappingcollection.js @@ -38,22 +38,22 @@ import { generateRemoteUrl } from '@nextcloud/router' sync: OC.Backbone.davSync, /** - * Use PUT instead of PROPPATCH - */ + * Use PUT instead of PROPPATCH + */ usePUT: true, /** - * Id of the file for which to filter activities by - * - * @var int - */ + * Id of the file for which to filter activities by + * + * @member int + */ _objectId: null, /** - * Type of the object to filter by - * - * @var string - */ + * Type of the object to filter by + * + * @member string + */ _objectType: 'files', model: OC.SystemTags.SystemTagModel, @@ -63,19 +63,19 @@ import { generateRemoteUrl } from '@nextcloud/router' }, /** - * Sets the object id to filter by or null for all. - * - * @param {int} objectId file id or null - */ + * Sets the object id to filter by or null for all. + * + * @param {int} objectId file id or null + */ setObjectId(objectId) { this._objectId = objectId }, /** - * Sets the object type to filter by or null for all. - * - * @param {int} objectType file id or null - */ + * Sets the object type to filter by or null for all. + * + * @param {int} objectType file id or null + */ setObjectType(objectType) { this._objectType = objectType }, diff --git a/core/src/views/UnifiedSearch.vue b/core/src/views/UnifiedSearch.vue index bcb9f03be8a..6f5745125a8 100644 --- a/core/src/views/UnifiedSearch.vue +++ b/core/src/views/UnifiedSearch.vue @@ -203,7 +203,8 @@ export default { /** * Is there any result to display - * @returns {boolean} + * + * @return {boolean} */ hasResults() { return Object.keys(this.results).length !== 0 @@ -211,7 +212,8 @@ export default { /** * Return ordered results - * @returns {Array} + * + * @return {Array} */ orderedResults() { return this.typesIDs @@ -225,7 +227,8 @@ export default { /** * Available filters * We only show filters that are available on the results - * @returns {string[]} + * + * @return {string[]} */ availableFilters() { return Object.keys(this.results) @@ -233,7 +236,8 @@ export default { /** * Applied filters - * @returns {string[]} + * + * @return {string[]} */ usedFiltersIn() { let match @@ -246,7 +250,8 @@ export default { /** * Applied anti filters - * @returns {string[]} + * + * @return {string[]} */ usedFiltersNot() { let match @@ -259,7 +264,8 @@ export default { /** * Is the current search too short - * @returns {boolean} + * + * @return {boolean} */ isShortQuery() { return this.query && this.query.trim().length < minSearchLength @@ -267,7 +273,8 @@ export default { /** * Is the current search valid - * @returns {boolean} + * + * @return {boolean} */ isValidQuery() { return this.query && this.query.trim() !== '' && !this.isShortQuery @@ -275,7 +282,8 @@ export default { /** * Have we reached the end of all types searches - * @returns {boolean} + * + * @return {boolean} */ isDoneSearching() { return Object.values(this.reached).every(state => state === false) @@ -283,7 +291,8 @@ export default { /** * Is there any search in progress - * @returns {boolean} + * + * @return {boolean} */ isLoading() { return Object.values(this.loading).some(state => state === true) @@ -478,7 +487,8 @@ export default { /** * Load more results for the provided type - * @param {String} type type + * + * @param {string} type type */ async loadMore(type) { // If already loading, ignore @@ -535,7 +545,7 @@ export default { * * @param {Array} list the results * @param {string} type the type - * @returns {Array} + * @return {Array} */ limitIfAny(list, type) { if (type in this.limits) { @@ -550,6 +560,7 @@ export default { /** * Focus the first result if any + * * @param {Event} event the keydown event */ focusFirst(event) { @@ -565,6 +576,7 @@ export default { /** * Focus the next result if any + * * @param {Event} event the keydown event */ focusNext(event) { @@ -584,6 +596,7 @@ export default { /** * Focus the previous result if any + * * @param {Event} event the keydown event */ focusPrev(event) { @@ -604,6 +617,7 @@ export default { /** * Focus the specified result index if it exists + * * @param {number} index the result index */ focusIndex(index) { @@ -615,6 +629,7 @@ export default { /** * Set the current focused element based on the target + * * @param {Event} event the focus event */ setFocusedIndex(event) { -- cgit v1.2.3