rewrite
rewrite copied to clipboard
Fix `RemoveTrailingWhitespace` to preserve shebang lines
Summary
- Fix
RemoveTrailingWhitespacerecipe removing shebang lines from JavaScript files - Add
COMPILATION_UNIT_PREFIXto the list of locations to skip when removing trailing whitespace - Add test case to verify shebang preservation in JavaScript files
Changes
-
RemoveTrailingWhitespaceVisitor.java: Skip
COMPILATION_UNIT_PREFIXlocation to preserve shebangs and other file-level prefixes - RemoveTrailingWhitespaceTest.java (JavaScript): Add integration test for shebang preservation
Test plan
-
[x] New JavaScript integration test passes:
RemoveTrailingWhitespaceTest.doNotRemoveShebang() -
[x] All existing Java tests pass:
RemoveTrailingWhitespaceTest -
[x] Verified the fix resolves the issue described in #6274
-
Fixes #6274
🤖 Generated with Claude Code
CI taking more than 1hr to run? Is it stuck or what's wrong with this?