From 313ba6c3c20fe6dafda5c4645ad532921900601f Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 11 Oct 2023 22:56:53 -0700 Subject: [PATCH] refactor(large): disallow implicit any Signed-off-by: Varun Patil --- package-lock.json | 13 +++++++ package.json | 1 + src/App.vue | 4 +-- src/bootstrap.ts | 22 +++++++++--- src/components/admin/AdminMain.vue | 4 +-- src/components/modal/AlbumCollaborators.vue | 6 ++-- src/components/modal/AlbumForm.vue | 5 +-- src/components/modal/EditExif.vue | 39 ++++++++------------- src/components/viewer/ImageEditor.vue | 8 ++--- src/components/viewer/PsLivePhoto.ts | 2 +- src/components/viewer/PsVideo.ts | 18 +++++----- src/components/viewer/Viewer.vue | 6 ++-- src/mixins/UserConfig.ts | 4 +-- src/native/api.ts | 2 +- src/services/dav/albums.ts | 2 +- src/services/dav/client.ts | 2 +- src/services/static-config.ts | 29 ++++++++------- src/services/utils/algo.ts | 2 +- src/shims.d.ts | 19 ++++++++++ src/vue-shims.d.ts | 10 ------ tsconfig.json | 8 +++-- 21 files changed, 119 insertions(+), 87 deletions(-) create mode 100644 src/shims.d.ts delete mode 100644 src/vue-shims.d.ts diff --git a/package-lock.json b/package-lock.json index 3e62ce73..8feadd67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "@nextcloud/webpack-vue-config": "^6.0.0", "@playwright/test": "^1.39.0", "@types/hammerjs": "^2.0.42", + "@types/justified-layout": "^4.1.1", "@types/luxon": "^3.3.2", "@types/url-parse": "^1.4.9", "@types/videojs-contrib-quality-levels": "^2.0.2", @@ -2534,6 +2535,12 @@ "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "peer": true }, + "node_modules/@types/justified-layout": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@types/justified-layout/-/justified-layout-4.1.1.tgz", + "integrity": "sha512-/ZJGVeDif6EHRzK3kUifyOekGJcBXD1s/eRYAYgkJHI4QAkohz62E0PSMbFrGpOdTulPWRgOAh1mFZbYw9a9iQ==", + "dev": true + }, "node_modules/@types/leaflet": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.0.tgz", @@ -13688,6 +13695,12 @@ "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "peer": true }, + "@types/justified-layout": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@types/justified-layout/-/justified-layout-4.1.1.tgz", + "integrity": "sha512-/ZJGVeDif6EHRzK3kUifyOekGJcBXD1s/eRYAYgkJHI4QAkohz62E0PSMbFrGpOdTulPWRgOAh1mFZbYw9a9iQ==", + "dev": true + }, "@types/leaflet": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.0.tgz", diff --git a/package.json b/package.json index 8f5235d4..5d620cac 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "@nextcloud/webpack-vue-config": "^6.0.0", "@playwright/test": "^1.39.0", "@types/hammerjs": "^2.0.42", + "@types/justified-layout": "^4.1.1", "@types/luxon": "^3.3.2", "@types/url-parse": "^1.4.9", "@types/videojs-contrib-quality-levels": "^2.0.2", diff --git a/src/App.vue b/src/App.vue index 17b6f791..5eb5e06a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -278,7 +278,7 @@ export default defineComponent({ name: this.t('memories', 'Info'), icon: 'icon-details', - mount(el, fileInfo, context) { + mount(el: HTMLElement, fileInfo: { id: string | number }, context: any) { this.metadataComponent?.$destroy?.(); this.metadataComponent = new Vue({ render: (h) => h(Metadata), @@ -287,7 +287,7 @@ export default defineComponent({ this.metadataComponent.$mount(el); this.metadataComponent.$children[0].update(Number(fileInfo.id)); }, - update(fileInfo) { + update(fileInfo: { id: string | number }) { this.metadataComponent.$children[0].update(Number(fileInfo.id)); }, destroy() { diff --git a/src/bootstrap.ts b/src/bootstrap.ts index b8e0fab1..2a90ec03 100644 --- a/src/bootstrap.ts +++ b/src/bootstrap.ts @@ -27,11 +27,24 @@ import './styles/global.scss'; // Global exposed variables declare global { - var mode: 'admin' | 'user'; + var __webpack_nonce__: string; + var __webpack_public_path__: string; - var vueroute: () => Route; var OC: Nextcloud.Common.OC; var OCP: Nextcloud.Common.OCP; + var OCA: { + Files?: { + Sidebar?: any; + App?: any; + }; + Theming?: { + name: string; + enabledThemes: any[]; + }; + }; + + var mode: 'admin' | 'user'; + var vueroute: () => Route; var mModals: { editMetadata: (photos: IPhoto[], sections?: number[]) => void; @@ -62,13 +75,12 @@ declare global { var windowInnerWidth: number; // cache var windowInnerHeight: number; // cache - var __webpack_nonce__: string; - var __webpack_public_path__: string; - var vidjs: typeof videojsType; var Plyr: typeof PlyrType; var videoClientId: string; var videoClientIdPersistent: string; + + var photoswipe: unknown; } // Allow global access to the router diff --git a/src/components/admin/AdminMain.vue b/src/components/admin/AdminMain.vue index a145ff1c..ba3c6b59 100644 --- a/src/components/admin/AdminMain.vue +++ b/src/components/admin/AdminMain.vue @@ -113,7 +113,7 @@ export default defineComponent({ } }, - async update(key: keyof ISystemConfig, value: any = null) { + async update(key: K, value: ISystemConfig[K] | null = null) { if (!this.config?.hasOwnProperty(key)) { console.error('Unknown setting', key); return; @@ -121,7 +121,7 @@ export default defineComponent({ // Get final value value ??= this.config[key]; - this.config[key as string] = value; + this.config[key] = value; try { this.loading++; diff --git a/src/components/modal/AlbumCollaborators.vue b/src/components/modal/AlbumCollaborators.vue index b5134b0d..b16a0761 100644 --- a/src/components/modal/AlbumCollaborators.vue +++ b/src/components/modal/AlbumCollaborators.vue @@ -265,7 +265,7 @@ export default defineComponent({ }, }); - this.currentSearchResults = response.data.ocs.data.map((collaborator) => { + this.currentSearchResults = response.data.ocs.data.map((collaborator: any) => { switch (collaborator.source) { case 'users': return { @@ -394,7 +394,7 @@ export default defineComponent({ }, 10000); }, - selectEntity(collaboratorKey) { + selectEntity(collaboratorKey: string) { if (this.selectedCollaboratorsKeys.includes(collaboratorKey)) { return; } @@ -403,7 +403,7 @@ export default defineComponent({ this.selectedCollaboratorsKeys.push(collaboratorKey); }, - unselectEntity(collaboratorKey) { + unselectEntity(collaboratorKey: string) { const index = this.selectedCollaboratorsKeys.indexOf(collaboratorKey); if (index === -1) { diff --git a/src/components/modal/AlbumForm.vue b/src/components/modal/AlbumForm.vue index 00602f7b..cd978c33 100644 --- a/src/components/modal/AlbumForm.vue +++ b/src/components/modal/AlbumForm.vue @@ -216,10 +216,7 @@ export default defineComponent({ this.loading = true; let album = { ...this.album }; if (this.album.basename !== this.albumName) { - album = await dav.renameAlbum(this.album, { - currentAlbumName: this.album.basename, - newAlbumName: this.albumName, - }); + album = await dav.renameAlbum(this.album, this.album.basename, this.albumName); } if (this.album.location !== this.albumLocation) { album.location = await dav.updateAlbum(this.album, { diff --git a/src/components/modal/EditExif.vue b/src/components/modal/EditExif.vue index 4161beed..224f7697 100644 --- a/src/components/modal/EditExif.vue +++ b/src/components/modal/EditExif.vue @@ -23,14 +23,14 @@