babel-plugin-transform-react-qa-classes
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -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" |
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
15205
199
14