diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-11-18 14:38:03 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-01-16 22:18:29 +0100 |
commit | 24851d930d03b0259290d98bce0721464918a566 (patch) | |
tree | 60c6fffc99f32450a9884b713575d2d9f0d7861e | |
parent | 2de855f0bc8b8538cc46c5ec8527644c74c85784 (diff) | |
download | nextcloud-server-24851d930d03b0259290d98bce0721464918a566.tar.gz nextcloud-server-24851d930d03b0259290d98bce0721464918a566.zip |
chore: Resolve ESLint warnings
- Add default value to non-required Vue props
- Reformat function to async function if needed
- Add some documentation
- Allow `any` in places where it makes sense (tests)
- Order vue component sections as required
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r-- | apps/files/src/actions/editLocallyAction.spec.ts | 3 | ||||
-rw-r--r-- | apps/files/src/components/FileEntryMixin.ts | 8 | ||||
-rw-r--r-- | apps/files/src/components/SidebarTab.vue | 2 | ||||
-rw-r--r-- | apps/files/src/services/PreviewService.ts | 16 | ||||
-rw-r--r-- | apps/files/src/store/dragging.ts | 4 | ||||
-rw-r--r-- | apps/files_external/tests/appSpec.js | 1 | ||||
-rw-r--r-- | core/src/components/setup/RecommendedApps.vue | 11 |
7 files changed, 21 insertions, 24 deletions
diff --git a/apps/files/src/actions/editLocallyAction.spec.ts b/apps/files/src/actions/editLocallyAction.spec.ts index 9c7de1b78be..07ccac5043d 100644 --- a/apps/files/src/actions/editLocallyAction.spec.ts +++ b/apps/files/src/actions/editLocallyAction.spec.ts @@ -17,10 +17,11 @@ const view = { name: 'Files', } as View -// Mock webroot variable +// Mock web root variable beforeAll(() => { // eslint-disable-next-line @typescript-eslint/no-explicit-any (window as any)._oc_webroot = ''; + // eslint-disable-next-line @typescript-eslint/no-explicit-any (window as any).OCA = { Viewer: { open: vi.fn() } } }) diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts index 2d20881cde0..d949a907d43 100644 --- a/apps/files/src/components/FileEntryMixin.ts +++ b/apps/files/src/components/FileEntryMixin.ts @@ -225,11 +225,11 @@ export default defineComponent({ /** * When the source changes, reset the preview * and fetch the new one. - * @param a - * @param b + * @param newSource The new value of the source prop + * @param oldSource The previous value */ - source(a: Node, b: Node) { - if (a.source !== b.source) { + source(newSource: Node, oldSource: Node) { + if (newSource.source !== oldSource.source) { this.resetState() } }, diff --git a/apps/files/src/components/SidebarTab.vue b/apps/files/src/components/SidebarTab.vue index a8a94fd4752..88dfd27ce5c 100644 --- a/apps/files/src/components/SidebarTab.vue +++ b/apps/files/src/components/SidebarTab.vue @@ -48,7 +48,7 @@ export default { }, icon: { type: String, - required: false, + default: '', }, /** diff --git a/apps/files/src/services/PreviewService.ts b/apps/files/src/services/PreviewService.ts index 769a1fcfb9f..6dbb67f30b6 100644 --- a/apps/files/src/services/PreviewService.ts +++ b/apps/files/src/services/PreviewService.ts @@ -8,18 +8,14 @@ const SWCacheName = 'previews' /** * Check if the preview is already cached by the service worker - * @param previewUrl + * @param previewUrl URL to check */ -export const isCachedPreview = function(previewUrl: string): Promise<boolean> { +export async function isCachedPreview(previewUrl: string): Promise<boolean> { if (!window?.caches?.open) { - return Promise.resolve(false) + return false } - return window?.caches?.open(SWCacheName) - .then(function(cache) { - return cache.match(previewUrl) - .then(function(response) { - return !!response - }) - }) + const cache = await window.caches.open(SWCacheName) + const response = await cache.match(previewUrl) + return response !== undefined } diff --git a/apps/files/src/store/dragging.ts b/apps/files/src/store/dragging.ts index f5c20095cca..810f662149c 100644 --- a/apps/files/src/store/dragging.ts +++ b/apps/files/src/store/dragging.ts @@ -14,8 +14,8 @@ export const useDragAndDropStore = defineStore('dragging', { actions: { /** - * Set the selection of fileIds - * @param selection + * Set the selection of files being dragged currently + * @param selection array of node sources */ set(selection = [] as FileSource[]) { Vue.set(this, 'dragging', selection) diff --git a/apps/files_external/tests/appSpec.js b/apps/files_external/tests/appSpec.js index fcbef7ef822..4d150cd36bb 100644 --- a/apps/files_external/tests/appSpec.js +++ b/apps/files_external/tests/appSpec.js @@ -2,6 +2,7 @@ * SPDX-FileCopyrightText: 2014 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ +import $ from 'jquery' describe('OCA.Files_External.App tests', function() { const App = OCA.Files_External.App diff --git a/core/src/components/setup/RecommendedApps.vue b/core/src/components/setup/RecommendedApps.vue index 9ecd25e5097..d6968bb53e4 100644 --- a/core/src/components/setup/RecommendedApps.vue +++ b/core/src/components/setup/RecommendedApps.vue @@ -55,16 +55,15 @@ </template> <script> -import axios from '@nextcloud/axios' -import { generateUrl, imagePath } from '@nextcloud/router' +import { t } from '@nextcloud/l10n' import { loadState } from '@nextcloud/initial-state' +import { generateUrl, imagePath } from '@nextcloud/router' +import axios from '@nextcloud/axios' import pLimit from 'p-limit' -import { translate as t } from '@nextcloud/l10n' +import logger from '../../logger.js' -import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js' import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' - -import logger from '../../logger.js' +import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js' const recommended = { calendar: { |