formatjs / babel-plugin-react-intl

Extracts string messages from React components that use React Intl.
http://formatjs.io/react/
Other
420 stars 122 forks source link

JSXOpeningElement not being visited #118

Closed Kronuz closed 5 years ago

Kronuz commented 7 years ago

In my project, for some reason, JSXOpeningElement isn't being visited for all elements (any idea?); however on those, JSXElement does get visited.

I fixed things here by also adding a JSXElement visitor which basically just calls JSXOpeningElement:

JSXElement(path, state) {
    _JSXOpeningElement(path.get('openingElement'), state);
},
JSXOpeningElement(path, state) {
    _JSXOpeningElement(path, state);
},
longlho commented 5 years ago

FormattedMessage is a self-closing tag which is prob the reason why this happens