From 640ce671d4de4d1eed324bd25736dc0017f1826a Mon Sep 17 00:00:00 2001 From: Bentroen <29354120+Bentroen@users.noreply.github.com> Date: Mon, 6 Oct 2025 23:10:57 -0300 Subject: [PATCH] chore: re-add `eslint-plugin-unused-imports` to ESLint config --- bun.lock | 6 ++---- eslint.config.mjs | 24 ++++++++++++++---------- package.json | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/bun.lock b/bun.lock index 8c4b1aa8..c9b14326 100644 --- a/bun.lock +++ b/bun.lock @@ -15,7 +15,7 @@ "eslint": "^9.36.0", "eslint-plugin-import": "^2.32.0", "eslint-plugin-mdx": "^3.6.2", - "eslint-plugin-unused-imports": "^2.0.0", + "eslint-plugin-unused-imports": "^4.2.0", "globals": "^16.4.0", "husky": "^9.1.7", "lint-staged": "^16.2.3", @@ -1608,9 +1608,7 @@ "eslint-plugin-react-hooks": ["eslint-plugin-react-hooks@5.0.0-canary-7118f5dd7-20230705", "", { "peerDependencies": { "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" } }, "sha512-AZYbMo/NW9chdL7vk6HQzQhT+PvTAEVqWk9ziruUoW2kAOcN5qNyelv70e0F1VNQAbvutOC9oc+xfWycI9FxDw=="], - "eslint-plugin-unused-imports": ["eslint-plugin-unused-imports@2.0.0", "", { "dependencies": { "eslint-rule-composer": "^0.3.0" }, "peerDependencies": { "@typescript-eslint/eslint-plugin": "^5.0.0", "eslint": "^8.0.0" }, "optionalPeers": ["@typescript-eslint/eslint-plugin"] }, "sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A=="], - - "eslint-rule-composer": ["eslint-rule-composer@0.3.0", "", {}, "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg=="], + "eslint-plugin-unused-imports": ["eslint-plugin-unused-imports@4.2.0", "", { "peerDependencies": { "@typescript-eslint/eslint-plugin": "^8.0.0-0 || ^7.0.0 || ^6.0.0 || ^5.0.0", "eslint": "^9.0.0 || ^8.0.0" }, "optionalPeers": ["@typescript-eslint/eslint-plugin"] }, "sha512-hLbJ2/wnjKq4kGA9AUaExVFIbNzyxYdVo49QZmKCnhk5pc9wcYRbfgLHvWJ8tnsdcseGhoUAddm9gn/lt+d74w=="], "eslint-scope": ["eslint-scope@8.4.0", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg=="], diff --git a/eslint.config.mjs b/eslint.config.mjs index 2e59d116..688d6684 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -4,6 +4,7 @@ import eslint from '@eslint/js'; import { defineConfig } from 'eslint/config'; import importPlugin from 'eslint-plugin-import'; import react from 'eslint-plugin-react'; +import unusedImports from 'eslint-plugin-unused-imports'; import globals from 'globals'; import tseslint from 'typescript-eslint'; @@ -34,6 +35,7 @@ export default defineConfig( }, plugins: { import: importPlugin, + 'unused-imports': unusedImports, }, settings: { 'import/resolver': { @@ -57,16 +59,7 @@ export default defineConfig( '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/no-require-imports': 'warn', '@typescript-eslint/ban-ts-comment': 'warn', - '@typescript-eslint/no-unused-vars': [ - 'warn', - { - vars: 'all', - varsIgnorePattern: '^_', - args: 'after-used', - argsIgnorePattern: '^_', - caughtErrors: 'none', // Allow unused error variables in catch blocks - }, - ], + '@typescript-eslint/no-unused-vars': 'off', // Handled by unused-imports plugin 'lines-between-class-members': [ 'warn', 'always', @@ -98,6 +91,17 @@ export default defineConfig( ], 'import/newline-after-import': 'warn', 'import/no-duplicates': 'warn', + 'unused-imports/no-unused-imports': 'warn', + 'unused-imports/no-unused-vars': [ + 'warn', + { + vars: 'all', + varsIgnorePattern: '^_', + args: 'after-used', + argsIgnorePattern: '^_', + caughtErrors: 'none', // Allow unused error variables in catch blocks + }, + ], }, }, diff --git a/package.json b/package.json index b9a8fc52..1c4fb4ef 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "eslint": "^9.36.0", "eslint-plugin-import": "^2.32.0", "eslint-plugin-mdx": "^3.6.2", - "eslint-plugin-unused-imports": "^2.0.0", + "eslint-plugin-unused-imports": "^4.2.0", "globals": "^16.4.0", "husky": "^9.1.7", "lint-staged": "^16.2.3",