From 30a2da5e0a35bebe07c0a538820eaa70b7fa8e52 Mon Sep 17 00:00:00 2001 From: Florian Wilde Date: Thu, 17 Sep 2026 19:43:50 +0200 Subject: [PATCH] chore: ESLint, Prettier und Vitest einrichten (#001) Co-Authored-By: Claude Opus 5 (1M context) --- .editorconfig | 12 ++++++++++++ .gitattributes | 5 +++++ .prettierignore | 6 ++++++ .prettierrc.json | 6 ++++++ eslint.config.mjs | 13 +++++++++++++ tests/version.test.ts | 8 ++++++++ vitest.config.mts | 12 ++++++++++++ 7 files changed, 62 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .prettierignore create mode 100644 .prettierrc.json create mode 100644 eslint.config.mjs create mode 100644 tests/version.test.ts create mode 100644 vitest.config.mts diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8c52ff9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..28eafd3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +* text=auto eol=lf +*.sh text eol=lf +*.ico binary +*.png binary +*.pdf binary diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c9a1924 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +.next +node_modules +coverage +docs +*.md +package-lock.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..5242053 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "semi": true, + "singleQuote": false, + "trailingComma": "all", + "printWidth": 110 +} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..0ad09f2 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,13 @@ +import { defineConfig, globalIgnores } from "eslint/config"; +import nextVitals from "eslint-config-next/core-web-vitals"; +import nextTs from "eslint-config-next/typescript"; +import prettier from "eslint-config-prettier/flat"; + +const eslintConfig = defineConfig([ + ...nextVitals, + ...nextTs, + prettier, + globalIgnores([".next/**", "out/**", "build/**", "coverage/**", "next-env.d.ts"]), +]); + +export default eslintConfig; diff --git a/tests/version.test.ts b/tests/version.test.ts new file mode 100644 index 0000000..9891637 --- /dev/null +++ b/tests/version.test.ts @@ -0,0 +1,8 @@ +import { describe, expect, it } from "vitest"; +import { APP_VERSION } from "@/lib/version"; + +describe("APP_VERSION", () => { + it("entspricht Semantic Versioning", () => { + expect(APP_VERSION).toMatch(/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/); + }); +}); diff --git a/vitest.config.mts b/vitest.config.mts new file mode 100644 index 0000000..b9471b1 --- /dev/null +++ b/vitest.config.mts @@ -0,0 +1,12 @@ +import { fileURLToPath } from "node:url"; +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + resolve: { + alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) }, + }, + test: { + include: ["tests/**/*.test.ts", "src/**/*.test.ts"], + environment: "node", + }, +});