diff --git a/Makefile b/Makefile index 66f038db..a22693d4 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,13 @@ license-check: scripts/update_go_license.sh --check prettier: - @echo "==> Formatting backend Go source..." - gofmt -w $$(find . -type f -name '*.go' -not -path './.git/*' -not -path './frontend/*') - @echo "==> Formatting frontend source..." + @echo "==> Formatting backend Go source and removing unused imports..." + @command -v goimports >/dev/null 2>&1 || { \ + echo "goimports not found, installing..."; \ + go install golang.org/x/tools/cmd/goimports@latest; \ + } + goimports -w $$(find . -type f -name '*.go' -not -path './.git/*' -not -path './frontend/*') + @echo "==> Formatting frontend source and removing unused imports..." cd frontend && pnpm format build-embedded: diff --git a/frontend/app/(main)/pages/detail/components/danger-zone-card.tsx b/frontend/app/(main)/pages/detail/components/danger-zone-card.tsx index f16ef52f..9995c702 100644 --- a/frontend/app/(main)/pages/detail/components/danger-zone-card.tsx +++ b/frontend/app/(main)/pages/detail/components/danger-zone-card.tsx @@ -20,7 +20,6 @@ import { Button } from '@/components/ui/button'; import { Card, CardContent, - CardDescription, CardHeader, CardTitle, } from '@/components/ui/card'; diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs index fa167c8d..4e728f12 100644 --- a/frontend/eslint.config.mjs +++ b/frontend/eslint.config.mjs @@ -1,6 +1,7 @@ import { dirname } from 'path'; import { fileURLToPath } from 'url'; import { FlatCompat } from '@eslint/eslintrc'; +import unusedImports from 'eslint-plugin-unused-imports'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); @@ -20,6 +21,25 @@ const eslintConfig = [ 'next-env.d.ts', ], }, + { + plugins: { + 'unused-imports': unusedImports, + }, + rules: { + // Prefer unused-imports so unused imports can be auto-removed with --fix. + '@typescript-eslint/no-unused-vars': 'off', + 'unused-imports/no-unused-imports': 'error', + 'unused-imports/no-unused-vars': [ + 'warn', + { + vars: 'all', + varsIgnorePattern: '^_', + args: 'after-used', + argsIgnorePattern: '^_', + }, + ], + }, + }, ]; export default eslintConfig; diff --git a/frontend/package.json b/frontend/package.json index 4a199d34..f8a7ed16 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -93,6 +93,7 @@ "@types/react-dom": "^19", "eslint": "^9", "eslint-config-next": "15.5.6", + "eslint-plugin-unused-imports": "^4.4.1", "jsdom": "^29.1.1", "prettier": "^3.9.5", "tailwindcss": "^4", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index d2ce924d..73b5ace3 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -243,6 +243,9 @@ importers: eslint-config-next: specifier: 15.5.6 version: 15.5.6(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + eslint-plugin-unused-imports: + specifier: ^4.4.1 + version: 4.4.1(@typescript-eslint/eslint-plugin@8.46.3(@typescript-eslint/parser@8.46.3(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@9.39.1(jiti@2.6.1)) jsdom: specifier: ^29.1.1 version: 29.1.1 @@ -2746,6 +2749,15 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7 + eslint-plugin-unused-imports@4.4.1: + resolution: {integrity: sha512-oZGYUz1X3sRMGUB+0cZyK2VcvRX5lm/vB56PgNNcU+7ficUCKm66oZWKUubXWnOuPjQ8PvmXtCViXBMONPe7tQ==} + peerDependencies: + '@typescript-eslint/eslint-plugin': ^8.0.0-0 || ^7.0.0 || ^6.0.0 || ^5.0.0 + eslint: ^10.0.0 || ^9.0.0 || ^8.0.0 + peerDependenciesMeta: + '@typescript-eslint/eslint-plugin': + optional: true + eslint-scope@8.4.0: resolution: {integrity: sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -7131,6 +7143,12 @@ snapshots: string.prototype.matchall: 4.0.12 string.prototype.repeat: 1.0.0 + eslint-plugin-unused-imports@4.4.1(@typescript-eslint/eslint-plugin@8.46.3(@typescript-eslint/parser@8.46.3(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@9.39.1(jiti@2.6.1)): + dependencies: + eslint: 9.39.1(jiti@2.6.1) + optionalDependencies: + '@typescript-eslint/eslint-plugin': 8.46.3(@typescript-eslint/parser@8.46.3(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-scope@8.4.0: dependencies: esrecurse: 4.3.0