JSPM

babel-plugin-remove-attribute

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 983
  • Score
    100M100P100Q107945F
  • License MIT

Plugin to remove a single attribute from JSX

Package Exports

  • babel-plugin-remove-attribute

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-remove-attribute) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

babel-plugin-remove-attribute CircleCI npm version

Plugin to remove a single attribute from JSX elements.

Usage

.babelrc

{
  plugins: [
    ..., 
    ['babel-plugin-remove-attribute', { 
      attribute: (attribute name here),
    }], 
    ...,
  ],
}

Motivation

When locating elements for testing (e.g. React, Selenium), it's common to do so via a class on the element. This couples styling with testing though, so it's a better idea to use a custom attribute on the elements. You can then use the plugin for production code to remove these from the DOM, if you care enough.