Skip to content

Commit

Permalink
Merge pull request #4 from oliviertassinari/babel-6
Browse files Browse the repository at this point in the history
[babel] upgrade to babel@6
  • Loading branch information
oliviertassinari committed Nov 26, 2015
2 parents b4182c0 + ab1cbe5 commit 4bd3924
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"react"
]
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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"
}
Expand Down
12 changes: 6 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -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();
}
},
},
});
};
};
2 changes: 1 addition & 1 deletion test/fixtures/simple/actual.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
React.createClass({
render() {
render: function() {
return (
<div className="bar" data-test="thisIsASelectorForSelenium">
Hello Wold!
Expand Down
5 changes: 1 addition & 4 deletions test/fixtures/simple/expected.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
"use strict";

React.createClass({
render: function render() {
render: function () {
return React.createElement(
"div",
{ className: "bar" },
"Hello Wold!"
);
}
});

0 comments on commit 4bd3924

Please sign in to comment.