Skip to content

Commit 6d8a7a1

Browse files
authored
Merge pull request #46082 from nextcloud/chore/enable-eslint
chore: Enable ESLint for apps and fix all errors
2 parents 3a97dbf + b0f6686 commit 6d8a7a1

File tree

255 files changed

+1090
-1278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+1090
-1278
lines changed

.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,13 @@ module.exports = {
3636
mode: 'typescript',
3737
},
3838
},
39+
overrides: [
40+
// Allow any in tests
41+
{
42+
files: ['**/*.spec.ts'],
43+
rules: {
44+
'@typescript-eslint/no-explicit-any': 'warn',
45+
},
46+
}
47+
],
3948
}

__tests__/mock-window.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
window.OC = { ...window.OC }
7+
window.OCA = { ...window.OCA }
8+
window.OCP = { ...window.OCP }

apps/comments/src/services/DavClient.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ const client = createClient(getRootPath())
1212

1313
// set CSRF token header
1414
const setHeaders = (token) => {
15-
client.setHeaders({
16-
// Add this so the server knows it is an request from the browser
17-
'X-Requested-With': 'XMLHttpRequest',
18-
// Inject user auth
19-
requesttoken: token ?? '',
20-
})
15+
client.setHeaders({
16+
// Add this so the server knows it is an request from the browser
17+
'X-Requested-With': 'XMLHttpRequest',
18+
// Inject user auth
19+
requesttoken: token ?? '',
20+
})
2121
}
2222

2323
// refresh headers when request token changes

apps/comments/src/services/GetComments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const getDirectoryFiles = function(
6060
// Map all items to a consistent output structure (results)
6161
return responseItems.map(item => {
6262
// Each item should contain a stat object
63-
const props = item.propstat!.prop!;
63+
const props = item.propstat!.prop!
6464

6565
return prepareFileFromProps(props, props.id!.toString(), isDetailed)
6666
})

apps/comments/src/utils/cancelableRequest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const cancelableRequest = function(request) {
2222
const fetch = async function(url, options) {
2323
const response = await request(
2424
url,
25-
Object.assign({ signal }, options)
25+
Object.assign({ signal }, options),
2626
)
2727
return response
2828
}

apps/dav/src/components/AbsenceForm.vue

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
:clear-search-on-blur="() => false"
2727
:user-select="true"
2828
:options="options"
29-
@search="asyncFind"
30-
>
29+
@search="asyncFind">
3130
<template #no-options="{ search }">
3231
{{ search ?$t('dav', 'No results.') : $t('dav', 'Start typing.') }}
3332
</template>
@@ -51,21 +50,21 @@
5150
</template>
5251

5352
<script>
53+
import { getCurrentUser } from '@nextcloud/auth'
54+
import { showError, showSuccess } from '@nextcloud/dialogs'
55+
import { loadState } from '@nextcloud/initial-state'
56+
import { generateOcsUrl } from '@nextcloud/router'
57+
import { ShareType } from '@nextcloud/sharing'
58+
import { formatDateAsYMD } from '../utils/date.js'
59+
import axios from '@nextcloud/axios'
60+
import debounce from 'debounce'
61+
import logger from '../service/logger.js'
62+
5463
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
5564
import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'
5665
import NcTextArea from '@nextcloud/vue/dist/Components/NcTextArea.js'
5766
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
5867
import NcDateTimePickerNative from '@nextcloud/vue/dist/Components/NcDateTimePickerNative.js'
59-
import { generateOcsUrl } from '@nextcloud/router'
60-
import { getCurrentUser } from '@nextcloud/auth'
61-
import debounce from 'debounce'
62-
import axios from '@nextcloud/axios'
63-
import { formatDateAsYMD } from '../utils/date.js'
64-
import { loadState } from '@nextcloud/initial-state'
65-
import { showError, showSuccess } from '@nextcloud/dialogs'
66-
import { Type as ShareTypes } from '@nextcloud/sharing'
67-
68-
import logger from '../service/logger.js'
6968
7069
export default {
7170
name: 'AbsenceForm',
@@ -74,17 +73,17 @@ export default {
7473
NcTextField,
7574
NcTextArea,
7675
NcDateTimePickerNative,
77-
NcSelect
76+
NcSelect,
7877
},
7978
data() {
80-
const { firstDay, lastDay, status, message ,replacementUserId ,replacementUserDisplayName } = loadState('dav', 'absence', {})
79+
const { firstDay, lastDay, status, message, replacementUserId, replacementUserDisplayName } = loadState('dav', 'absence', {})
8180
return {
8281
loading: false,
8382
status: status ?? '',
8483
message: message ?? '',
8584
firstDay: firstDay ? new Date(firstDay) : new Date(),
8685
lastDay: lastDay ? new Date(lastDay) : null,
87-
replacementUserId: replacementUserId ,
86+
replacementUserId,
8887
replacementUser: replacementUserId ? { user: replacementUserId, displayName: replacementUserDisplayName } : null,
8988
searchLoading: false,
9089
options: [],
@@ -126,10 +125,10 @@ export default {
126125
return {
127126
user: result.uuid || result.value.shareWith,
128127
displayName: result.name || result.label,
129-
subtitle: result.dsc | ''
128+
subtitle: result.dsc | '',
130129
}
131130
},
132-
131+
133132
async asyncFind(query) {
134133
this.searchLoading = true
135134
await this.debounceGetSuggestions(query.trim())
@@ -142,7 +141,7 @@ export default {
142141
async getSuggestions(search) {
143142
144143
const shareType = [
145-
ShareTypes.SHARE_TYPE_USER,
144+
ShareType.SHARE_TYPE_USER,
146145
]
147146
148147
let request = null

apps/dav/src/dav/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ export const getClient = memoize((service) => {
2727
onRequestTokenUpdate(setHeaders)
2828
setHeaders(getRequestToken())
2929

30-
return client;
30+
return client
3131
})

apps/dav/src/service/PreferenceService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function enableUserStatusAutomation() {
1717
}),
1818
{
1919
configValue: 'yes',
20-
}
20+
},
2121
)
2222
}
2323

@@ -29,6 +29,6 @@ export async function disableUserStatusAutomation() {
2929
generateOcsUrl('/apps/provisioning_api/api/v1/config/users/{appId}/{configKey}', {
3030
appId: 'dav',
3131
configKey: 'user_status_automation',
32-
})
32+
}),
3333
)
3434
}

apps/dav/src/settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ const CalDavSettingsView = new View({
1717
sendInvitations: loadState('dav', 'sendInvitations'),
1818
generateBirthdayCalendar: loadState(
1919
'dav',
20-
'generateBirthdayCalendar'
20+
'generateBirthdayCalendar',
2121
),
2222
sendEventReminders: loadState('dav', 'sendEventReminders'),
2323
sendEventRemindersToSharedUsers: loadState(
2424
'dav',
25-
'sendEventRemindersToSharedUsers'
25+
'sendEventRemindersToSharedUsers',
2626
),
2727
sendEventRemindersPush: loadState('dav', 'sendEventRemindersPush'),
2828
}

apps/dav/src/views/CalDavSettings.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,27 @@ describe('CalDavSettings', () => {
5454
},
5555
Vue => {
5656
Vue.prototype.$t = jest.fn((app, text) => text)
57-
}
57+
},
5858
)
5959
expect(TLUtils.container).toMatchSnapshot()
6060
const sendInvitations = TLUtils.getByLabelText(
61-
'Send invitations to attendees'
61+
'Send invitations to attendees',
6262
)
6363
expect(sendInvitations).toBeChecked()
6464
const generateBirthdayCalendar = TLUtils.getByLabelText(
65-
'Automatically generate a birthday calendar'
65+
'Automatically generate a birthday calendar',
6666
)
6767
expect(generateBirthdayCalendar).toBeChecked()
6868
const sendEventReminders = TLUtils.getByLabelText(
69-
'Send notifications for events'
69+
'Send notifications for events',
7070
)
7171
expect(sendEventReminders).toBeChecked()
7272
const sendEventRemindersToSharedUsers = TLUtils.getByLabelText(
73-
'Send reminder notifications to calendar sharees as well'
73+
'Send reminder notifications to calendar sharees as well',
7474
)
7575
expect(sendEventRemindersToSharedUsers).toBeChecked()
7676
const sendEventRemindersPush = TLUtils.getByLabelText(
77-
'Enable notifications for events via push'
77+
'Enable notifications for events via push',
7878
)
7979
expect(sendEventRemindersPush).toBeChecked()
8080

0 commit comments

Comments
 (0)