Welcome to mirror list, hosted at ThFree Co, Russian Federation.

isStandardSyntaxSelector.js « utils « dist « stylelint-scss « node_modules « assets - github.com/fourtyone11/origin-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 895ccb1481867598b2ffa1e8b0fffd332fe0370b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = _default;

var _hasInterpolation = _interopRequireDefault(require("./hasInterpolation"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

/**
 * Check whether a selector is standard
 *
 * @param {string} selector
 * @returns {boolean}
 */
function _default(selector) {
  // SCSS or Less interpolation
  if ((0, _hasInterpolation["default"])(selector)) {
    return false;
  } // SCSS placeholder selectors


  if (selector.startsWith("%")) {
    return false;
  } // Less :extend()


  if (/:extend(\(.*?\))?/.test(selector)) {
    return false;
  } // Less mixin with resolved nested selectors (e.g. .foo().bar or .foo(@a, @b)[bar])


  if (/\.[a-z0-9-_]+\(.*\).+/i.test(selector)) {
    return false;
  } // ERB template tags


  if (selector.includes("<%") || selector.includes("%>")) {
    return false;
  }

  return true;
}