Skip to content

Commit cd54f7c

Browse files
committed
chore: upgrade typescript, eslint and fix lint
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 4cfab4b commit cd54f7c

File tree

120 files changed

+11903
-5416
lines changed

Some content is hidden

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

120 files changed

+11903
-5416
lines changed

.eslintrc.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@ module.exports = {
33
__webpack_nonce__: true,
44
_: true,
55
$: true,
6-
moment: true,
7-
escapeHTML: true,
8-
oc_userconfig: true,
96
dayNames: true,
7+
escapeHTML: true,
108
firstDay: true,
11-
'cypress/globals': true,
12-
},
13-
parserOptions: {
14-
parser: '@typescript-eslint/parser',
9+
moment: true,
10+
oc_userconfig: true,
11+
sinon: true,
1512
},
1613
plugins: [
1714
'cypress',
1815
],
1916
extends: [
20-
'@nextcloud',
17+
'@nextcloud/eslint-config/typescript',
2118
'plugin:cypress/recommended',
2219
],
2320
rules: {

__mocks__/@nextcloud/dialogs.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
3+
*
4+
* @author John Molakvoæ <skjnldsv@protonmail.com>
5+
*
6+
* @license AGPL-3.0-or-later
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License as
10+
* published by the Free Software Foundation, either version 3 of the
11+
* License, or (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
23+
import { jest } from '@jest/globals'
24+
25+
export const showMessage = jest.fn()
26+
export const showSuccess = jest.fn()
27+
export const showWarning = jest.fn()
28+
export const showInfo = jest.fn()
29+
export const showError = jest.fn()
30+
export const showUndo = jest.fn()

__tests__/tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"verbatimModuleSyntax": false
5+
}
6+
}

apps/files/src/actions/editLocallyAction.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
*/
2222
import { action } from './editLocallyAction'
2323
import { expect } from '@jest/globals'
24-
import { File, Folder, Permission } from '@nextcloud/files'
24+
import { File, Permission } from '@nextcloud/files'
2525
import { FileAction } from '../services/FileAction'
26+
import * as ncDialogs from '@nextcloud/dialogs'
2627
import axios from '@nextcloud/axios'
2728
import type { Navigation } from '../services/Navigation'
28-
import ncDialogs from '@nextcloud/dialogs'
2929

3030
const view = {
3131
id: 'files',
@@ -140,7 +140,7 @@ describe('Edit locally action execute tests', () => {
140140

141141
test('Edit locally fails and show error', async () => {
142142
jest.spyOn(axios, 'post').mockImplementation(async () => ({}))
143-
jest.spyOn(ncDialogs, 'showError')
143+
jest.spyOn(ncDialogs, 'showError').mockImplementation(async () => ({}))
144144

145145
const file = new File({
146146
id: 1,

apps/files/src/actions/openFolderAction.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
import { action } from './openFolderAction'
2323
import { expect } from '@jest/globals'
24-
import { File, Folder, Permission } from '@nextcloud/files'
24+
import { File, Folder, Node, Permission } from '@nextcloud/files'
2525
import { FileAction } from '../services/FileAction'
2626
import type { Navigation } from '../services/Navigation'
2727

@@ -139,8 +139,7 @@ describe('Open folder action execute tests', () => {
139139
const goToRouteMock = jest.fn()
140140
window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } }
141141

142-
// @ts-ignore null as Node
143-
const exec = await action.exec(null, view, '/')
142+
const exec = await action.exec(null as unknown as Node, view, '/')
144143
expect(exec).toBe(false)
145144
expect(goToRouteMock).toBeCalledTimes(0)
146145
})

apps/files/src/actions/sidebarAction.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,3 @@ export const action = new FileAction({
6565
})
6666

6767
registerFileAction(action)
68-

apps/files/src/components/SidebarTab.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<!--
32
- @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
43
-

apps/files/src/services/RouterService.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,26 @@
1919
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*
2121
*/
22-
import type { Route } from 'vue-router';
23-
import type VueRouter from 'vue-router';
24-
import type { Dictionary } from 'vue-router/types/router';
25-
import type { Location } from 'vue-router/types/router';
22+
import type { Route } from 'vue-router'
23+
import type VueRouter from 'vue-router'
24+
import type { Dictionary, Location } from 'vue-router/types/router'
2625

2726
export default class RouterService {
2827

29-
private _router: VueRouter;
28+
private _router: VueRouter
3029

3130
constructor(router: VueRouter) {
3231
this._router = router
3332
}
3433

3534
/**
3635
* Trigger a route change on the files app
37-
*
36+
*
3837
* @param path the url path, eg: '/trashbin?dir=/Deleted'
3938
* @param replace replace the current history
4039
* @see https://router.vuejs.org/guide/essentials/navigation.html#navigate-to-a-different-location
4140
*/
42-
goTo(path: string, replace: boolean = false): Promise<Route> {
41+
goTo(path: string, replace = false): Promise<Route> {
4342
return this._router.push({
4443
path,
4544
replace,
@@ -68,4 +67,5 @@ export default class RouterService {
6867
replace,
6968
} as Location)
7069
}
70+
7171
}

apps/files/src/views/Navigation.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe('Quota rendering', () => {
161161
// TODO: remove when @nextcloud/l10n 2.0 is released
162162
// https://github.com/nextcloud/nextcloud-l10n/pull/542
163163
cy.stub(L10n, 'translate', (app, text, vars = {}, number) => {
164-
cy.log({app, text, vars, number})
164+
cy.log({ app, text, vars, number })
165165
return text.replace(/%n/g, '' + number).replace(/{([^{}]*)}/g, (match, key) => {
166166
return vars[key]
167167
})

apps/files_sharing/src/components/SharingEntryInternal.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<template>
32
<ul>
43
<SharingEntrySimple ref="shareEntrySimple"

0 commit comments

Comments
 (0)