UNPKG

@atlaskit/eslint-plugin-design-system

Version:

The essential plugin for use with the Atlassian Design System.

15 lines 531 B
/** * @param node * @returns The furthest parent node that is on the same line as the input node. */ export const findParentNodeForLine = node => { var _node$loc, _node$parent$loc; if (!node.parent) { return node; } if (((_node$loc = node.loc) === null || _node$loc === void 0 ? void 0 : _node$loc.start.line) !== ((_node$parent$loc = node.parent.loc) === null || _node$parent$loc === void 0 ? void 0 : _node$parent$loc.start.line)) { return node; } else { return findParentNodeForLine(node.parent); } };