Skip to content

fix: fix eslint scripts #1518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions __mocks__/@nextcloud/axios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*!
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
Expand All @@ -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(() => {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/upload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions __tests__/utils/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
2 changes: 1 addition & 1 deletion cypress/components/UploadPicker/invalid-filenames.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,4 @@ describe.only('UploadPicker: invalid filenames (server capabilities)', { testIso
expect(requests).to.contain('now-valid.jpg')
})
})
})
})
2 changes: 1 addition & 1 deletion lib/utils/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*!
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/filesystem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*!
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading