babel-plugin-react-component-data-attribute
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -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 @@ } |
{ | ||
"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>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13927
5
273