@udyux/stylelint-order
Version:
[fork] A collection of order related linting rules for stylelint.
15 lines (13 loc) • 349 B
JavaScript
module.exports = function getContainingNode(node) {
// For styled-components declarations are children of Root node
if (
node.type !== 'rule' &&
node.type !== 'atrule' &&
node.parent.document &&
node.parent.document.nodes &&
node.parent.document.nodes.some((item) => item.type === 'root')
) {
return node.parent;
}
return node;
};