royriojas / esformatter-jsx

esformatter plugin: format jsx files (or js files with Facebook React JSX Syntax)
MIT License
142 stars 25 forks source link

Esformatter crashed when there are comments in jsx #59

Open CowSmiles opened 8 years ago

CowSmiles commented 8 years ago

When there is comment is jsx, the esformatter will crash reporting the following error: "test.jsx" 10L, 242C written Error while executing esformatter! no changes made. Error: stdin Cannot read property 'value' of undefined TypeError: Cannot read property 'value' of undefined at getParentheses (/usr/lib/node_modules/esformatter/lib/hooks/expressionParentheses.js:26:66) at Object.addSpaceInsideExpressionParentheses [as addSpaceInside] (/usr/lib/node_modules/esformatter/lib/hooks/expressionParentheses.js:10:21) at transformNode (/usr/lib/node_modules/esformatter/lib/transform.js:78:25) at Array.forEach (native) at Object.moonwalk (/usr/lib/node_modules/esformatter/node_modules/rocambole/rocambole.js:432:11) at transform (/usr/lib/node_modules/esformatter/lib/transform.js:37:13) at doFormat (/usr/lib/node_modules/esformatter/lib/format.js:130:3) at Object.format (/usr/lib/node_modules/esformatter/lib/format.js:44:9) at toConsole (/usr/lib/node_modules/esformatter/lib/cli.js:214:26) at /usr/lib/node_modules/esformatter/lib/cli.js:85:7

After deleting the comment, it will works.

Test file: test.jsx.zip

millermedeiros commented 8 years ago

probably duplicate of https://github.com/millermedeiros/esformatter/issues/427 (which was fixed on esformatter v0.9.4)