From a4890757cd85796315eea9b1c38771e0fba0cf6d Mon Sep 17 00:00:00 2001 From: axolotle Date: Wed, 18 Dec 2024 14:54:07 +0100 Subject: [PATCH 01/13] chore: upgrade deps --- app/package.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/package.json b/app/package.json index c2aec76ce..1793aa92e 100644 --- a/app/package.json +++ b/app/package.json @@ -18,33 +18,33 @@ "@fontsource/firago": "^5.1.0", "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.4", - "@vueuse/core": "^11.1.0", + "@vueuse/core": "^12.0.0", "bootstrap": "^5.3.3", - "bootstrap-vue-next": "^0.25.13", - "date-fns": "^4.0.0", + "bootstrap-vue-next": "^0.26.15", + "date-fns": "^4.1.0", "fork-awesome": "^1.2.0", "simple-evaluate": "^1.4.6", - "uuid": "^10.0.0", - "vue": "^3.5.6", + "uuid": "^11.0.3", + "vue": "^3.5.13", "vue-i18n": "^10.0.5", - "vue-router": "^4.4.5", + "vue-router": "^4.5.0", "vue-showdown": "^4.2.0" }, "devDependencies": { "@types/uuid": "^10.0.0", - "@vitejs/plugin-vue": "^5.1.3", - "@vue/eslint-config-typescript": "^13.0.0", - "@vue/tsconfig": "^0.5.1", - "eslint": "^8.57.0", + "@vitejs/plugin-vue": "^5.2.1", + "@vue/eslint-config-typescript": "^14.1.4", + "@vue/tsconfig": "^0.7.0", + "eslint": "^9.17.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-vue": "^9.28.0", - "prettier": "^3.3.3", - "sass": "^1.78.0", - "typescript": "^5.6.2", - "unplugin-vue-components": "^0.27.4", - "vite": "^5.4.6", - "vue-tsc": "^2.1.6" + "eslint-plugin-vue": "^9.32.0", + "prettier": "^3.4.2", + "sass": "^1.83.0", + "typescript": "^5.7.2", + "unplugin-vue-components": "^0.28.0", + "vite": "^6.0.3", + "vue-tsc": "^2.1.10" }, "browserslist": [ "> 1%", From f98ec6fcfd054442e6670ef877ba223c9e13760e Mon Sep 17 00:00:00 2001 From: axolotle Date: Wed, 18 Dec 2024 14:55:24 +0100 Subject: [PATCH 02/13] chore: add 'upgrade-deps' yarn command --- app/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/package.json b/app/package.json index 1793aa92e..d160a90f5 100644 --- a/app/package.json +++ b/app/package.json @@ -11,7 +11,8 @@ "lint:prettier": "prettier --check .", "lint": "yarn lint:js && yarn lint:prettier", "lintfix": "prettier --write --list-different . && yarn lint:js --fix", - "type-check": "vue-tsc --noEmit -p tsconfig.json" + "type-check": "vue-tsc --noEmit -p tsconfig.json", + "upgrade-deps": "yarn upgrade-interactive --latest" }, "dependencies": { "@fontsource/fira-code": "^5.1.0", From ad97dd58129ec9a8132c8f4f4938cd0fc61265ac Mon Sep 17 00:00:00 2001 From: axolotle Date: Wed, 18 Dec 2024 14:56:40 +0100 Subject: [PATCH 03/13] chore: update tsconfig.json --- app/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/tsconfig.json b/app/tsconfig.json index d2a0565ff..33c78f46f 100644 --- a/app/tsconfig.json +++ b/app/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "@vue/tsconfig/tsconfig.dom.json", + "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], "compilerOptions": { "target": "ESNext", "noErrorTruncation": true, - "lib": ["es2021", "dom"], + "lib": ["es2023", "dom"], "paths": { "@/*": ["./src/*"] }, From 68bcece0b68cbcb231e1085860b0aac978f4564e Mon Sep 17 00:00:00 2001 From: axolotle Date: Wed, 18 Dec 2024 14:59:33 +0100 Subject: [PATCH 04/13] chore: migrate to new eslint config file and command --- app/eslint.config.mjs | 41 +++++++++++++++++++++++++++++++++++++++++ app/package.json | 5 ++--- 2 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 app/eslint.config.mjs diff --git a/app/eslint.config.mjs b/app/eslint.config.mjs new file mode 100644 index 000000000..352904405 --- /dev/null +++ b/app/eslint.config.mjs @@ -0,0 +1,41 @@ +import pluginVue from 'eslint-plugin-vue' +import vueTsEslintConfig from '@vue/eslint-config-typescript' +import skipFormatting from '@vue/eslint-config-prettier/skip-formatting' + +export default [ + { + name: 'app/files-to-lint', + files: ['**/*.{ts,js,vue}'], + }, + + { + name: 'app/files-to-ignore', + ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'], + }, + + { + name: 'custom-ignore', + ignores: ['**/src/types/data/**'], + }, + + ...pluginVue.configs['flat/recommended'], + ...vueTsEslintConfig(), + skipFormatting, + + { + rules: { + 'vue/no-v-html': 'off', + 'no-unused-vars': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + varsIgnorePattern: '^_', + argsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + }, + ], + 'no-console': ['error', { allow: ['warn', 'error'] }], + }, + }, +] diff --git a/app/package.json b/app/package.json index d160a90f5..6c7ce9b57 100644 --- a/app/package.json +++ b/app/package.json @@ -7,7 +7,7 @@ "scripts": { "dev": "vite", "build": "vite build", - "lint:js": "eslint --ext \".ts,.vue,.cjs,.js\" --ignore-path ../.gitignore .", + "lint:js": "eslint .", "lint:prettier": "prettier --check .", "lint": "yarn lint:js && yarn lint:prettier", "lintfix": "prettier --write --list-different . && yarn lint:js --fix", @@ -34,11 +34,10 @@ "devDependencies": { "@types/uuid": "^10.0.0", "@vitejs/plugin-vue": "^5.2.1", + "@vue/eslint-config-prettier": "^10.1.0", "@vue/eslint-config-typescript": "^14.1.4", "@vue/tsconfig": "^0.7.0", "eslint": "^9.17.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-vue": "^9.32.0", "prettier": "^3.4.2", "sass": "^1.83.0", From a5f558dd2ebbc718afd33b70ab28b5a437cef87f Mon Sep 17 00:00:00 2001 From: axolotle Date: Wed, 18 Dec 2024 15:32:41 +0100 Subject: [PATCH 05/13] chore: lint fix --- app/src/api/api.ts | 12 +++++------- app/src/api/errors.ts | 1 - app/src/api/handlers.ts | 4 +--- app/src/components/ConfigPanels.vue | 4 ++-- app/src/components/RecursiveListGroup.vue | 10 ++++++++-- app/src/composables/data.ts | 5 +---- app/src/helpers/commons.ts | 8 +++----- app/src/helpers/data/tree.ts | 2 +- app/src/helpers/yunohostArguments.ts | 4 ++-- app/src/main.ts | 2 +- app/src/types/commons.ts | 1 - app/src/types/core/options.ts | 4 ++-- app/src/types/form.ts | 16 ++++++++-------- app/src/views/app/AppInfo.vue | 2 +- 14 files changed, 35 insertions(+), 40 deletions(-) diff --git a/app/src/api/api.ts b/app/src/api/api.ts index 0ae10b5e4..1038d7ca0 100644 --- a/app/src/api/api.ts +++ b/app/src/api/api.ts @@ -101,7 +101,7 @@ export default { * @returns Promise that resolve the api response data * @throws Throw an `APIError` or subclass depending on server response */ - async fetch({ + async fetch({ uri, method = 'GET', cachePath = undefined, @@ -206,9 +206,7 @@ export default { * @returns Promise that resolve the api response data or an error * @throws Throw an `APIError` or subclass depending on server response */ - get( - query: string | Omit, - ): Promise { + get(query: string | Omit): Promise { return this.fetch(typeof query === 'string' ? { uri: query } : query) }, @@ -220,7 +218,7 @@ export default { * @returns Promise that resolve the api response data or an error * @throws Throw an `APIError` or subclass depending on server response */ - post(query: Omit): Promise { + post(query: Omit): Promise { return this.fetch({ ...query, method: 'POST' }) }, @@ -232,7 +230,7 @@ export default { * @returns Promise that resolve the api response data or an error * @throws Throw an `APIError` or subclass depending on server response */ - put(query: Omit): Promise { + put(query: Omit): Promise { return this.fetch({ ...query, method: 'PUT' }) }, @@ -244,7 +242,7 @@ export default { * @returns Promise that resolve the api response data or an error * @throws Throw an `APIError` or subclass depending on server response */ - delete(query: Omit): Promise { + delete(query: Omit): Promise { return this.fetch({ ...query, method: 'DELETE' }) }, diff --git a/app/src/api/errors.ts b/app/src/api/errors.ts index 9b8c7d092..bf108e52a 100644 --- a/app/src/api/errors.ts +++ b/app/src/api/errors.ts @@ -34,7 +34,6 @@ class APIError extends Error { } log() { - /* eslint-disable-next-line */ console.error(`${this.name} (${this.code}): ${this.path}\n${this.message}`) } } diff --git a/app/src/api/handlers.ts b/app/src/api/handlers.ts index efb82103f..0e393e827 100644 --- a/app/src/api/handlers.ts +++ b/app/src/api/handlers.ts @@ -17,9 +17,7 @@ import type { APIErrorData } from './api' * @param response - A fetch `Response` object. * @returns Parsed response's json or response's text. */ -export async function getResponseData( - response: Response, -): Promise { +export async function getResponseData(response: Response): Promise { // FIXME the api should always return json as response const responseText = await response.text() try { diff --git a/app/src/components/ConfigPanels.vue b/app/src/components/ConfigPanels.vue index aee639119..411061a5c 100644 --- a/app/src/components/ConfigPanels.vue +++ b/app/src/components/ConfigPanels.vue @@ -14,14 +14,14 @@ defineOptions({ }) const currentRoute = useRoute() -const props = defineProps<{ +const _props = defineProps<{ panel: ConfigPanel routes: ConfigPanels['routes'] validations: FormValidation }>() const emit = defineEmits<{ - apply: [action?: KeyOfStr] + apply: [action?: KeyOfStr] }>() const slots = defineSlots<{ diff --git a/app/src/components/RecursiveListGroup.vue b/app/src/components/RecursiveListGroup.vue index c7d580d69..87222567b 100644 --- a/app/src/components/RecursiveListGroup.vue +++ b/app/src/components/RecursiveListGroup.vue @@ -1,5 +1,9 @@