Skip to content

Commit

Permalink
refactor: remove the traverse code in parseJSXElement to eliminate …
Browse files Browse the repository at this point in the history
…redundant calls for setting translation keys (#250)
  • Loading branch information
cheton committed Jul 11, 2023
1 parent 27575e9 commit 9dbe663
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,27 +555,6 @@ class Parser {
return;
}

ensureArray(node.openingElement.attributes).forEach(attribute => {
const value = attribute.value;

if (!(value && value.type === 'JSXExpressionContainer')) {
return;
}

const expression = value.expression;
if (!(expression && expression.type === 'JSXElement')) {
return;
}

parseJSXElement(expression, code);
});

ensureArray(node.children).forEach(childNode => {
if (childNode.type === 'JSXElement') {
parseJSXElement(childNode, code);
}
});

if (component instanceof RegExp
? !node.openingElement.name.name.match(component)
: node.openingElement.name.name !== component) {
Expand Down

0 comments on commit 9dbe663

Please sign in to comment.