From 9e840b8dae4343e85c64478638db4fe1f5e69521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LUDWIG?= Date: Sat, 9 Nov 2024 19:50:22 +0100 Subject: [PATCH] build(deps): update Next.js to v15 and ESLint to v9 --- .github/workflows/chromatic.yml | 4 +- .github/workflows/ci.yml | 6 +- .github/workflows/release.yml | 4 +- .vscode/settings.json | 6 +- CONTRIBUTING.md | 2 +- apps/storybook/.eslintrc.json | 4 - apps/storybook/.storybook/main.ts | 3 +- apps/storybook/.storybook/preview.tsx | 12 +- apps/storybook/eslint.config.js | 13 + apps/storybook/package.json | 7 +- apps/storybook/tsconfig.json | 7 + apps/website/.eslintrc.json | 14 - apps/website/Dockerfile | 4 +- .../app/[locale]/(main)/blog/[slug]/page.tsx | 14 +- .../website/app/[locale]/(main)/blog/page.tsx | 7 +- apps/website/app/[locale]/(main)/layout.tsx | 7 +- apps/website/app/[locale]/(main)/page.tsx | 9 +- .../app/[locale]/curriculum-vitae/layout.tsx | 7 +- .../app/[locale]/curriculum-vitae/page.tsx | 9 +- apps/website/app/[locale]/layout.tsx | 16 +- apps/website/eslint.config.js | 13 + apps/website/i18n.ts | 3 - apps/website/i18n/request.ts | 3 + apps/website/middleware.ts | 25 +- apps/website/package.json | 5 +- apps/website/public/.gitkeep | 0 package.json | 4 +- packages/blog/.eslintrc.json | 14 - packages/blog/eslint.config.js | 13 + packages/blog/package.json | 3 +- packages/blog/src/BlogPostContent.tsx | 2 +- packages/blog/src/BlogPosts.tsx | 2 +- packages/config-eslint/.eslintrc.json | 26 - packages/config-eslint/eslint.config.js | 40 + packages/config-eslint/index.d.ts | 7 + packages/config-eslint/nextjs/.eslintrc.json | 57 - .../config-eslint/nextjs/eslint.config.js | 61 + packages/config-eslint/package.json | 27 +- packages/config-tailwind/.eslintrc.json | 14 - packages/config-tailwind/eslint.config.js | 13 + packages/config-tailwind/package.json | 1 + packages/config-typescript/tsconfig.json | 5 +- packages/i18n/.eslintrc.json | 14 - packages/i18n/eslint.config.js | 13 + packages/i18n/package.json | 8 +- packages/i18n/src/config.tsx | 26 - packages/i18n/src/navigation.ts | 9 - packages/i18n/src/{i18n.ts => request.ts} | 9 +- packages/i18n/src/routing.ts | 26 + packages/i18n/src/translations/en-US.json | 6 +- packages/i18n/src/translations/fr-FR.json | 6 +- packages/react-hooks/.eslintrc.json | 14 - packages/react-hooks/eslint.config.js | 13 + packages/react-hooks/package.json | 5 +- packages/react-hooks/vitest.config.ts | 6 +- packages/ui/.eslintrc.json | 14 - packages/ui/eslint.config.js | 13 + packages/ui/package.json | 3 +- .../CurriculumVitae/CurriculumVitaeAbout.tsx | 8 +- .../CurriculumVitaeEducation.tsx | 4 +- .../CurriculumVitaeProfile.tsx | 2 +- packages/ui/src/Design/Button/Button.tsx | 2 +- packages/ui/src/Design/Link/Link.tsx | 2 +- .../ui/src/Errors/ErrorServer/ErrorServer.tsx | 2 +- .../ui/src/Home/About/AboutDescription.tsx | 6 +- packages/ui/src/Home/Interests/Interests.tsx | 12 + .../ui/src/Layout/Header/Locales/Locales.tsx | 2 +- packages/utils/.eslintrc.json | 14 - packages/utils/eslint.config.js | 13 + packages/utils/package.json | 5 +- packages/utils/src/constants.ts | 11 +- packages/utils/vitest.config.ts | 2 +- pnpm-lock.yaml | 6086 ++++++++--------- pnpm-workspace.yaml | 106 +- 74 files changed, 3206 insertions(+), 3749 deletions(-) delete mode 100644 apps/storybook/.eslintrc.json create mode 100644 apps/storybook/eslint.config.js create mode 100644 apps/storybook/tsconfig.json delete mode 100644 apps/website/.eslintrc.json create mode 100644 apps/website/eslint.config.js delete mode 100644 apps/website/i18n.ts create mode 100644 apps/website/i18n/request.ts delete mode 100644 apps/website/public/.gitkeep delete mode 100644 packages/blog/.eslintrc.json create mode 100644 packages/blog/eslint.config.js delete mode 100644 packages/config-eslint/.eslintrc.json create mode 100644 packages/config-eslint/eslint.config.js create mode 100644 packages/config-eslint/index.d.ts delete mode 100644 packages/config-eslint/nextjs/.eslintrc.json create mode 100644 packages/config-eslint/nextjs/eslint.config.js delete mode 100644 packages/config-tailwind/.eslintrc.json create mode 100644 packages/config-tailwind/eslint.config.js delete mode 100644 packages/i18n/.eslintrc.json create mode 100644 packages/i18n/eslint.config.js delete mode 100644 packages/i18n/src/config.tsx delete mode 100644 packages/i18n/src/navigation.ts rename packages/i18n/src/{i18n.ts => request.ts} (74%) create mode 100644 packages/i18n/src/routing.ts delete mode 100644 packages/react-hooks/.eslintrc.json create mode 100644 packages/react-hooks/eslint.config.js delete mode 100644 packages/ui/.eslintrc.json create mode 100644 packages/ui/eslint.config.js delete mode 100644 packages/utils/.eslintrc.json create mode 100644 packages/utils/eslint.config.js diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 7e157e5..3583aab 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -11,14 +11,14 @@ jobs: timeout-minutes: 30 runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v4.2.1" + - uses: "actions/checkout@v4.2.2" with: fetch-depth: 0 - uses: "pnpm/action-setup@v4.0.0" - name: "Setup Node.js" - uses: "actions/setup-node@v4.0.4" + uses: "actions/setup-node@v4.1.0" with: node-version: "22.x" cache: "pnpm" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4420bf4..71cf2ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,12 +11,12 @@ jobs: timeout-minutes: 30 runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v4.2.1" + - uses: "actions/checkout@v4.2.2" - uses: "pnpm/action-setup@v4.0.0" - name: "Setup Node.js" - uses: "actions/setup-node@v4.0.4" + uses: "actions/setup-node@v4.1.0" with: node-version: "22.x" cache: "pnpm" @@ -38,6 +38,6 @@ jobs: commitlint: runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v4.2.1" + - uses: "actions/checkout@v4.2.2" - uses: "wagoid/commitlint-github-action@v6.1.2" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dbadd1f..ba41387 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: pull-requests: "write" id-token: "write" steps: - - uses: "actions/checkout@v4.2.1" + - uses: "actions/checkout@v4.2.2" with: fetch-depth: 0 persist-credentials: false @@ -29,7 +29,7 @@ jobs: - uses: "pnpm/action-setup@v4.0.0" - name: "Setup Node.js" - uses: "actions/setup-node@v4.0.4" + uses: "actions/setup-node@v4.1.0" with: node-version: "22.x" cache: "pnpm" diff --git a/.vscode/settings.json b/.vscode/settings.json index 3a93add..448ec30 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,12 +7,8 @@ "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll": "explicit", - "source.organizeImports": "explicit" + "source.organizeImports": "never" }, - "eslint.options": { - "ignorePath": ".gitignore" - }, - "prettier.ignorePath": ".gitignore", "tailwindCSS.experimental.classRegex": [ ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], ["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 76190d8..267a40a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,7 @@ The commit message guidelines adheres to [Conventional Commits](https://www.conv ### Prerequisites - [Node.js](https://nodejs.org/) >= 22.0.0 -- [pnpm](https://pnpm.io/) >= 9.12.1 [(`corepack enable`)](https://nodejs.org/docs/latest-v22.x/api/corepack.html) +- [pnpm](https://pnpm.io/) >= 9.12.3 [(`corepack enable`)](https://nodejs.org/docs/latest-v22.x/api/corepack.html) - [Docker](https://www.docker.com/) ### Installation diff --git a/apps/storybook/.eslintrc.json b/apps/storybook/.eslintrc.json deleted file mode 100644 index 42c084e..0000000 --- a/apps/storybook/.eslintrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "root": true, - "extends": ["@repo/eslint-config"] -} diff --git a/apps/storybook/.storybook/main.ts b/apps/storybook/.storybook/main.ts index 75be0ec..cb6c6a1 100644 --- a/apps/storybook/.storybook/main.ts +++ b/apps/storybook/.storybook/main.ts @@ -13,11 +13,10 @@ const config: StorybookConfig = { "../stories/*.mdx", ], addons: [ + "@chromatic-com/storybook", "@storybook/addon-essentials", "@storybook/addon-storysource", "@storybook/addon-a11y", - "@storybook/addon-links", - "@chromatic-com/storybook", "@storybook/addon-interactions", "storybook-dark-mode", ], diff --git a/apps/storybook/.storybook/preview.tsx b/apps/storybook/.storybook/preview.tsx index a1a2240..1efa32b 100644 --- a/apps/storybook/.storybook/preview.tsx +++ b/apps/storybook/.storybook/preview.tsx @@ -1,7 +1,6 @@ import "@repo/config-tailwind/styles.css" -import { defaultTranslationValues } from "@repo/i18n/config" -import i18nMessagesEnglish from "@repo/i18n/translations/en-US.json" -import { LOCALE_DEFAULT } from "@repo/utils/constants" +import i18nMessages from "@repo/i18n/translations/en-US.json" +import { LOCALE_DEFAULT, TIMEZONE } from "@repo/utils/constants" import type { Preview } from "@storybook/react" import { NextIntlClientProvider } from "next-intl" import { ThemeProvider as NextThemeProvider } from "next-themes" @@ -28,7 +27,7 @@ const preview: Preview = { disableSaveFromUI: true, matchers: { color: /(background|color)$/i, - date: /Date$/i, + date: /date$/i, }, }, }, @@ -37,10 +36,9 @@ const preview: Preview = { return ( diff --git a/apps/storybook/eslint.config.js b/apps/storybook/eslint.config.js new file mode 100644 index 0000000..00a4178 --- /dev/null +++ b/apps/storybook/eslint.config.js @@ -0,0 +1,13 @@ +import typescriptESLint from "typescript-eslint" +import config from "@repo/eslint-config" + +export default typescriptESLint.config(...config, { + files: ["**/*.ts", "**/*.tsx"], + languageOptions: { + parser: typescriptESLint.parser, + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, +}) diff --git a/apps/storybook/package.json b/apps/storybook/package.json index 8cad641..d7e3f85 100644 --- a/apps/storybook/package.json +++ b/apps/storybook/package.json @@ -26,13 +26,13 @@ }, "devDependencies": { "@repo/eslint-config": "workspace:*", + "@repo/config-typescript": "workspace:*", "@chromatic-com/storybook": "catalog:", "@playwright/test": "catalog:", - "@storybook/addon-a11y": "catalog:", "@storybook/addon-essentials": "catalog:", - "@storybook/addon-interactions": "catalog:", - "@storybook/addon-links": "catalog:", "@storybook/addon-storysource": "catalog:", + "@storybook/addon-a11y": "catalog:", + "@storybook/addon-interactions": "catalog:", "@storybook/addon-themes": "catalog:", "@storybook/blocks": "catalog:", "@storybook/nextjs": "catalog:", @@ -51,6 +51,7 @@ "storybook-dark-mode": "catalog:", "postcss": "catalog:", "tailwindcss": "catalog:", + "typescript-eslint": "catalog:", "typescript": "catalog:" } } diff --git a/apps/storybook/tsconfig.json b/apps/storybook/tsconfig.json new file mode 100644 index 0000000..9fc99ef --- /dev/null +++ b/apps/storybook/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "@repo/config-typescript/tsconfig.json", + "compilerOptions": { + "lib": ["DOM", "DOM.Iterable", "ESNext"] + }, + "include": ["./.storybook/**/*.ts", "./.storybook/**/*.tsx"] +} diff --git a/apps/website/.eslintrc.json b/apps/website/.eslintrc.json deleted file mode 100644 index bf40d0d..0000000 --- a/apps/website/.eslintrc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "root": true, - "extends": ["@repo/eslint-config/nextjs/.eslintrc.json"], - "overrides": [ - { - "files": ["*.ts", "*.tsx"], - "plugins": ["@typescript-eslint"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "projectService": true - } - } - ] -} diff --git a/apps/website/Dockerfile b/apps/website/Dockerfile index 422abe5..bb17be8 100644 --- a/apps/website/Dockerfile +++ b/apps/website/Dockerfile @@ -1,4 +1,4 @@ -FROM node:22.4.1-slim AS node-pnpm +FROM node:22.11.0-slim AS node-pnpm ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable @@ -8,7 +8,7 @@ WORKDIR /usr/src/app FROM node-pnpm AS builder COPY ./ ./ -RUN pnpm install --global turbo@2.1.3 +RUN pnpm install --global turbo@2.2.3 RUN turbo prune @repo/website --docker FROM node-pnpm AS installer diff --git a/apps/website/app/[locale]/(main)/blog/[slug]/page.tsx b/apps/website/app/[locale]/(main)/blog/[slug]/page.tsx index ea22f00..60ba5e9 100644 --- a/apps/website/app/[locale]/(main)/blog/[slug]/page.tsx +++ b/apps/website/app/[locale]/(main)/blog/[slug]/page.tsx @@ -4,19 +4,20 @@ import { notFound } from "next/navigation" import { getBlogPostBySlug, getBlogPosts } from "@repo/blog" import { BlogPostUI } from "@repo/blog/BlogPostUI" import type { Locale } from "@repo/utils/constants" -import { unstable_setRequestLocale } from "next-intl/server" +import { setRequestLocale } from "next-intl/server" interface BlogPostPageProps { - params: { + params: Promise<{ slug: string locale: Locale - } + }> } export const generateMetadata = async ( props: BlogPostPageProps, ): Promise => { - const blogPost = await getBlogPostBySlug(props.params.slug) + const { slug } = await props.params + const blogPost = await getBlogPostBySlug(slug) if (blogPost == null) { return notFound() } @@ -50,10 +51,11 @@ export const generateStaticParams = async (): Promise< const BlogPostPage: React.FC = async (props) => { const { params } = props + const { locale, slug } = await params // Enable static rendering - unstable_setRequestLocale(params.locale) + setRequestLocale(locale) - const blogPost = await getBlogPostBySlug(params.slug) + const blogPost = await getBlogPostBySlug(slug) if (blogPost == null) { return notFound() } diff --git a/apps/website/app/[locale]/(main)/blog/page.tsx b/apps/website/app/[locale]/(main)/blog/page.tsx index 48bcecf..1d12c03 100644 --- a/apps/website/app/[locale]/(main)/blog/page.tsx +++ b/apps/website/app/[locale]/(main)/blog/page.tsx @@ -1,6 +1,6 @@ import { getBlogPosts } from "@repo/blog" import { BlogPosts } from "@repo/blog/BlogPosts" -import type { LocaleProps } from "@repo/i18n/config" +import type { LocaleProps } from "@repo/i18n/routing" import { MainLayout } from "@repo/ui/Layout/MainLayout" import { Section, @@ -9,7 +9,7 @@ import { } from "@repo/ui/Layout/Section" import { LOCALE_DEFAULT } from "@repo/utils/constants" import type { Metadata } from "next" -import { unstable_setRequestLocale } from "next-intl/server" +import { setRequestLocale } from "next-intl/server" const title = "Blog | Théo LUDWIG" const description = @@ -36,8 +36,9 @@ interface BlogPageProps extends LocaleProps {} const BlogPage: React.FC = async (props) => { const { params } = props + const { locale } = await params // Enable static rendering - unstable_setRequestLocale(params.locale) + setRequestLocale(locale) const posts = await getBlogPosts() diff --git a/apps/website/app/[locale]/(main)/layout.tsx b/apps/website/app/[locale]/(main)/layout.tsx index 0666aa1..6b4565c 100644 --- a/apps/website/app/[locale]/(main)/layout.tsx +++ b/apps/website/app/[locale]/(main)/layout.tsx @@ -1,18 +1,19 @@ import "@repo/config-tailwind/styles.css" -import type { LocaleProps } from "@repo/i18n/config" +import type { LocaleProps } from "@repo/i18n/routing" import { Footer } from "@repo/ui/Layout/Footer" import { Header } from "@repo/ui/Layout/Header" import { ThemeProvider } from "@repo/ui/Layout/Header/SwitchTheme" import { VERSION } from "@repo/utils/constants" -import { unstable_setRequestLocale } from "next-intl/server" +import { setRequestLocale } from "next-intl/server" interface MainLayoutProps extends React.PropsWithChildren, LocaleProps {} const MainLayout: React.FC = async (props) => { const { children, params } = props + const { locale } = await params // Enable static rendering - unstable_setRequestLocale(params.locale) + setRequestLocale(locale) return ( diff --git a/apps/website/app/[locale]/(main)/page.tsx b/apps/website/app/[locale]/(main)/page.tsx index 98c6d6c..7298e3e 100644 --- a/apps/website/app/[locale]/(main)/page.tsx +++ b/apps/website/app/[locale]/(main)/page.tsx @@ -1,4 +1,4 @@ -import type { LocaleProps } from "@repo/i18n/config" +import type { LocaleProps } from "@repo/i18n/routing" import { About } from "@repo/ui/Home/About" import { Interests } from "@repo/ui/Home/Interests" import { OpenSource } from "@repo/ui/Home/OpenSource" @@ -6,15 +6,16 @@ import { Portfolio } from "@repo/ui/Home/Portfolio" import { Skills } from "@repo/ui/Home/Skills" import { MainLayout } from "@repo/ui/Layout/MainLayout" import { RevealFade } from "@repo/ui/Layout/Section" -import { unstable_setRequestLocale } from "next-intl/server" +import { setRequestLocale } from "next-intl/server" interface HomePageProps extends LocaleProps {} -const HomePage: React.FC = (props) => { +const HomePage: React.FC = async (props) => { const { params } = props + const { locale } = await params // Enable static rendering - unstable_setRequestLocale(params.locale) + setRequestLocale(locale) return ( diff --git a/apps/website/app/[locale]/curriculum-vitae/layout.tsx b/apps/website/app/[locale]/curriculum-vitae/layout.tsx index d96f637..a94cfc0 100644 --- a/apps/website/app/[locale]/curriculum-vitae/layout.tsx +++ b/apps/website/app/[locale]/curriculum-vitae/layout.tsx @@ -1,7 +1,7 @@ import "@repo/config-tailwind/styles.css" -import type { LocaleProps } from "@repo/i18n/config" +import type { LocaleProps } from "@repo/i18n/routing" import { ThemeProvider } from "@repo/ui/Layout/Header/SwitchTheme" -import { unstable_setRequestLocale } from "next-intl/server" +import { setRequestLocale } from "next-intl/server" interface CurriculumVitaeLayoutProps extends React.PropsWithChildren, @@ -12,8 +12,9 @@ const CurriculumVitaeLayout: React.FC = async ( ) => { const { children, params } = props + const { locale } = await params // Enable static rendering - unstable_setRequestLocale(params.locale) + setRequestLocale(locale) return {children} } diff --git a/apps/website/app/[locale]/curriculum-vitae/page.tsx b/apps/website/app/[locale]/curriculum-vitae/page.tsx index 2a972ea..5e795c7 100644 --- a/apps/website/app/[locale]/curriculum-vitae/page.tsx +++ b/apps/website/app/[locale]/curriculum-vitae/page.tsx @@ -1,14 +1,15 @@ -import type { LocaleProps } from "@repo/i18n/config" +import type { LocaleProps } from "@repo/i18n/routing" import { CurriculumVitae } from "@repo/ui/CurriculumVitae" -import { unstable_setRequestLocale } from "next-intl/server" +import { setRequestLocale } from "next-intl/server" interface CurriculumVitaeProps extends LocaleProps {} -const CurriculumVitaePage: React.FC = (props) => { +const CurriculumVitaePage: React.FC = async (props) => { const { params } = props + const { locale } = await params // Enable static rendering - unstable_setRequestLocale(params.locale) + setRequestLocale(locale) return } diff --git a/apps/website/app/[locale]/layout.tsx b/apps/website/app/[locale]/layout.tsx index 6796c37..81cc421 100644 --- a/apps/website/app/[locale]/layout.tsx +++ b/apps/website/app/[locale]/layout.tsx @@ -1,5 +1,5 @@ import "@repo/config-tailwind/styles.css" -import type { LocaleProps } from "@repo/i18n/config" +import type { LocaleProps } from "@repo/i18n/routing" import type { Locale } from "@repo/utils/constants" import { LOCALES } from "@repo/utils/constants" import type { Metadata } from "next" @@ -7,18 +7,19 @@ import { NextIntlClientProvider } from "next-intl" import { getMessages, getTranslations, - unstable_setRequestLocale, + setRequestLocale, } from "next-intl/server" export const generateMetadata = async ({ params, }: LocaleProps): Promise => { - const t = await getTranslations({ locale: params.locale }) + const { locale } = await params + const t = await getTranslations({ locale }) const title = t("meta.title") const description = `${title} - ${t("meta.description")}` const image = "/images/logo.webp" const url = new URL("https://theoludwig.fr") - const locale = LOCALES.join(", ") + const locales = LOCALES.join(", ") return { title, @@ -36,7 +37,7 @@ export const generateMetadata = async ({ height: 96, }, ], - locale, + locale: locales, type: "website", }, twitter: { @@ -61,13 +62,14 @@ interface LocaleLayoutProps extends React.PropsWithChildren, LocaleProps {} const LocaleLayout: React.FC = async (props) => { const { children, params } = props + const { locale } = await params // Enable static rendering - unstable_setRequestLocale(params.locale) + setRequestLocale(locale) const messages = await getMessages() return ( - + {children} diff --git a/apps/website/eslint.config.js b/apps/website/eslint.config.js new file mode 100644 index 0000000..eee072a --- /dev/null +++ b/apps/website/eslint.config.js @@ -0,0 +1,13 @@ +import typescriptESLint from "typescript-eslint" +import configNextjs from "@repo/eslint-config/nextjs" + +export default typescriptESLint.config(...configNextjs, { + files: ["**/*.ts", "**/*.tsx"], + languageOptions: { + parser: typescriptESLint.parser, + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, +}) diff --git a/apps/website/i18n.ts b/apps/website/i18n.ts deleted file mode 100644 index 0475f75..0000000 --- a/apps/website/i18n.ts +++ /dev/null @@ -1,3 +0,0 @@ -import i18nConfig from "@repo/i18n/i18n" - -export default i18nConfig diff --git a/apps/website/i18n/request.ts b/apps/website/i18n/request.ts new file mode 100644 index 0000000..14b901f --- /dev/null +++ b/apps/website/i18n/request.ts @@ -0,0 +1,3 @@ +import i18nRequestConfig from "@repo/i18n/request" + +export default i18nRequestConfig diff --git a/apps/website/middleware.ts b/apps/website/middleware.ts index 3df6ef2..978d46b 100644 --- a/apps/website/middleware.ts +++ b/apps/website/middleware.ts @@ -1,25 +1,26 @@ -import { LOCALES, LOCALE_DEFAULT, LOCALE_PREFIX } from "@repo/utils/constants" -import createMiddleware from "next-intl/middleware" +import { routing } from "@repo/i18n/routing" +import createIntlMiddleware from "next-intl/middleware" -export default createMiddleware({ - locales: LOCALES, - defaultLocale: LOCALE_DEFAULT, - localePrefix: LOCALE_PREFIX, -}) +const intlMiddleware = createIntlMiddleware(routing) + +export default intlMiddleware export const config = { matcher: [ // Enable a redirect to a matching locale at the root "/", - // Set a cookie to remember the previous locale for - // all requests that have a locale prefix // Next.js issue, middleware matcher should support template literals: // https://github.com/vercel/next.js/issues/56398 "/(en-US|fr-FR)/:path*", - // Enable redirects that add missing locales - // (e.g. `/pathnames` -> `/en/pathnames`) - "/((?!_next|_vercel|.*\\..*).*)", + /* + * Match all request paths except for the ones starting with: + * - api (API routes) + * - _next/static (static files) + * - _next/image (image optimization files) + * - favicon.ico (favicon file) + */ + "/((?!api|_next/static|_next/image|images|favicon.ico).*)", ], } diff --git a/apps/website/package.json b/apps/website/package.json index 36cc28b..43abcc8 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -7,10 +7,10 @@ "#*": "./*" }, "scripts": { - "dev": "next dev --port 3000 --turbo", + "dev": "next dev --port 3000 --turbopack", "build": "next build", "start": "next start --port 3000", - "lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives", + "lint:eslint": "eslint . --max-warnings 0", "lint:typescript": "tsc --noEmit" }, "dependencies": { @@ -34,6 +34,7 @@ "eslint": "catalog:", "postcss": "catalog:", "tailwindcss": "catalog:", + "typescript-eslint": "catalog:", "typescript": "catalog:" } } diff --git a/apps/website/public/.gitkeep b/apps/website/public/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/package.json b/package.json index 570ff9a..3cd35dc 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,10 @@ "version": "4.0.0", "private": true, "type": "module", - "packageManager": "pnpm@9.12.1+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4", + "packageManager": "pnpm@9.12.3+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee", "engines": { "node": ">=22.0.0", - "pnpm": ">=9.12.1" + "pnpm": ">=9.12.3" }, "scripts": { "build": "turbo run build", diff --git a/packages/blog/.eslintrc.json b/packages/blog/.eslintrc.json deleted file mode 100644 index bf40d0d..0000000 --- a/packages/blog/.eslintrc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "root": true, - "extends": ["@repo/eslint-config/nextjs/.eslintrc.json"], - "overrides": [ - { - "files": ["*.ts", "*.tsx"], - "plugins": ["@typescript-eslint"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "projectService": true - } - } - ] -} diff --git a/packages/blog/eslint.config.js b/packages/blog/eslint.config.js new file mode 100644 index 0000000..eee072a --- /dev/null +++ b/packages/blog/eslint.config.js @@ -0,0 +1,13 @@ +import typescriptESLint from "typescript-eslint" +import configNextjs from "@repo/eslint-config/nextjs" + +export default typescriptESLint.config(...configNextjs, { + files: ["**/*.ts", "**/*.tsx"], + languageOptions: { + parser: typescriptESLint.parser, + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, +}) diff --git a/packages/blog/package.json b/packages/blog/package.json index c866753..b7fb5d4 100644 --- a/packages/blog/package.json +++ b/packages/blog/package.json @@ -9,7 +9,7 @@ "./BlogPostUI": "./src/BlogPostUI.tsx" }, "scripts": { - "lint:eslint": "eslint src --max-warnings 0 --report-unused-disable-directives", + "lint:eslint": "eslint src --max-warnings 0", "lint:typescript": "tsc --noEmit" }, "dependencies": { @@ -49,6 +49,7 @@ "eslint": "catalog:", "postcss": "catalog:", "tailwindcss": "catalog:", + "typescript-eslint": "catalog:", "typescript": "catalog:" } } diff --git a/packages/blog/src/BlogPostContent.tsx b/packages/blog/src/BlogPostContent.tsx index 207adbc..27cd9f4 100644 --- a/packages/blog/src/BlogPostContent.tsx +++ b/packages/blog/src/BlogPostContent.tsx @@ -9,7 +9,7 @@ import rehypeSlug from "rehype-slug" import remarkGfm from "remark-gfm" import remarkMath from "remark-math" -import { Link } from "@repo/i18n/navigation" +import { Link } from "@repo/i18n/routing" import "katex/dist/katex.min.css" import { BlogPostComments } from "./BlogPostComments.tsx" diff --git a/packages/blog/src/BlogPosts.tsx b/packages/blog/src/BlogPosts.tsx index f89f854..a61e036 100644 --- a/packages/blog/src/BlogPosts.tsx +++ b/packages/blog/src/BlogPosts.tsx @@ -1,4 +1,4 @@ -import { Link } from "@repo/i18n/navigation" +import { Link } from "@repo/i18n/routing" import { Typography } from "@repo/ui/Design/Typography" import { Section, SectionContent } from "@repo/ui/Layout/Section" import { getISODate } from "@repo/utils/dates" diff --git a/packages/config-eslint/.eslintrc.json b/packages/config-eslint/.eslintrc.json deleted file mode 100644 index 5354ada..0000000 --- a/packages/config-eslint/.eslintrc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "extends": ["conventions"], - "plugins": ["import-x"], - "rules": { - "import-x/no-absolute-path": "error", - "import-x/no-webpack-loader-syntax": "error", - "import-x/no-self-import": "error", - "import-x/no-useless-path-segments": "error", - "import-x/export": "error", - "import-x/no-duplicates": "error", - "import-x/no-named-default": "error", - "import-x/no-empty-named-blocks": "error", - "import-x/no-anonymous-default-export": "error", - "import-x/extensions": [ - "error", - "ignorePackages", - { - "ts": "always", - "tsx": "always", - "js": "never", - "jsx": "never" - } - ], - "import-x/consistent-type-specifier-style": ["error", "prefer-top-level"] - } -} diff --git a/packages/config-eslint/eslint.config.js b/packages/config-eslint/eslint.config.js new file mode 100644 index 0000000..87365e3 --- /dev/null +++ b/packages/config-eslint/eslint.config.js @@ -0,0 +1,40 @@ +import typescriptESLint from "typescript-eslint" +import configConventions from "eslint-config-conventions" +import importX from "eslint-plugin-import-x" +import unicorn from "eslint-plugin-unicorn" + +export default typescriptESLint.config( + { + ignores: [ + ".next", + "**/next.config.js", + "**/eslint.config.js", + "**/tailwind.config.js", + "**/postcss.config.js", + "**/vitest.config.ts", + "**/kysely.config.ts", + ], + }, + ...configConventions, + { + name: "config-eslint", + plugins: { + "import-x": importX, + unicorn, + }, + rules: { + "import-x/extensions": [ + "error", + "ignorePackages", + { + ts: "always", + tsx: "always", + js: "never", + jsx: "never", + }, + ], + "unicorn/explicit-length-check": "error", + "unicorn/consistent-destructuring": "off", + }, + }, +) diff --git a/packages/config-eslint/index.d.ts b/packages/config-eslint/index.d.ts new file mode 100644 index 0000000..e578123 --- /dev/null +++ b/packages/config-eslint/index.d.ts @@ -0,0 +1,7 @@ +import type typescriptESLint from "typescript-eslint" + +declare const eslintConfigConventions: ReturnType< + typeof typescriptESLint.config +> + +export default eslintConfigConventions diff --git a/packages/config-eslint/nextjs/.eslintrc.json b/packages/config-eslint/nextjs/.eslintrc.json deleted file mode 100644 index ff9a683..0000000 --- a/packages/config-eslint/nextjs/.eslintrc.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "extends": [ - "../.eslintrc.json", - "next/core-web-vitals", - "plugin:tailwindcss/recommended", - "plugin:storybook/recommended" - ], - "ignorePatterns": [ - "next.config.js", - "tailwind.config.js", - "postcss.config.js", - "vitest.config.ts" - ], - "settings": { - "tailwindcss": { - "callees": ["classNames", "cva"] - }, - "react": { - "version": "detect" - } - }, - "rules": { - "tailwindcss/classnames-order": "off", - "tailwindcss/no-custom-classname": "off", - "@next/next/no-html-link-for-pages": "off", - "react/self-closing-comp": [ - "error", - { - "component": true, - "html": true - } - ], - "react/void-dom-elements-no-children": "error", - "react/jsx-boolean-value": "error", - "no-restricted-imports": [ - "error", - { - "paths": [ - { - "name": "next/link", - "message": "Please import from `@repo/i18n/navigation` instead." - }, - { - "name": "next/navigation", - "importNames": [ - "redirect", - "permanentRedirect", - "useRouter", - "usePathname" - ], - "message": "Please import from `@repo/i18n/navigation` instead." - } - ] - } - ] - } -} diff --git a/packages/config-eslint/nextjs/eslint.config.js b/packages/config-eslint/nextjs/eslint.config.js new file mode 100644 index 0000000..fad3bd6 --- /dev/null +++ b/packages/config-eslint/nextjs/eslint.config.js @@ -0,0 +1,61 @@ +import { FlatCompat } from "@eslint/eslintrc" +import storybook from "eslint-plugin-storybook" +import tailwind from "eslint-plugin-tailwindcss" +import typescriptESLint from "typescript-eslint" +import config from "../eslint.config.js" + +const flatCompat = new FlatCompat() + +export default typescriptESLint.config( + ...config, + ...flatCompat.extends("next/core-web-vitals"), + ...tailwind.configs["flat/recommended"], + ...storybook.configs["flat/recommended"], + { + name: "config-eslint/nextjs", + settings: { + tailwindcss: { + callees: ["classNames", "cva"], + }, + react: { + version: "detect", + }, + }, + rules: { + "tailwindcss/classnames-order": "off", + "tailwindcss/no-custom-classname": "off", + "@next/next/no-html-link-for-pages": "off", + "@next/next/no-img-element": "off", + "react/self-closing-comp": [ + "error", + { + component: true, + html: true, + }, + ], + "react/void-dom-elements-no-children": "error", + "react/jsx-boolean-value": "error", + "no-restricted-imports": [ + "error", + { + paths: [ + { + name: "next/link", + message: "Please import from `@repo/i18n/routing` instead.", + }, + { + name: "next/navigation", + importNames: [ + "redirect", + "permanentRedirect", + "useRouter", + "usePathname", + ], + message: "Please import from `@repo/i18n/routing` instead.", + }, + ], + }, + ], + }, + }, +) diff --git a/packages/config-eslint/package.json b/packages/config-eslint/package.json index 0b68cca..2718327 100644 --- a/packages/config-eslint/package.json +++ b/packages/config-eslint/package.json @@ -2,14 +2,24 @@ "name": "@repo/eslint-config", "version": "4.0.0", "private": true, - "main": ".eslintrc.json", - "files": [ - ".eslintrc.json", - "nextjs/.eslintrc.json" - ], + "type": "module", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./eslint.config.js", + "require": "./eslint.config.js", + "default": "./eslint.config.js" + }, + "./nextjs": { + "types": "./index.d.ts", + "import": "./nextjs/eslint.config.js", + "require": "./nextjs/eslint.config.js", + "default": "./nextjs/eslint.config.js" + } + }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "catalog:", - "@typescript-eslint/parser": "catalog:", + "@eslint/eslintrc": "catalog:", + "typescript-eslint": "catalog:", "eslint": "catalog:", "eslint-config-conventions": "catalog:", "eslint-plugin-promise": "catalog:", @@ -18,6 +28,7 @@ "eslint-plugin-storybook": "catalog:", "eslint-plugin-tailwindcss": "catalog:", "eslint-plugin-import-x": "catalog:", - "typescript": "catalog:" + "typescript": "catalog:", + "globals": "catalog:" } } diff --git a/packages/config-tailwind/.eslintrc.json b/packages/config-tailwind/.eslintrc.json deleted file mode 100644 index 30befb4..0000000 --- a/packages/config-tailwind/.eslintrc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "root": true, - "extends": ["@repo/eslint-config"], - "overrides": [ - { - "files": ["*.ts", "*.tsx"], - "plugins": ["@typescript-eslint"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "projectService": true - } - } - ] -} diff --git a/packages/config-tailwind/eslint.config.js b/packages/config-tailwind/eslint.config.js new file mode 100644 index 0000000..00a4178 --- /dev/null +++ b/packages/config-tailwind/eslint.config.js @@ -0,0 +1,13 @@ +import typescriptESLint from "typescript-eslint" +import config from "@repo/eslint-config" + +export default typescriptESLint.config(...config, { + files: ["**/*.ts", "**/*.tsx"], + languageOptions: { + parser: typescriptESLint.parser, + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, +}) diff --git a/packages/config-tailwind/package.json b/packages/config-tailwind/package.json index 0597e12..2a1b9f6 100644 --- a/packages/config-tailwind/package.json +++ b/packages/config-tailwind/package.json @@ -24,6 +24,7 @@ "@repo/eslint-config": "workspace:*", "@repo/config-typescript": "workspace:*", "@tailwindcss/typography": "catalog:", + "typescript-eslint": "catalog:", "eslint": "catalog:", "postcss": "catalog:", "tailwindcss": "catalog:" diff --git a/packages/config-typescript/tsconfig.json b/packages/config-typescript/tsconfig.json index 32cae46..75c1dcb 100644 --- a/packages/config-typescript/tsconfig.json +++ b/packages/config-typescript/tsconfig.json @@ -24,9 +24,6 @@ "target": "ESNext", "module": "ESNext", "moduleResolution": "Bundler", - "resolveJsonModule": true, - - "experimentalDecorators": true, - "emitDecoratorMetadata": true + "resolveJsonModule": true } } diff --git a/packages/i18n/.eslintrc.json b/packages/i18n/.eslintrc.json deleted file mode 100644 index 30befb4..0000000 --- a/packages/i18n/.eslintrc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "root": true, - "extends": ["@repo/eslint-config"], - "overrides": [ - { - "files": ["*.ts", "*.tsx"], - "plugins": ["@typescript-eslint"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "projectService": true - } - } - ] -} diff --git a/packages/i18n/eslint.config.js b/packages/i18n/eslint.config.js new file mode 100644 index 0000000..00a4178 --- /dev/null +++ b/packages/i18n/eslint.config.js @@ -0,0 +1,13 @@ +import typescriptESLint from "typescript-eslint" +import config from "@repo/eslint-config" + +export default typescriptESLint.config(...config, { + files: ["**/*.ts", "**/*.tsx"], + languageOptions: { + parser: typescriptESLint.parser, + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, +}) diff --git a/packages/i18n/package.json b/packages/i18n/package.json index a96747e..a92a4f4 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -5,13 +5,12 @@ "type": "module", "exports": { "./translations/*.json": "./src/translations/*.json", - "./config": "./src/config.tsx", - "./i18n": "./src/i18n.ts", "./messages.d.ts": "./src/messages.d.ts", - "./navigation": "./src/navigation.ts" + "./request": "./src/request.ts", + "./routing": "./src/routing.ts" }, "scripts": { - "lint:eslint": "eslint src --max-warnings 0 --report-unused-disable-directives", + "lint:eslint": "eslint src --max-warnings 0", "lint:typescript": "tsc --noEmit", "test": "vitest run" }, @@ -30,6 +29,7 @@ "@types/react-dom": "catalog:", "@total-typescript/ts-reset": "catalog:", "eslint": "catalog:", + "typescript-eslint": "catalog:", "typescript": "catalog:", "vitest": "catalog:" } diff --git a/packages/i18n/src/config.tsx b/packages/i18n/src/config.tsx deleted file mode 100644 index 5b24b4d..0000000 --- a/packages/i18n/src/config.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import type { Locale } from "@repo/utils/constants" -import type { RichTranslationValues } from "next-intl" - -export interface LocaleProps { - params: { - locale: Locale - } -} - -export const defaultTranslationValues: RichTranslationValues = { - br: () => { - return
- }, - strong: (children) => { - return {children} - }, - em: (children) => { - return {children} - }, - s: (children) => { - return {children} - }, - u: (children) => { - return {children} - }, -} diff --git a/packages/i18n/src/navigation.ts b/packages/i18n/src/navigation.ts deleted file mode 100644 index 4ad143a..0000000 --- a/packages/i18n/src/navigation.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { createSharedPathnamesNavigation } from "next-intl/navigation" - -import { LOCALES, LOCALE_PREFIX } from "@repo/utils/constants" - -export const { Link, redirect, usePathname, useRouter, permanentRedirect } = - createSharedPathnamesNavigation({ - locales: LOCALES, - localePrefix: LOCALE_PREFIX, - }) diff --git a/packages/i18n/src/i18n.ts b/packages/i18n/src/request.ts similarity index 74% rename from packages/i18n/src/i18n.ts rename to packages/i18n/src/request.ts index 5bc3825..c39f0bd 100644 --- a/packages/i18n/src/i18n.ts +++ b/packages/i18n/src/request.ts @@ -1,15 +1,14 @@ import deepmerge from "deepmerge" import type { AbstractIntlMessages } from "next-intl" import { getRequestConfig } from "next-intl/server" -import { notFound } from "next/navigation" import type { Locale } from "@repo/utils/constants" import { LOCALE_DEFAULT, LOCALES } from "@repo/utils/constants" -import { defaultTranslationValues } from "./config.tsx" -export default getRequestConfig(async ({ locale }) => { +export default getRequestConfig(async ({ requestLocale }) => { + let locale = await requestLocale if (!LOCALES.includes(locale as Locale)) { - return notFound() + locale = LOCALE_DEFAULT } const userMessages = (await import(`./translations/${locale}.json`)).default @@ -22,7 +21,7 @@ export default getRequestConfig(async ({ locale }) => { ) return { + locale, messages, - defaultTranslationValues, } }) diff --git a/packages/i18n/src/routing.ts b/packages/i18n/src/routing.ts new file mode 100644 index 0000000..c0accaa --- /dev/null +++ b/packages/i18n/src/routing.ts @@ -0,0 +1,26 @@ +import { createNavigation } from "next-intl/navigation" + +import { LOCALES, LOCALE_DEFAULT, LOCALE_PREFIX } from "@repo/utils/constants" +import { defineRouting } from "next-intl/routing" +import type { Locale } from "@repo/utils/constants" + +export interface LocaleProps { + params: Promise<{ + locale: Locale + }> +} + +export const routing = defineRouting({ + locales: LOCALES, + defaultLocale: LOCALE_DEFAULT, + localePrefix: LOCALE_PREFIX, +}) + +export const { + Link, + redirect, + usePathname, + useRouter, + getPathname, + permanentRedirect, +} = createNavigation(routing) diff --git a/packages/i18n/src/translations/en-US.json b/packages/i18n/src/translations/en-US.json index 044bb41..cf488dd 100644 --- a/packages/i18n/src/translations/en-US.json +++ b/packages/i18n/src/translations/en-US.json @@ -10,10 +10,10 @@ "institution": "Conservatoire National des Arts et Métiers (CNAM), in Eckbolsheim - UIMM Alsace - ITII Alsace", "study-type": "Engineer in Computer Science and Information Systems (IS)", "years": { - "2024-2025": { + "2024-2027": { "courses": {}, - "description": "1st year", - "title": "2024 - 2025" + "description": "", + "title": "2024 - 2027" } } }, diff --git a/packages/i18n/src/translations/fr-FR.json b/packages/i18n/src/translations/fr-FR.json index 510866f..a561d8b 100644 --- a/packages/i18n/src/translations/fr-FR.json +++ b/packages/i18n/src/translations/fr-FR.json @@ -10,10 +10,10 @@ "institution": "Conservatoire National des Arts et Métiers (CNAM) à Eckbolsheim - UIMM Alsace - ITII Alsace", "study-type": "Ingénieur en Informatique et Systèmes d'Information (SI)", "years": { - "2024-2025": { + "2024-2027": { "courses": {}, - "description": "1ère année", - "title": "2024 - 2025" + "description": "", + "title": "2024 - 2027" } } }, diff --git a/packages/react-hooks/.eslintrc.json b/packages/react-hooks/.eslintrc.json deleted file mode 100644 index bf40d0d..0000000 --- a/packages/react-hooks/.eslintrc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "root": true, - "extends": ["@repo/eslint-config/nextjs/.eslintrc.json"], - "overrides": [ - { - "files": ["*.ts", "*.tsx"], - "plugins": ["@typescript-eslint"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "projectService": true - } - } - ] -} diff --git a/packages/react-hooks/eslint.config.js b/packages/react-hooks/eslint.config.js new file mode 100644 index 0000000..eee072a --- /dev/null +++ b/packages/react-hooks/eslint.config.js @@ -0,0 +1,13 @@ +import typescriptESLint from "typescript-eslint" +import configNextjs from "@repo/eslint-config/nextjs" + +export default typescriptESLint.config(...configNextjs, { + files: ["**/*.ts", "**/*.tsx"], + languageOptions: { + parser: typescriptESLint.parser, + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, +}) diff --git a/packages/react-hooks/package.json b/packages/react-hooks/package.json index 765d21c..8e92baa 100644 --- a/packages/react-hooks/package.json +++ b/packages/react-hooks/package.json @@ -8,7 +8,7 @@ "./useIsMounted": "./src/useIsMounted.ts" }, "scripts": { - "lint:eslint": "eslint src --max-warnings 0 --report-unused-disable-directives", + "lint:eslint": "eslint src --max-warnings 0", "lint:typescript": "tsc --noEmit", "test": "vitest run --browser.headless", "test:ui": "vitest --ui --no-open" @@ -25,10 +25,11 @@ "@types/react-dom": "catalog:", "@total-typescript/ts-reset": "catalog:", "@vitest/browser": "catalog:", - "@vitest/coverage-istanbul": "catalog:", + "@vitest/coverage-v8": "catalog:", "@vitest/ui": "catalog:", "eslint": "catalog:", "playwright": "catalog:", + "typescript-eslint": "catalog:", "typescript": "catalog:", "vitest": "catalog:" } diff --git a/packages/react-hooks/vitest.config.ts b/packages/react-hooks/vitest.config.ts index 6b097a6..26b2220 100644 --- a/packages/react-hooks/vitest.config.ts +++ b/packages/react-hooks/vitest.config.ts @@ -1,15 +1,19 @@ import { defineConfig } from "vitest/config" export default defineConfig({ + optimizeDeps: { + include: ["@vitest/coverage-v8/browser"], + }, test: { browser: { provider: "playwright", enabled: true, name: "chromium", + screenshotFailures: false, }, coverage: { enabled: true, - provider: "istanbul", + provider: "v8", }, }, }) diff --git a/packages/ui/.eslintrc.json b/packages/ui/.eslintrc.json deleted file mode 100644 index bf40d0d..0000000 --- a/packages/ui/.eslintrc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "root": true, - "extends": ["@repo/eslint-config/nextjs/.eslintrc.json"], - "overrides": [ - { - "files": ["*.ts", "*.tsx"], - "plugins": ["@typescript-eslint"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "projectService": true - } - } - ] -} diff --git a/packages/ui/eslint.config.js b/packages/ui/eslint.config.js new file mode 100644 index 0000000..eee072a --- /dev/null +++ b/packages/ui/eslint.config.js @@ -0,0 +1,13 @@ +import typescriptESLint from "typescript-eslint" +import configNextjs from "@repo/eslint-config/nextjs" + +export default typescriptESLint.config(...configNextjs, { + files: ["**/*.ts", "**/*.tsx"], + languageOptions: { + parser: typescriptESLint.parser, + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, +}) diff --git a/packages/ui/package.json b/packages/ui/package.json index 9c5b7dd..9be5414 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -23,7 +23,7 @@ "./Layout/Section": "./src/Layout/Section/Section.tsx" }, "scripts": { - "lint:eslint": "eslint src --max-warnings 0 --report-unused-disable-directives", + "lint:eslint": "eslint src --max-warnings 0", "lint:typescript": "tsc --noEmit" }, "dependencies": { @@ -51,6 +51,7 @@ "eslint": "catalog:", "postcss": "catalog:", "tailwindcss": "catalog:", + "typescript-eslint": "catalog:", "typescript": "catalog:" } } diff --git a/packages/ui/src/CurriculumVitae/CurriculumVitaeAbout.tsx b/packages/ui/src/CurriculumVitae/CurriculumVitaeAbout.tsx index ea64ab6..7a1b764 100644 --- a/packages/ui/src/CurriculumVitae/CurriculumVitaeAbout.tsx +++ b/packages/ui/src/CurriculumVitae/CurriculumVitaeAbout.tsx @@ -13,7 +13,13 @@ export const CurriculumVitaeAbout: React.FC = () => { title={t("curriculum-vitae.about.title")} icon={} > -

{t.rich("curriculum-vitae.about.description")}

+

+ {t.rich("curriculum-vitae.about.description", { + br: () => { + return
+ }, + })} +

) } diff --git a/packages/ui/src/CurriculumVitae/CurriculumVitaeEducation.tsx b/packages/ui/src/CurriculumVitae/CurriculumVitaeEducation.tsx index c9f4b9e..8ece154 100644 --- a/packages/ui/src/CurriculumVitae/CurriculumVitaeEducation.tsx +++ b/packages/ui/src/CurriculumVitae/CurriculumVitaeEducation.tsx @@ -11,10 +11,10 @@ export const CurriculumVitaeEducation: React.FC< const educations = [ { - years: t("curriculum-vitae.education.cnam.years.2024-2025.title"), + years: t("curriculum-vitae.education.cnam.years.2024-2027.title"), studyType: t("curriculum-vitae.education.cnam.study-type"), institution: t("curriculum-vitae.education.cnam.institution"), - score: t("curriculum-vitae.education.cnam.years.2024-2025.description"), + score: t("curriculum-vitae.education.cnam.years.2024-2027.description"), courses: [], }, { diff --git a/packages/ui/src/CurriculumVitae/CurriculumVitaeProfile.tsx b/packages/ui/src/CurriculumVitae/CurriculumVitaeProfile.tsx index fa6f27a..6fb2725 100644 --- a/packages/ui/src/CurriculumVitae/CurriculumVitaeProfile.tsx +++ b/packages/ui/src/CurriculumVitae/CurriculumVitaeProfile.tsx @@ -1,4 +1,4 @@ -import { Link } from "@repo/i18n/navigation" +import { Link } from "@repo/i18n/routing" import { useTranslations } from "next-intl" import Image from "next/image" import { BirthDate } from "../Home/About/AboutList/BirthDate.tsx" diff --git a/packages/ui/src/Design/Button/Button.tsx b/packages/ui/src/Design/Button/Button.tsx index 7e096e7..7607d25 100644 --- a/packages/ui/src/Design/Button/Button.tsx +++ b/packages/ui/src/Design/Button/Button.tsx @@ -1,5 +1,5 @@ import { classNames } from "@repo/config-tailwind/classNames" -import { Link as NextLink } from "@repo/i18n/navigation" +import { Link as NextLink } from "@repo/i18n/routing" import type { VariantProps } from "cva" import { cva } from "cva" diff --git a/packages/ui/src/Design/Link/Link.tsx b/packages/ui/src/Design/Link/Link.tsx index 71eaad9..9b7e448 100644 --- a/packages/ui/src/Design/Link/Link.tsx +++ b/packages/ui/src/Design/Link/Link.tsx @@ -1,5 +1,5 @@ import { classNames } from "@repo/config-tailwind/classNames" -import { Link as NextLink } from "@repo/i18n/navigation" +import { Link as NextLink } from "@repo/i18n/routing" import { FiExternalLink } from "react-icons/fi" export interface LinkProps extends React.ComponentProps { diff --git a/packages/ui/src/Errors/ErrorServer/ErrorServer.tsx b/packages/ui/src/Errors/ErrorServer/ErrorServer.tsx index 79b14c0..6645204 100644 --- a/packages/ui/src/Errors/ErrorServer/ErrorServer.tsx +++ b/packages/ui/src/Errors/ErrorServer/ErrorServer.tsx @@ -1,6 +1,6 @@ "use client" -import { useRouter } from "@repo/i18n/navigation" +import { useRouter } from "@repo/i18n/routing" import { useTranslations } from "next-intl" import { useEffect, useTransition } from "react" import { Button } from "../../Design/Button/Button.tsx" diff --git a/packages/ui/src/Home/About/AboutDescription.tsx b/packages/ui/src/Home/About/AboutDescription.tsx index cb765c3..750671f 100644 --- a/packages/ui/src/Home/About/AboutDescription.tsx +++ b/packages/ui/src/Home/About/AboutDescription.tsx @@ -10,7 +10,11 @@ export const AboutDescription: React.FC = () => { return (
- {t.rich("home.about.description")} + {t.rich("home.about.description", { + strong: (children) => { + return {children} + }, + })}