.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / utils / findAtRuleContext.js
1 /* @flow */
2 "use strict";
3
4 /**
5  * Find the at-rule in which a rule is nested.
6  *
7  * Returns `null` if the rule is not nested within an at-rule.
8  */
9 module.exports = function findAtRuleContext(
10   rule /*: postcss$rule */
11 ) /*: ?postcss$node*/ {
12   const parent = rule.parent;
13
14   if (parent.type === "root") {
15     return null;
16   }
17   if (parent.type === "atrule") {
18     return parent;
19   }
20   return findAtRuleContext(parent);
21 };