@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
11 lines (10 loc) • 379 B
JavaScript
import { isNodeOfType } from 'eslint-codemod-utils';
/**
* Returns the `spacing` JSXAttribute from an icon element, or undefined.
*/
export function getSpacingAttribute(node) {
if (!isNodeOfType(node.openingElement, 'JSXOpeningElement')) {
return undefined;
}
return node.openingElement.attributes.find(a => a.type === 'JSXAttribute' && a.name.name === 'spacing');
}