max-mapper / standard-format

converts your code into Standard JavaScript Format
264 stars 59 forks source link

new statements with linebreaks and comments break #156

Closed tmcw closed 8 years ago

tmcw commented 8 years ago

Hi there Max!

This is one of those 1% of suspected compiler bugs that end up being compiler bugs :)

This input:

var foo = new // ARRAY_COPY(
  Date();

console.log(foo);

Runs correctly with node:

~/src/decode-webp〉node formatter-bug.js
Thu Mar 31 2016 18:33:54 GMT-0400 (EDT)

After standard-format:

~/src/decode-webp〉standard-format formatter-bug.js
var foo = new // ARRAY_COPY(Date()

console.log(foo)

Which is invalid, and crashes node.

tmcw commented 8 years ago

Bug is upstream in esformatter: https://github.com/millermedeiros/esformatter/pull/439

tmcw commented 8 years ago

semver will magically upgrade to 0.9.4 of esformatter, and the fix is in there https://github.com/millermedeiros/esformatter/blob/master/CHANGELOG.md#v094-2016-05-25

yoshuawuyts commented 8 years ago

hah, that's a cute lil bug :sparkles: