@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
18 lines (17 loc) • 559 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getSpacingAttribute = getSpacingAttribute;
var _eslintCodemodUtils = require("eslint-codemod-utils");
/**
* Returns the `spacing` JSXAttribute from an icon element, or undefined.
*/
function getSpacingAttribute(node) {
if (!(0, _eslintCodemodUtils.isNodeOfType)(node.openingElement, 'JSXOpeningElement')) {
return undefined;
}
return node.openingElement.attributes.find(function (a) {
return a.type === 'JSXAttribute' && a.name.name === 'spacing';
});
}