first commit
This commit is contained in:
33
node_modules/stylelint/lib/utils/findAtRuleContext.cjs
generated
vendored
Normal file
33
node_modules/stylelint/lib/utils/findAtRuleContext.cjs
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// NOTICE: This file is generated by Rollup. To modify it,
|
||||
// please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
|
||||
'use strict';
|
||||
|
||||
const typeGuards = require('./typeGuards.cjs');
|
||||
|
||||
/**
|
||||
* Find the at-rule in which a rule is nested.
|
||||
*
|
||||
* Returns `null` if the rule is not nested within an at-rule.
|
||||
*
|
||||
* @param {import('postcss').Rule} rule
|
||||
* @returns {null | import('postcss').AtRule}
|
||||
*/
|
||||
function findAtRuleContext(rule) {
|
||||
const parent = rule.parent;
|
||||
|
||||
if (!parent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeGuards.isAtRule(parent)) {
|
||||
return parent;
|
||||
}
|
||||
|
||||
if (typeGuards.isRule(parent)) {
|
||||
return findAtRuleContext(parent);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = findAtRuleContext;
|
||||
Reference in New Issue
Block a user