🧹 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="">
<head>
<meta charset="utf-8" />
@ -29,9 +29,8 @@
<body>
<noscript>
<strong
>Es tut uns leid, aber <%= htmlWebpackPlugin.options.title %>
funktioniert nicht richtig ohne JavaScript. Bitte aktivieren Sie es, um
fortzufahren.</strong
>Es tut uns leid, aber <%= htmlWebpackPlugin.options.title %> funktioniert nicht richtig
ohne JavaScript. Bitte aktivieren Sie es, um fortzufahren.</strong
>
</noscript>
<div id="app"></div>

View file

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

View file

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

View file

@ -1,9 +1,9 @@
<!DOCTYPE html>
<!doctype html>
<html lang="">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<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 App from '../App.vue'
import { mount } from "@vue/test-utils";
import App from "../App.vue";
describe('App', () => {
it('mounts renders properly', () => {
const wrapper = mount(App)
expect(wrapper.text()).toContain('You did it!')
})
})
describe("App", () => {
it("mounts renders properly", () => {
const wrapper = mount(App);
expect(wrapper.text()).toContain("You did it!");
});
});

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,11 +3,7 @@
<button class="button">
<slot name="default">
<span v-if="icon !== undefined" class="icon">
<FontAwesomeIcon
v-if="icon !== undefined"
:icon="icon"
:beat-fade="busy"
/>
<FontAwesomeIcon v-if="icon !== undefined" :icon="icon" :beat-fade="busy" />
</span>
</slot>
<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">
<BulmaButton class="is-small is-primary" @click="load">
<FontAwesomeIcon
:icon="['fas', 'arrows-rotate']"
:spin="state === 'loading'"
/>
<FontAwesomeIcon :icon="['fas', 'arrows-rotate']" :spin="state === 'loading'" />
</BulmaButton>
</p>
<button class="card-header-icon" @click="toggle">
<span class="icon">
<FontAwesomeIcon
:icon="['fas', is_open ? 'angle-down' : 'angle-right']"
/>
<FontAwesomeIcon :icon="['fas', is_open ? 'angle-down' : 'angle-right']" />
</span>
</button>
</header>

View file

@ -6,7 +6,11 @@
>
<div
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 }}
</div>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -24,10 +24,7 @@ export class Door {
// integer coercion
let day = Number(value);
day =
!Number.isNaN(day) && Number.isFinite(day)
? Math.trunc(day)
: Door.MIN_DAY;
day = !Number.isNaN(day) && Number.isFinite(day) ? Math.trunc(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 {
return new Rectangle(
this.corner_1.plus(vector),
this.corner_2.plus(vector),
);
return new Rectangle(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 type { Loading } from "./helpers";
import type { Credentials, DoorSaved, ImageData, SiteConfigModel } from "./model";
@ -55,19 +55,17 @@ export const advent22Store = defineStore("advent22", {
const favicon = await API.request<ImageData>("user/favicon");
const link: HTMLLinkElement =
document.querySelector("link[rel*='icon']") ??
document.createElement("link");
document.querySelector("link[rel*='icon']") ?? document.createElement("link");
link.rel = "shortcut icon";
link.type = "image/x-icon";
link.href = favicon.data_url;
if (link.parentElement === null)
document.getElementsByTagName("head")[0]!.appendChild(link);
} catch { }
} catch {}
try {
const [is_admin, site_config, background_image, user_doors, next_door] =
await Promise.all([
const [is_admin, site_config, background_image, user_doors, next_door] = await Promise.all([
this.update_is_admin(),
API.request<SiteConfigModel>("user/site_config"),
API.request<ImageData>("user/background_image"),
@ -78,8 +76,7 @@ export const advent22Store = defineStore("advent22", {
document.title = site_config.title;
if (site_config.subtitle !== "")
document.title += " " + site_config.subtitle;
if (site_config.subtitle !== "") document.title += " " + site_config.subtitle;
this.site_config = site_config;
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 { defineStore } from 'pinia'
import { ref, computed } from "vue";
import { defineStore } from "pinia";
export const useCounterStore = defineStore('counter', () => {
const count = ref(0)
const doubleCount = computed(() => count.value * 2)
export const useCounterStore = defineStore("counter", () => {
const count = ref(0);
const doubleCount = computed(() => count.value * 2);
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 vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueDevTools from "vite-plugin-vue-devtools";
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
],
plugins: [vue(), vueDevTools()],
resolve: {
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 { mergeConfig, defineConfig, configDefaults } from 'vitest/config'
import viteConfig from './vite.config'
import { fileURLToPath } from "node:url";
import { mergeConfig, defineConfig, configDefaults } from "vitest/config";
import viteConfig from "./vite.config";
export default mergeConfig(
viteConfig,
defineConfig({
test: {
environment: 'jsdom',
exclude: [...configDefaults.exclude, 'e2e/**'],
root: fileURLToPath(new URL('./', import.meta.url)),
environment: "jsdom",
exclude: [...configDefaults.exclude, "e2e/**"],
root: fileURLToPath(new URL("./", import.meta.url)),
},
}),
)
);