securityos/node_modules/stylelint/lib/utils/isBlocklessAtRuleAfterSameN...

24 lines
666 B
JavaScript
Raw Permalink Normal View History

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