chore: upgrade typescript, eslint and fix lint

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ 2023-06-27 11:44:59 +02:00
parent 4cfab4b838
commit cd54f7c7f4
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
120 changed files with 12945 additions and 6439 deletions

View File

@ -3,21 +3,18 @@ module.exports = {
__webpack_nonce__: true,
_: true,
$: true,
moment: true,
escapeHTML: true,
oc_userconfig: true,
dayNames: true,
escapeHTML: true,
firstDay: true,
'cypress/globals': true,
},
parserOptions: {
parser: '@typescript-eslint/parser',
moment: true,
oc_userconfig: true,
sinon: true,
},
plugins: [
'cypress',
],
extends: [
'@nextcloud',
'@nextcloud/eslint-config/typescript',
'plugin:cypress/recommended',
],
rules: {

View File

@ -0,0 +1,30 @@
/**
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import { jest } from '@jest/globals'
export const showMessage = jest.fn()
export const showSuccess = jest.fn()
export const showWarning = jest.fn()
export const showInfo = jest.fn()
export const showError = jest.fn()
export const showUndo = jest.fn()

6
__tests__/tsconfig.json Normal file
View File

@ -0,0 +1,6 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"verbatimModuleSyntax": false
}
}

View File

@ -21,11 +21,11 @@
*/
import { action } from './editLocallyAction'
import { expect } from '@jest/globals'
import { File, Folder, Permission } from '@nextcloud/files'
import { File, Permission } from '@nextcloud/files'
import { FileAction } from '../services/FileAction'
import * as ncDialogs from '@nextcloud/dialogs'
import axios from '@nextcloud/axios'
import type { Navigation } from '../services/Navigation'
import ncDialogs from '@nextcloud/dialogs'
const view = {
id: 'files',
@ -140,7 +140,7 @@ describe('Edit locally action execute tests', () => {
test('Edit locally fails and show error', async () => {
jest.spyOn(axios, 'post').mockImplementation(async () => ({}))
jest.spyOn(ncDialogs, 'showError')
jest.spyOn(ncDialogs, 'showError').mockImplementation(async () => ({}))
const file = new File({
id: 1,

View File

@ -21,7 +21,7 @@
*/
import { action } from './openFolderAction'
import { expect } from '@jest/globals'
import { File, Folder, Permission } from '@nextcloud/files'
import { File, Folder, Node, Permission } from '@nextcloud/files'
import { FileAction } from '../services/FileAction'
import type { Navigation } from '../services/Navigation'
@ -139,8 +139,7 @@ describe('Open folder action execute tests', () => {
const goToRouteMock = jest.fn()
window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } }
// @ts-ignore null as Node
const exec = await action.exec(null, view, '/')
const exec = await action.exec(null as unknown as Node, view, '/')
expect(exec).toBe(false)
expect(goToRouteMock).toBeCalledTimes(0)
})

View File

@ -65,4 +65,3 @@ export const action = new FileAction({
})
registerFileAction(action)

View File

@ -1,4 +1,3 @@
<!--
- @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
-

View File

@ -19,14 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import type { Route } from 'vue-router';
import type VueRouter from 'vue-router';
import type { Dictionary } from 'vue-router/types/router';
import type { Location } from 'vue-router/types/router';
import type { Route } from 'vue-router'
import type VueRouter from 'vue-router'
import type { Dictionary, Location } from 'vue-router/types/router'
export default class RouterService {
private _router: VueRouter;
private _router: VueRouter
constructor(router: VueRouter) {
this._router = router
@ -34,12 +33,12 @@ export default class RouterService {
/**
* Trigger a route change on the files app
*
*
* @param path the url path, eg: '/trashbin?dir=/Deleted'
* @param replace replace the current history
* @see https://router.vuejs.org/guide/essentials/navigation.html#navigate-to-a-different-location
*/
goTo(path: string, replace: boolean = false): Promise<Route> {
goTo(path: string, replace = false): Promise<Route> {
return this._router.push({
path,
replace,
@ -68,4 +67,5 @@ export default class RouterService {
replace,
} as Location)
}
}

View File

@ -161,7 +161,7 @@ describe('Quota rendering', () => {
// TODO: remove when @nextcloud/l10n 2.0 is released
// https://github.com/nextcloud/nextcloud-l10n/pull/542
cy.stub(L10n, 'translate', (app, text, vars = {}, number) => {
cy.log({app, text, vars, number})
cy.log({ app, text, vars, number })
return text.replace(/%n/g, '' + number).replace(/{([^{}]*)}/g, (match, key) => {
return vars[key]
})

View File

@ -1,4 +1,3 @@
<template>
<ul>
<SharingEntrySimple ref="shareEntrySimple"

View File

@ -196,15 +196,13 @@ export default {
return (this.category === 'app-bundles')
},
allBundlesEnabled() {
const self = this
return function(id) {
return self.bundleApps(id).filter(app => !app.active).length === 0
return (id) => {
return this.bundleApps(id).filter(app => !app.active).length === 0
}
},
bundleToggleText() {
const self = this
return function(id) {
if (self.allBundlesEnabled(id)) {
return (id) => {
if (this.allBundlesEnabled(id)) {
return t('settings', 'Disable all')
}
return t('settings', 'Enable all')

View File

@ -123,16 +123,15 @@ export default {
}
},
removeGroup(groupid) {
const self = this
// TODO migrate to a vue js confirm dialog component
OC.dialogs.confirm(
t('settings', 'You are about to remove the group {group}. The users will NOT be deleted.', { group: groupid }),
t('settings', 'Please confirm the group removal '),
function(success) {
(success) => {
if (success) {
self.$store.dispatch('removeGroup', groupid)
this.$store.dispatch('removeGroup', groupid)
}
}
},
)
},
},

View File

@ -87,18 +87,18 @@ export default {
</script>
<style lang="scss" scoped>
.federation-actions__btn {
&::v-deep p {
width: 150px !important;
padding: 8px 0 !important;
color: var(--color-main-text) !important;
font-size: 12.8px !important;
line-height: 1.5em !important;
}
.federation-actions__btn {
&::v-deep p {
width: 150px !important;
padding: 8px 0 !important;
color: var(--color-main-text) !important;
font-size: 12.8px !important;
line-height: 1.5em !important;
}
}
.federation-actions__btn--active {
background-color: var(--color-primary-element-light) !important;
box-shadow: inset 2px 0 var(--color-primary-element) !important;
}
.federation-actions__btn--active {
background-color: var(--color-primary-element-light) !important;
box-shadow: inset 2px 0 var(--color-primary-element) !important;
}
</style>

View File

@ -252,8 +252,8 @@ export default {
const result = await axios.post(generateUrl('/apps/theming/background/color'), { color })
this.update(result.data)
},
debouncePickColor: debounce(function() {
this.pickColor(...arguments)
debouncePickColor: debounce(function(...args) {
this.pickColor(...args)
}, 200),
async pickFile() {

View File

@ -1,4 +1,3 @@
/**
* @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
*

View File

@ -1,5 +1,3 @@
/* eslint-disable node/no-unpublished-import */
import {
applyChangesToNextcloud,
configureNextcloud,

BIN
dist/2142-2142.js vendored Normal file

Binary file not shown.

BIN
dist/2142-2142.js.map vendored Normal file

Binary file not shown.

BIN
dist/2323-2323.js vendored

Binary file not shown.

BIN
dist/2323-2323.js.map vendored

Binary file not shown.

BIN
dist/6117-6117.js vendored

Binary file not shown.

BIN
dist/6117-6117.js.map vendored

Binary file not shown.

BIN
dist/614-614.js vendored

Binary file not shown.

BIN
dist/614-614.js.map vendored

Binary file not shown.

BIN
dist/7816-7816.js vendored

Binary file not shown.

BIN
dist/7816-7816.js.map vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/core-common.js vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/core-install.js vendored

Binary file not shown.

Binary file not shown.

BIN
dist/core-login.js vendored

Binary file not shown.

BIN
dist/core-login.js.map vendored

Binary file not shown.

BIN
dist/core-main.js vendored

Binary file not shown.

BIN
dist/core-main.js.map vendored

Binary file not shown.

Binary file not shown.

BIN
dist/core-profile.js vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/files-main.js vendored

Binary file not shown.

Binary file not shown.

BIN
dist/files-main.js.map vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/files-sidebar.js vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More