From: Ferdinand Thiessen Date: Wed, 16 Oct 2024 12:06:49 +0000 (+0200) Subject: fix(code-style): Adjust JS code to our code style X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e8c1e2c611e6cc783e45abc036ee9d55d3a426d8;p=nextcloud-server.git fix(code-style): Adjust JS code to our code style This resolves 68 ESLint warnings about invalid code style. Signed-off-by: Ferdinand Thiessen --- diff --git a/apps/comments/src/comments-activity-tab.ts b/apps/comments/src/comments-activity-tab.ts index f38484d25e7..f092f2b8f5b 100644 --- a/apps/comments/src/comments-activity-tab.ts +++ b/apps/comments/src/comments-activity-tab.ts @@ -24,7 +24,7 @@ export function registerCommentsPlugins() { if (!ActivityTabPluginView) { const { default: ActivityCommentAction } = await import('./views/ActivityCommentAction.vue') - /** @ts-expect-error Types are broken for Vue2 */ + // @ts-expect-error Types are broken for Vue2 ActivityTabPluginView = Vue.extend(ActivityCommentAction) } ActivityTabPluginInstance = new ActivityTabPluginView({ @@ -50,7 +50,7 @@ export function registerCommentsPlugins() { const { data: comments } = await getComments({ resourceType: 'files', resourceId: fileInfo.id }, { limit, offset }) logger.debug('Loaded comments', { fileInfo, comments }) const { default: CommentView } = await import('./views/ActivityCommentEntry.vue') - /** @ts-expect-error Types are broken for Vue2 */ + // @ts-expect-error Types are broken for Vue2 const CommentsViewObject = Vue.extend(CommentView) return comments.map((comment) => ({ diff --git a/apps/files/src/store/viewConfig.ts b/apps/files/src/store/viewConfig.ts index 08d75b3d050..76786306d60 100644 --- a/apps/files/src/store/viewConfig.ts +++ b/apps/files/src/store/viewConfig.ts @@ -59,8 +59,8 @@ export const useViewConfigStore = function(...args) { * Set the sorting key AND sort by ASC * The key param must be a valid key of a File object * If not found, will be searched within the File attributes - * @param key - * @param view + * @param key Key to sort by + * @param view View to set the sorting key for */ setSortingBy(key = 'basename', view = 'files') { // Save new config @@ -70,7 +70,7 @@ export const useViewConfigStore = function(...args) { /** * Toggle the sorting direction - * @param view + * @param view view to set the sorting order for */ toggleSortingDirection(view = 'files') { const config = this.getConfig(view) || { sorting_direction: 'asc' } diff --git a/apps/files/src/views/FilesList.vue b/apps/files/src/views/FilesList.vue index 5341502df24..9383f98a00b 100644 --- a/apps/files/src/views/FilesList.vue +++ b/apps/files/src/views/FilesList.vue @@ -410,7 +410,7 @@ export default defineComponent({ showCustomEmptyView() { return !this.loading && this.isEmptyDir && this.currentView?.emptyView !== undefined - } + }, }, watch: { diff --git a/apps/files_external/src/actions/enterCredentialsAction.ts b/apps/files_external/src/actions/enterCredentialsAction.ts index 29d660315b4..20821298db5 100644 --- a/apps/files_external/src/actions/enterCredentialsAction.ts +++ b/apps/files_external/src/actions/enterCredentialsAction.ts @@ -23,8 +23,15 @@ type CredentialResponse = { password?: string, } +/** + * Set credentials for external storage + * + * @param node The node for which to set the credentials + * @param login The username + * @param password The password + */ async function setCredentials(node: Node, login: string, password: string): Promise { - const configResponse = await axios.put(generateUrl('apps/files_external/userglobalstorages/{id}', node.attributes), { + const configResponse = await axios.put(generateUrl('apps/files_external/userglobalstorages/{id}', { id: node.attributes.id }), { backendOptions: { user: login, password }, }) as AxiosResponse diff --git a/apps/files_external/src/actions/inlineStorageCheckAction.ts b/apps/files_external/src/actions/inlineStorageCheckAction.ts index a213c196b50..42b1d5b3718 100644 --- a/apps/files_external/src/actions/inlineStorageCheckAction.ts +++ b/apps/files_external/src/actions/inlineStorageCheckAction.ts @@ -30,7 +30,8 @@ export const action = new FileAction({ /** * Use this function to check the storage availability * We then update the node attributes directly. - * @param node + * + * @param node The node to render inline */ async renderInline(node: Node) { let config = null as unknown as StorageConfig diff --git a/apps/files_sharing/src/files_views/shares.spec.ts b/apps/files_sharing/src/files_views/shares.spec.ts index 153057bc0ad..79ef2a09843 100644 --- a/apps/files_sharing/src/files_views/shares.spec.ts +++ b/apps/files_sharing/src/files_views/shares.spec.ts @@ -3,6 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ /* eslint-disable n/no-extraneous-import */ +/* eslint-disable @typescript-eslint/no-explicit-any */ import type { OCSResponse } from '@nextcloud/typings/ocs' import { Folder, Navigation, View, getNavigation } from '@nextcloud/files' import { beforeEach, describe, expect, test, vi } from 'vitest' diff --git a/apps/files_sharing/src/mixins/ShareRequests.js b/apps/files_sharing/src/mixins/ShareRequests.js index dcccd5e78ed..24b4b12061e 100644 --- a/apps/files_sharing/src/mixins/ShareRequests.js +++ b/apps/files_sharing/src/mixins/ShareRequests.js @@ -26,10 +26,10 @@ export default { * @param {string} [data.password] password to protect public link Share with * @param {number} [data.permissions] 1 = read; 2 = update; 4 = create; 8 = delete; 16 = share; 31 = all (default: 31, for public shares: 1) * @param {boolean} [data.sendPasswordByTalk] send the password via a talk conversation - * @param {string} [data.expireDate] expire the shareautomatically after + * @param {string} [data.expireDate] expire the share automatically after * @param {string} [data.label] custom label * @param {string} [data.attributes] Share attributes encoded as json - * @param data.note + * @param {string} data.note custom note to recipient * @return {Share} the new share * @throws {Error} */ diff --git a/apps/files_sharing/src/models/Share.ts b/apps/files_sharing/src/models/Share.ts index dab409853d0..bfc6357240d 100644 --- a/apps/files_sharing/src/models/Share.ts +++ b/apps/files_sharing/src/models/Share.ts @@ -314,7 +314,7 @@ export default class Share { /** * Get the shared item id - */ + */ get fileSource(): number { return this._share.file_source } diff --git a/apps/files_sharing/src/utils/GeneratePassword.ts b/apps/files_sharing/src/utils/GeneratePassword.ts index bbfa5e7b27d..2f3f65c51d8 100644 --- a/apps/files_sharing/src/utils/GeneratePassword.ts +++ b/apps/files_sharing/src/utils/GeneratePassword.ts @@ -13,9 +13,9 @@ const config = new Config() const passwordSet = 'abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789' /** - * Generate a valid policy password or - * request a valid password if password_policy - * is enabled + * Generate a valid policy password or request a valid password if password_policy is enabled + * + * @param {boolean} verbose If enabled the the status is shown to the user via toast */ export default async function(verbose = false): Promise { // password policy is enabled, let's request a pass diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index baa098352d1..3f9dca57d03 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -247,6 +247,7 @@ import { emit } from '@nextcloud/event-bus' import { getLanguage } from '@nextcloud/l10n' import { ShareType } from '@nextcloud/sharing' +import moment from '@nextcloud/moment' import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js' import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue index 318b8ca3b56..6870e43d816 100644 --- a/apps/files_sharing/src/views/SharingTab.vue +++ b/apps/files_sharing/src/views/SharingTab.vue @@ -82,15 +82,19 @@