From a3585685df479cdb627442828b17f7cb46f33dca Mon Sep 17 00:00:00 2001
From: wuzhiqing <gtawu12138@gmail.com>
Date: Fri, 26 Jul 2024 11:02:02 +0800
Subject: [PATCH] chore: add ESLint plugin and rules to remove unused imports

- Installed eslint-plugin-unused-imports
- Updated .eslintrc.json to include rules for detecting unused imports
---
 .eslintrc.json |  5 ++++-
 package.json   |  1 +
 yarn.lock      | 12 ++++++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/.eslintrc.json b/.eslintrc.json
index d229e86f2..5b5e88e67 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,4 +1,7 @@
 {
   "extends": "next/core-web-vitals",
-  "plugins": ["prettier"]
+  "plugins": ["prettier", "unused-imports"],
+  "rules": {
+    "unused-imports/no-unused-imports": "warn"
+  }
 }
diff --git a/package.json b/package.json
index ca5fcc0f5..ac4c65f75 100644
--- a/package.json
+++ b/package.json
@@ -66,6 +66,7 @@
     "eslint-config-next": "13.4.19",
     "eslint-config-prettier": "^8.8.0",
     "eslint-plugin-prettier": "^5.1.3",
+    "eslint-plugin-unused-imports": "^3.2.0",
     "husky": "^8.0.0",
     "lint-staged": "^13.2.2",
     "prettier": "^3.0.2",
diff --git a/yarn.lock b/yarn.lock
index 4979e4d99..8751953ca 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3367,6 +3367,18 @@ eslint-plugin-react@^7.31.7:
     semver "^6.3.0"
     string.prototype.matchall "^4.0.8"
 
+eslint-plugin-unused-imports@^3.2.0:
+  version "3.2.0"
+  resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.2.0.tgz#63a98c9ad5f622cd9f830f70bc77739f25ccfe0d"
+  integrity sha512-6uXyn6xdINEpxE1MtDjxQsyXB37lfyO2yKGVVgtD7WEWQGORSOZjgrD6hBhvGv4/SO+TOlS+UnC6JppRqbuwGQ==
+  dependencies:
+    eslint-rule-composer "^0.3.0"
+
+eslint-rule-composer@^0.3.0:
+  version "0.3.0"
+  resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9"
+  integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==
+
 eslint-scope@5.1.1:
   version "5.1.1"
   resolved "https://registry.npmmirror.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"