Skip to content

Commit

Permalink
Merge pull request #608 from YunoHost/maintenance
Browse files Browse the repository at this point in the history
chore: general maintenance
  • Loading branch information
Axolotle authored Dec 19, 2024
2 parents ec03439 + 3ee4829 commit 814b22b
Show file tree
Hide file tree
Showing 31 changed files with 1,159 additions and 956 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ jobs:
run: cd app && yarn install --frozen-lockfile
- name: Run linter
run: cd app && yarn lint
- name: Run type checking
run: cd app && yarn type-check
26 changes: 0 additions & 26 deletions app/.eslintrc.js

This file was deleted.

124 changes: 61 additions & 63 deletions app/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,67 @@ declare module 'vue' {
export interface GlobalComponents {
AdressItem: typeof import('./src/components/globals/formItems/AdressItem.vue')['default']
AppCatalogSkeleton: typeof import('./src/components/globals/skeletons/AppCatalogSkeleton.vue')['default']
BAccordion: typeof import('bootstrap-vue-next')['BAccordion']
BAccordionItem: typeof import('bootstrap-vue-next')['BAccordionItem']
BBadge: typeof import('bootstrap-vue-next')['BBadge']
BBreadcrumb: typeof import('bootstrap-vue-next')['BBreadcrumb']
BBreadcrumbItem: typeof import('bootstrap-vue-next')['BBreadcrumbItem']
BButton: typeof import('bootstrap-vue-next')['BButton']
BButtonGroup: typeof import('bootstrap-vue-next')['BButtonGroup']
BButtonToolbar: typeof import('bootstrap-vue-next')['BButtonToolbar']
BCard: typeof import('bootstrap-vue-next')['BCard']
BCardBody: typeof import('bootstrap-vue-next')['BCardBody']
BCardGroup: typeof import('bootstrap-vue-next')['BCardGroup']
BCardHeader: typeof import('bootstrap-vue-next')['BCardHeader']
BCardText: typeof import('bootstrap-vue-next')['BCardText']
BCardTitle: typeof import('bootstrap-vue-next')['BCardTitle']
BCol: typeof import('bootstrap-vue-next')['BCol']
BCollapse: typeof import('bootstrap-vue-next')['BCollapse']
BDropdown: typeof import('bootstrap-vue-next')['BDropdown']
BDropdownDivider: typeof import('bootstrap-vue-next')['BDropdownDivider']
BDropdownForm: typeof import('bootstrap-vue-next')['BDropdownForm']
BDropdownGroup: typeof import('bootstrap-vue-next')['BDropdownGroup']
BDropdownItem: typeof import('bootstrap-vue-next')['BDropdownItem']
BDropdownItemButton: typeof import('bootstrap-vue-next')['BDropdownItemButton']
BDropdownText: typeof import('bootstrap-vue-next')['BDropdownText']
BForm: typeof import('bootstrap-vue-next')['BForm']
BFormCheckbox: typeof import('bootstrap-vue-next')['BFormCheckbox']
BFormCheckboxGroup: typeof import('bootstrap-vue-next')['BFormCheckboxGroup']
BFormFile: typeof import('bootstrap-vue-next')['BFormFile']
BFormGroup: typeof import('bootstrap-vue-next')['BFormGroup']
BFormInput: typeof import('bootstrap-vue-next')['BFormInput']
BFormInvalidFeedback: typeof import('bootstrap-vue-next')['BFormInvalidFeedback']
BFormRadio: typeof import('bootstrap-vue-next')['BFormRadio']
BFormRadioGroup: typeof import('bootstrap-vue-next')['BFormRadioGroup']
BFormSelect: typeof import('bootstrap-vue-next')['BFormSelect']
BFormSelectOption: typeof import('bootstrap-vue-next')['BFormSelectOption']
BFormTag: typeof import('bootstrap-vue-next')['BFormTag']
BFormTags: typeof import('bootstrap-vue-next')['BFormTags']
BFormTextarea: typeof import('bootstrap-vue-next')['BFormTextarea']
BImg: typeof import('bootstrap-vue-next')['BImg']
BInputGroup: typeof import('bootstrap-vue-next')['BInputGroup']
BInputGroupText: typeof import('bootstrap-vue-next')['BInputGroupText']
BLink: typeof import('bootstrap-vue-next')['BLink']
BListGroup: typeof import('bootstrap-vue-next')['BListGroup']
BListGroupItem: typeof import('bootstrap-vue-next')['BListGroupItem']
BModal: typeof import('bootstrap-vue-next')['BModal']
BModalOrchestrator: typeof import('bootstrap-vue-next')['BModalOrchestrator']
BNav: typeof import('bootstrap-vue-next')['BNav']
BNavbar: typeof import('bootstrap-vue-next')['BNavbar']
BNavbarBrand: typeof import('bootstrap-vue-next')['BNavbarBrand']
BNavbarNav: typeof import('bootstrap-vue-next')['BNavbarNav']
BNavItem: typeof import('bootstrap-vue-next')['BNavItem']
BNavText: typeof import('bootstrap-vue-next')['BNavText']
BOverlay: typeof import('bootstrap-vue-next')['BOverlay']
BPopover: typeof import('bootstrap-vue-next')['BPopover']
BProgress: typeof import('bootstrap-vue-next')['BProgress']
BProgressBar: typeof import('bootstrap-vue-next')['BProgressBar']
BRow: typeof import('bootstrap-vue-next')['BRow']
BAccordion: typeof import('bootstrap-vue-next/components/BAccordion')['BAccordion']
BAccordionItem: typeof import('bootstrap-vue-next/components/BAccordion')['BAccordionItem']
BBadge: typeof import('bootstrap-vue-next/components/BBadge')['BBadge']
BBreadcrumb: typeof import('bootstrap-vue-next/components/BBreadcrumb')['BBreadcrumb']
BBreadcrumbItem: typeof import('bootstrap-vue-next/components/BBreadcrumb')['BBreadcrumbItem']
BButton: typeof import('bootstrap-vue-next/components/BButton')['BButton']
BButtonGroup: typeof import('bootstrap-vue-next/components/BButton')['BButtonGroup']
BButtonToolbar: typeof import('bootstrap-vue-next/components/BButton')['BButtonToolbar']
BCard: typeof import('bootstrap-vue-next/components/BCard')['BCard']
BCardBody: typeof import('bootstrap-vue-next/components/BCard')['BCardBody']
BCardGroup: typeof import('bootstrap-vue-next/components/BCard')['BCardGroup']
BCardHeader: typeof import('bootstrap-vue-next/components/BCard')['BCardHeader']
BCardText: typeof import('bootstrap-vue-next/components/BCard')['BCardText']
BCardTitle: typeof import('bootstrap-vue-next/components/BCard')['BCardTitle']
BCol: typeof import('bootstrap-vue-next/components/BContainer')['BCol']
BCollapse: typeof import('bootstrap-vue-next/components/BCollapse')['BCollapse']
BDropdown: typeof import('bootstrap-vue-next/components/BDropdown')['BDropdown']
BDropdownDivider: typeof import('bootstrap-vue-next/components/BDropdown')['BDropdownDivider']
BDropdownForm: typeof import('bootstrap-vue-next/components/BDropdown')['BDropdownForm']
BDropdownGroup: typeof import('bootstrap-vue-next/components/BDropdown')['BDropdownGroup']
BDropdownItem: typeof import('bootstrap-vue-next/components/BDropdown')['BDropdownItem']
BDropdownItemButton: typeof import('bootstrap-vue-next/components/BDropdown')['BDropdownItemButton']
BDropdownText: typeof import('bootstrap-vue-next/components/BDropdown')['BDropdownText']
BForm: typeof import('bootstrap-vue-next/components/BForm')['BForm']
BFormCheckbox: typeof import('bootstrap-vue-next/components/BFormCheckbox')['BFormCheckbox']
BFormCheckboxGroup: typeof import('bootstrap-vue-next/components/BFormCheckbox')['BFormCheckboxGroup']
BFormFile: typeof import('bootstrap-vue-next/components/BFormFile')['BFormFile']
BFormGroup: typeof import('bootstrap-vue-next/components/BFormGroup')['BFormGroup']
BFormInput: typeof import('bootstrap-vue-next/components/BFormInput')['BFormInput']
BFormInvalidFeedback: typeof import('bootstrap-vue-next/components/BForm')['BFormInvalidFeedback']
BFormRadio: typeof import('bootstrap-vue-next/components/BFormRadio')['BFormRadio']
BFormRadioGroup: typeof import('bootstrap-vue-next/components/BFormRadio')['BFormRadioGroup']
BFormSelect: typeof import('bootstrap-vue-next/components/BFormSelect')['BFormSelect']
BFormSelectOption: typeof import('bootstrap-vue-next/components/BFormSelect')['BFormSelectOption']
BFormTag: typeof import('bootstrap-vue-next/components/BFormTags')['BFormTag']
BFormTags: typeof import('bootstrap-vue-next/components/BFormTags')['BFormTags']
BFormTextarea: typeof import('bootstrap-vue-next/components/BFormTextarea')['BFormTextarea']
BImg: typeof import('bootstrap-vue-next/components/BImg')['BImg']
BInputGroup: typeof import('bootstrap-vue-next/components/BInputGroup')['BInputGroup']
BInputGroupText: typeof import('bootstrap-vue-next/components/BInputGroup')['BInputGroupText']
BLink: typeof import('bootstrap-vue-next/components/BLink')['BLink']
BListGroup: typeof import('bootstrap-vue-next/components/BListGroup')['BListGroup']
BListGroupItem: typeof import('bootstrap-vue-next/components/BListGroup')['BListGroupItem']
BModal: typeof import('bootstrap-vue-next/components/BModal')['BModal']
BModalOrchestrator: typeof import('bootstrap-vue-next/components/BModal')['BModalOrchestrator']
BNav: typeof import('bootstrap-vue-next/components/BNav')['BNav']
BNavbar: typeof import('bootstrap-vue-next/components/BNavbar')['BNavbar']
BNavbarBrand: typeof import('bootstrap-vue-next/components/BNavbar')['BNavbarBrand']
BNavbarNav: typeof import('bootstrap-vue-next/components/BNavbar')['BNavbarNav']
BNavItem: typeof import('bootstrap-vue-next/components/BNav')['BNavItem']
BNavText: typeof import('bootstrap-vue-next/components/BNav')['BNavText']
BOverlay: typeof import('bootstrap-vue-next/components/BOverlay')['BOverlay']
BPopover: typeof import('bootstrap-vue-next/components/BPopover')['BPopover']
BProgress: typeof import('bootstrap-vue-next/components/BProgress')['BProgress']
BProgressBar: typeof import('bootstrap-vue-next/components/BProgress')['BProgressBar']
BRow: typeof import('bootstrap-vue-next/components/BContainer')['BRow']
BSkeleton: typeof import('./src/components/globals/skeletons/BSkeleton.vue')['default']
BSkeletonWrapper: typeof import('./src/components/globals/skeletons/BSkeletonWrapper.vue')['default']
BTab: typeof import('bootstrap-vue-next')['BTab']
BTable: typeof import('bootstrap-vue-next')['BTable']
BTabs: typeof import('bootstrap-vue-next')['BTabs']
BTab: typeof import('bootstrap-vue-next/components/BTabs')['BTab']
BTable: typeof import('bootstrap-vue-next/components/BTable')['BTable']
BTabs: typeof import('bootstrap-vue-next/components/BTabs')['BTabs']
ButtonItem: typeof import('./src/components/globals/formItems/ButtonItem.vue')['default']
CardCollapse: typeof import('./src/components/CardCollapse.vue')['default']
CardDeckFeed: typeof import('./src/components/CardDeckFeed.vue')['default']
Expand Down Expand Up @@ -118,9 +118,7 @@ declare module 'vue' {
YSpinner: typeof import('./src/components/globals/YSpinner.vue')['default']
}
export interface ComponentCustomProperties {
vBModal: typeof import('bootstrap-vue-next')['vBModal']
vBPopover: typeof import('bootstrap-vue-next')['vBPopover']
vBToggle: typeof import('bootstrap-vue-next')['vBToggle']
vBTooltip: typeof import('bootstrap-vue-next')['vBTooltip']
vBModal: typeof import('bootstrap-vue-next/directives/BModal')['vBModal']
vBToggle: typeof import('bootstrap-vue-next/directives/BToggle')['vBToggle']
}
}
41 changes: 41 additions & 0 deletions app/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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'] }],
},
},
]
42 changes: 21 additions & 21 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,44 @@
"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",
"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",
"@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",
"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"
"@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-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%",
Expand Down
12 changes: 5 additions & 7 deletions app/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends any = any>({
async fetch<T>({
uri,
method = 'GET',
cachePath = undefined,
Expand Down Expand Up @@ -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<T extends any = any>(
query: string | Omit<APIQuery, 'method' | 'data'>,
): Promise<T> {
get<T>(query: string | Omit<APIQuery, 'method' | 'data'>): Promise<T> {
return this.fetch(typeof query === 'string' ? { uri: query } : query)
},

Expand All @@ -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<T extends any = any>(query: Omit<APIQuery, 'method'>): Promise<T> {
post<T>(query: Omit<APIQuery, 'method'>): Promise<T> {
return this.fetch({ ...query, method: 'POST' })
},

Expand All @@ -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<T extends any = any>(query: Omit<APIQuery, 'method'>): Promise<T> {
put<T>(query: Omit<APIQuery, 'method'>): Promise<T> {
return this.fetch({ ...query, method: 'PUT' })
},

Expand All @@ -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<T extends any = any>(query: Omit<APIQuery, 'method'>): Promise<T> {
delete<T>(query: Omit<APIQuery, 'method'>): Promise<T> {
return this.fetch({ ...query, method: 'DELETE' })
},

Expand Down
1 change: 0 additions & 1 deletion app/src/api/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class APIError extends Error {
}

log() {
/* eslint-disable-next-line */
console.error(`${this.name} (${this.code}): ${this.path}\n${this.message}`)
}
}
Expand Down
4 changes: 1 addition & 3 deletions app/src/api/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends any = any>(
response: Response,
): Promise<T> {
export async function getResponseData<T>(response: Response): Promise<T> {
// FIXME the api should always return json as response
const responseText = await response.text()
try {
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/ConfigPanels.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ defineOptions({
})
const currentRoute = useRoute()
const props = defineProps<{
const _props = defineProps<{
panel: ConfigPanel<NestedMV, MV>
routes: ConfigPanels<NestedMV, MV>['routes']
validations: FormValidation<NestedMV>
}>()
const emit = defineEmits<{
apply: [action?: KeyOfStr<typeof props.panel.fields>]
apply: [action?: KeyOfStr<typeof _props.panel.fields>]
}>()
const slots = defineSlots<{
Expand Down
10 changes: 8 additions & 2 deletions app/src/components/RecursiveListGroup.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<script setup lang="ts">
import type { TreeChildNode, AnyTreeNode } from '@/helpers/data/tree'
import type {
AnyTreeNode,
TreeChildNode,
TreeRootNode,
} from '@/helpers/data/tree'
const props = withDefaults(
defineProps<{
Expand All @@ -16,7 +20,9 @@ const props = withDefaults(
)
type NodeSlot = {
[K in keyof TreeChildNode as TreeChildNode[K] extends Function
[K in keyof TreeChildNode as TreeChildNode[K] extends (
callback: (node: AnyTreeNode, index: number, root: TreeRootNode) => boolean,
) => AnyTreeNode
? never
: K]: TreeChildNode[K]
}
Expand Down
5 changes: 1 addition & 4 deletions app/src/composables/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,7 @@ type StoreKeysParam =
type DataKeys = StoreKeys | StoreKeysParam
export type StorePath = `${StoreKeys}` | `${StoreKeysParam}.${string}`

export function useCache<T extends any = any>(
method: RequestMethod,
cachePath: StorePath,
) {
export function useCache<T>(method: RequestMethod, cachePath: StorePath) {
const [key, param] = cachePath.split(/\.(.*)/s) as
| [StoreKeys, undefined]
| [StoreKeysParam, string]
Expand Down
Loading

0 comments on commit 814b22b

Please sign in to comment.