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

babel-plugin-jsx-remove-qa

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-jsx-remove-qa - npm Package Compare versions

Comparing version 0.2.4 to 0.3.0

tests/remove-qa-classnames.spec.js

27

index.js

@@ -8,9 +8,12 @@ const RemoveQAClasses = ({ types: t }) => {

let attributeIdentifiers = 'className';
let attributeIdentifiers = ['className'];
if (state.opts && state.opts.attributes) {
attributeIdentifiers = [attributeIdentifiers, ...state.opts.attributes];
attributeIdentifiers = [
...attributeIdentifiers,
...state.opts.attributes
];
}
const classNameRegEx = /\s?qa-([-\w])*/g;
const classNameRegEx = /(^qa-([-\w])*|\sqa-([-\w])*)/g;
let newClassNameValue;

@@ -36,10 +39,18 @@

return t.jSXAttribute(
t.jSXIdentifier(attr.name.name),
t.stringLiteral(newClassNameValue)
);
if (newClassNameValue.length) {
return t.jSXAttribute(
t.jSXIdentifier(attr.name.name),
t.stringLiteral(newClassNameValue)
);
}
};
const attrs = path.node.attributes.map(replaceQAClassName);
const isDefined = value => typeof value !== 'undefined';
const attrs = (
path.node.attributes
.map(replaceQAClassName)
.filter(isDefined)
);
const node = t.jSXOpeningElement(

@@ -46,0 +57,0 @@ path.node.name,

{
"name": "babel-plugin-jsx-remove-qa",
"version": "0.2.4",
"version": "0.3.0",
"description": "babel plugin to remove-qa-classes",

@@ -14,3 +14,5 @@ "main": "dist/index.js",

"strip",
"className"
"className",
"jsx",
"react"
],

@@ -20,3 +22,4 @@ "repository": "git://github.com/coderas/babel-plugin-jsx-remove-qa.git",

"build": "babel -d dist index.js",
"postinstall": "babel -d dist index.js"
"postinstall": "babel -d dist index.js",
"test": "mocha \"**/*.spec.js\" --compilers js:babel-core/register --reporter spec"
},

@@ -32,4 +35,7 @@ "author": "Rich Gorman",

"babel-plugin-transform-react-jsx": "^6.8.0",
"babel-preset-es2015": "^6.16.0"
"babel-preset-es2015": "^6.16.0",
"chai": "^3.5.0",
"mocha": "^3.1.2",
"uglify-js": "^2.7.3"
}
}

Sorry, the diff of this file is not supported yet

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