babel-plugin-remove-react-jsx-attribute

1.0.2 • Public • Published

babel-plugin-remove-react-jsx-attribute

Installation

npm install --save-dev babel-plugin-remove-react-jsx-attribute

yarn add -D babel-plugin-remove-react-jsx-attribute

Introduction

This is useful to remove jsx attribute which isn't not necessary to transpiling your code. For Instance, You can easily remove 'data-testid' just for testing.

Example

  • input
function Element() {
  return <div className="app" data-testid="custom-element" />;
}
  • output
function Element() {
  return <div className="app" />;
}

Usage

Add plugin to .babelrc or webpack.config.js babel options

plugins: [
  ...
  ["babel-plugin-remove-react-jsx-attribute", { attributes: ["data-testid",  /^(data-)/]}]
]

Package Sidebar

Install

npm i babel-plugin-remove-react-jsx-attribute

Weekly Downloads

351

Version

1.0.2

License

MIT

Unpacked Size

2.02 kB

Total Files

3

Last publish

Collaborators

  • zereight
  • yungo1846