@stylistic/stylelint-plugin
Version:
A collection of stylistic/formatting Stylelint rules
15 lines (11 loc) • 483 B
JavaScript
/** @typedef {import('postcss').Node} PostcssNode */
/**
* Gets the next non-comment node in a PostCSS AST at or after a given node.
* @param {PostcssNode | void} startNode - The starting node.
* @returns {PostcssNode | null} The next non-comment node, or null if none exists.
*/
export function nextNonCommentNode (startNode) {
if (!startNode || !startNode.next) return null
if (startNode.type === `comment`) return nextNonCommentNode(startNode.next())
return startNode
}