babel-plugin-react-remove-attributes

1.0.6 • Public • Published

babel-plugin-react-remove-attributes

npm version Build Status

About

This plugin will remove specified attributes from React components. The default attribute to be removed is data-test-id.

This could be useful for removing tags used for testing eg:

<Button data-test-id="run_button">Run</Button>

will become:

<Button>Run</Button>

How to use

By default, data-test-id is removed.

It's possible to pass attributes that we want to remove in several ways:

Input type example
string data-test-something
array of strings ['data-test-one', 'data-test-two']
regular expression /data-test-*/
array of regular expressions [/data-test-*/, /data-details-*/]

TODO:

  • Replace lodash isEqual check

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-react-remove-attributes

Weekly Downloads

4

Version

1.0.6

License

MIT

Last publish

Collaborators

  • tfiechowski