UNPKG

stylelint-sassdoc

Version:

stylelint plugin to check scss files for a valid sassdoc documentation Credits to https://github.com/anneangersbach

28 lines (25 loc) 857 B
const adjacentLineIsSCSSComment = require('./adjacentLineIsSCSSComment'); const regExCheck = require('./regExCheck'); /** * Checks the suceeding comment nodes for @group * @param {Node} node - the current node */ let results = []; module.exports = function checkCommentsForGroup(node, tail = 0) { const nextNode = node.next(); if (tail === 0) { results = []; } if (adjacentLineIsSCSSComment(node, false)) { // check for @group if (regExCheck(nextNode, /@group .+/)) { const returnComment = {}; returnComment.returnOnLine = nextNode.source.start.line; returnComment.node = nextNode; results.push(returnComment); } // continue with any comments preceding this one return checkCommentsForGroup(nextNode, tail + 1); } return results; };