Bug#931359: Ruins newlines around comments and end of file

積丹尼 Dan Jacobson jidanni at jidanni.org
Tue Jul 2 21:36:09 BST 2019


X-Debbugs-Cc: fayland at gmail.com
Package: libjavascript-beautifier-perl
Version: 0.25-1
File: /usr/bin/js_beautify

Despite preserve newlines default, it
* ruins newlines near comments.
* rips up newline at end of file.

$ cat k.js
// comment 1

// comment 2

var a = 1;
$ js_beautify k.js
// comment 1
// comment 2
var a = 1;$ js_beautify k.js|diff k.js -
2d1
< 
4,5c3
< 
< var a = 1;
---
> var a = 1;
\ No newline at end of file
$

P.S., on the man pages

       $js_source_code = <<'EOF';
         a = 12;
         {return '\\w+';} EOF

shouldn't EOF be on a new line?


By the way, js_beautify --preserve_newlines is permanently on with no way to turn it off.

P.S., you only preserve one newline of
var
a = 1;
var a
= 1;

See also https://rt.cpan.org/Public/Bug/Display.html?id=127384



More information about the pkg-perl-maintainers mailing list