From 27f75e1ac1298bad86e671efd7dd313541eec18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torge=20J=C3=BCrgensen?= Date: Tue, 14 Nov 2023 21:50:45 +0100 Subject: [PATCH] linter & ts update & fixes --- .devcontainer/devcontainer.json | 2 +- .eslintrc.js | 53 +- api/package.json | 10 +- api/src/enumMappings/getEnumOptions.ts | 4 +- api/src/enumMappings/role.ts | 1 + api/src/index.ts | 9 +- api/src/middlewares/index.ts | 2 +- api/src/scripts/createUser.ts | 1 + api/src/services/authentication/index.ts | 21 +- api/src/services/gliederung/index.ts | 1 + api/src/services/index.ts | 1 + api/src/services/user/index.ts | 9 +- api/src/util/prisma-exclude.ts | 13 +- api/tsconfig.json | 17 +- frontend/package.json | 2 +- frontend/src/api.ts | 2 + frontend/src/components/BasicHeader.vue | 20 +- .../components/BasicInputs/BasicCheckbox.vue | 19 +- .../BasicInputs/BasicDatepicker.vue | 44 +- .../src/components/BasicInputs/BasicInput.vue | 55 +- .../components/BasicInputs/BasicPassword.vue | 66 +- .../src/components/BasicInputs/BasicRadio.vue | 47 + .../components/BasicInputs/BasicSelect.vue | 45 +- .../components/BasicInputs/BasicSwitch.vue | 38 +- .../components/BasicInputs/BasicTextArea.vue | 33 +- .../components/BasicInputs/BasicTypeahead.vue | 49 +- .../BasicInputs/components/BasicFormGroup.vue | 10 +- .../BasicInputs/components/Typeahead.vue | 35 +- .../components/BasicInputs/defaultProps.ts | 13 + frontend/src/components/Button.vue | 6 +- frontend/src/components/Sidebar/Sidebar.vue | 8 +- .../src/components/Sidebar/SidebarItems.vue | 2 +- .../components/forms/user/FormUserGeneral.vue | 16 +- frontend/src/composables/useAuthentication.ts | 3 +- frontend/src/composables/useValidatedModel.ts | 4 +- frontend/src/layouts/BaseLayout.vue | 2 +- frontend/src/layouts/LoginLayout.vue | 2 +- frontend/src/main.ts | 1 + frontend/src/router/authenticationGuard.ts | 5 +- frontend/src/router/index.ts | 8 +- frontend/src/shims.d.ts | 1 + frontend/src/store/dashboardStore.ts | 1 + frontend/src/store/registrationStore.ts | 4 +- frontend/src/types.ts | 4 +- frontend/src/views/Dashboard/routes.ts | 2 +- frontend/src/views/Developer.vue | 14 +- frontend/src/views/Houses/HouseDetail.vue | 55 +- frontend/src/views/Houses/HousesList.vue | 8 +- frontend/src/views/Houses/routes.ts | 2 +- frontend/src/views/Login/Login.vue | 42 +- frontend/src/views/Login/routes.ts | 2 +- .../src/views/Registration/RegisterLogin.vue | 24 +- .../views/Registration/RegisterUsername.vue | 34 +- .../views/Registration/RegistrationStart.vue | 26 +- .../components/RegistrationLayout.vue | 16 +- frontend/src/views/Registration/routes.ts | 2 +- frontend/src/views/Users/UserCreate.vue | 3 +- frontend/src/views/Users/UserDetail.vue | 16 +- frontend/src/views/Users/UsersList.vue | 8 +- frontend/src/views/Users/routes.ts | 2 +- frontend/tsconfig.json | 53 +- frontend/tsconfig.tsbuildinfo | 1 + package-lock.json | 13758 +++++++--------- package.json | 32 +- packages/helpers/package.json | 1 + packages/helpers/tsconfig.json | 12 +- packages/helpers/tsconfig.tsbuildinfo | 1 + packages/validation/src/executeRules.ts | 5 +- .../validation/src/watchAndValidateValue.ts | 5 +- packages/validation/tsconfig.json | 13 +- packages/validation/tsconfig.tsbuildinfo | 1 + tsconfig.base.json | 16 + tsconfig.json | 40 +- 73 files changed, 6176 insertions(+), 8707 deletions(-) create mode 100644 frontend/src/components/BasicInputs/BasicRadio.vue create mode 100644 frontend/src/components/BasicInputs/defaultProps.ts create mode 100644 frontend/src/shims.d.ts create mode 100644 frontend/tsconfig.tsbuildinfo create mode 100644 packages/helpers/tsconfig.tsbuildinfo create mode 100644 packages/validation/tsconfig.tsbuildinfo create mode 100644 tsconfig.base.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 382a52c5..52bd2dfa 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -33,7 +33,7 @@ "forwardPorts": [8080, 8085, 3030, 9222, 27017], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "npm i" + // "postCreateCommand": "" // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // "remoteUser": "root" diff --git a/.eslintrc.js b/.eslintrc.js index 508e7139..1c55a055 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,23 @@ +const importSettings = { + 'import/first': 'error', + 'import/no-duplicates': 'error', + 'import/no-unresolved': 'off', + 'import/newline-after-import': 'error', + 'import/order': [ + 'error', + { + 'newlines-between': 'always', + alphabetize: { order: 'asc', caseInsensitive: true }, + pathGroups: [ + { + pattern: '@/**/*', + group: 'internal', + }, + ], + }, + ], +} + module.exports = { root: true, env: { @@ -26,10 +46,14 @@ module.exports = { parserOptions: { parser: '@typescript-eslint/parser', }, + settings: { + 'import/internal-regex': '^@codeanker/', + }, extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:vue/vue3-recommended', + 'plugin:import/recommended', 'plugin:prettier/recommended', ], rules: { @@ -53,14 +77,33 @@ module.exports = { 'vue/v-on-function-call': 'error', 'vue/no-unused-properties': ['error', { groups: ['props', 'data', 'computed', 'methods', 'setup'] }], 'vue/html-button-has-type': 'error', + 'vue/no-ref-object-reactivity-loss': 'error', + 'vue/padding-line-between-blocks': 'error', + 'vue/define-macros-order': 'error', + 'vue/block-order': [ + 'error', + { + order: ['template', 'script', 'style'], + }, + ], + 'vue/require-macro-variable-name': 'error', + 'vue/define-props-declaration': 'error', + 'vue/define-emits-declaration': 'error', + 'vue/component-api-style': ['error', ['script-setup']], + 'vue/block-lang': ['error', { script: { lang: 'ts' } }], + ...importSettings, }, }, { files: ['**/*.ts'], plugins: ['@typescript-eslint'], parser: '@typescript-eslint/parser', + env: { + es2022: true, + }, extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], settings: { + 'import/internal-regex': '^@codeanker/', 'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'], }, @@ -77,13 +120,17 @@ module.exports = { 'error', { argsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_' }, ], + ...importSettings, }, }, { - files: ['**/*.ts'], + files: ['**/*.js'], extends: ['eslint:recommended', 'plugin:prettier/recommended'], rules: { - 'no-unused-vars': 'off', + 'no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_', ignoreRestSiblings: true }, + ], }, }, { @@ -99,7 +146,7 @@ module.exports = { }, }, { - files: ['api/test/**/*.ts'], + files: ['api/test/**/*.js'], env: { mocha: true, }, diff --git a/api/package.json b/api/package.json index b744136f..479de6b1 100644 --- a/api/package.json +++ b/api/package.json @@ -1,9 +1,10 @@ { "name": "@codeanker/api", "main": "./src/index.ts", + "type": "module", "scripts": { - "dev": "nodemon -x ts-node src/index.ts", - "createUser": "ts-node src/scripts/createUser.ts" + "dev": "tsx watch --clear-screen=false src/index.ts", + "createUser": "tsx src/scripts/createUser.ts" }, "dependencies": { "@prisma/client": "^4.14.0", @@ -25,9 +26,8 @@ "@types/koa": "^2.13.6", "@types/koa-router": "^7.4.4", "@types/node": "^20.1.4", - "nodemon": "^2.0.22", "prisma": "^4.14.0", - "ts-node": "^10.9.1", - "typescript": "^5.0.4" + "tsx": "^4.1.2", + "typescript": "^5.2.2" } } diff --git a/api/src/enumMappings/getEnumOptions.ts b/api/src/enumMappings/getEnumOptions.ts index f011ed87..eb77d903 100644 --- a/api/src/enumMappings/getEnumOptions.ts +++ b/api/src/enumMappings/getEnumOptions.ts @@ -1,10 +1,10 @@ -import { EnumMapping } from './defineEnumMapping' +import { type EnumMapping } from './defineEnumMapping' export function getEnumOptions(enumMapping: T) { return Object.entries(enumMapping).map(([apiKey, mapping]) => { return { value: apiKey as keyof T, - label: mapping.human + label: mapping.human, } }) } diff --git a/api/src/enumMappings/role.ts b/api/src/enumMappings/role.ts index 33958032..433bd885 100644 --- a/api/src/enumMappings/role.ts +++ b/api/src/enumMappings/role.ts @@ -1,4 +1,5 @@ import { Prisma } from '@prisma/client' + import { defineEnumMapping } from './defineEnumMapping' export const roleMapping = defineEnumMapping({ diff --git a/api/src/index.ts b/api/src/index.ts index 0f0e80ee..7cfc01b8 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -1,9 +1,10 @@ -import { appRouter } from './services' -import * as Koa from 'koa' +import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server' +import config from 'config' +import Koa from 'koa' import { createKoaMiddleware } from 'trpc-koa-adapter' + import { koaRouter } from './middlewares' -import { inferRouterInputs, inferRouterOutputs } from '@trpc/server' -import * as config from 'config' +import { appRouter } from './services' // Export type router type signature, // NOT the router itself. diff --git a/api/src/middlewares/index.ts b/api/src/middlewares/index.ts index 895ca2ac..3cdeab64 100644 --- a/api/src/middlewares/index.ts +++ b/api/src/middlewares/index.ts @@ -1,4 +1,4 @@ -import * as Router from 'koa-router' +import Router from 'koa-router' const koaRouter = new Router() diff --git a/api/src/scripts/createUser.ts b/api/src/scripts/createUser.ts index d5b6f51b..a1a6ef8a 100644 --- a/api/src/scripts/createUser.ts +++ b/api/src/scripts/createUser.ts @@ -1,4 +1,5 @@ import { input, password as passwordInput, select } from '@inquirer/prompts' + import { getEnumOptions, roleMapping } from '../enumMappings' import prisma from '../prisma' import { hashPassword } from '../services/authentication' diff --git a/api/src/services/authentication/index.ts b/api/src/services/authentication/index.ts index 6036ca61..8b584250 100644 --- a/api/src/services/authentication/index.ts +++ b/api/src/services/authentication/index.ts @@ -1,10 +1,11 @@ +import { TRPCError } from '@trpc/server' +import bcrypt from 'bcryptjs' +import config from 'config' +import jwt from 'jsonwebtoken' import { z } from 'zod' -import { publicProcedure, router } from '../../trpc' + import prisma from '../../prisma' -import { TRPCError } from '@trpc/server' -import { sign, verify } from 'jsonwebtoken' -import { hash, compare } from 'bcryptjs' -import * as config from 'config' +import { publicProcedure, router } from '../../trpc' import exclude from '../../util/prisma-exclude' const jwtSecret: string = config.get('secret') @@ -33,7 +34,7 @@ export const authenticationRouter = router({ // eslint-disable-next-line @typescript-eslint/no-unused-vars const { password, ...userWithoutPassword } = user - const accessToken = sign( + const accessToken = jwt.sign( { userId: user.id, }, @@ -53,7 +54,7 @@ export const authenticationRouter = router({ ) .mutation(async (opts) => { try { - const payload = verify(opts.input.accessToken, jwtSecret) + const payload = jwt.verify(opts.input.accessToken, jwtSecret) if (payload === null || typeof payload !== 'object') throw new Error('Weird payload') const user = await prisma.user.findUnique({ @@ -84,7 +85,7 @@ export const authenticationRouter = router({ }) ) .mutation(async ({ input }) => { - const { password } = await prisma.user.findFirst({ + const { password } = await prisma.user.findFirstOrThrow({ where: { id: input.id, }, @@ -118,12 +119,12 @@ export const authenticationRouter = router({ }) export function hashPassword(password: string) { - return hash(password, 10) + return bcrypt.hash(password, 10) } async function passwordMatches(hash: string, password: string) { // find password in entity, this allows for dot notation if (!hash) return false - return await compare(password, hash) + return await bcrypt.compare(password, hash) } diff --git a/api/src/services/gliederung/index.ts b/api/src/services/gliederung/index.ts index c0ef39fa..c2949f5a 100644 --- a/api/src/services/gliederung/index.ts +++ b/api/src/services/gliederung/index.ts @@ -1,4 +1,5 @@ import { z } from 'zod' + import prisma from '../../prisma' import { publicProcedure, router } from '../../trpc' diff --git a/api/src/services/index.ts b/api/src/services/index.ts index 5269c4d6..07435c55 100644 --- a/api/src/services/index.ts +++ b/api/src/services/index.ts @@ -1,4 +1,5 @@ import { router } from '../trpc' + import { authenticationRouter } from './authentication' import { gliederungRouter } from './gliederung' import { userRouter } from './user' diff --git a/api/src/services/user/index.ts b/api/src/services/user/index.ts index 9924b761..412c8e59 100644 --- a/api/src/services/user/index.ts +++ b/api/src/services/user/index.ts @@ -1,9 +1,10 @@ +import { Gender } from '@prisma/client' import { z } from 'zod' + import prisma from '../../prisma' import { publicProcedure, router } from '../../trpc' -import { hashPassword } from '../authentication' import exclude from '../../util/prisma-exclude' -import { Gender } from '@prisma/client' +import { hashPassword } from '../authentication' export const userRouter = router({ create: publicProcedure @@ -15,7 +16,7 @@ export const userRouter = router({ role: z.enum(['GLIEDERUNG_ADMIN', 'ADMIN']), password: z.string(), birthdate: z.string().nullable(), - gender: z.enum(Object.keys(Gender)).nullable(), + gender: z.nativeEnum(Gender).nullable(), }) ) .mutation(async (opts) => { @@ -70,7 +71,7 @@ export const userRouter = router({ firstname: z.string(), lastname: z.string(), birthdate: z.string().nullable(), - gender: z.enum(Object.keys(Gender)).nullable(), + gender: z.nativeEnum(Gender).nullable(), }) ) .mutation(async ({ input }) => { diff --git a/api/src/util/prisma-exclude.ts b/api/src/util/prisma-exclude.ts index c90082bc..e304e31d 100644 --- a/api/src/util/prisma-exclude.ts +++ b/api/src/util/prisma-exclude.ts @@ -6,8 +6,13 @@ * * @see https://www.prisma.io/docs/concepts/components/prisma-client/excluding-fields */ -export default function exclude(entity: Entity, ...keys: Key[]): Omit { - const entries = Object.entries(entity).filter(([key]) => !keys.includes(key)) - const result = Object.fromEntries(entries) - return result as Omit +export default function exclude, K extends keyof T>( + entity: T, + ...keys: K[] +): Omit { + const clone = { ...entity } + for (const key of keys) { + delete clone[key] + } + return clone } diff --git a/api/tsconfig.json b/api/tsconfig.json index 130c7db3..6f6b0132 100644 --- a/api/tsconfig.json +++ b/api/tsconfig.json @@ -1,8 +1,11 @@ { - "compilerOptions": { - "strict": true - }, - "ts-node": { - "swc": true - } - } + "extends": "../tsconfig.base.json", + "compilerOptions": { + "lib": [ + "ES2022" + ] + }, + "include": [ + "src" + ], +} diff --git a/frontend/package.json b/frontend/package.json index 4f317616..4373dd2e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -19,7 +19,7 @@ "@vueuse/core": "^10.1.2", "crypto-js": "^4.1.1", "socket.io-client": "^4.6.1", - "vue": "^3.2.47", + "vue": "^3.3.8", "vue-router": "^4.1.6" }, "devDependencies": { diff --git a/frontend/src/api.ts b/frontend/src/api.ts index 71fd799a..71127758 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -1,5 +1,7 @@ import { createTRPCProxyClient, httpBatchLink } from '@trpc/client' + import type { AppRouter } from '@codeanker/api' + export const apiClient = createTRPCProxyClient({ links: [ httpBatchLink({ diff --git a/frontend/src/components/BasicHeader.vue b/frontend/src/components/BasicHeader.vue index c9cdb205..e7c43cad 100644 --- a/frontend/src/components/BasicHeader.vue +++ b/frontend/src/components/BasicHeader.vue @@ -1,12 +1,3 @@ - - + + diff --git a/frontend/src/components/BasicInputs/BasicCheckbox.vue b/frontend/src/components/BasicInputs/BasicCheckbox.vue index 558857bd..bcffbb34 100644 --- a/frontend/src/components/BasicInputs/BasicCheckbox.vue +++ b/frontend/src/components/BasicInputs/BasicCheckbox.vue @@ -19,23 +19,14 @@ diff --git a/frontend/src/components/BasicInputs/BasicDatepicker.vue b/frontend/src/components/BasicInputs/BasicDatepicker.vue index 720096d5..dd71c185 100644 --- a/frontend/src/components/BasicInputs/BasicDatepicker.vue +++ b/frontend/src/components/BasicInputs/BasicDatepicker.vue @@ -31,30 +31,20 @@ :close-on-scroll="closeOnScroll" :auto-apply="autoApply" :markers="markers" - :format="format" /> diff --git a/frontend/src/components/BasicInputs/BasicInput.vue b/frontend/src/components/BasicInputs/BasicInput.vue index d7ac171d..8f2b6541 100644 --- a/frontend/src/components/BasicInputs/BasicInput.vue +++ b/frontend/src/components/BasicInputs/BasicInput.vue @@ -4,7 +4,6 @@ :name="name" :label="label" :error-message="errorMessage" - :required="!!required" >
@@ -25,40 +26,30 @@ diff --git a/frontend/src/components/BasicInputs/BasicPassword.vue b/frontend/src/components/BasicInputs/BasicPassword.vue index 487c13d8..8c62242f 100644 --- a/frontend/src/components/BasicInputs/BasicPassword.vue +++ b/frontend/src/components/BasicInputs/BasicPassword.vue @@ -14,6 +14,8 @@ :placeholder="placeholder || label || name" class="rounded-r-none" :disabled="disabled" + @focus="emit('focus')" + @blur="emit('blur')" />
@@ -39,37 +42,32 @@ diff --git a/frontend/src/components/BasicInputs/BasicRadio.vue b/frontend/src/components/BasicInputs/BasicRadio.vue new file mode 100644 index 00000000..31a812e7 --- /dev/null +++ b/frontend/src/components/BasicInputs/BasicRadio.vue @@ -0,0 +1,47 @@ + + + diff --git a/frontend/src/components/BasicInputs/BasicSelect.vue b/frontend/src/components/BasicInputs/BasicSelect.vue index aa617b00..a6190f21 100644 --- a/frontend/src/components/BasicInputs/BasicSelect.vue +++ b/frontend/src/components/BasicInputs/BasicSelect.vue @@ -2,7 +2,6 @@
@@ -13,7 +12,10 @@ > {{ options.find((option) => option.value === modelValue)?.label || placeholder || 'Bitte wählen...' }} - +
diff --git a/frontend/src/components/BasicInputs/BasicSwitch.vue b/frontend/src/components/BasicInputs/BasicSwitch.vue index 92523f70..ee07bf61 100644 --- a/frontend/src/components/BasicInputs/BasicSwitch.vue +++ b/frontend/src/components/BasicInputs/BasicSwitch.vue @@ -32,38 +32,16 @@ diff --git a/frontend/src/components/BasicInputs/BasicTextArea.vue b/frontend/src/components/BasicInputs/BasicTextArea.vue index 0db2ed23..dce82c7c 100644 --- a/frontend/src/components/BasicInputs/BasicTextArea.vue +++ b/frontend/src/components/BasicInputs/BasicTextArea.vue @@ -17,36 +17,23 @@ diff --git a/frontend/src/components/BasicInputs/BasicTypeahead.vue b/frontend/src/components/BasicInputs/BasicTypeahead.vue index b2814f25..f111f9b9 100644 --- a/frontend/src/components/BasicInputs/BasicTypeahead.vue +++ b/frontend/src/components/BasicInputs/BasicTypeahead.vue @@ -2,7 +2,6 @@
@@ -13,7 +12,7 @@ :result-formatter="resultFormatter" :sync="sync" :immediate="immediate" - :debounce="debounce" + :debounce-time="debounceTime" :strict="strict" > diff --git a/frontend/src/components/BasicInputs/components/BasicFormGroup.vue b/frontend/src/components/BasicInputs/components/BasicFormGroup.vue index 2c5fa198..8cd3bc4e 100644 --- a/frontend/src/components/BasicInputs/components/BasicFormGroup.vue +++ b/frontend/src/components/BasicInputs/components/BasicFormGroup.vue @@ -2,14 +2,8 @@
{{ label }} @@ -24,14 +18,12 @@ withDefaults( id?: string label?: string name?: string - required?: boolean errorMessage?: string }>(), { id: '', label: '', name: '', - required: false, errorMessage: undefined, } ) diff --git a/frontend/src/components/BasicInputs/components/Typeahead.vue b/frontend/src/components/BasicInputs/components/Typeahead.vue index 1a66b16f..79e59616 100644 --- a/frontend/src/components/BasicInputs/components/Typeahead.vue +++ b/frontend/src/components/BasicInputs/components/Typeahead.vue @@ -14,21 +14,22 @@ class="btn bg-transparent px-1" @click="clear" > - + class="text-gray-500" + /> --> - + /> -->
- + @@ -80,8 +84,9 @@ diff --git a/frontend/src/components/Sidebar/Sidebar.vue b/frontend/src/components/Sidebar/Sidebar.vue index e89e5b6f..1e5aace6 100644 --- a/frontend/src/components/Sidebar/Sidebar.vue +++ b/frontend/src/components/Sidebar/Sidebar.vue @@ -123,13 +123,15 @@ diff --git a/frontend/src/layouts/LoginLayout.vue b/frontend/src/layouts/LoginLayout.vue index 2dd6ca2b..91535393 100644 --- a/frontend/src/layouts/LoginLayout.vue +++ b/frontend/src/layouts/LoginLayout.vue @@ -8,4 +8,4 @@
- + diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 7365613d..1957e9e2 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -1,4 +1,5 @@ import { createApp } from 'vue' + import App from './App.vue' import router from './router' import './assets/main.scss' diff --git a/frontend/src/router/authenticationGuard.ts b/frontend/src/router/authenticationGuard.ts index 2ce3ea62..86abc835 100644 --- a/frontend/src/router/authenticationGuard.ts +++ b/frontend/src/router/authenticationGuard.ts @@ -1,6 +1,7 @@ +import { type NavigationGuardWithThis } from 'vue-router' + import useAuthentication from '@/composables/useAuthentication' -import { Route } from '@/types' -import { NavigationGuardWithThis } from 'vue-router' +import type { Route } from '@/types' export default function makeGuard(routes: Route[]): NavigationGuardWithThis { const publicRoutes: string[] = routes diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index ef99520c..1f207403 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -1,12 +1,14 @@ +import { createRouter, createWebHistory } from 'vue-router' + +import authenticationGuard from './authenticationGuard' + import _import from '@/helpers/import' -import { Route } from '@/types' +import type { Route } from '@/types' import routesDashboard from '@/views/Dashboard/routes' import routesHouses from '@/views/Houses/routes' import routesAuth from '@/views/Login/routes' import routesRegistration from '@/views/Registration/routes' import routesUser from '@/views/Users/routes' -import { createRouter, createWebHistory } from 'vue-router' -import authenticationGuard from './authenticationGuard' const routes: Route[] = [ { diff --git a/frontend/src/shims.d.ts b/frontend/src/shims.d.ts new file mode 100644 index 00000000..5597b4fb --- /dev/null +++ b/frontend/src/shims.d.ts @@ -0,0 +1 @@ +import 'vite/client' diff --git a/frontend/src/store/dashboardStore.ts b/frontend/src/store/dashboardStore.ts index 5c640b2a..aae5141c 100644 --- a/frontend/src/store/dashboardStore.ts +++ b/frontend/src/store/dashboardStore.ts @@ -1,4 +1,5 @@ import { createGlobalState, useStorage } from '@vueuse/core' + import { dayjs } from '@codeanker/helpers' interface DashboardState { diff --git a/frontend/src/store/registrationStore.ts b/frontend/src/store/registrationStore.ts index 2a109a21..09a88f6b 100644 --- a/frontend/src/store/registrationStore.ts +++ b/frontend/src/store/registrationStore.ts @@ -1,7 +1,9 @@ import { createGlobalState, useAsyncState, useStorage } from '@vueuse/core' import { unref } from 'vue' + import { apiClient } from '../api' -import { RouterInput } from '@codeanker/api' + +import { type RouterInput } from '@codeanker/api' export const useCreateRegistrationState = createGlobalState(() => { const defaultRegistrationState: Partial = {} diff --git a/frontend/src/types.ts b/frontend/src/types.ts index e3b7f45e..b4132acb 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -1,5 +1,5 @@ -import { FunctionalComponent } from 'vue' -import { RouteRecordRaw } from 'vue-router' +import { type FunctionalComponent } from 'vue' +import { type RouteRecordRaw } from 'vue-router' export type Route = RouteRecordRaw & { public?: boolean diff --git a/frontend/src/views/Dashboard/routes.ts b/frontend/src/views/Dashboard/routes.ts index b1c7b8a7..97080de5 100644 --- a/frontend/src/views/Dashboard/routes.ts +++ b/frontend/src/views/Dashboard/routes.ts @@ -1,5 +1,5 @@ import _import from '@/helpers/import' -import { Route } from '@/types' +import type { Route } from '@/types' const routesDashboard: Route[] = [ { diff --git a/frontend/src/views/Developer.vue b/frontend/src/views/Developer.vue index 9f05a7ab..748a5e34 100644 --- a/frontend/src/views/Developer.vue +++ b/frontend/src/views/Developer.vue @@ -5,7 +5,7 @@ src="/codeanker.png" alt="Codeanker Logo" /> -
@@ -120,7 +120,7 @@ > validate -
+

HeadlessUI

HeadlessUI kann auch verwendet werden. Hier ein Beispiel

@@ -129,17 +129,19 @@ diff --git a/frontend/src/views/Houses/HouseDetail.vue b/frontend/src/views/Houses/HouseDetail.vue index bbf786c2..08c4dea4 100644 --- a/frontend/src/views/Houses/HouseDetail.vue +++ b/frontend/src/views/Houses/HouseDetail.vue @@ -245,37 +245,36 @@
- + + diff --git a/frontend/src/views/Login/routes.ts b/frontend/src/views/Login/routes.ts index ef9489e1..fc210218 100644 --- a/frontend/src/views/Login/routes.ts +++ b/frontend/src/views/Login/routes.ts @@ -1,5 +1,5 @@ -import { Route } from '@/types' import _import from '@/helpers/import' +import type { Route } from '@/types' const routesAuth: Route[] = [ { diff --git a/frontend/src/views/Registration/RegisterLogin.vue b/frontend/src/views/Registration/RegisterLogin.vue index 323e40aa..acc8460f 100644 --- a/frontend/src/views/Registration/RegisterLogin.vue +++ b/frontend/src/views/Registration/RegisterLogin.vue @@ -1,14 +1,3 @@ - - + + diff --git a/frontend/src/views/Registration/RegisterUsername.vue b/frontend/src/views/Registration/RegisterUsername.vue index 788712f9..e3f18a5d 100644 --- a/frontend/src/views/Registration/RegisterUsername.vue +++ b/frontend/src/views/Registration/RegisterUsername.vue @@ -1,19 +1,3 @@ - - + + diff --git a/frontend/src/views/Registration/RegistrationStart.vue b/frontend/src/views/Registration/RegistrationStart.vue index afb29214..cd3aa4c7 100644 --- a/frontend/src/views/Registration/RegistrationStart.vue +++ b/frontend/src/views/Registration/RegistrationStart.vue @@ -1,22 +1,12 @@ - - + + diff --git a/frontend/src/views/Registration/components/RegistrationLayout.vue b/frontend/src/views/Registration/components/RegistrationLayout.vue index aaa74bcb..2d97403a 100644 --- a/frontend/src/views/Registration/components/RegistrationLayout.vue +++ b/frontend/src/views/Registration/components/RegistrationLayout.vue @@ -1,10 +1,3 @@ - - + + diff --git a/frontend/src/views/Registration/routes.ts b/frontend/src/views/Registration/routes.ts index 94e04bc6..9da56cbc 100644 --- a/frontend/src/views/Registration/routes.ts +++ b/frontend/src/views/Registration/routes.ts @@ -1,5 +1,5 @@ import _import from '@/helpers/import' -import { Route } from '@/types' +import type { Route } from '@/types' const routesRegistration: Route[] = [ { diff --git a/frontend/src/views/Users/UserCreate.vue b/frontend/src/views/Users/UserCreate.vue index 6183a17d..f4024b41 100644 --- a/frontend/src/views/Users/UserCreate.vue +++ b/frontend/src/views/Users/UserCreate.vue @@ -19,8 +19,9 @@ diff --git a/frontend/src/views/Users/UserDetail.vue b/frontend/src/views/Users/UserDetail.vue index 1e2997b4..4dc5e419 100644 --- a/frontend/src/views/Users/UserDetail.vue +++ b/frontend/src/views/Users/UserDetail.vue @@ -142,6 +142,11 @@