Skip to content

Commit b4aabd8

Browse files
committed
chore: fix various linter issues
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 2eeb7b5 commit b4aabd8

3 files changed

Lines changed: 40 additions & 24 deletions

File tree

__tests__/files/node.spec.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,10 @@ describe('Sanity checks', () => {
437437
mime: 'image/jpeg',
438438
owner: 'emma',
439439
})
440-
// @ts-expect-error wrong type error check
441-
expect(() => { file.size = 'test' }).toThrowError('Invalid size type')
440+
expect(() => {
441+
// @ts-expect-error wrong type error check
442+
file.size = 'test'
443+
}).toThrowError('Invalid size type')
442444
})
443445

444446
test('Invalid owner', () => {
@@ -504,8 +506,10 @@ describe('Sanity checks', () => {
504506
owner: 'emma',
505507
status: NodeStatus.LOCKED,
506508
})
507-
// @ts-expect-error wrong type error check
508-
expect(() => { file.status = 'invalid' }).toThrowError('Status must be a valid NodeStatus')
509+
expect(() => {
510+
// @ts-expect-error wrong type error check
511+
file.status = 'invalid'
512+
}).toThrowError('Status must be a valid NodeStatus')
509513
})
510514
})
511515

@@ -908,8 +912,10 @@ describe('Attributes update', () => {
908912
})
909913

910914
// We can not update the owner
911-
// @ts-expect-error owner is a read-only property
912-
expect(() => { file.owner = 'admin' }).toThrowError()
915+
expect(() => {
916+
// @ts-expect-error owner is a read-only property
917+
file.owner = 'admin'
918+
}).toThrowError()
913919
// The owner is still the original one
914920
expect(file?.owner).toBe('emma')
915921
})

__tests__/sidebar/sidebarTab.spec.ts

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,28 @@ describe('Sidebar tabs', () => {
5151

5252
describe('Tab validation', () => {
5353
it('fails with an invalid parameter', () => {
54-
expect(
54+
expect(() => {
5555
// @ts-expect-error mocking for testing
56-
() => registerSidebarTab(getExampleTab)).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tab is not an object]')
56+
registerSidebarTab(getExampleTab)
57+
}).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tab is not an object]')
5758
})
5859

5960
it('fails with missing id', () => {
60-
expect(
61+
expect(() => {
6162
// @ts-expect-error mocking for testing
62-
() => registerSidebarTab({ ...getExampleTab(), id: undefined })).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have an id conforming to the HTML id attribute specifications]')
63+
registerSidebarTab({ ...getExampleTab(), id: undefined })
64+
}).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have an id conforming to the HTML id attribute specifications]')
6365
})
6466

6567
it('fails with non conforming id', () => {
6668
expect(() => registerSidebarTab({ ...getExampleTab(), id: 'this is invalid' })).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have an id conforming to the HTML id attribute specifications]')
6769
})
6870

6971
it('fails with missing tagName name', () => {
70-
expect(
72+
expect(() => {
7173
// @ts-expect-error mocking for testing
72-
() => registerSidebarTab({ ...getExampleTab(), tagName: undefined })).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have the tagName name set]')
74+
registerSidebarTab({ ...getExampleTab(), tagName: undefined })
75+
}).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have the tagName name set]')
7376
})
7477

7578
it('fails with invalid tagName name', () => {
@@ -78,43 +81,49 @@ describe('Sidebar tabs', () => {
7881
})
7982

8083
it('fails with missing name', () => {
81-
expect(
84+
expect(() => {
8285
// @ts-expect-error mocking for testing
83-
() => registerSidebarTab({ ...getExampleTab(), displayName: undefined })).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have a name set]')
86+
registerSidebarTab({ ...getExampleTab(), displayName: undefined })
87+
}).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have a name set]')
8488
})
8589

8690
it('fails with invalid name', () => {
87-
expect(
91+
expect(() => {
8892
// @ts-expect-error mocking for testing
89-
() => registerSidebarTab({ ...getExampleTab(), displayName: 1234 })).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have a name set]')
93+
registerSidebarTab({ ...getExampleTab(), displayName: 1234 })
94+
}).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have a name set]')
9095
})
9196

9297
it('fails with missing icon', () => {
93-
expect(
98+
expect(() => {
9499
// @ts-expect-error mocking for testing
95-
() => registerSidebarTab({ ...getExampleTab(), iconSvgInline: undefined })).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have an valid SVG icon]')
100+
registerSidebarTab({ ...getExampleTab(), iconSvgInline: undefined })
101+
}).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have an valid SVG icon]')
96102
})
97103

98104
it('fails with invalid SVG icon', () => {
99105
expect(() => registerSidebarTab({ ...getExampleTab(), iconSvgInline: 'icon-group' })).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have an valid SVG icon]')
100106
})
101107

102108
it('fails with missing order', () => {
103-
expect(
109+
expect(() => {
104110
// @ts-expect-error mocking for testing
105-
() => registerSidebarTab({ ...getExampleTab(), order: undefined })).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have a numeric order set]')
111+
registerSidebarTab({ ...getExampleTab(), order: undefined })
112+
}).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have a numeric order set]')
106113
})
107114

108115
it('fails with invalid order', () => {
109-
expect(
116+
expect(() => {
110117
// @ts-expect-error mocking for testing
111-
() => registerSidebarTab({ ...getExampleTab(), order: '3' })).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have a numeric order set]')
118+
registerSidebarTab({ ...getExampleTab(), order: '3' })
119+
}).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have a numeric order set]')
112120
})
113121

114122
it('fails with missing "enabled" method', () => {
115-
expect(
123+
expect(() => {
116124
// @ts-expect-error mocking for testing
117-
() => registerSidebarTab({ ...getExampleTab(), enabled: undefined })).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have an "enabled" method]')
125+
registerSidebarTab({ ...getExampleTab(), enabled: undefined })
126+
}).toThrowErrorMatchingInlineSnapshot('[Error: Sidebar tabs need to have an "enabled" method]')
118127
})
119128
})
120129
})

lib/dav/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable jsdoc/check-tag-names */
12
/*!
23
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
34
* SPDX-License-Identifier: AGPL-3.0-or-later

0 commit comments

Comments
 (0)