Prevent CLRF line endings with pre-commit hook#29169
Conversation
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
e036d2e to
4738553
Compare
|
/bonk do you see any issues with this? |
|
Reviewing this PR that adds a Husky pre-commit hook for LF line endings. Findings: The PR adds a pre-commit hook that:
The implementation is solid with proper handling for:
Minor issue: Line 14 in if [ ! -f "$file" ]; thenThis is already correct. However, line 13 and line 20 also use for file in $STAGED; do # Line 13 - will break on spacesAnd line 20: if grep -qU $'\r' "$file"; then # Line 20 - correctly quotedRecommendation: Line 13 should handle word splitting properly. The while IFS= read -r file; do
# ... existing logic ...
done <<< "$STAGED"Overall assessment: The hook is a useful defense-in-depth addition alongside the existing LGTM with the minor note about filename handling. The space-in-filename issue is an edge case but worth addressing for robustness. |
|
/bonk please review |
|
Posted 1 suggestion on the node_modules cache key. The pre-commit hook looks solid—properly handles filenames with spaces, deleted files, and cross-platform compatibility. Good defense alongside |
3100e0c to
735b8dd
Compare
|
Preview URL: https://735b8ddf.preview.developers.cloudflare.com |
Summary