zaach / jsxgettext

Extract gettext calls from JavaScript, EJS, and other template formats.
Mozilla Public License 2.0
105 stars 56 forks source link

JSX bare attributes throw exception #110

Closed remko closed 7 years ago

remko commented 8 years ago

When I run jsxgettext on the following JS(X) snippet:

const x = <input required/>;

I get an exception:

jsxgettext/lib/jsxgettext.js:29
    if (node.value.type === 'JSXExpressionContainer') {
                  ^

TypeError: Cannot read property 'type' of null
    at Object.assign.JSXAttribute (jsxgettext/lib/jsxgettext.js:29:19)
    at c (jsxgettext/node_modules/acorn/dist/walk.js:38:15)

Changing the bare attribute to required={true} fixes the error.

BYK commented 7 years ago

Fixed by #107.