acornjs/acorn-jsx

Whitespace not allowed after "}" in certain contexts

Closed this issue · 4 comments

Original report from downstream 6to5/acorn-6to5/issues/5:

The following all produce errors in the repl

var a = {} ;
var  a = ({} );
var a = b({} );
var a = <div>{ {a} }</div>;
var a = <div {...a} ></div>;

I've traced it down to the line while (!eat(_braceR)) { in the parseObj function. I think adding skipSpace() before the loop, and as the last thing in the loop, will fix the problem.

Well, all the examples but var a = <div>{ {a} }</div>; work completely fine for me. Probably you just had corrupted state after JSX-specific errors and then tried other cases without restarting REPL.

That example should still work: var a = <div>{ {1:1} }</div>; also fails.

As you can see, it's already fixed in acorn-jsx (works fine to me with latest version).

Works fine in the latest version of 6to5/acorn-6to5 too.