Skip to content

Commit 666d9e1

Browse files
authored
chore: styling and missing unit tests (#265)
* chore: removed unused docker cleanup file * chore: Replaced the DaisyUI spinner with <Spinner size="small" /> * chore: added missing css, centralized classes * chore: missing a11y added * chore: prettierrc added * chore: formatting for frontend code * chore: added unit tests for editor toolbar and script actions * chore: detected issues
1 parent 2d9d60e commit 666d9e1

146 files changed

Lines changed: 12072 additions & 10215 deletions

File tree

Some content is hidden

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

.github/workflows/frontend-ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ jobs:
3939
working-directory: frontend
4040
run: npm run stylelint
4141

42+
- name: Check formatting (Prettier)
43+
working-directory: frontend
44+
run: npm run format:check
45+
4246
- name: Run svelte-check
4347
working-directory: frontend
4448
run: npm run check
49+
50+
- name: Verify production build
51+
working-directory: frontend
52+
run: npm run build

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,18 @@ repos:
4646
files: ^frontend/src/.*\.css$
4747
pass_filenames: false
4848

49+
# Prettier - matches CI: cd frontend && npx prettier --check
50+
- id: prettier-frontend
51+
name: prettier (frontend)
52+
entry: bash -c 'cd frontend && npx prettier --check "src/**/*.{ts,svelte,json}"'
53+
language: system
54+
files: ^frontend/src/.*\.(ts|svelte|json)$
55+
pass_filenames: false
56+
4957
# Svelte Check - matches CI: cd frontend && npx svelte-check
5058
- id: svelte-check-frontend
5159
name: svelte-check (frontend)
52-
entry: bash -c 'cd frontend && npx svelte-check --tsconfig ./tsconfig.json'
60+
entry: bash -c 'cd frontend && npx svelte-check --tsconfig ./tsconfig.json --fail-on-warnings'
5361
language: system
5462
files: ^frontend/src/.*\.(ts|svelte)$
5563
pass_filenames: false

frontend/.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
public/build/
3+
dist/
4+
coverage/
5+
test-results/
6+
playwright-report/
7+
src/lib/api/
8+
*.css

frontend/.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"singleQuote": true,
3+
"tabWidth": 4,
4+
"printWidth": 120,
5+
"trailingComma": "all",
6+
"plugins": ["prettier-plugin-svelte"],
7+
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
8+
}

frontend/eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default [
6464
},
6565
rules: {
6666
...svelte.configs.recommended.rules,
67-
'svelte/button-has-type': 'warn',
67+
'svelte/button-has-type': 'error',
6868
'no-unused-vars': 'off',
6969
'no-undef': 'off',
7070
},

frontend/package-lock.json

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
"start": "sirv public --single --no-clear --dev --host",
1010
"generate:api": "openapi-ts",
1111
"lint": "eslint src --ext .ts,.svelte",
12-
"check": "svelte-check --tsconfig ./tsconfig.json",
12+
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings",
1313
"test": "vitest run",
1414
"test:watch": "vitest",
1515
"test:ui": "vitest --ui",
1616
"test:coverage": "vitest run --coverage",
1717
"test:e2e": "playwright test",
18-
"stylelint": "stylelint \"src/**/*.css\""
18+
"stylelint": "stylelint \"src/**/*.css\"",
19+
"format": "prettier --write \"src/**/*.{ts,svelte,json}\"",
20+
"format:check": "prettier --check \"src/**/*.{ts,svelte,json}\""
1921
},
2022
"dependencies": {
2123
"@codemirror/autocomplete": "^6.17.0",
@@ -69,20 +71,22 @@
6971
"eslint-plugin-svelte": "^3.15.0",
7072
"express": "^5.2.1",
7173
"globals": "^17.3.0",
72-
"jsdom": "^28.1.0",
7374
"http-proxy": "^1.18.1",
75+
"jsdom": "^28.1.0",
7476
"monocart-reporter": "^2.10.0",
7577
"postcss": "^8.4.47",
7678
"postcss-lightningcss": "^1.0.2",
79+
"prettier": "^3.8.1",
80+
"prettier-plugin-svelte": "^3.5.1",
7781
"rollup": "^4.59.0",
7882
"rollup-plugin-css-only": "^4.3.0",
7983
"rollup-plugin-livereload": "^2.0.0",
8084
"rollup-plugin-postcss": "^4.0.2",
8185
"rollup-plugin-serve": "^3.0.0",
8286
"rollup-plugin-svelte": "^7.2.2",
87+
"sirv-cli": "^3.0.1",
8388
"stylelint": "^17.0.0",
8489
"stylelint-config-standard": "^40.0.0",
85-
"sirv-cli": "^3.0.1",
8690
"svelte-check": "^4.3.6",
8791
"svelte-eslint-parser": "^1.4.1",
8892
"svelte-preprocess": "^6.0.3",

frontend/src/App.svelte

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<script lang="ts">
22
import { onMount } from 'svelte';
3-
import { Router, goto } from "@mateothegreat/svelte5-router";
3+
import { Router, goto } from '@mateothegreat/svelte5-router';
44
import { Toaster } from 'svelte-sonner';
5-
import Header from "$components/Header.svelte";
6-
import Footer from "$components/Footer.svelte";
7-
import Spinner from "$components/Spinner.svelte";
8-
import ErrorDisplay from "$components/ErrorDisplay.svelte";
5+
import Header from '$components/Header.svelte';
6+
import Footer from '$components/Footer.svelte';
7+
import Spinner from '$components/Spinner.svelte';
8+
import ErrorDisplay from '$components/ErrorDisplay.svelte';
99
import { themeStore } from '$stores/theme.svelte';
1010
import { appError } from '$stores/errorStore.svelte';
1111
import { authStore } from '$stores/auth.svelte';
@@ -14,18 +14,18 @@
1414
const log = logger.withTag('App');
1515
1616
// Page components
17-
import Home from "$routes/Home.svelte";
18-
import Login from "$routes/Login.svelte";
19-
import Register from "$routes/Register.svelte";
20-
import Privacy from "$routes/Privacy.svelte";
21-
import Editor from "$routes/Editor.svelte";
22-
import Settings from "$routes/Settings.svelte";
23-
import Notifications from "$routes/Notifications.svelte";
24-
import AdminEvents from "$routes/admin/AdminEvents.svelte";
25-
import AdminExecutions from "$routes/admin/AdminExecutions.svelte";
26-
import AdminSagas from "$routes/admin/AdminSagas.svelte";
27-
import AdminUsers from "$routes/admin/AdminUsers.svelte";
28-
import AdminSettings from "$routes/admin/AdminSettings.svelte";
17+
import Home from '$routes/Home.svelte';
18+
import Login from '$routes/Login.svelte';
19+
import Register from '$routes/Register.svelte';
20+
import Privacy from '$routes/Privacy.svelte';
21+
import Editor from '$routes/Editor.svelte';
22+
import Settings from '$routes/Settings.svelte';
23+
import Notifications from '$routes/Notifications.svelte';
24+
import AdminEvents from '$routes/admin/AdminEvents.svelte';
25+
import AdminExecutions from '$routes/admin/AdminExecutions.svelte';
26+
import AdminSagas from '$routes/admin/AdminSagas.svelte';
27+
import AdminUsers from '$routes/admin/AdminUsers.svelte';
28+
import AdminSettings from '$routes/admin/AdminSettings.svelte';
2929
3030
let authInitialized = $state(false);
3131
@@ -61,20 +61,20 @@
6161
// Routes configuration
6262
const routes = [
6363
// Public routes
64-
{ path: "/", component: Home },
65-
{ path: "/login", component: Login },
66-
{ path: "/register", component: Register },
67-
{ path: "/privacy", component: Privacy },
64+
{ path: '/', component: Home },
65+
{ path: '/login', component: Login },
66+
{ path: '/register', component: Register },
67+
{ path: '/privacy', component: Privacy },
6868
// Protected routes
69-
{ path: "/editor", component: Editor, hooks: { pre: requireAuth } },
70-
{ path: "/settings", component: Settings, hooks: { pre: requireAuth } },
71-
{ path: "/notifications", component: Notifications, hooks: { pre: requireAuth } },
72-
{ path: "/admin/events", component: AdminEvents, hooks: { pre: requireAuth } },
73-
{ path: "/admin/executions", component: AdminExecutions, hooks: { pre: requireAuth } },
74-
{ path: "/admin/sagas", component: AdminSagas, hooks: { pre: requireAuth } },
75-
{ path: "/admin/users", component: AdminUsers, hooks: { pre: requireAuth } },
76-
{ path: "/admin/settings", component: AdminSettings, hooks: { pre: requireAuth } },
77-
{ path: "^/admin$", component: AdminEvents, hooks: { pre: requireAuth } },
69+
{ path: '/editor', component: Editor, hooks: { pre: requireAuth } },
70+
{ path: '/settings', component: Settings, hooks: { pre: requireAuth } },
71+
{ path: '/notifications', component: Notifications, hooks: { pre: requireAuth } },
72+
{ path: '/admin/events', component: AdminEvents, hooks: { pre: requireAuth } },
73+
{ path: '/admin/executions', component: AdminExecutions, hooks: { pre: requireAuth } },
74+
{ path: '/admin/sagas', component: AdminSagas, hooks: { pre: requireAuth } },
75+
{ path: '/admin/users', component: AdminUsers, hooks: { pre: requireAuth } },
76+
{ path: '/admin/settings', component: AdminSettings, hooks: { pre: requireAuth } },
77+
{ path: '^/admin$', component: AdminEvents, hooks: { pre: requireAuth } },
7878
];
7979
// --8<-- [end:routes]
8080
</script>
@@ -83,7 +83,7 @@
8383
<ErrorDisplay error={appError.current.error} title={appError.current.title} />
8484
{:else}
8585
<div class="flex flex-col min-h-screen bg-bg-default dark:bg-dark-bg-default pt-16">
86-
<Header/>
86+
<Header />
8787
<Toaster richColors position="top-right" />
8888
<main class="flex-grow">
8989
{#if !authInitialized}
@@ -94,6 +94,6 @@
9494
<Router base="/" {routes} />
9595
{/if}
9696
</main>
97-
<Footer/>
97+
<Footer />
9898
</div>
9999
{/if}

0 commit comments

Comments
 (0)