From 9e3e36364a4ff051805b1955bf90ea503ea0839c Mon Sep 17 00:00:00 2001 From: Rahman Date: Tue, 7 Jul 2026 17:22:57 +0200 Subject: [PATCH] chore: auto-fix eslint issues in post-edit hook The PostToolUse hook ran prettier --write then a report-only `pnpm run lint`. Fixable eslint issues at warning severity (e.g. import/order) were never corrected and never failed lint, so they leaked into commits and had to be fixed manually with `eslint --fix`. Add an `eslint --fix "$FILE_PATH"` pass after prettier and before the report-only lint, scoped to the edited file (matching the prettier step). This auto-corrects all eslint-fixable rules on each edit while the final lint pass still gates on errors. --- .claude/hooks/post-edit.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.claude/hooks/post-edit.sh b/.claude/hooks/post-edit.sh index 1e106043b5..3314eb3c58 100755 --- a/.claude/hooks/post-edit.sh +++ b/.claude/hooks/post-edit.sh @@ -44,6 +44,13 @@ else pnpm exec prettier --write "$FILE_PATH" 2>/dev/null fi +# Auto-fix eslint-fixable issues (import order, prefer-const, etc.) on the edited file. +# This corrects fixable warnings that the report-only lint pass below would otherwise +# leave in place (import/order is a warning, so it never fails lint but does clutter diffs). +if [[ -n "$PACKAGE_DIR" ]]; then + (cd "$PACKAGE_DIR" && pnpm exec eslint --fix "$FILE_PATH" 2>/dev/null) +fi + # Run lint from the package directory using the project's lint setup if [[ -n "$PACKAGE_DIR" ]]; then LINT_OUTPUT=$(cd "$PACKAGE_DIR" && pnpm run lint 2>&1)