From c52e7ebb198b869719fcfe12e9296891317ad48e Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Wed, 23 Dec 2015 15:23:12 +0100 Subject: [PATCH] [babel] Fix issue with transform-react-inline-elements --- src/index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index bf3e564..bc7a7b9 100644 --- a/src/index.js +++ b/src/index.js @@ -3,11 +3,16 @@ module.exports = function() { return { visitor: { - JSXIdentifier: function(path) { - if (path.node.name === 'data-test') { - path.parentPath.remove(); - } - }, + Program(path) { + // On program start, do an explicit traversal up front for your plugin. + path.traverse({ + JSXIdentifier: function(path) { + if (path.node.name === 'data-test') { + path.parentPath.remove(); + } + }, + }); + } }, }; };