@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
22 lines (21 loc) • 550 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getJSXElementName = getJSXElementName;
function unrollMemberExpression(exp) {
if (exp.type === 'JSXIdentifier') {
return exp.name;
}
return unrollMemberExpression(exp.object);
}
function getJSXElementName(jsx) {
switch (jsx.name.type) {
case 'JSXIdentifier':
return jsx.name.name;
case 'JSXMemberExpression':
return unrollMemberExpression(jsx.name.object);
case 'JSXNamespacedName':
return jsx.name.namespace.name;
}
}