Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-transform-qa-classes

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-transform-qa-classes

React transform that adds generated classes to component root nodes for use by QA

  • 0.0.3-alpha2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

react-transform-qa-classes

Simple Babel plugin that adds classes to React component root nodes generated from the displayName or class name.

This was developed for a specific use case, but I guess it could be useful more generally (or at least as a code reference). It's an alpha release - I have yet to test it in the wild.

Usage

You should have Babel 6 installed and setup, then run npm install babel-plugin-react-transform react-transform-qa-classes --save-dev.

Next setup .babelrc. In the example below, I have a special env value for QA testing.

{
	"env": {
		"qa": {
			"plugins": [
				["react-transform", {
					"transforms": [{
						"transform": "react-transform-qa-classes"
					}]
				}]
			]
		}
	}
}

Then launch babel or your build process with BABEL_ENV=qa.

Result

Two classes are added to all component root nodes - __qa and _qa_[displayName] where [displayName] is the component displayName or class name in lowercase.

Bookmarklet

javascript:var comps = document.querySelectorAll('.__qa');[].forEach.call(comps, function(c, i){console.log(i, c.className, c);c.style.outline = '1px solid red'});

Keywords

FAQs

Package last updated on 09 Mar 2016

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc