Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@ pre-commit:
parallel: true
commands:
autofix:
glob: "*.{rb,rake,ru}"
run: bin/lefthook/ruby-autofix all-changed
stage_fixed: true

rubocop:
glob: "*.{rb,rake,ru}"
run: bin/lefthook/ruby-lint all-changed

eslint:
glob: "*.{js,jsx,ts,tsx}"
run: bin/lefthook/eslint-lint all-changed
stage_fixed: true

prettier:
glob: "*.{js,jsx,ts,tsx,json,md,yml,yaml}"
run: bin/lefthook/prettier-format all-changed
stage_fixed: true

trailing-newlines:
run: bin/lefthook/check-trailing-newlines all-changed
Expand Down
10 changes: 0 additions & 10 deletions bin/lefthook/prettier-format
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ if [ -n "$root_files" ]; then
printf " %s\n" $root_files

yarn run prettier --write $root_files

# Re-stage files if running on staged or all-changed context
if [ "$CONTEXT" = "staged" ] || [ "$CONTEXT" = "all-changed" ]; then
echo $root_files | xargs -r git add
fi
fi

# Format Pro files (using Pro's Prettier config)
Expand All @@ -44,11 +39,6 @@ if [ -n "$pro_files" ]; then
pro_files_relative=$(echo "$pro_files" | sed 's|^react_on_rails_pro/||')

(cd react_on_rails_pro && yarn run prettier --write $pro_files_relative)

# Re-stage files if running on staged or all-changed context
if [ "$CONTEXT" = "staged" ] || [ "$CONTEXT" = "all-changed" ]; then
echo $pro_files | xargs -r git add
fi
fi

echo "✅ Prettier formatting complete"
6 changes: 1 addition & 5 deletions bin/lefthook/ruby-autofix
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ printf " %s\n" $files

bundle exec rake autofix

# Re-stage files if running on staged or all-changed context
if [ "$CONTEXT" = "staged" ] || [ "$CONTEXT" = "all-changed" ]; then
echo $files | xargs -r git add
echo "✅ Re-staged formatted files"
fi
echo "Completed auto-fixing all linting violations"