cd web && npx lint-staged || exit 1
cd ..

# dotnet format on staged .cs files (repo root). Scoped to the staged files so we
# don't pay the full-tree cost; skip entirely when no .cs is staged (avoids the
# ~20-40s sln load for web-only commits).
cs_files=$(git diff --cached --name-only --diff-filter=ACM -- '*.cs')
if [ -n "$cs_files" ]; then
  echo "husky - dotnet format (verify) on staged .cs files"
  # shellcheck disable=SC2086
  dotnet format ErsatzTV.sln --verify-no-changes --include $cs_files || {
    echo "husky - dotnet format found issues in staged .cs files; run 'dotnet format ErsatzTV.sln --include <files>' to fix"
    exit 1
  }
fi
