diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 6b10a5b..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": [ - "next/core-web-vitals", - "next/typescript" - ] -} diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index a9d8cea..36aacf5 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -28,4 +28,4 @@ jobs: run: pnpm install - name: Run check - run: pnpm run check + run: pnpm run lint diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..82181eb --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,37 @@ +// @ts-check +import { defineConfig, globalIgnores } from "eslint/config"; +import nextVitals from "eslint-config-next/core-web-vitals"; +import nextTs from "eslint-config-next/typescript"; +import tseslint from "typescript-eslint"; + +const eslintConfig = defineConfig([ + // Next.js core-web-vitals and TypeScript configs + ...nextVitals, + ...nextTs, + // Add strict TypeScript rules on top + ...tseslint.configs.strictTypeChecked, + ...tseslint.configs.stylisticTypeChecked, + // Configure TypeScript parser options + { + files: ["**/*.{ts,tsx}"], + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + }, + // Override default ignores of eslint-config-next + globalIgnores([ + // Default ignores of eslint-config-next: + ".next/**", + "out/**", + "build/**", + "next-env.d.ts", + // Additional ignores: + "*.mjs", + "tailwind.config.ts", + ]), +]); + +export default eslintConfig; diff --git a/package.json b/package.json index fe005ae..0a70a88 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,10 @@ "dev": "next dev --turbopack", "build": "next build", "start": "next start", - "check": "next lint && npx tsc --noEmit" + "lint": "next typegen && eslint . && npx tsc --noEmit" }, "dependencies": { + "@eslint/js": "^9.39.1", "@hookform/resolvers": "^5.1.1", "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-popover": "^1.1.14", @@ -42,7 +43,8 @@ "postcss": "8.5.6", "tailwindcss": "4.1.17", "turbo": "2.6.1", - "typescript": "5.9.3" + "typescript": "5.9.3", + "typescript-eslint": "^8.46.4" }, "packageManager": "pnpm@10.21.0", "pnpm": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c1956e6..2eeefea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,6 +12,9 @@ importers: .: dependencies: + '@eslint/js': + specifier: ^9.39.1 + version: 9.39.1 '@hookform/resolvers': specifier: ^5.1.1 version: 5.2.2(react-hook-form@7.66.0(react@19.2.0)) @@ -109,6 +112,9 @@ importers: typescript: specifier: 5.9.3 version: 5.9.3 + typescript-eslint: + specifier: ^8.46.4 + version: 8.46.4(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) packages: diff --git a/tsconfig.json b/tsconfig.json index dd21ba8..e1867c3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "preserve", + "jsx": "react-jsx", "incremental": true, "plugins": [ { @@ -22,6 +22,13 @@ }, "target": "ES2023" }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "event-dates.json"], + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts", + "event-dates.json", + ".next/dev/types/**/*.ts" + ], "exclude": ["node_modules"] }