1
0
mirror of https://github.com/theoludwig/theoludwig.git synced 2026-06-03 07:18:36 +02:00

Compare commits

...

1 Commits

13 changed files with 3444 additions and 2420 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
with:
fetch-depth: 0
- uses: "pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d" # v6.0.5
- uses: "pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093" # v6.0.8
- name: "Setup Node.js"
uses: "actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e" # v6.4.0
+1 -2
View File
@@ -20,7 +20,7 @@ jobs:
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
- uses: "pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d" # v6.0.5
- uses: "pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093" # v6.0.8
- name: "Setup Node.js"
uses: "actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e" # v6.4.0
@@ -35,7 +35,6 @@ jobs:
- name: "Install Playwright"
run: "pnpm exec playwright install --with-deps"
- run: "node --run lint:editorconfig"
- run: "node --run lint:markdown"
- run: "node --run lint:turbo"
# - run: "node --run lint:typescript" # already covered by oxlint
+267 -1
View File
@@ -1,13 +1,167 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"extends": ["node_modules/eslint-config-conventions/.oxlintrc.json"],
"options": {
"typeAware": true,
"typeCheck": true,
"denyWarnings": true,
"reportUnusedDisableDirectives": "error"
},
"env": {
"builtin": true,
"browser": true,
"node": true,
"shared-node-browser": true
},
"plugins": ["eslint", "typescript", "unicorn", "react", "oxc", "import", "promise"],
"categories": {
"correctness": "error",
"suspicious": "error",
"pedantic": "error",
"perf": "error"
},
"rules": {
"no-await-in-loop": "off",
"no-loop-func": "off",
"no-negated-condition": "off",
"no-inline-comments": "off",
"max-lines": "off",
"max-depth": "off",
"max-classes-per-file": "off",
"max-lines-per-function": "off",
"require-await": "off",
"no-lonely-if": "off",
"array-callback-return": "off",
"no-shadow": "off",
"no-throw-literal": "off",
"consistent-return": "off",
"getter-return": "error",
"no-undef": "error",
"no-unreachable": "error",
"use-isnan": [
"error",
{
"enforceForSwitchCase": true,
"enforceForIndexOf": true
}
],
"valid-typeof": [
"error",
{
"requireStringLiterals": true
}
],
"default-param-last": "error",
"default-case-last": "error",
"eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"grouped-accessor-pairs": "error",
"new-cap": [
"error",
{
"newIsCap": true,
"capIsNew": false,
"properties": true
}
],
"no-implicit-coercion": "error",
"no-extra-boolean-cast": [
"error",
{
"enforceForInnerExpressions": true
}
],
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"no-multi-str": "error",
"no-new-func": "error",
"no-proto": "error",
"no-regex-spaces": "error",
"no-useless-computed-key": "error",
"no-else-return": [
"error",
{
"allowElseIf": false
}
],
"no-var": "error",
"no-void": [
"error",
{
"allowAsStatement": true
}
],
"prefer-const": [
"error",
{
"destructuring": "all"
}
],
"prefer-object-has-own": "error",
"yoda": "error",
"curly": "error",
"func-style": "error",
"arrow-body-style": ["error", "always"],
"object-shorthand": ["error", "properties"],
"promise/param-names": "error",
"promise/no-nesting": "error",
"unicorn/catch-error-name": "error",
"unicorn/consistent-date-clone": "error",
"unicorn/error-message": "error",
"unicorn/no-array-for-each": "error",
"unicorn/no-array-method-this-argument": "error",
"unicorn/no-document-cookie": "error",
"unicorn/no-zero-fractions": "error",
"unicorn/number-literal-case": "error",
"unicorn/prefer-node-protocol": "error",
"unicorn/throw-new-error": "error",
"unicorn/require-array-join-separator": "error",
"unicorn/prefer-number-properties": "error",
"unicorn/prefer-modern-math-apis": "error",
"unicorn/prefer-structured-clone": "error",
"unicorn/consistent-existence-index-check": "error",
"unicorn/no-array-reverse": "off",
"unicorn/no-array-sort": "off",
"unicorn/no-lonely-if": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prefer-at": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/prefer-top-level-await": "off",
"unicorn/prefer-string-slice": "off",
"unicorn/no-immediate-mutation": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/no-object-as-default-parameter": "off",
"react/no-array-index-key": "off",
"react/no-unknown-property": "off",
"react/react-in-jsx-scope": "off",
"react/iframe-missing-sandbox": "off",
"react/self-closing-comp": "error",
"react/jsx-boolean-value": "error",
"react/jsx-no-target-blank": "off",
"react/jsx-no-useless-fragment": "off",
"react/no-unstable-nested-components": "off",
"import/no-webpack-loader-syntax": "error",
"import/export": "error",
"import/no-duplicates": "error",
"import/no-named-default": "error",
"import/no-anonymous-default-export": "error",
"import/consistent-type-specifier-style": "error",
"import/no-unassigned-import": "off",
"import/no-named-as-default-member": "off",
"import/max-dependencies": "off",
"import/extensions": [
"error",
"ignorePackages",
@@ -17,6 +171,118 @@
"js": "never",
"jsx": "never"
}
],
"typescript/ban-types": "off",
"typescript/no-unnecessary-type-arguments": "off",
"typescript/no-unsafe-type-assertion": "off",
"typescript/no-unsafe-member-access": "off",
"typescript/no-confusing-void-expression": "off",
"typescript/no-unsafe-assignment": "off",
"typescript/no-misused-promises": "off",
"typescript/return-await": ["error", "always"],
"typescript/require-await": "off",
"typescript/switch-exhaustiveness-check": "off",
"typescript/ban-ts-comment": "off",
"typescript/prefer-readonly-parameter-types": "off",
"typescript/strict-void-return": "off",
"no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"no-use-before-define": [
"error",
{
"functions": false,
"classes": false,
"enums": false,
"variables": false,
"typedefs": false
}
],
"no-redeclare": [
"error",
{
"builtinGlobals": false
}
],
"typescript/only-throw-error": "off",
"no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true,
"allowTaggedTemplates": true
}
],
"typescript/adjacent-overload-signatures": "error",
"typescript/consistent-type-definitions": "error",
"typescript/consistent-type-imports": "error",
"typescript/explicit-member-accessibility": "error",
"typescript/explicit-function-return-type": [
"error",
{
"allowExpressions": true,
"allowHigherOrderFunctions": true,
"allowTypedFunctionExpressions": true,
"allowDirectConstAssertionInArrowFunctions": true
}
],
"typescript/no-extraneous-class": [
"error",
{
"allowWithDecorator": true
}
],
"typescript/no-floating-promises": [
"error",
{
"allowForKnownSafeCalls": [
{
"from": "package",
"name": ["test", "it", "suite", "describe"],
"package": "node:test"
}
]
}
],
"typescript/no-non-null-assertion": "error",
"typescript/no-this-alias": "error",
"typescript/no-require-imports": "error",
"typescript/prefer-function-type": "error",
"typescript/prefer-find": "error",
"typescript/prefer-nullish-coalescing": "off",
"typescript/prefer-readonly": "error",
"typescript/prefer-reduce-type-parameter": "error",
"typescript/prefer-return-this-type": "error",
"typescript/promise-function-async": "error",
"typescript/require-array-sort-compare": "error",
"typescript/restrict-plus-operands": [
"error",
{
"skipCompoundAssignments": true
}
],
"typescript/restrict-template-expressions": "error",
"typescript/strict-boolean-expressions": [
"error",
{
"allowString": false,
"allowNumber": false,
"allowNullableObject": false,
"allowNullableBoolean": false,
"allowNullableString": false,
"allowNullableNumber": false,
"allowAny": false
}
]
}
}
+1 -2
View File
@@ -28,7 +28,7 @@ The commit message guidelines adheres to [Conventional Commits](https://www.conv
### Prerequisites
- [Node.js](https://nodejs.org/) >= v24.0.0 [(`nvm install 24`)](https://nvm.sh)
- [pnpm](https://pnpm.io/) [(`npm install --global corepack@0.34.7 && corepack enable`)](https://github.com/nodejs/corepack)
- [pnpm](https://pnpm.io/) [(`npm install --global corepack@0.35.0 && corepack enable`)](https://github.com/nodejs/corepack)
- [Docker](https://www.docker.com/)
### Installation
@@ -58,7 +58,6 @@ pnpm exec playwright install --with-deps
node --run dev
# Lint
node --run lint:editorconfig
node --run lint:markdown
node --run lint:turbo
# node --run lint:typescript # already covered by oxlint
+2 -2
View File
@@ -1,7 +1,7 @@
FROM docker.io/node:24.15.0-slim@sha256:879b21aec4a1ad820c27ccd565e7c7ed955f24b92e6694556154f251e4bdb240 AS node-pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME/bin:$PATH"
RUN npm install --global corepack@0.34.7 && corepack enable
RUN npm install --global corepack@0.35.0 && corepack enable
ENV TURBO_TELEMETRY_DISABLED=1
ENV NEXT_TELEMETRY_DISABLED=1
ENV DO_NOT_TRACK=1
@@ -9,7 +9,7 @@ WORKDIR /usr/src/app
FROM node-pnpm AS builder
COPY ./ ./
RUN pnpm install --global turbo@2.9.9
RUN pnpm install --global turbo@2.9.16
RUN turbo prune @repo/website --docker
FROM node-pnpm AS installer
+2 -2
View File
@@ -1,5 +1,5 @@
import type { ClassValue } from "clsx"
import { clsx } from "clsx"
import type { ClassValue } from "@repo/utils/clsx"
import { clsx } from "@repo/utils/clsx"
import { twMerge } from "tailwind-merge"
export const classNames = (...inputs: ClassValue[]): string => {
+1 -1
View File
@@ -17,7 +17,7 @@
},
"dependencies": {
"@fontsource/montserrat": "catalog:",
"clsx": "catalog:",
"@repo/utils": "workspace:*",
"tailwind-merge": "catalog:"
},
"devDependencies": {
+2 -5
View File
@@ -6,19 +6,16 @@
"scripts": {
"dev": "turbo run dev --parallel",
"start": "turbo run start --parallel",
"lint:editorconfig": "editorconfig-checker",
"lint:markdown": "markdownlint-cli2",
"lint:turbo": "turbo boundaries",
"lint:typescript": "turbo run lint:typescript",
"lint:oxlint": "turbo run typegen && oxlint . --type-aware --type-check --deny-warnings --report-unused-disable-directives",
"lint:oxlint": "turbo run typegen && oxlint .",
"lint:oxfmt": "oxfmt . --check",
"oxfmt": "oxfmt .",
"test": "turbo run test",
"build": "turbo run build"
},
"devDependencies": {
"editorconfig-checker": "catalog:",
"eslint-config-conventions": "catalog:",
"markdownlint": "catalog:",
"markdownlint-cli2": "catalog:",
"markdownlint-rule-relative-links": "catalog:",
@@ -32,5 +29,5 @@
"engines": {
"node": ">=24.0.0"
},
"packageManager": "pnpm@11.0.6+sha512.97f906e1da2bedac3df83cadae04b4753a130092dd49d55cd36825ad3e623e9df3f97754f8f259e699172a360fac569acf2f908e7732bdae3eddb2dcf7e121fd"
"packageManager": "pnpm@11.5.0+sha512.dbfcc4f81cf48597afd4bc391ffdf12c11f1a9fb83a395bfa6b0a2d9cc2fd8ffebafdb1ccbd529632153f793904c2615b7f09fe1a345473fd1c35845172a8eb1"
}
+1
View File
@@ -5,6 +5,7 @@
"type": "module",
"exports": {
"./constants": "./src/constants.ts",
"./clsx": "./src/clsx.ts",
"./dates": "./src/dates.ts",
"./objects": "./src/objects.ts",
"./strings": "./src/strings.ts",
+25
View File
@@ -0,0 +1,25 @@
type ClassDictionary = Record<string, unknown>
export type ClassValue = ClassDictionary | string | null | boolean | undefined
/**
* Utility for constructing className strings conditionally.
* @see https://github.com/lukeed/clsx
*/
export const clsx = (inputs: ClassValue[]): string => {
let result = ""
for (const input of inputs) {
if (typeof input === "string") {
if (input.length > 0) {
result = result.length > 0 ? result + " " + input : input
}
} else if (typeof input === "object" && input !== null) {
for (const key of Object.keys(input)) {
if (input[key] != null && input[key] !== false && input[key] !== 0 && input[key] !== "") {
result = result.length > 0 ? result + " " + key : key
}
}
}
}
return result
}
+166
View File
@@ -0,0 +1,166 @@
import assert from "node:assert/strict"
import { describe, it } from "node:test"
import type { ClassValue } from "../clsx.ts"
import { clsx } from "../clsx.ts"
describe("clsx", () => {
describe("strings", () => {
it("should return empty string for empty input", () => {
// Arrange - Given
const input: ClassValue[] = [""]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "")
})
it("should return the string as-is", () => {
// Arrange - Given
const input: ClassValue[] = ["foo"]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "foo")
})
it("should join multiple strings with space", () => {
// Arrange - Given
const input: ClassValue[] = ["foo", "bar"]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "foo bar")
})
it("should skip falsy values between strings", () => {
// Arrange - Given
const input: ClassValue[] = ["foo", false, "bar", null, "baz"]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "foo bar baz")
})
})
describe("objects", () => {
it("should return empty string for empty object", () => {
// Arrange - Given
const input: ClassValue[] = [{}]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "")
})
it("should include keys with truthy values", () => {
// Arrange - Given
const input: ClassValue[] = [{ foo: true, bar: false }]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "foo")
})
it("should exclude keys with falsy values (0, null, false)", () => {
// Arrange - Given
const input: ClassValue[] = [{ foo: 1, bar: 0, baz: 1 }]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "foo baz")
})
it("should join keys from multiple objects", () => {
// Arrange - Given
const input: ClassValue[] = [{ foo: 1 }, { bar: 2 }]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "foo bar")
})
it("should handle null between objects", () => {
// Arrange - Given
const input: ClassValue[] = [{ foo: 1 }, null, { baz: 1, bat: 0 }]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "foo baz")
})
})
describe("mixed", () => {
it("should handle strings and objects together", () => {
// Arrange - Given
const input: ClassValue[] = ["hello", { world: 1, push: true }]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "hello world push")
})
it("should ignore non-string/object values", () => {
// Arrange - Given
const input: ClassValue[] = [undefined, "hello", null, true]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "hello")
})
it("should return empty string with no arguments", () => {
// Arrange - Given
const input: ClassValue[] = []
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "")
})
it("should not append empty string with separator after a non-empty token", () => {
// Arrange - Given
const input: ClassValue[] = ["foo", ""]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "foo")
})
it("should exclude object keys whose value is null, undefined, or empty string", () => {
// Arrange - Given
const input: ClassValue[] = [{ a: null, b: undefined, c: "", d: "ok" }]
// Act - When
const output = clsx(input)
// Assert - Then
assert.strictEqual(output, "d")
})
})
})
+2943 -2370
View File
File diff suppressed because it is too large Load Diff
+32 -34
View File
@@ -3,39 +3,46 @@ packages:
- "configs/*"
- "packages/*"
allowBuilds:
"@swc/core": true
"@parcel/watcher": true
"sharp": true
"unrs-resolver": true
"core-js-pure": true
"esbuild": true
minimumReleaseAge: 1440
minimumReleaseAgeStrict: true
minimumReleaseAgeIgnoreMissingTime: false
catalogMode: "strict"
catalog:
# Turborepo
"turbo": "2.9.9"
# TypeScript/Linting
"turbo": "2.9.16"
"typescript": "6.0.3"
"@types/node": "25.6.0"
"@types/node": "25.9.1"
"@total-typescript/ts-reset": "0.6.1"
"oxlint": "1.63.0"
"oxlint-tsgolint": "0.22.1"
"oxfmt": "0.48.0"
"eslint-config-conventions": "21.4.0"
"editorconfig-checker": "6.1.1"
"oxlint": "1.67.0"
"oxlint-tsgolint": "0.23.0"
"oxfmt": "0.52.0"
# Utils
"mime": "4.1.0"
# React.js/Next.js
"next": "16.2.4"
"next-intl": "4.11.0"
"next": "16.2.6"
"next-intl": "4.13.0"
"next-themes": "0.4.6"
"react": "19.2.5"
"react-dom": "19.2.5"
"@types/react": "19.2.14"
"react": "19.2.6"
"react-dom": "19.2.6"
"@types/react": "19.2.15"
"@types/react-dom": "19.2.3"
"react-icons": "5.6.0"
# Blog
"@giscus/react": "3.1.0"
"gray-matter": "4.0.3"
"katex": "0.16.45"
"katex": "0.17.0"
"next-mdx-remote": "5.0.0"
"@mdx-js/mdx": "3.1.1"
"rehype-katex": "7.0.1"
@@ -52,33 +59,24 @@ catalog:
"markdownlint-rule-relative-links": "5.1.0"
# Storybook
"storybook": &storybook "10.3.6"
"storybook": &storybook "10.4.1"
"@storybook/addon-docs": *storybook
"@storybook/addon-a11y": *storybook
"@storybook/nextjs": *storybook
"@storybook/addon-themes": *storybook
"@storybook/test-runner": "0.24.3"
"@chromatic-com/storybook": "5.1.2"
"chromatic": "16.8.0"
"@storybook/test-runner": "0.24.4"
"@chromatic-com/storybook": "5.2.1"
"chromatic": "16.10.0"
# Testing
"playwright": &playwright "1.59.1"
"playwright": &playwright "1.60.0"
"@playwright/test": *playwright
"start-server-and-test": "3.0.2"
"start-server-and-test": "3.0.5"
# CSS
"postcss": "8.5.14"
"tailwindcss": &tailwindcss "4.2.4"
"postcss": "8.5.15"
"tailwindcss": &tailwindcss "4.3.0"
"@tailwindcss/postcss": *tailwindcss
"@tailwindcss/typography": "0.5.19"
"tailwind-merge": "3.5.0"
"clsx": "2.1.1"
"tailwind-merge": "3.6.0"
"@fontsource/montserrat": "5.2.8"
allowBuilds:
"@swc/core": true
"@parcel/watcher": true
"sharp": true
"unrs-resolver": true
"core-js-pure": true
"esbuild": true