code: function checkDepth(selector, rule) {
        var depth;
        // Stripping "[...]", "(...)", "+", "~" (the last two might come with
        // spaces) for simplicity and since we don't need those to count depth
        var stripped = selector.replace(/\(.*?\)|\[.*?\]|(\s*)[+~](\s*)/g, []);
        // Trimming redundant spaces
        stripped = stripped.replace(/\s+/g, ' ');
        // Finally find everything between spaces and ">" (possibly with spaces)
        depth = stripped.match(/[^\s>]+/g).length;
        if (depth > max) {
          stylelint.utils.report({
            ruleName: ruleName,
            result: result,
            node: rule,
            message: messages.rejected(selector, max)
          });
        }
      }
docs: Checks a simple selector's (without :not/:matches) depth