Skip to content

Conversation

@timtebeek
Copy link
Member

@timtebeek timtebeek commented Nov 10, 2025

Summary

  • Fix RemoveTrailingWhitespace recipe removing shebang lines from JavaScript files
  • Add COMPILATION_UNIT_PREFIX to 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_PREFIX location to preserve shebangs and other file-level prefixes
  • RemoveTrailingWhitespaceTest.java (JavaScript): Add integration test for shebang preservation

Test plan

🤖 Generated with Claude Code

@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Nov 10, 2025
@timtebeek timtebeek added the bug Something isn't working label Nov 10, 2025
@timtebeek timtebeek changed the title Fix RemoveTrailingWhitespace to preserve shebang lines Fix RemoveTrailingWhitespace to preserve shebang lines Nov 10, 2025
@Override
public void defaults(RecipeSpec spec) {
spec.recipe(new RemoveTrailingWhitespace())
.typeValidationOptions(TypeValidation.builder().allowNonWhitespaceInWhitespace(true).build());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might hint at a parser issue as well, but I've not yet gotten the local server running to troubleshoot this one.

@timtebeek timtebeek added question Further information is requested javascript parser labels Nov 10, 2025
@timtebeek timtebeek marked this pull request as draft November 11, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working javascript parser question Further information is requested

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Remove trailing whitespace removes prefix from generate-llms-txt.js

2 participants