stylelint
Version:
A mighty CSS linter that helps you avoid errors and enforce conventions.
23 lines (19 loc) • 635 B
JavaScript
import findNodeUpToRoot from './findNodeUpToRoot.mjs';
import { isAtRule } from './typeGuards.mjs';
import { nestingSupportedAtKeywords } from '../reference/atKeywords.mjs';
/** @import { Declaration, Node } from 'postcss' */
/**
* Check whether a declaration is a descriptor one
*
* @param {Declaration} decl
* @returns {boolean}
*/
export default function isDescriptorDeclaration(decl) {
return Boolean(findNodeUpToRoot(decl, isAtRuleSupportingDescriptors));
}
/**
* @param {Node} node
*/
function isAtRuleSupportingDescriptors(node) {
return isAtRule(node) && !nestingSupportedAtKeywords.has(node.name.toLowerCase());
}