Sha256: 1ea539a2dbd26c707ae7f077eb4c6b0978bc5d0900a5b36bc619b75b68d2626f

Contents?: true

Size: 1.12 KB

Versions: 24

Compression:

Stored size: 1.12 KB

Contents

"use strict";

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

var _stylelint = require("stylelint");

var _utils = require("../../utils");

var ruleName = (0, _utils.namespace)("at-extend-no-missing-placeholder");
exports.ruleName = ruleName;

var messages = _stylelint.utils.ruleMessages(ruleName, {
  rejected: "Expected a placeholder selector (e.g. %placeholder) to be used in @extend"
});

exports.messages = messages;

function _default(actual) {
  return function (root, result) {
    var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
      actual: actual
    });

    if (!validOptions) {
      return;
    }

    root.walkAtRules("extend", function (atrule) {
      var isPlaceholder = atrule.params.trim()[0] === "%";
      var isInterpolation = /^#{.+}/.test(atrule.params.trim());

      if (!isPlaceholder && !isInterpolation) {
        _stylelint.utils.report({
          ruleName: ruleName,
          result: result,
          node: atrule,
          message: messages.rejected
        });
      }
    });
  };
}

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-cms-4.1.8 node_modules/stylelint-scss/dist/rules/at-extend-no-missing-placeholder/index.js
trusty-cms-4.1.7 node_modules/stylelint-scss/dist/rules/at-extend-no-missing-placeholder/index.js
trusty-cms-4.1.6 node_modules/stylelint-scss/dist/rules/at-extend-no-missing-placeholder/index.js
trusty-cms-4.1.5 node_modules/stylelint-scss/dist/rules/at-extend-no-missing-placeholder/index.js