From b365ced0f7a34d6a6b9efab48ad493a2a8dae120 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 3 Jun 2026 11:38:06 +0000 Subject: [PATCH] fix(eslint): use native Next.js typescript-eslint setup The config spread both eslint-config-next and our own typescript-eslint, each registering the @typescript-eslint plugin. As two separate installs they became distinct instances and ESLint flat config crashed with "Cannot redefine plugin" whenever the versions drifted apart (e.g. the 8.60 bump). Switch to the native Next.js setup: spread next/core-web-vitals + next/typescript (the latter already bundles the typescript-eslint recommended rules) and drop the direct @typescript-eslint/* and typescript-eslint dependencies. Now a single typescript-eslint instance (provided transitively by Next) is in play, so the crash cannot recur and no pnpm override is needed. --- eslint.config.js | 18 ++++++++++++------ package.json | 5 +---- pnpm-lock.yaml | 9 --------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index c79bcb4..214b591 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,17 +1,17 @@ const { defineConfig } = require('eslint/config'); const globals = require('globals'); -const tseslint = require('typescript-eslint'); const simpleImportSort = require('eslint-plugin-simple-import-sort'); const unusedImports = require('eslint-plugin-unused-imports'); const { FlatCompat } = require('@eslint/eslintrc'); -const eslintNext = require('eslint-config-next'); +const nextCoreWebVitals = require('eslint-config-next/core-web-vitals'); +const nextTypescript = require('eslint-config-next/typescript'); const compat = new FlatCompat({ baseDirectory: __dirname }); module.exports = defineConfig([ - ...eslintNext, - ...tseslint.configs.recommended, // bringt Plugin + Rules mit + ...nextCoreWebVitals, + ...nextTypescript, ...compat.extends('prettier', 'plugin:prettier/recommended'), { languageOptions: { @@ -32,8 +32,6 @@ module.exports = defineConfig([ 'no-unused-vars': 'off', 'no-console': 'warn', 'no-multi-spaces': 'error', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-unused-vars': 'off', 'react/no-unescaped-entities': 'off', 'react/display-name': 'off', 'object-curly-spacing': ['warn', 'always'], @@ -84,4 +82,12 @@ module.exports = defineConfig([ ], }, }, + + { + files: ['**/*.ts', '**/*.tsx'], + rules: { + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-unused-vars': 'off', + }, + }, ]); diff --git a/package.json b/package.json index a90233e..b3204cc 100644 --- a/package.json +++ b/package.json @@ -75,8 +75,6 @@ "@types/node": "24.12.4", "@types/qs": "6.15.1", "@types/react": "19.2.16", - "@typescript-eslint/eslint-plugin": "8.59.4", - "@typescript-eslint/parser": "8.59.4", "eslint": "9.39.4", "eslint-config-next": "16.2.7", "eslint-config-prettier": "10.1.8", @@ -94,7 +92,6 @@ "prettier": "3.8.3", "prettier-plugin-tailwindcss": "0.8.0", "tailwindcss": "4.3.0", - "typescript": "6.0.3", - "typescript-eslint": "8.59.4" + "typescript": "6.0.3" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6aaae8d..450454e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,12 +99,6 @@ importers: '@types/react': specifier: 19.2.16 version: 19.2.16 - '@typescript-eslint/eslint-plugin': - specifier: 8.59.4 - version: 8.59.4(@typescript-eslint/parser@8.59.4(eslint@9.39.4(jiti@2.6.1))(typescript@6.0.3))(eslint@9.39.4(jiti@2.6.1))(typescript@6.0.3) - '@typescript-eslint/parser': - specifier: 8.59.4 - version: 8.59.4(eslint@9.39.4(jiti@2.6.1))(typescript@6.0.3) eslint: specifier: 9.39.4 version: 9.39.4(jiti@2.6.1) @@ -159,9 +153,6 @@ importers: typescript: specifier: 6.0.3 version: 6.0.3 - typescript-eslint: - specifier: 8.59.4 - version: 8.59.4(eslint@9.39.4(jiti@2.6.1))(typescript@6.0.3) packages: