acornjs / acorn-jsx

Alternative, faster React.js JSX parser
MIT License
646 stars 72 forks source link

Incorrect parsing when static properties are met #36

Closed toninorair closed 8 years ago

toninorair commented 8 years ago

If static properties were found in code, parsing does not work correctly, JsxElements aren't parsed correctly anymore. For example: class B {} class A { static propTypes = { className: 1 }; render() { return ( <B></B> );}}

if propTypes statement if present, JsxElement 'B' isn't resolved correctly

RReverser commented 8 years ago

Please format code using Markdown (between ```js and ````` lines), as not only formatting is off, but it also looks like some pieces were removed by Github's sanitizer.

toninorair commented 8 years ago

The main idea of message that 'static propTypes` breaks further parsing

RReverser commented 8 years ago

I see. This is in fact out of scope of this plugin - each plugin extends Acorn with some specific syntax, and you need to combine them if you want to use several unofficial features on top of JavaScript (like JSX or static properties).

Unfortunately, I'm not aware of a plugin that allows static properties at the moment, so can't help you with this one (maybe @Rich-Harris knows though?).

Closing as not related to the JSX plugin.

Rich-Harris commented 8 years ago

maybe @Rich-Harris knows though?

afraid not :(