epiphany/node_modules/stylelint/lib/utils/isBlocklessAtRuleAfterSameNameBlocklessAtRule.js
2023-12-09 22:48:07 -08:00

23 lines
666 B
JavaScript

'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;
};