From 6afe9900c3904cb7f46eb88aa04a997a3b4ece9d Mon Sep 17 00:00:00 2001 From: Kostiantyn Miakshyn Date: Mon, 9 Dec 2024 18:22:06 +0100 Subject: [PATCH] fix: fix eslint scripts Signed-off-by: Kostiantyn Miakshyn --- __mocks__/@nextcloud/axios.ts | 8 ++++---- __tests__/upload.spec.ts | 4 ++-- __tests__/utils/config.spec.ts | 16 ++++++++-------- .../UploadPicker/invalid-filenames.cy.ts | 2 +- lib/utils/config.ts | 2 +- lib/utils/filesystem.ts | 2 +- package.json | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/__mocks__/@nextcloud/axios.ts b/__mocks__/@nextcloud/axios.ts index 3b176e8a..4bf22a89 100644 --- a/__mocks__/@nextcloud/axios.ts +++ b/__mocks__/@nextcloud/axios.ts @@ -1,4 +1,4 @@ -/** +/*! * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ @@ -7,12 +7,12 @@ // implemented in node 15 const timeout = (timeout: number, data = {}, signal: AbortSignal = new AbortController().signal) => { return new Promise((resolve, reject) => { - if (signal?.aborted){ - reject(new DOMException("Aborted", "AbortError")) + if (signal?.aborted) { + reject(new DOMException('Aborted', 'AbortError')) return } signal.addEventListener('abort', () => { - reject(new DOMException("Aborted", "AbortError")) + reject(new DOMException('Aborted', 'AbortError')) }) setTimeout(() => { diff --git a/__tests__/upload.spec.ts b/__tests__/upload.spec.ts index f8303358..9bc7c6c2 100644 --- a/__tests__/upload.spec.ts +++ b/__tests__/upload.spec.ts @@ -141,7 +141,7 @@ describe('Cancellation', () => { const upload = new Upload('http://domain.com/remote.php/dav/files/user/image.jpg', true, 10 * 1024 * 1024, file) // Mock controller and spy on abort - upload['_controller'] = controller + upload._controller = controller vi.spyOn(controller, 'abort') expect(upload.signal).toBeInstanceOf(AbortSignal) @@ -165,7 +165,7 @@ describe('Cancellation', () => { const upload = new Upload('http://domain.com/remote.php/dav/files/user/image.jpg', true, 150 * 1024 * 1024, file) // Mock controller and spy on abort - upload['_controller'] = controller + upload._controller = controller vi.spyOn(controller, 'abort') expect(upload.signal).toBeInstanceOf(AbortSignal) diff --git a/__tests__/utils/config.spec.ts b/__tests__/utils/config.spec.ts index 183bfc8b..4ec869da 100644 --- a/__tests__/utils/config.spec.ts +++ b/__tests__/utils/config.spec.ts @@ -7,36 +7,36 @@ import { getMaxChunksSize } from '../../lib/utils/config.js' describe('Max chunk size tests', () => { test('Returning valid config', () => { - Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: 15 * 1024 * 1024 }}}}) + Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: 15 * 1024 * 1024 } } } }) expect(getMaxChunksSize()).toBe(15 * 1024 * 1024) }) test('Returning valid config for chunking v2 minimum size', () => { - Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: 4 * 1024 * 1024 }}}}) + Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: 4 * 1024 * 1024 } } } }) expect(getMaxChunksSize()).toBe(5 * 1024 * 1024) }) test('Returning valid config for chunking v2 maximum chunk count', () => { - Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: 5 * 1024 * 1024 }}}}) + Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: 5 * 1024 * 1024 } } } }) expect(getMaxChunksSize(50 * 1024 * 1024 * 10000)).toBe(5 * 1024 * 1024 * 10) }) test('Returning disabled chunking config', () => { - Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: 0 }}}}) + Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: 0 } } } }) expect(getMaxChunksSize()).toBe(0) - Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: -1 }}}}) + Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: -1 } } } }) expect(getMaxChunksSize()).toBe(0) - Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: null }}}}) + Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: null } } } }) expect(getMaxChunksSize()).toBe(0) }) test('Returning invalid config', () => { - Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: 'test' }}}}) + Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: 'test' } } } }) expect(getMaxChunksSize()).toBe(10 * 1024 * 1024) - Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: undefined }}}}) + Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: undefined } } } }) expect(getMaxChunksSize()).toBe(10 * 1024 * 1024) }) }) diff --git a/cypress/components/UploadPicker/invalid-filenames.cy.ts b/cypress/components/UploadPicker/invalid-filenames.cy.ts index bce55768..decc5c62 100644 --- a/cypress/components/UploadPicker/invalid-filenames.cy.ts +++ b/cypress/components/UploadPicker/invalid-filenames.cy.ts @@ -474,4 +474,4 @@ describe.only('UploadPicker: invalid filenames (server capabilities)', { testIso expect(requests).to.contain('now-valid.jpg') }) }) -}) \ No newline at end of file +}) diff --git a/lib/utils/config.ts b/lib/utils/config.ts index f11efe44..587feeda 100644 --- a/lib/utils/config.ts +++ b/lib/utils/config.ts @@ -1,4 +1,4 @@ -/** +/*! * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ diff --git a/lib/utils/filesystem.ts b/lib/utils/filesystem.ts index cc3f37dd..0602cc49 100644 --- a/lib/utils/filesystem.ts +++ b/lib/utils/filesystem.ts @@ -1,4 +1,4 @@ -/** +/*! * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ diff --git a/package.json b/package.json index 9dd84c07..f3c30cdf 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,8 @@ "cypress:gui": "cypress open --component", "dev": "vite --mode development build", "l10n:extract": "node build/extract-l10n.js", - "lint": "eslint --ext .js,.vue .", - "lint:fix": "eslint --ext .js,.vue --fix .", + "lint": "eslint --ext .js,.ts,.vue .", + "lint:fix": "eslint --ext .js,.ts,.vue --fix .", "test": "vitest run", "test:coverage": "vitest run --coverage", "test:watch": "vitest watch",