acorn-static-class-property-initializer
Partial support for static class properties from ES Class Fields & Static Properties Proposal in Acorn - a tiny, fast JavaScript parser, written completely in JavaScript.
Purpose
Made to support static property initializers in React components written as ES6+ classes:
static propTypes = entityState: PropTypesstringisRequired ; { return <div>thispropsentityState</div>; }
Usage
You can use module directly in order to get Acorn instance with plugin installed:
var acorn = ;
Or you can use inject.js
to inject multiple plugins into Acorn:
var acorn = ;var injectAcornJsx = ;var injectAcornStaticClassPropertyInitializer = ;;;
Then, use the plugins
option whenever you need to support static class properties while parsing:
var ast = acorn;