From ab1cbe57d2cb4a2d4e7f2ccfedd3c2c00a23a948 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Wed, 25 Nov 2015 13:02:25 +0100 Subject: [PATCH] [babel] upgrade to babel@6 --- .babelrc | 5 +++++ package.json | 6 ++++-- src/index.js | 12 ++++++------ test/fixtures/simple/actual.js | 2 +- test/fixtures/simple/expected.js | 5 +---- 5 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..2e9146f --- /dev/null +++ b/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + "react" + ] +} diff --git a/package.json b/package.json index f1eb257..979e117 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-react-remove-properties", - "version": "0.1.1", + "version": "0.2.0", "description": "Removes React properties", "main": "lib/index.js", "scripts": { @@ -25,9 +25,11 @@ "url": "https://github.com/oliviertassinari/babel-plugin-react-remove-properties/issues" }, "dependencies": { - "babel-core": "^5.6.4" + "babel-core": "^6.2.1" }, "devDependencies": { + "babel-cli": "^6.2.0", + "babel-preset-react": "^6.1.18", "istanbul": "^0.4.0", "mocha": "^2.2.5" } diff --git a/src/index.js b/src/index.js index 39f9380..bf3e564 100644 --- a/src/index.js +++ b/src/index.js @@ -1,13 +1,13 @@ 'use strict'; -module.exports = function({Plugin}) { - return new Plugin('react-remove-properties', { +module.exports = function() { + return { visitor: { - JSXIdentifier(node) { - if (node.name === 'data-test') { - this.parentPath.dangerouslyRemove(); + JSXIdentifier: function(path) { + if (path.node.name === 'data-test') { + path.parentPath.remove(); } }, }, - }); + }; }; diff --git a/test/fixtures/simple/actual.js b/test/fixtures/simple/actual.js index 1d702f3..1d1bcaa 100644 --- a/test/fixtures/simple/actual.js +++ b/test/fixtures/simple/actual.js @@ -1,5 +1,5 @@ React.createClass({ - render() { + render: function() { return (
Hello Wold! diff --git a/test/fixtures/simple/expected.js b/test/fixtures/simple/expected.js index 7ef2b3d..9c735de 100644 --- a/test/fixtures/simple/expected.js +++ b/test/fixtures/simple/expected.js @@ -1,7 +1,5 @@ -"use strict"; - React.createClass({ - render: function render() { + render: function () { return React.createElement( "div", { className: "bar" }, @@ -9,4 +7,3 @@ React.createClass({ ); } }); -