Skip to content

Instantly share code, notes, and snippets.

@vkuprin
Last active April 13, 2025 02:38
Show Gist options
  • Save vkuprin/4f2489965118160b1526466a2af4bd1d to your computer and use it in GitHub Desktop.
Save vkuprin/4f2489965118160b1526466a2af4bd1d to your computer and use it in GitHub Desktop.
git ls-files -c "*.js" "*.jsx" "*.ts" "*.tsx" | xargs -I{} perl -i -0pe '
# First, handle specific JSX/TSX comment blocks with curly braces
s|\{\/\*.*?\*\/\}||gs;
# Then handle regular comments
s|(?<!\:)//[^\n]*| |g;
s|/\*.*?\*/| |gs;
# Clean up extra whitespace
s|[ \t]+\n|\n|g;
' {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment