antrophiclove
← Kütüphaneye dön
Kurulum
curl -sL https://www.antrophiclove.com/api/kaynak/smart-formatting/raw

Bu içerik mevcut dosyaya elle harmanlanmalı: .claude/settings.json

smart-formatting

Smart code formatting based on file type

Event Configuration

  • Event Type: PostToolUse
  • Tool Matcher: Edit|MultiEdit
  • Category: development

Environment Variables

None required

Requirements

  • prettier for JS/TS
  • black for Python
  • gofmt for Go

Script

file_path=$(jq -r '.tool_input.file_path // empty')
case "$file_path" in
  *.js|*.jsx|*.ts|*.tsx|*.json|*.css|*.md)
    npx prettier --write "$file_path" 2>/dev/null || true
    ;;
  *.py)
    python3 -m black "$file_path" 2>/dev/null || true
    ;;
  *.go)
    gofmt -w "$file_path" 2>/dev/null || true
    ;;
esac