diff --git a/.gitea/workflows/check.yml b/.gitea/workflows/lint.yml similarity index 92% rename from .gitea/workflows/check.yml rename to .gitea/workflows/lint.yml index b323bdf..e1e8e8f 100644 --- a/.gitea/workflows/check.yml +++ b/.gitea/workflows/lint.yml @@ -27,5 +27,5 @@ jobs: - name: Install dependencies run: pnpm install - - name: Run check - run: pnpm run check + - name: Run lint + run: pnpm run lint diff --git a/eslint.config.js b/eslint.config.js deleted file mode 100644 index 18540a3..0000000 --- a/eslint.config.js +++ /dev/null @@ -1,48 +0,0 @@ -import { FlatCompat } from "@eslint/eslintrc"; -import tseslint from "typescript-eslint"; - -const compat = new FlatCompat({ - baseDirectory: import.meta.dirname, -}); - -export default tseslint.config( - { - ignores: [".next"], - }, - ...compat.extends("next/core-web-vitals"), - { - files: ["**/*.ts", "**/*.tsx"], - extends: [ - ...tseslint.configs.recommended, - ...tseslint.configs.recommendedTypeChecked, - ...tseslint.configs.stylisticTypeChecked, - ], - rules: { - "@typescript-eslint/array-type": "off", - "@typescript-eslint/consistent-type-definitions": "off", - "@typescript-eslint/consistent-type-imports": [ - "warn", - { prefer: "type-imports", fixStyle: "inline-type-imports" }, - ], - "@typescript-eslint/no-unused-vars": [ - "warn", - { argsIgnorePattern: "^_" }, - ], - "@typescript-eslint/require-await": "off", - "@typescript-eslint/no-misused-promises": [ - "error", - { checksVoidReturn: { attributes: false } }, - ], - }, - }, - { - linterOptions: { - reportUnusedDisableDirectives: true, - }, - languageOptions: { - parserOptions: { - projectService: true, - }, - }, - }, -); 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/next.config.js b/next.config.ts similarity index 90% rename from next.config.js rename to next.config.ts index 121c4f4..acdb540 100644 --- a/next.config.js +++ b/next.config.ts @@ -2,7 +2,7 @@ * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful * for Docker builds. */ -import "./src/env.js"; +import './src/env.ts'; /** @type {import("next").NextConfig} */ const config = {}; diff --git a/package.json b/package.json index ce5d41c..6a27355 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dev": "next dev --turbopack", "format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,mdx}\" --cache", "format:write": "prettier --write \"**/*.{ts,tsx,js,jsx,mdx}\" --cache", - "lint:fix": "next lint --fix", + "lint": "next typegen && eslint . && npx tsc --noEmit", "preview": "next build && next start", "start": "next start" }, @@ -34,13 +34,13 @@ "zod": "^4.0.0" }, "devDependencies": { - "@eslint/eslintrc": "3.3.1", "@tailwindcss/postcss": "4.1.17", "@types/node": "24.10.1", "@types/react": "19.2.5", "@types/react-dom": "19.2.3", "eslint": "9.39.1", "eslint-config-next": "16.0.3", + "eslint-config-prettier": "^10.1.8", "eslint-plugin-react-hooks": "5.2.0", "postcss": "8.5.6", "prettier": "3.6.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 841b401..a7298f0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -67,9 +67,6 @@ importers: specifier: ^4.0.0 version: 4.1.12 devDependencies: - '@eslint/eslintrc': - specifier: 3.3.1 - version: 3.3.1 '@tailwindcss/postcss': specifier: 4.1.17 version: 4.1.17 @@ -88,6 +85,9 @@ importers: eslint-config-next: specifier: 16.0.3 version: 16.0.3(@typescript-eslint/parser@8.46.4(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + eslint-config-prettier: + specifier: ^10.1.8 + version: 10.1.8(eslint@9.39.1(jiti@2.6.1)) eslint-plugin-react-hooks: specifier: 5.2.0 version: 5.2.0(eslint@9.39.1(jiti@2.6.1)) @@ -1499,6 +1499,12 @@ packages: typescript: optional: true + eslint-config-prettier@10.1.8: + resolution: {integrity: sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} @@ -4109,6 +4115,10 @@ snapshots: - eslint-plugin-import-x - supports-color + eslint-config-prettier@10.1.8(eslint@9.39.1(jiti@2.6.1)): + dependencies: + eslint: 9.39.1(jiti@2.6.1) + eslint-import-resolver-node@0.3.9: dependencies: debug: 3.2.7 diff --git a/src/env.js b/src/env.ts similarity index 100% rename from src/env.js rename to src/env.ts diff --git a/tsconfig.json b/tsconfig.json index 62d6fc0..9cf6a2d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,42 +1,35 @@ { "compilerOptions": { - /* Base Options: */ - "esModuleInterop": true, + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": false, "skipLibCheck": true, - "target": "es2022", - "allowJs": true, - "resolveJsonModule": true, - "moduleDetection": "force", - "isolatedModules": true, - "verbatimModuleSyntax": true, - - /* Strictness */ "strict": true, - "noUncheckedIndexedAccess": true, - "checkJs": true, - - /* Bundled projects */ - "lib": ["dom", "dom.iterable", "ES2022"], "noEmit": true, - "module": "ESNext", - "moduleResolution": "Bundler", - "jsx": "preserve", - "plugins": [{ "name": "next" }], + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "react-jsx", "incremental": true, - - /* Path Aliases */ "baseUrl": ".", "paths": { "@/*": ["./src/*"] - } + }, + "target": "ES2022", + "forceConsistentCasingInFileNames": true, + "verbatimModuleSyntax": true, + "noUncheckedIndexedAccess": false, + "exactOptionalPropertyTypes": false, + "noImplicitReturns": false, + "plugins": [{ "name": "next" }] }, "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx", - "**/*.cjs", - "**/*.js", - ".next/types/**/*.ts" + ".next/types/**/*.ts", + ".next/dev/types/**/*.ts" ], "exclude": ["node_modules"] }