mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-13 13:23:32 -06:00
Initial commit
This commit is contained in:
71
node_modules/stylelint-scss/dist/rules/operator-no-newline-before/index.js
generated
vendored
Normal file
71
node_modules/stylelint-scss/dist/rules/operator-no-newline-before/index.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (expectation) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: expectation
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
(0, _operatorNoUnspaced.calculationOperatorSpaceChecker)({
|
||||
root: root,
|
||||
result: result,
|
||||
checker: checkNewlineBefore
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _operatorNoUnspaced = require("../operator-no-unspaced");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("operator-no-newline-before");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
rejected: function rejected(operator) {
|
||||
return "Unexpected newline before \"" + operator + "\"";
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The checker function: whether there is a newline before THAT operator.
|
||||
*/
|
||||
function checkNewlineBefore(_ref) {
|
||||
var string = _ref.string,
|
||||
globalIndex = _ref.globalIndex,
|
||||
startIndex = _ref.startIndex,
|
||||
endIndex = _ref.endIndex,
|
||||
node = _ref.node,
|
||||
result = _ref.result;
|
||||
|
||||
var symbol = string.substring(startIndex, endIndex + 1);
|
||||
var newLineBefore = false;
|
||||
|
||||
var index = startIndex - 1;
|
||||
while (index && (0, _utils.isWhitespace)(string[index])) {
|
||||
if (string[index] === "\n") {
|
||||
newLineBefore = true;
|
||||
break;
|
||||
}
|
||||
index--;
|
||||
}
|
||||
|
||||
if (newLineBefore) {
|
||||
_stylelint.utils.report({
|
||||
ruleName: ruleName,
|
||||
result: result,
|
||||
node: node,
|
||||
message: messages.rejected(symbol),
|
||||
index: endIndex + globalIndex
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user