securityos/node_modules/stylelint/lib/utils/isBlocklessAtRuleAfterBlock...

24 lines
603 B
JavaScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
'use strict';
const getPreviousNonSharedLineCommentNode = require('./getPreviousNonSharedLineCommentNode');
const hasBlock = require('./hasBlock');
const { isAtRule } = require('./typeGuards');
/**
* @param {import('postcss').AtRule} atRule
* @returns {boolean}
*/
module.exports = function isBlocklessAtRuleAfterBlocklessAtRule(atRule) {
if (atRule.type !== 'atrule') {
return false;
}
const previousNode = getPreviousNonSharedLineCommentNode(atRule);
if (previousNode === undefined) {
return false;
}
return isAtRule(previousNode) && !hasBlock(previousNode) && !hasBlock(atRule);
};