diff options
Diffstat (limited to 'assets/node_modules/stylelint-scss/dist/rules/at-mixin-pattern/index.js')
-rw-r--r-- | assets/node_modules/stylelint-scss/dist/rules/at-mixin-pattern/index.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/assets/node_modules/stylelint-scss/dist/rules/at-mixin-pattern/index.js b/assets/node_modules/stylelint-scss/dist/rules/at-mixin-pattern/index.js new file mode 100644 index 0000000..c5fe357 --- /dev/null +++ b/assets/node_modules/stylelint-scss/dist/rules/at-mixin-pattern/index.js @@ -0,0 +1,56 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = _default; +exports.messages = exports.ruleName = void 0; + +var _lodash = require("lodash"); + +var _stylelint = require("stylelint"); + +var _utils = require("../../utils"); + +var ruleName = (0, _utils.namespace)("at-mixin-pattern"); +exports.ruleName = ruleName; + +var messages = _stylelint.utils.ruleMessages(ruleName, { + expected: "Expected @mixin name to match specified pattern" +}); + +exports.messages = messages; + +function _default(pattern) { + return function (root, result) { + var validOptions = _stylelint.utils.validateOptions(result, ruleName, { + actual: pattern, + possible: [_lodash.isRegExp, _lodash.isString] + }); + + if (!validOptions) { + return; + } + + var regexpPattern = (0, _lodash.isString)(pattern) ? new RegExp(pattern) : pattern; + root.walkAtRules(function (decl) { + if (decl.name !== "mixin") { + return; + } // Stripping the mixin of its arguments + + + var mixinName = decl.params.replace(/(\s*?)\((?:\s|\S)*\)/g, ""); + + if (regexpPattern.test(mixinName)) { + return; + } + + _stylelint.utils.report({ + message: messages.expected, + node: decl, + result: result, + ruleName: ruleName + }); + }); + }; +}
\ No newline at end of file |