🧹 reformat using "prettier"

This commit is contained in:
Jörn-Michael Miehe 2026-02-21 19:24:09 +00:00
parent a1c4e408a9
commit d816460efa
25 changed files with 97 additions and 184 deletions

View file

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang=""> <html lang="">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
@ -29,9 +29,8 @@
<body> <body>
<noscript> <noscript>
<strong <strong
>Es tut uns leid, aber <%= htmlWebpackPlugin.options.title %> >Es tut uns leid, aber <%= htmlWebpackPlugin.options.title %> funktioniert nicht richtig
funktioniert nicht richtig ohne JavaScript. Bitte aktivieren Sie es, um ohne JavaScript. Bitte aktivieren Sie es, um fortzufahren.</strong
fortzufahren.</strong
> >
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>

View file

@ -2,32 +2,20 @@
"extends": "@vue/tsconfig/tsconfig.dom.json", "extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": { "compilerOptions": {
"experimentalDecorators": true, "experimentalDecorators": true,
"lib": [ "lib": ["es2020", "dom", "dom.iterable", "es2022.object", "es2023.array"],
"es2020",
"dom",
"dom.iterable",
"es2022.object",
"es2023.array",
],
// "moduleResolution": "node", // "moduleResolution": "node",
// "sourceMap": true, // "sourceMap": true,
"baseUrl": ".", "baseUrl": ".",
"types": [ "types": ["webpack-env", "mocha", "chai"],
"webpack-env",
"mocha",
"chai",
],
"paths": { "paths": {
"@/*": [ "@/*": ["src/*"]
"src/*", }
]
},
}, },
"include": [ "include": [
"src/**/*.vue", "src/**/*.vue",
"src/**/*.ts", "src/**/*.ts",
// "src/**/*.tsx", // "src/**/*.tsx",
"tests/**/*.ts", "tests/**/*.ts"
// "tests/**/*.tsx", // "tests/**/*.tsx",
], ]
} }

View file

@ -1,9 +1,9 @@
import { globalIgnores } from 'eslint/config' import { globalIgnores } from "eslint/config";
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript' import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescript";
import pluginVue from 'eslint-plugin-vue' import pluginVue from "eslint-plugin-vue";
import pluginVitest from '@vitest/eslint-plugin' import pluginVitest from "@vitest/eslint-plugin";
import pluginOxlint from 'eslint-plugin-oxlint' import pluginOxlint from "eslint-plugin-oxlint";
import skipFormatting from 'eslint-config-prettier/flat' import skipFormatting from "eslint-config-prettier/flat";
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines: // To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
// import { configureVueProject } from '@vue/eslint-config-typescript' // import { configureVueProject } from '@vue/eslint-config-typescript'
@ -12,21 +12,21 @@ import skipFormatting from 'eslint-config-prettier/flat'
export default defineConfigWithVueTs( export default defineConfigWithVueTs(
{ {
name: 'app/files-to-lint', name: "app/files-to-lint",
files: ['**/*.{vue,ts,mts,tsx}'], files: ["**/*.{vue,ts,mts,tsx}"],
}, },
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']), globalIgnores(["**/dist/**", "**/dist-ssr/**", "**/coverage/**"]),
...pluginVue.configs['flat/essential'], ...pluginVue.configs["flat/essential"],
vueTsConfigs.recommended, vueTsConfigs.recommended,
{ {
...pluginVitest.configs.recommended, ...pluginVitest.configs.recommended,
files: ['src/**/__tests__/*'], files: ["src/**/__tests__/*"],
}, },
...pluginOxlint.buildFromOxlintConfigFile('.oxlintrc.json'), ...pluginOxlint.buildFromOxlintConfigFile(".oxlintrc.json"),
skipFormatting, skipFormatting,
) );

View file

@ -1,9 +1,9 @@
<!DOCTYPE html> <!doctype html>
<html lang=""> <html lang="">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico"> <link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title> <title>Vite App</title>
</head> </head>
<body> <body>

View file

@ -1,11 +1,11 @@
import { describe, it, expect } from 'vitest' import { describe, it, expect } from "vitest";
import { mount } from '@vue/test-utils' import { mount } from "@vue/test-utils";
import App from '../App.vue' import App from "../App.vue";
describe('App', () => { describe("App", () => {
it('mounts renders properly', () => { it("mounts renders properly", () => {
const wrapper = mount(App) const wrapper = mount(App);
expect(wrapper.text()).toContain('You did it!') expect(wrapper.text()).toContain("You did it!");
}) });
}) });

View file

@ -4,8 +4,8 @@
<BulmaToast @handle="on_toast_handle" class="content"> <BulmaToast @handle="on_toast_handle" class="content">
<p> <p>
Du hast noch keine Türchen geöffnet, vielleicht gibt es ein Anzeigeproblem Du hast noch keine Türchen geöffnet, vielleicht gibt es ein Anzeigeproblem in Deinem
in Deinem Webbrowser? Webbrowser?
</p> </p>
<div class="level"> <div class="level">
<div class="level-item"> <div class="level-item">

View file

@ -12,12 +12,7 @@
<div class="field"> <div class="field">
<label class="label">Username</label> <label class="label">Username</label>
<div class="control"> <div class="control">
<input <input ref="username_input" class="input" type="text" v-model="creds.username" />
ref="username_input"
class="input"
type="text"
v-model="creds.username"
/>
</div> </div>
</div> </div>

View file

@ -18,10 +18,7 @@
</template> </template>
</div> </div>
<button <button v-if="state.show !== 'loading'" class="modal-close is-large has-background-primary" />
v-if="state.show !== 'loading'"
class="modal-close is-large has-background-primary"
/>
</div> </div>
</template> </template>

View file

@ -7,12 +7,9 @@
Alle {{ store.user_doors.length }} Türchen offen! Alle {{ store.user_doors.length }} Türchen offen!
</template> </template>
<template v-else> <template v-else>
<template v-if="store.user_doors.length === 0"> <template v-if="store.user_doors.length === 0"> Zeit bis zum ersten Türchen: </template>
Zeit bis zum ersten Türchen:
</template>
<template v-else> <template v-else>
{{ store.user_doors.length }} Türchen offen. Zeit bis zum nächsten {{ store.user_doors.length }} Türchen offen. Zeit bis zum nächsten Türchen:
Türchen:
</template> </template>
<CountDown :until="store.next_door_target" /> <CountDown :until="store.next_door_target" />
</template> </template>

View file

@ -9,15 +9,11 @@
<dt>Wert</dt> <dt>Wert</dt>
<dd> <dd>
Eingabe: Eingabe:
<span class="is-family-monospace"> <span class="is-family-monospace"> "{{ admin_config_model.solution.value }}" </span>
"{{ admin_config_model.solution.value }}"
</span>
</dd> </dd>
<dd> <dd>
Ausgabe: Ausgabe:
<span class="is-family-monospace"> <span class="is-family-monospace"> "{{ admin_config_model.solution.clean }}" </span>
"{{ admin_config_model.solution.clean }}"
</span>
</dd> </dd>
<dt>Transformation</dt> <dt>Transformation</dt>
@ -47,9 +43,7 @@
<dd>{{ store.user_doors.length }}</dd> <dd>{{ store.user_doors.length }}</dd>
<dt>Zeit zum nächsten Türchen</dt> <dt>Zeit zum nächsten Türchen</dt>
<dd v-if="store.next_door_target === null"> <dd v-if="store.next_door_target === null">Kein nächstes Türchen</dd>
Kein nächstes Türchen
</dd>
<dd v-else><CountDown :until="store.next_door_target" /></dd> <dd v-else><CountDown :until="store.next_door_target" /></dd>
<dt>Erstes Türchen</dt> <dt>Erstes Türchen</dt>
@ -65,9 +59,7 @@
<dd>{{ fmt_puzzle_date("end") }}</dd> <dd>{{ fmt_puzzle_date("end") }}</dd>
<dt>Zufalls-Seed</dt> <dt>Zufalls-Seed</dt>
<dd class="is-family-monospace"> <dd class="is-family-monospace">"{{ admin_config_model.puzzle.seed }}"</dd>
"{{ admin_config_model.puzzle.seed }}"
</dd>
<dt>Extra-Tage</dt> <dt>Extra-Tage</dt>
<dd> <dd>
@ -121,10 +113,7 @@
<dd>{{ admin_config_model.image.border }} px</dd> <dd>{{ admin_config_model.image.border }} px</dd>
<dt>Schriftarten</dt> <dt>Schriftarten</dt>
<dd <dd v-for="(font, index) in admin_config_model.fonts" :key="`font-${index}`">
v-for="(font, index) in admin_config_model.fonts"
:key="`font-${index}`"
>
{{ font.file }} ({{ font.size }} pt) {{ font.file }} ({{ font.size }} pt)
</dd> </dd>
</dl> </dl>
@ -276,10 +265,7 @@ async function on_open(): Promise<void> {
clear_credentials(creds.value.ui); clear_credentials(creds.value.ui);
} }
async function load_credentials( async function load_credentials(creds: Credentials, endpoint: string): Promise<void> {
creds: Credentials,
endpoint: string,
): Promise<void> {
try { try {
const new_creds = await API.request<Credentials>(endpoint); const new_creds = await API.request<Credentials>(endpoint);

View file

@ -8,11 +8,7 @@
:icon="['fas', 'fa-backward']" :icon="['fas', 'fa-backward']"
/> />
<BulmaBreadcrumbs <BulmaBreadcrumbs :steps="steps" v-model="current_step" class="level-item mb-0" />
:steps="steps"
v-model="current_step"
class="level-item mb-0"
/>
<BulmaButton <BulmaButton
:disabled="current_step === 2" :disabled="current_step === 2"

View file

@ -3,11 +3,7 @@
<button class="button"> <button class="button">
<slot name="default"> <slot name="default">
<span v-if="icon !== undefined" class="icon"> <span v-if="icon !== undefined" class="icon">
<FontAwesomeIcon <FontAwesomeIcon v-if="icon !== undefined" :icon="icon" :beat-fade="busy" />
v-if="icon !== undefined"
:icon="icon"
:beat-fade="busy"
/>
</span> </span>
</slot> </slot>
<span v-if="text !== undefined">{{ text }}</span> <span v-if="text !== undefined">{{ text }}</span>

View file

@ -6,18 +6,13 @@
<p v-if="refreshable && is_open" class="card-header-icon px-0"> <p v-if="refreshable && is_open" class="card-header-icon px-0">
<BulmaButton class="is-small is-primary" @click="load"> <BulmaButton class="is-small is-primary" @click="load">
<FontAwesomeIcon <FontAwesomeIcon :icon="['fas', 'arrows-rotate']" :spin="state === 'loading'" />
:icon="['fas', 'arrows-rotate']"
:spin="state === 'loading'"
/>
</BulmaButton> </BulmaButton>
</p> </p>
<button class="card-header-icon" @click="toggle"> <button class="card-header-icon" @click="toggle">
<span class="icon"> <span class="icon">
<FontAwesomeIcon <FontAwesomeIcon :icon="['fas', is_open ? 'angle-down' : 'angle-right']" />
:icon="['fas', is_open ? 'angle-down' : 'angle-right']"
/>
</span> </span>
</button> </button>
</header> </header>

View file

@ -6,7 +6,11 @@
> >
<div <div
class="has-text-danger" class="has-text-danger"
style="text-shadow: 0 0 10px white, 0 0 20px white" style="
text-shadow:
0 0 10px white,
0 0 20px white;
"
> >
{{ door.day }} {{ door.day }}
</div> </div>

View file

@ -27,13 +27,7 @@ import { computed } from "vue";
const store = advent22Store(); const store = advent22Store();
type BulmaVariant = type BulmaVariant = "primary" | "link" | "info" | "success" | "warning" | "danger";
| "primary"
| "link"
| "info"
| "success"
| "warning"
| "danger";
withDefaults( withDefaults(
defineProps<{ defineProps<{

View file

@ -32,11 +32,7 @@ function get_event_thous(event: MouseEvent): Vector2D {
type TCEventType = "mousedown" | "mousemove" | "mouseup" | "click" | "dblclick"; type TCEventType = "mousedown" | "mousemove" | "mouseup" | "click" | "dblclick";
const is_tceventtype = (t: unknown): t is TCEventType => const is_tceventtype = (t: unknown): t is TCEventType =>
t === "mousedown" || t === "mousedown" || t === "mousemove" || t === "mouseup" || t === "click" || t === "dblclick";
t === "mousemove" ||
t === "mouseup" ||
t === "click" ||
t === "dblclick";
const emit = defineEmits<{ const emit = defineEmits<{
(event: TCEventType, e: MouseEvent, point: Vector2D): void; (event: TCEventType, e: MouseEvent, point: Vector2D): void;

View file

@ -14,12 +14,7 @@
:door="door" :door="door"
force_visible force_visible
/> />
<SVGRect <SVGRect v-if="preview_visible" variant="success" :rectangle="preview" visible />
v-if="preview_visible"
variant="success"
:rectangle="preview"
visible
/>
</ThouCanvas> </ThouCanvas>
</template> </template>

View file

@ -13,11 +13,7 @@
<figure class="image is-unselectable"> <figure class="image is-unselectable">
<img :src="unwrap_loading(store.background_image).data_url" /> <img :src="unwrap_loading(store.background_image).data_url" />
<ThouCanvas> <ThouCanvas>
<PreviewDoor <PreviewDoor v-for="(_, index) in model" :key="`door-${index}`" v-model="model[index]" />
v-for="(_, index) in model"
:key="`door-${index}`"
v-model="model[index]"
/>
</ThouCanvas> </ThouCanvas>
</figure> </figure>
</div> </div>

View file

@ -1,10 +1,7 @@
import { nextTick, type UnwrapRef } from "vue"; import { nextTick, type UnwrapRef } from "vue";
import { APIError } from "./api_error"; import { APIError } from "./api_error";
export function objForEach<T>( export function objForEach<T>(obj: T, f: (k: keyof T, v: T[keyof T]) => void): void {
obj: T,
f: (k: keyof T, v: T[keyof T]) => void,
): void {
for (const k in obj) { for (const k in obj) {
if (Object.prototype.hasOwnProperty.call(obj, k)) { if (Object.prototype.hasOwnProperty.call(obj, k)) {
f(k, obj[k]); f(k, obj[k]);

View file

@ -24,10 +24,7 @@ export class Door {
// integer coercion // integer coercion
let day = Number(value); let day = Number(value);
day = day = !Number.isNaN(day) && Number.isFinite(day) ? Math.trunc(day) : Door.MIN_DAY;
!Number.isNaN(day) && Number.isFinite(day)
? Math.trunc(day)
: Door.MIN_DAY;
this._day = Math.max(day, Door.MIN_DAY); this._day = Math.max(day, Door.MIN_DAY);
} }

View file

@ -71,9 +71,6 @@ export class Rectangle {
} }
public move(vector: Vector2D): Rectangle { public move(vector: Vector2D): Rectangle {
return new Rectangle( return new Rectangle(this.corner_1.plus(vector), this.corner_2.plus(vector));
this.corner_1.plus(vector),
this.corner_2.plus(vector),
);
} }
} }

View file

@ -1,4 +1,4 @@
import { acceptHMRUpdate, defineStore } from "pinia"; import { defineStore } from "pinia";
import { API } from "./api"; import { API } from "./api";
import type { Loading } from "./helpers"; import type { Loading } from "./helpers";
import type { Credentials, DoorSaved, ImageData, SiteConfigModel } from "./model"; import type { Credentials, DoorSaved, ImageData, SiteConfigModel } from "./model";
@ -55,31 +55,28 @@ export const advent22Store = defineStore("advent22", {
const favicon = await API.request<ImageData>("user/favicon"); const favicon = await API.request<ImageData>("user/favicon");
const link: HTMLLinkElement = const link: HTMLLinkElement =
document.querySelector("link[rel*='icon']") ?? document.querySelector("link[rel*='icon']") ?? document.createElement("link");
document.createElement("link");
link.rel = "shortcut icon"; link.rel = "shortcut icon";
link.type = "image/x-icon"; link.type = "image/x-icon";
link.href = favicon.data_url; link.href = favicon.data_url;
if (link.parentElement === null) if (link.parentElement === null)
document.getElementsByTagName("head")[0]!.appendChild(link); document.getElementsByTagName("head")[0]!.appendChild(link);
} catch { } } catch {}
try { try {
const [is_admin, site_config, background_image, user_doors, next_door] = const [is_admin, site_config, background_image, user_doors, next_door] = await Promise.all([
await Promise.all([ this.update_is_admin(),
this.update_is_admin(), API.request<SiteConfigModel>("user/site_config"),
API.request<SiteConfigModel>("user/site_config"), API.request<ImageData>("user/background_image"),
API.request<ImageData>("user/background_image"), API.request<DoorSaved[]>("user/doors"),
API.request<DoorSaved[]>("user/doors"), API.request<number | null>("user/next_door"),
API.request<number | null>("user/next_door"), ]);
]);
void is_admin; // discard value void is_admin; // discard value
document.title = site_config.title; document.title = site_config.title;
if (site_config.subtitle !== "") if (site_config.subtitle !== "") document.title += " " + site_config.subtitle;
document.title += " " + site_config.subtitle;
this.site_config = site_config; this.site_config = site_config;
this.background_image = background_image; this.background_image = background_image;
@ -123,9 +120,3 @@ export const advent22Store = defineStore("advent22", {
}, },
}, },
}); });
if (import.meta.webpackHot) {
import.meta.webpackHot.accept(
acceptHMRUpdate(advent22Store, import.meta.webpackHot),
);
}

View file

@ -1,12 +1,12 @@
import { ref, computed } from 'vue' import { ref, computed } from "vue";
import { defineStore } from 'pinia' import { defineStore } from "pinia";
export const useCounterStore = defineStore('counter', () => { export const useCounterStore = defineStore("counter", () => {
const count = ref(0) const count = ref(0);
const doubleCount = computed(() => count.value * 2) const doubleCount = computed(() => count.value * 2);
function increment() { function increment() {
count.value++ count.value++;
} }
return { count, doubleCount, increment } return { count, doubleCount, increment };
}) });

View file

@ -1,18 +1,15 @@
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from "node:url";
import { defineConfig } from 'vite' import { defineConfig } from "vite";
import vue from '@vitejs/plugin-vue' import vue from "@vitejs/plugin-vue";
import vueDevTools from 'vite-plugin-vue-devtools' import vueDevTools from "vite-plugin-vue-devtools";
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [vue(), vueDevTools()],
vue(),
vueDevTools(),
],
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)) "@": fileURLToPath(new URL("./src", import.meta.url)),
}, },
}, },
}) });

View file

@ -1,14 +1,14 @@
import { fileURLToPath } from 'node:url' import { fileURLToPath } from "node:url";
import { mergeConfig, defineConfig, configDefaults } from 'vitest/config' import { mergeConfig, defineConfig, configDefaults } from "vitest/config";
import viteConfig from './vite.config' import viteConfig from "./vite.config";
export default mergeConfig( export default mergeConfig(
viteConfig, viteConfig,
defineConfig({ defineConfig({
test: { test: {
environment: 'jsdom', environment: "jsdom",
exclude: [...configDefaults.exclude, 'e2e/**'], exclude: [...configDefaults.exclude, "e2e/**"],
root: fileURLToPath(new URL('./', import.meta.url)), root: fileURLToPath(new URL("./", import.meta.url)),
}, },
}), }),
) );