mirror of
https://github.com/thangisme/notes.git
synced 2024-11-01 04:07:21 -04:00
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.messages = exports.ruleName = undefined;
|
|
|
|
exports.default = function (value) {
|
|
return function (root, result) {
|
|
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
|
actual: value,
|
|
possible: ["always", "never"]
|
|
});
|
|
if (!validOptions) {
|
|
return;
|
|
}
|
|
|
|
root.walkAtRules("include", function (mixinCall) {
|
|
// If it is "No parens in argumentless calls"
|
|
if (value === "never" && mixinCall.params.search(/\(\s*?\)\s*?$/) === -1) {
|
|
return;
|
|
}
|
|
// If it is "Always use parens"
|
|
if (value === "always" && mixinCall.params.search(/\(/) !== -1) {
|
|
return;
|
|
}
|
|
|
|
var mixinName = /\s*(\S*?)\s*(?:\(|$)/.exec(mixinCall.params)[1];
|
|
|
|
_stylelint.utils.report({
|
|
message: messages[value === "never" ? "rejected" : "expected"](mixinName),
|
|
node: mixinCall,
|
|
result: result,
|
|
ruleName: ruleName
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
var _stylelint = require("stylelint");
|
|
|
|
var _utils = require("../../utils");
|
|
|
|
var ruleName = exports.ruleName = (0, _utils.namespace)("at-mixin-no-argumentless-call-parentheses");
|
|
|
|
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
|
expected: function expected(mixin) {
|
|
return "Expected parentheses in mixin \"" + mixin + "\" call";
|
|
},
|
|
rejected: function rejected(mixin) {
|
|
return "Unexpected parentheses in argumentless mixin \"" + mixin + "\" call";
|
|
}
|
|
}); |