Socket
Book a DemoInstallSign in
Socket

babel-plugin-remove-data-test-id-attribute

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-remove-data-test-id-attribute

removes data-test-id attributes from jsx html elements. To be used for production builds.

1.0.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

babel-plugin-remove-data-test-id-attribute

Removes data-test-id attribute from jsx html elements.

The data-test-id is normally added for testing as a helper attribute to quickly grab an element by id and simualte events or do other stuff. The data-test-id not required in the production builds and should be removed in production builds.

Usage -

$ npm i -D babel-plugin-remove-data-test-id-attribute

In your .babelrc file, or whereever you setup babel preferences, add the plugin to the plugins array, inside the production environment -

{
    "env": {
    "production": {
      "plugins": ["babel-plugin-remove-data-test-id-attribute" ]
    }
  }
}

E.g. - If your jsx code looks like this

<div data-id="pqr" data-test-id='abc'>
    abc
	<p>para</p>
    <Custom data-test-id='blah' />
</div>

When the code is passed through this plugin, it will change to -

<div data-id="pqr">
    abc
	<p>para</p>
    <Custom />
</div>

Keywords

babel-plugin

FAQs

Package last updated on 22 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.