Skip to content

Commit 1c9be00

Browse files
Merge pull request #6 from aleksandrkovalenko/master
* Add ability to specify property in options * Update README.md
2 parents 7484c0b + 6785772 commit 1c9be00

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,24 @@ $ npm install --save-dev babel-plugin-react-remove-properties
4646

4747
**.babelrc**
4848

49-
```json
49+
```js
50+
// without options
5051
{
5152
"env": {
5253
"production": {
5354
"plugins": ["react-remove-properties"]
5455
}
5556
}
5657
}
58+
59+
// with options
60+
{
61+
"env": {
62+
"production": {
63+
"plugins": ["react-remove-properties", {"property": "data-test"}]
64+
}
65+
}
66+
}
5767
```
5868

5969
#### Via CLI

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
module.exports = function() {
44
return {
55
visitor: {
6-
Program: function(path) {
6+
Program: function(path, state) {
77
// On program start, do an explicit traversal up front for this plugin.
8+
const property = state.opts.property || 'data-test';
89
path.traverse({
910
JSXIdentifier: function(path) {
10-
if (path.node.name === 'data-test') {
11+
if (path.node.name === property) {
1112
path.parentPath.remove();
1213
}
1314
},

0 commit comments

Comments
 (0)