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

babel-plugin-react-component-data-attribute

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-react-component-data-attribute - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

src/index.js

17

lib/index.js

@@ -33,2 +33,9 @@ 'use strict';

function shouldProcessPossibleComponent(path, state) {
if (!path.getFunctionParent().isProgram()) {
return false;
}
if (path.parentPath.isAssignmentExpression()) {
return false;
}
var _ref = state.opts || {},

@@ -93,2 +100,7 @@ _ref$onlyRootComponen = _ref.onlyRootComponents;

const hasDataAttribute = node.attributes.some(attribute => t.isJSXIdentifier(attribute.name, { name: DATA_ATTRIBUTE }));
if (hasDataAttribute) {
return;
}
node.attributes.push(createAttribute(name));

@@ -123,2 +135,7 @@ },

const hasDataAttribute = secondArgument.node.properties.some(property => t.isStringLiteral(property.key, { value: DATA_ATTRIBUTE }));
if (hasDataAttribute) {
return;
}
secondArgument.node.properties.push(createObjectProperty(name));

@@ -125,0 +142,0 @@ }

4

package.json
{
"name": "babel-plugin-react-component-data-attribute",
"description": "Babel plugin to add a data attribute containing its component’s name to the top-level DOM node",
"version": "0.1.0",
"description": "Babel plugin to add a data attribute containing its component’s name to the top-level DOM node",
"version": "0.2.0",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "author": "Chris Sauve <chrismsauve@gmail.com>",

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