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

babel-plugin-transform-react-qa-classes

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-transform-react-qa-classes - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

34

lib/index.js

@@ -7,4 +7,4 @@ 'use strict';

exports.default = function (_ref) {
var t = _ref.types;
exports.default = function (_ref2) {
var t = _ref2.types;

@@ -49,5 +49,9 @@ return {

var openingElement = arg.get('openingElement');
if (isReactFragment(openingElement)) return;
openingElement.node.attributes.push(t.jSXAttribute(t.jSXIdentifier(options.attribute), t.stringLiteral(options.format(name.node && name.node.name))));
applyAttribute({
openingElement: openingElement,
t: t,
name: name.node && name.node.name,
options: options
});
}

@@ -74,2 +78,19 @@ });

function applyAttribute(_ref) {
var openingElement = _ref.openingElement,
t = _ref.t,
name = _ref.name,
options = _ref.options;
if (!openingElement || isReactFragment(openingElement)) return;
var isAttributeAlreadySet = openingElement.node.attributes.find(function (node) {
return node.name.name === options.attribute;
});
if (isAttributeAlreadySet) return;
openingElement.node.attributes.push(t.jSXAttribute(t.jSXIdentifier(options.attribute), t.stringLiteral(options.format(name))));
}
function functionBodyPushAttributes(t, path, options, componentName) {

@@ -96,6 +117,3 @@ var openingElement = null;

if (!openingElement) return;
if (isReactFragment(openingElement)) return;
openingElement.node.attributes.push(t.jSXAttribute(t.jSXIdentifier(options.attribute), t.stringLiteral(options.format(componentName))));
applyAttribute({ openingElement: openingElement, t: t, name: componentName, options: options });
}
{
"name": "babel-plugin-transform-react-qa-classes",
"version": "1.4.0",
"version": "1.5.0",
"license": "MIT",

@@ -42,2 +42,4 @@ "description": "Add component's name in `data-qa` attributes to React Components Edit",

"devDependencies": {
"@commitlint/cli": "^8.3.4",
"@commitlint/config-conventional": "^8.3.4",
"@semantic-release/github": "^5.5.5",

@@ -64,2 +66,3 @@ "@semantic-release/npm": "^5.3.4",

"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "npm run lint",

@@ -66,0 +69,0 @@ "pre-push": "npm run test"

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