oliviertassinari / babel-plugin-react-remove-properties

Babel plugin for removing React properties. :dash:
379 stars 18 forks source link

Regex support #61

Closed zslabs closed 5 years ago

zslabs commented 5 years ago

Thanks for creating this! Instead of an array of values; have you ever considered adding support for regex expressions as well? A lot of our selectors (for Cypress) start with data-test- but then vary based on their implementation. We have a few hundred; so it'd be great if we could allocate a namespace to be removed in prod since they are used exclusively for testing.

Thanks again!

oliviertassinari commented 5 years ago

@zslabs I have no objection with your feature request.

divmgl commented 5 years ago

We'll likely just need to extend this block to support a regex rather than using indexOf.

https://github.com/oliviertassinari/babel-plugin-react-remove-properties/blob/master/src/index.js#L26

zslabs commented 5 years ago

@divmgl Was nice enough to create a PR https://github.com/oliviertassinari/babel-plugin-react-remove-properties/pull/62