millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

ArrayPattern with a Valid syntax throws a TypoError #444

Closed Vasanthi-S closed 8 years ago

Vasanthi-S commented 8 years ago

Hi,

When I try to format the below valid syntax code using ESFormatter, I notice a TypoError being thrown:

Code: var [a , , b] = [1,2,3];

Error thrown: Error: E:\MyEclipse_Folders\workspace\runtime-me_launch_5\W11\WebRoot\test.js Cannot read property 'endToken' of null TypeError: Cannot read property 'endToken' of null at C:\Users\vasanthi\node_modules\esformatter\lib\hooks\ArrayPattern.js:11:31 at Array.forEach (native) at Object.ArrayPattern as format at transformNode (C:\Users\vasanthi\node_modules\esformatter\lib\transform.js:65:10) at Array.forEach (native) at Object.moonwalk (C:\Users\vasanthi\node_modules\esformatter\node_modules\rocambole\rocambole.js:432:11) at transform (C:\Users\vasanthi\node_modules\esformatter\lib\transform.js:37:13) at doFormat (C:\Users\vasanthi\node_modules\esformatter\lib\format.js:130:3) at Object.format (C:\Users\vasanthi\node_modules\esformatter\lib\format.js:44:9) at toConsole (C:\Users\vasanthi\node_modules\esformatter\lib\cli.js:214:26)

millermedeiros commented 8 years ago

@Vasanthi-S thanks a lot for the bug report, fixed on master, will release a new version soon(ish).