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:
33
node_modules/stylelint-scss/dist/rules/at-else-closing-brace-newline-after/index.js
generated
vendored
Normal file
33
node_modules/stylelint-scss/dist/rules/at-else-closing-brace-newline-after/index.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"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,
|
||||
possible: ["always-last-in-chain"]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
(0, _atIfClosingBraceNewlineAfter.sassConditionalBraceNLAfterChecker)({ root: root, result: result, ruleName: ruleName, atRuleName: "else", expectation: expectation, messages: messages });
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _atIfClosingBraceNewlineAfter = require("../at-if-closing-brace-newline-after");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-else-closing-brace-newline-after");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected newline after \"}\" of @else statement",
|
||||
rejected: "Unexpected newline after \"}\" of @else statement"
|
||||
});
|
33
node_modules/stylelint-scss/dist/rules/at-else-closing-brace-space-after/index.js
generated
vendored
Normal file
33
node_modules/stylelint-scss/dist/rules/at-else-closing-brace-space-after/index.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"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,
|
||||
possible: ["always-intermediate", "never-intermediate"]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
(0, _atIfClosingBraceSpaceAfter.sassConditionalBraceSpaceAfterChecker)({ root: root, result: result, ruleName: ruleName, atRuleName: "else", expectation: expectation, messages: messages });
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _atIfClosingBraceSpaceAfter = require("../at-if-closing-brace-space-after");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-else-closing-brace-space-after");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected single space after \"}\" of @else statement",
|
||||
rejected: "Unexpected space after \"}\" of @else statement"
|
||||
});
|
49
node_modules/stylelint-scss/dist/rules/at-else-empty-line-before/index.js
generated
vendored
Normal file
49
node_modules/stylelint-scss/dist/rules/at-else-empty-line-before/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"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,
|
||||
possible: ["never"]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
root.walkAtRules(function (atrule) {
|
||||
|
||||
if (atrule.name !== "else") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't need to ignore "the first rule in a stylesheet", etc, cases
|
||||
// because @else should always go after @if
|
||||
|
||||
if (!(0, _utils.hasEmptyLine)(atrule.raws.before)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: messages.rejected,
|
||||
node: atrule,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-else-empty-line-before");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
rejected: "Unxpected empty line before @else"
|
||||
});
|
39
node_modules/stylelint-scss/dist/rules/at-extend-no-missing-placeholder/index.js
generated
vendored
Normal file
39
node_modules/stylelint-scss/dist/rules/at-extend-no-missing-placeholder/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (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
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-extend-no-missing-placeholder");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
rejected: "Expected a placeholder selector (e.g. %placeholder) to be used in @extend"
|
||||
});
|
51
node_modules/stylelint-scss/dist/rules/at-function-pattern/index.js
generated
vendored
Normal file
51
node_modules/stylelint-scss/dist/rules/at-function-pattern/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (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 !== "function") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Stripping the function of its arguments
|
||||
var funcName = decl.params.replace(/(\s*?)\((?:\s|\S)*\)/g, "");
|
||||
if (regexpPattern.test(funcName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: messages.expected,
|
||||
node: decl,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _lodash = require("lodash");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-function-pattern");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected @function name to match specified pattern"
|
||||
});
|
93
node_modules/stylelint-scss/dist/rules/at-if-closing-brace-newline-after/index.js
generated
vendored
Normal file
93
node_modules/stylelint-scss/dist/rules/at-if-closing-brace-newline-after/index.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"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,
|
||||
possible: ["always-last-in-chain"]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
sassConditionalBraceNLAfterChecker({ root: root, result: result, ruleName: ruleName, atRuleName: "if", expectation: expectation, messages: messages });
|
||||
};
|
||||
};
|
||||
|
||||
exports.sassConditionalBraceNLAfterChecker = sassConditionalBraceNLAfterChecker;
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-if-closing-brace-newline-after");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected newline after \"}\" of @if statement",
|
||||
rejected: "Unexpected newline after \"}\" of @if statement"
|
||||
});
|
||||
|
||||
/**
|
||||
* The core logic for this rule. Can be imported by other rules with similar
|
||||
* logic, namely at-else-closing-brace-newline-after
|
||||
*
|
||||
* @param {Object} args -- Named arguments object
|
||||
* @param {PostCSS root} args.root
|
||||
* @param {PostCSS result} args.result
|
||||
* @param {String ruleName} args.ruleName - needed for `report` function
|
||||
* @param {String} args.atRuleName - the name of the at-rule to be checked, e.g. "if", "else"
|
||||
* @param {Object} args.messages - returned by stylelint.utils.ruleMessages
|
||||
* @return {undefined}
|
||||
*/
|
||||
function sassConditionalBraceNLAfterChecker(_ref) {
|
||||
var root = _ref.root,
|
||||
result = _ref.result,
|
||||
ruleName = _ref.ruleName,
|
||||
atRuleName = _ref.atRuleName,
|
||||
expectation = _ref.expectation,
|
||||
messages = _ref.messages;
|
||||
|
||||
function complain(node, message, index) {
|
||||
_stylelint.utils.report({
|
||||
result: result,
|
||||
ruleName: ruleName,
|
||||
node: node,
|
||||
message: message,
|
||||
index: index
|
||||
});
|
||||
}
|
||||
|
||||
root.walkAtRules(function (atrule) {
|
||||
// Do nothing if it's not an @if
|
||||
if (atrule.name !== atRuleName) {
|
||||
return;
|
||||
}
|
||||
|
||||
var nextNode = atrule.next();
|
||||
if (!nextNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
var nextBefore = nextNode.raws.before;
|
||||
var hasNewLinesBeforeNext = nextBefore && !(0, _utils.isSingleLineString)(nextBefore);
|
||||
var reportIndex = atrule.toString().length;
|
||||
|
||||
if (expectation === "always-last-in-chain") {
|
||||
// If followed by @else, no newline is needed
|
||||
if (nextNode.type === "atrule" && nextNode.name === "else") {
|
||||
if (hasNewLinesBeforeNext) {
|
||||
complain(atrule, messages.rejected, reportIndex);
|
||||
}
|
||||
} else {
|
||||
if (!hasNewLinesBeforeNext) {
|
||||
complain(atrule, messages.expected, reportIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
87
node_modules/stylelint-scss/dist/rules/at-if-closing-brace-space-after/index.js
generated
vendored
Normal file
87
node_modules/stylelint-scss/dist/rules/at-if-closing-brace-space-after/index.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"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,
|
||||
possible: ["always-intermediate", "never-intermediate"]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
sassConditionalBraceSpaceAfterChecker({ root: root, result: result, ruleName: ruleName, atRuleName: "if", expectation: expectation, messages: messages });
|
||||
};
|
||||
};
|
||||
|
||||
exports.sassConditionalBraceSpaceAfterChecker = sassConditionalBraceSpaceAfterChecker;
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-if-closing-brace-space-after");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected single space after \"}\" of @if statement",
|
||||
rejected: "Unexpected space after \"}\" of @if statement"
|
||||
});
|
||||
|
||||
/**
|
||||
* The core logic for this rule. Can be imported by other rules with similar
|
||||
* logic, namely at-else-closing-brace-space-after
|
||||
*
|
||||
* @param {Object} args -- Named arguments object
|
||||
* @param {PostCSS root} args.root
|
||||
* @param {PostCSS result} args.result
|
||||
* @param {String ruleName} args.ruleName - needed for `report` function
|
||||
* @param {String} args.atRuleName - the name of the at-rule to be checked, e.g. "if", "else"
|
||||
* @param {Object} args.messages - returned by stylelint.utils.ruleMessages
|
||||
* @return {undefined}
|
||||
*/
|
||||
function sassConditionalBraceSpaceAfterChecker(_ref) {
|
||||
var root = _ref.root,
|
||||
result = _ref.result,
|
||||
ruleName = _ref.ruleName,
|
||||
atRuleName = _ref.atRuleName,
|
||||
expectation = _ref.expectation,
|
||||
messages = _ref.messages;
|
||||
|
||||
function complain(node, message, index) {
|
||||
_stylelint.utils.report({
|
||||
result: result,
|
||||
ruleName: ruleName,
|
||||
node: node,
|
||||
message: message,
|
||||
index: index
|
||||
});
|
||||
}
|
||||
|
||||
root.walkAtRules(function (atrule) {
|
||||
// Do nothing if it's not an @if
|
||||
if (atrule.name !== atRuleName) {
|
||||
return;
|
||||
}
|
||||
|
||||
var nextNode = atrule.next();
|
||||
var hasSpaceAfter = nextNode && nextNode.raws.before === " ";
|
||||
var hasWhiteSpaceAfter = nextNode && nextNode.raws.before !== "";
|
||||
var reportIndex = atrule.toString().length;
|
||||
|
||||
// When followed by an @else
|
||||
if (nextNode && nextNode.type === "atrule" && nextNode.name === "else") {
|
||||
// A single space is needed
|
||||
if (expectation === "always-intermediate" && !hasSpaceAfter) {
|
||||
complain(atrule, messages.expected, reportIndex);
|
||||
} else if (expectation === "never-intermediate" && hasWhiteSpaceAfter) {
|
||||
// No whitespace is needed
|
||||
complain(atrule, messages.rejected, reportIndex);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
88
node_modules/stylelint-scss/dist/rules/at-import-no-partial-extension/index.js
generated
vendored
Normal file
88
node_modules/stylelint-scss/dist/rules/at-import-no-partial-extension/index.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (on, options) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: on
|
||||
}, {
|
||||
actual: options,
|
||||
possible: {
|
||||
// Accepting array of either strings or regular expressions
|
||||
ignoreExtensions: function ignoreExtensions(str) {
|
||||
return (0, _lodash.isRegExp)(str) || (0, _lodash.isString)(str);
|
||||
}
|
||||
},
|
||||
optional: true
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
result.warn("The 'at-import-no-partial-extension' rule has been deprecated, " + "and will be removed in '2.0'. Instead, use 'at-import-partial-extension-blacklist' or 'at-import-partial-extension-whitelist' rules.", {
|
||||
stylelintType: "deprecation"
|
||||
});
|
||||
|
||||
function checkPathForUnderscore(path, decl) {
|
||||
// Stripping trailing quotes and whitespaces, if any
|
||||
var pathStripped = path.replace(/^\s*?("|')\s*/, "").replace(/\s*("|')\s*?$/, "");
|
||||
var extension = _path2.default.extname(pathStripped).slice(1);
|
||||
|
||||
// If the extension is not empty
|
||||
if (!extension) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skipping importing CSS: url(), ".css", URI with a protocol, media
|
||||
if (pathStripped.slice(0, 4) === "url(" || pathStripped.slice(-4) === ".css" || pathStripped.search("//") !== -1 || pathStripped.search(/(?:\s|[,)"'])\w+$/) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (options && options.ignoreExtensions) {
|
||||
// Return if...
|
||||
if (options.ignoreExtensions.some(function (ignoredExt) {
|
||||
// the extension matches one of the ignored strings or Regexps
|
||||
return (0, _lodash.isString)(ignoredExt) && ignoredExt === extension || (0, _lodash.isRegExp)(ignoredExt) && extension.search(ignoredExt) !== -1;
|
||||
})) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: messages.expected,
|
||||
node: decl,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
}
|
||||
|
||||
root.walkAtRules("import", function (atRule) {
|
||||
// Processing comma-separated lists of import paths
|
||||
atRule.params.split(",").forEach(function (path) {
|
||||
checkPathForUnderscore(path, atRule);
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _lodash = require("lodash");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-import-no-partial-extension");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Unexpected file extension in imported partial name"
|
||||
});
|
54
node_modules/stylelint-scss/dist/rules/at-import-no-partial-leading-underscore/index.js
generated
vendored
Normal file
54
node_modules/stylelint-scss/dist/rules/at-import-no-partial-leading-underscore/index.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (actual) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, { actual: actual });
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
function checkPathForUnderscore(path, decl) {
|
||||
// Stripping trailing quotes and whitespaces, if any
|
||||
var pathStripped = path.replace(/^\s*?("|')\s*/, "").replace(/\s*("|')\s*?$/, "");
|
||||
|
||||
// Searching a _ at the start of filename
|
||||
if (pathStripped.search(/(?:^|\/|\\)_[^/]+$/) === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skipping importing CSS: url(), ".css", URI with a protocol, media
|
||||
if (pathStripped.slice(0, 4) === "url(" || pathStripped.slice(-4) === ".css" || pathStripped.search("//") !== -1 || pathStripped.search(/(?:\s|[,)"'])\w+$/) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: messages.expected,
|
||||
node: decl,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
}
|
||||
|
||||
root.walkAtRules("import", function (decl) {
|
||||
// Processing comma-separated lists of import paths
|
||||
decl.params.split(",").forEach(function (path) {
|
||||
checkPathForUnderscore(path, decl);
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-import-no-partial-leading-underscore");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Unexpected leading underscore in imported partial name"
|
||||
});
|
76
node_modules/stylelint-scss/dist/rules/at-import-partial-extension-blacklist/index.js
generated
vendored
Normal file
76
node_modules/stylelint-scss/dist/rules/at-import-partial-extension-blacklist/index.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (blacklistOption) {
|
||||
var blacklist = [].concat(blacklistOption);
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: blacklistOption,
|
||||
possible: [_lodash.isString, _lodash.isRegExp]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
function checkPathForUnderscore(path, decl) {
|
||||
// Stripping trailing quotes and whitespaces, if any
|
||||
var pathStripped = path.replace(/^\s*?("|')\s*/, "").replace(/\s*("|')\s*?$/, "");
|
||||
var extension = _path2.default.extname(pathStripped).slice(1);
|
||||
// Save this separately to be able to pass the original string to report()
|
||||
var extensionNormalized = extension.toLowerCase();
|
||||
|
||||
// If the extension is empty
|
||||
if (!extension) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skipping importing CSS: url(), ".css", URI with a protocol, media
|
||||
if (pathStripped.slice(0, 4) === "url(" || pathStripped.slice(-4) === ".css" || pathStripped.search("//") !== -1 || pathStripped.search(/(?:\s|[,)"'])\w+$/) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
blacklist.forEach(function (ext) {
|
||||
if ((0, _lodash.isString)(ext) && extensionNormalized === ext || (0, _lodash.isRegExp)(ext) && extensionNormalized.search(ext) !== -1) {
|
||||
_stylelint.utils.report({
|
||||
message: messages.rejected(extension),
|
||||
node: decl,
|
||||
word: extension,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
root.walkAtRules("import", function (atRule) {
|
||||
// Processing comma-separated lists of import paths
|
||||
atRule.params.split(",").forEach(function (path) {
|
||||
checkPathForUnderscore(path, atRule);
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _lodash = require("lodash");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-import-partial-extension-blacklist");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
rejected: function rejected(ext) {
|
||||
return "Unexpected extension \"." + ext + "\" in imported partial name";
|
||||
}
|
||||
});
|
78
node_modules/stylelint-scss/dist/rules/at-import-partial-extension-whitelist/index.js
generated
vendored
Normal file
78
node_modules/stylelint-scss/dist/rules/at-import-partial-extension-whitelist/index.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (whitelistOption) {
|
||||
var whitelist = [].concat(whitelistOption);
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: whitelistOption,
|
||||
possible: [_lodash.isString, _lodash.isRegExp]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
function checkPathForUnderscore(path, decl) {
|
||||
// Stripping trailing quotes and whitespaces, if any
|
||||
var pathStripped = path.replace(/^\s*?("|')\s*/, "").replace(/\s*("|')\s*?$/, "");
|
||||
var extension = _path2.default.extname(pathStripped).slice(1);
|
||||
// Save this separately to be able to pass the original string to report()
|
||||
var extensionNormalized = extension.toLowerCase();
|
||||
|
||||
// If the extension is empty
|
||||
if (!extension) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skipping importing CSS: url(), ".css", URI with a protocol, media
|
||||
if (pathStripped.slice(0, 4) === "url(" || pathStripped.slice(-4) === ".css" || pathStripped.search("//") !== -1 || pathStripped.search(/(?:\s|[,)"'])\w+$/) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (whitelist.some(function (ext) {
|
||||
return (0, _lodash.isString)(ext) && extensionNormalized === ext || (0, _lodash.isRegExp)(ext) && extensionNormalized.search(ext) !== -1;
|
||||
})) {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: messages.rejected(extension),
|
||||
node: decl,
|
||||
word: extension,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
}
|
||||
|
||||
root.walkAtRules("import", function (atRule) {
|
||||
// Processing comma-separated lists of import paths
|
||||
atRule.params.split(",").forEach(function (path) {
|
||||
checkPathForUnderscore(path, atRule);
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _lodash = require("lodash");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-import-partial-extension-whitelist");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
rejected: function rejected(ext) {
|
||||
return "Unexpected extension \"." + ext + "\" in imported partial name";
|
||||
}
|
||||
});
|
53
node_modules/stylelint-scss/dist/rules/at-mixin-argumentless-call-parentheses/index.js
generated
vendored
Normal file
53
node_modules/stylelint-scss/dist/rules/at-mixin-argumentless-call-parentheses/index.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"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";
|
||||
}
|
||||
});
|
38
node_modules/stylelint-scss/dist/rules/at-mixin-no-argumentless-call-parentheses/index.js
generated
vendored
Normal file
38
node_modules/stylelint-scss/dist/rules/at-mixin-no-argumentless-call-parentheses/index.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (actual) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, { actual: actual });
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
root.walkAtRules("include", function (decl) {
|
||||
if (decl.params.search(/\(\s*?\)\s*?$/) === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: messages.expected,
|
||||
node: decl,
|
||||
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: "Unexpected parentheses in argumentless @mixin call"
|
||||
});
|
51
node_modules/stylelint-scss/dist/rules/at-mixin-pattern/index.js
generated
vendored
Normal file
51
node_modules/stylelint-scss/dist/rules/at-mixin-pattern/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (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
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _lodash = require("lodash");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("at-mixin-pattern");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected @mixin name to match specified pattern"
|
||||
});
|
68
node_modules/stylelint-scss/dist/rules/declaration-nested-properties-no-divided-groups/index.js
generated
vendored
Normal file
68
node_modules/stylelint-scss/dist/rules/declaration-nested-properties-no-divided-groups/index.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"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;
|
||||
}
|
||||
|
||||
root.walk(function (item) {
|
||||
if (item.type !== "rule" && item.type !== "atrule") {
|
||||
return;
|
||||
}
|
||||
|
||||
var nestedGroups = {};
|
||||
|
||||
// Find all nested property groups
|
||||
item.each(function (decl) {
|
||||
if (decl.type !== "rule") {
|
||||
return;
|
||||
}
|
||||
var testForProp = (0, _utils.parseNestedPropRoot)(decl.selector);
|
||||
|
||||
if (testForProp && testForProp.propName !== undefined) {
|
||||
var ns = testForProp.propName.value;
|
||||
if (!nestedGroups.hasOwnProperty(ns)) {
|
||||
nestedGroups[ns] = [];
|
||||
}
|
||||
nestedGroups[ns].push(decl);
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(nestedGroups).forEach(function (namespace) {
|
||||
// Only warn if there are more than one nested groups with equal namespaces
|
||||
if (nestedGroups[namespace].length === 1) {
|
||||
return;
|
||||
}
|
||||
nestedGroups[namespace].forEach(function (group) {
|
||||
_stylelint.utils.report({
|
||||
message: messages.expected(namespace),
|
||||
node: group,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("declaration-nested-properties-no-divided-groups");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: function expected(prop) {
|
||||
return "Expected all nested properties of \"" + prop + "\" namespace to be in one nested group";
|
||||
}
|
||||
});
|
146
node_modules/stylelint-scss/dist/rules/declaration-nested-properties/index.js
generated
vendored
Normal file
146
node_modules/stylelint-scss/dist/rules/declaration-nested-properties/index.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (expectation, options) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: ["always", "never"]
|
||||
}, {
|
||||
actual: options,
|
||||
possible: {
|
||||
except: ["only-of-namespace"]
|
||||
},
|
||||
optional: true
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (expectation === "always") {
|
||||
root.walk(function (item) {
|
||||
if (item.type !== "rule" && item.type !== "atrule") {
|
||||
return;
|
||||
}
|
||||
|
||||
var warningCandidates = {};
|
||||
|
||||
item.each(function (decl) {
|
||||
var prop = decl.prop,
|
||||
type = decl.type,
|
||||
selector = decl.selector;
|
||||
|
||||
// Looking for namespaced non-nested properties
|
||||
// Namespaced prop is basically a prop with a `-` in a name, e.g. `margin-top`
|
||||
|
||||
if (type === "decl") {
|
||||
if (!(0, _utils.isStandardSyntaxProperty)(prop)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add simple namespaced prop decls to warningCandidates.ns
|
||||
// (prop names with browser prefixes are ignored)
|
||||
var seekNamespace = /^([a-zA-Z0-9]+)-/.exec(prop);
|
||||
if (seekNamespace && seekNamespace[1]) {
|
||||
var ns = seekNamespace[1];
|
||||
if (!warningCandidates.hasOwnProperty(ns)) {
|
||||
warningCandidates[ns] = [];
|
||||
}
|
||||
warningCandidates[ns].push({ node: decl });
|
||||
}
|
||||
}
|
||||
|
||||
// Nested props, `prop: [value] { <nested decls> }`
|
||||
if (type === "rule") {
|
||||
// `background:red {` - selector;
|
||||
// `background: red {` - nested prop; space is decisive here
|
||||
var testForProp = (0, _utils.parseNestedPropRoot)(selector);
|
||||
|
||||
if (testForProp && testForProp.propName !== undefined) {
|
||||
var _ns = testForProp.propName.value;
|
||||
if (!warningCandidates.hasOwnProperty(_ns)) {
|
||||
warningCandidates[_ns] = [];
|
||||
}
|
||||
warningCandidates[_ns].push({
|
||||
node: decl,
|
||||
nested: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Now check if the found properties deserve warnings
|
||||
Object.keys(warningCandidates).forEach(function (namespace) {
|
||||
var exceptIfOnlyOfNs = (0, _utils.optionsHaveException)(options, "only-of-namespace");
|
||||
var moreThanOneProp = warningCandidates[namespace].length > 1;
|
||||
|
||||
warningCandidates[namespace].forEach(function (candidate) {
|
||||
if (candidate.nested === true) {
|
||||
if (exceptIfOnlyOfNs) {
|
||||
// If there is only one prop inside a nested prop - warn (reverse "always")
|
||||
if (candidate.nested === true && candidate.node.nodes.length === 1) {
|
||||
_stylelint.utils.report({
|
||||
message: messages.rejected(namespace),
|
||||
node: candidate.node,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Don't warn on non-nested namespaced props if there are
|
||||
// less than 2 of them, and except: "only-of-namespace" is set
|
||||
if (exceptIfOnlyOfNs && !moreThanOneProp) {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: messages.expected(candidate.node.prop),
|
||||
node: candidate.node,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else if (expectation === "never") {
|
||||
root.walk(function (item) {
|
||||
// Just check if there are ANY nested props
|
||||
if (item.type === "rule") {
|
||||
// `background:red {` - selector;
|
||||
// `background: red {` - nested prop; space is decisive here
|
||||
var testForProp = (0, _utils.parseNestedPropRoot)(item.selector);
|
||||
|
||||
if (testForProp && testForProp.propName !== undefined) {
|
||||
_stylelint.utils.report({
|
||||
message: messages.rejected(testForProp.propName.value),
|
||||
result: result,
|
||||
ruleName: ruleName,
|
||||
node: item
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("declaration-nested-properties");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: function expected(prop) {
|
||||
return "Expected property \"" + prop + "\" to be in a nested form";
|
||||
},
|
||||
rejected: function rejected(prop) {
|
||||
return "Unexpected nested property \"" + prop + "\"";
|
||||
}
|
||||
});
|
79
node_modules/stylelint-scss/dist/rules/dollar-variable-colon-newline-after/index.js
generated
vendored
Normal file
79
node_modules/stylelint-scss/dist/rules/dollar-variable-colon-newline-after/index.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (expectation) {
|
||||
var checker = (0, _utils.whitespaceChecker)("newline", expectation, messages);
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: ["always", "always-multi-line"]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
root.walkDecls(function (decl) {
|
||||
if (!decl.prop || decl.prop[0] !== "$") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the raw $var, and only that
|
||||
var endOfPropIndex = (0, _utils.declarationValueIndex)(decl) + decl.raw("between").length - 1;
|
||||
// `$var:`, `$var :`
|
||||
var propPlusColon = decl.toString().slice(0, endOfPropIndex);
|
||||
|
||||
var _loop = function _loop(i, l) {
|
||||
if (propPlusColon[i] !== ":") {
|
||||
return "continue";
|
||||
}
|
||||
var indexToCheck = propPlusColon.substr(propPlusColon[i], 3) === "/*" ? propPlusColon.indexOf("*/", i) + 1 : i;
|
||||
|
||||
checker.afterOneOnly({
|
||||
source: propPlusColon,
|
||||
index: indexToCheck,
|
||||
lineCheckStr: decl.value,
|
||||
err: function err(m) {
|
||||
_stylelint.utils.report({
|
||||
message: m,
|
||||
node: decl,
|
||||
index: indexToCheck,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
}
|
||||
});
|
||||
return "break";
|
||||
};
|
||||
|
||||
_loop2: for (var i = 0, l = propPlusColon.length; i < l; i++) {
|
||||
var _ret = _loop(i, l);
|
||||
|
||||
switch (_ret) {
|
||||
case "continue":
|
||||
continue;
|
||||
|
||||
case "break":
|
||||
break _loop2;}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("dollar-variable-colon-newline-after");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expectedAfter: function expectedAfter() {
|
||||
return "Expected newline after \":\"";
|
||||
},
|
||||
expectedAfterMultiLine: function expectedAfterMultiLine() {
|
||||
return "Expected newline after \":\" with a multi-line value";
|
||||
}
|
||||
});
|
97
node_modules/stylelint-scss/dist/rules/dollar-variable-colon-space-after/index.js
generated
vendored
Normal file
97
node_modules/stylelint-scss/dist/rules/dollar-variable-colon-space-after/index.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (expectation) {
|
||||
var checker = (0, _utils.whitespaceChecker)("space", expectation, messages);
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: ["always", "never", "always-single-line"]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
variableColonSpaceChecker({
|
||||
root: root,
|
||||
result: result,
|
||||
locationChecker: checker.after,
|
||||
checkedRuleName: ruleName
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
exports.variableColonSpaceChecker = variableColonSpaceChecker;
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("dollar-variable-colon-space-after");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expectedAfter: function expectedAfter() {
|
||||
return "Expected single space after \":\"";
|
||||
},
|
||||
rejectedAfter: function rejectedAfter() {
|
||||
return "Unexpected whitespace after \":\"";
|
||||
},
|
||||
expectedAfterSingleLine: function expectedAfterSingleLine() {
|
||||
return "Expected single space after \":\" with a single-line value";
|
||||
}
|
||||
});
|
||||
|
||||
function variableColonSpaceChecker(_ref) {
|
||||
var locationChecker = _ref.locationChecker,
|
||||
root = _ref.root,
|
||||
result = _ref.result,
|
||||
checkedRuleName = _ref.checkedRuleName;
|
||||
|
||||
root.walkDecls(function (decl) {
|
||||
|
||||
if (decl.prop === undefined || decl.prop[0] !== "$") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the raw $var, and only that
|
||||
var endOfPropIndex = (0, _utils.declarationValueIndex)(decl) + decl.raw("between").length - 1;
|
||||
// `$var:`, `$var :`
|
||||
var propPlusColon = decl.toString().slice(0, endOfPropIndex);
|
||||
|
||||
var _loop = function _loop(i) {
|
||||
if (propPlusColon[i] !== ":") {
|
||||
return "continue";
|
||||
}
|
||||
locationChecker({
|
||||
source: propPlusColon,
|
||||
index: i,
|
||||
lineCheckStr: decl.value,
|
||||
err: function err(m) {
|
||||
_stylelint.utils.report({
|
||||
message: m,
|
||||
node: decl,
|
||||
index: i,
|
||||
result: result,
|
||||
ruleName: checkedRuleName
|
||||
});
|
||||
}
|
||||
});
|
||||
return "break";
|
||||
};
|
||||
|
||||
_loop2: for (var i = 0; i < propPlusColon.length; i++) {
|
||||
var _ret = _loop(i);
|
||||
|
||||
switch (_ret) {
|
||||
case "continue":
|
||||
continue;
|
||||
|
||||
case "break":
|
||||
break _loop2;}
|
||||
}
|
||||
});
|
||||
}
|
43
node_modules/stylelint-scss/dist/rules/dollar-variable-colon-space-before/index.js
generated
vendored
Normal file
43
node_modules/stylelint-scss/dist/rules/dollar-variable-colon-space-before/index.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (expectation) {
|
||||
var checker = (0, _utils.whitespaceChecker)("space", expectation, messages);
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: ["always", "never"]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
(0, _dollarVariableColonSpaceAfter.variableColonSpaceChecker)({
|
||||
root: root,
|
||||
result: result,
|
||||
locationChecker: checker.before,
|
||||
checkedRuleName: ruleName
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _dollarVariableColonSpaceAfter = require("../dollar-variable-colon-space-after");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("dollar-variable-colon-space-before");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expectedBefore: function expectedBefore() {
|
||||
return "Expected single space before \":\"";
|
||||
},
|
||||
rejectedBefore: function rejectedBefore() {
|
||||
return "Unexpected whitespace before \":\"";
|
||||
}
|
||||
});
|
90
node_modules/stylelint-scss/dist/rules/dollar-variable-empty-line-before/index.js
generated
vendored
Normal file
90
node_modules/stylelint-scss/dist/rules/dollar-variable-empty-line-before/index.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (expectation, options) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: ["always", "never"]
|
||||
}, {
|
||||
actual: options,
|
||||
possible: {
|
||||
except: ["first-nested", "after-comment", "after-dollar-variable"],
|
||||
ignore: ["after-comment", "inside-single-line-block"]
|
||||
},
|
||||
optional: true
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
root.walkDecls(function (decl) {
|
||||
|
||||
if (!isDollarVar(decl)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Always ignore the first $var in a stylesheet
|
||||
if (decl === root.first) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If ignoring vars after comments is set
|
||||
if ((0, _utils.optionsHaveIgnored)(options, "after-comment") && decl.prev() && decl.prev().type === "comment") {
|
||||
return;
|
||||
}
|
||||
|
||||
// If ignoring single-line blocks
|
||||
if ((0, _utils.optionsHaveIgnored)(options, "inside-single-line-block") && decl.parent.type !== "root" && (0, _utils.isSingleLineString)((0, _utils.blockString)(decl.parent))) {
|
||||
return;
|
||||
}
|
||||
|
||||
var expectHasEmptyLineBefore = expectation === "always";
|
||||
|
||||
// Reverse for a variable that is a first child of its parent
|
||||
if ((0, _utils.optionsHaveException)(options, "first-nested") && decl === decl.parent.first) {
|
||||
expectHasEmptyLineBefore = !expectHasEmptyLineBefore;
|
||||
}
|
||||
|
||||
// Reverse if after a comment
|
||||
if ((0, _utils.optionsHaveException)(options, "after-comment") && decl.prev() && decl.prev().type === "comment") {
|
||||
expectHasEmptyLineBefore = !expectHasEmptyLineBefore;
|
||||
}
|
||||
|
||||
// Reverse if after another $-variable
|
||||
if ((0, _utils.optionsHaveException)(options, "after-dollar-variable") && decl.prev() && isDollarVar(decl.prev())) {
|
||||
expectHasEmptyLineBefore = !expectHasEmptyLineBefore;
|
||||
}
|
||||
|
||||
if (expectHasEmptyLineBefore === (0, _utils.hasEmptyLine)(decl.raws.before)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: expectHasEmptyLineBefore ? messages.expected : messages.rejected,
|
||||
node: decl,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("dollar-variable-empty-line-before");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected an empty line before $-variable",
|
||||
rejected: "Unxpected empty line before $-variable"
|
||||
});
|
||||
|
||||
function isDollarVar(node) {
|
||||
return node.prop && node.prop[0] === "$";
|
||||
}
|
146
node_modules/stylelint-scss/dist/rules/dollar-variable-no-missing-interpolation/index.js
generated
vendored
Normal file
146
node_modules/stylelint-scss/dist/rules/dollar-variable-no-missing-interpolation/index.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (actual) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, { actual: actual });
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
var stringVars = [];
|
||||
var vars = [];
|
||||
|
||||
function findVars(node) {
|
||||
node.walkDecls(function (decl) {
|
||||
var prop = decl.prop,
|
||||
value = decl.value;
|
||||
|
||||
|
||||
if (!isSassVar(prop) || (0, _lodash.includes)(vars, prop)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isStringVal(value)) {
|
||||
stringVars.push(prop);
|
||||
}
|
||||
|
||||
vars.push(prop);
|
||||
});
|
||||
}
|
||||
|
||||
findVars(root);
|
||||
root.walkRules(findVars);
|
||||
|
||||
if (!vars.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
function shouldReport(node, value) {
|
||||
if (isAtSupports(node) || isCustomIdentProp(node)) {
|
||||
return (0, _lodash.includes)(stringVars, value);
|
||||
}
|
||||
if (isCustomIdentAtRule(node)) {
|
||||
return (0, _lodash.includes)(vars, value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function report(node, value) {
|
||||
var name = node.name,
|
||||
prop = node.prop,
|
||||
type = node.type;
|
||||
|
||||
var nodeName = isAtRule(type) ? "@" + name : prop;
|
||||
|
||||
_stylelint.utils.report({
|
||||
ruleName: ruleName,
|
||||
result: result,
|
||||
node: node,
|
||||
message: messages.rejected(nodeName, value)
|
||||
});
|
||||
}
|
||||
|
||||
function exitEarly(node) {
|
||||
return node.type !== "word" || !node.value;
|
||||
}
|
||||
|
||||
function walkValues(node, value) {
|
||||
(0, _postcssValueParser2.default)(value).walk(function (valNode) {
|
||||
var value = valNode.value;
|
||||
|
||||
if (exitEarly(valNode) || !shouldReport(node, value)) {
|
||||
return;
|
||||
}
|
||||
report(node, value);
|
||||
});
|
||||
}
|
||||
|
||||
root.walkDecls(toRegex(customIdentProps), function (decl) {
|
||||
walkValues(decl, decl.value);
|
||||
});
|
||||
|
||||
root.walkAtRules(toRegex(customIdentAtRules), function (atRule) {
|
||||
walkValues(atRule, atRule.params);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _lodash = require("lodash");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _postcssValueParser = require("postcss-value-parser");
|
||||
|
||||
var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("dollar-variable-no-missing-interpolation");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
rejected: function rejected(n, v) {
|
||||
return "Expected variable " + v + " to be interpolated when using it with " + n;
|
||||
}
|
||||
});
|
||||
|
||||
// https://developer.mozilla.org/en/docs/Web/CSS/custom-ident#Lists_of_excluded_values
|
||||
var customIdentProps = ["animation", "animation-name", "counter-reset", "counter-increment", "list-style-type", "will-change"];
|
||||
|
||||
// https://developer.mozilla.org/en/docs/Web/CSS/At-rule
|
||||
var customIdentAtRules = ["counter-style", "keyframes", "supports"];
|
||||
|
||||
function isAtRule(type) {
|
||||
return type === "atrule";
|
||||
}
|
||||
|
||||
function isCustomIdentAtRule(node) {
|
||||
return isAtRule(node.type) && (0, _lodash.includes)(customIdentAtRules, node.name);
|
||||
}
|
||||
|
||||
function isCustomIdentProp(node) {
|
||||
return (0, _lodash.includes)(customIdentProps, node.prop);
|
||||
}
|
||||
|
||||
function isAtSupports(node) {
|
||||
return isAtRule(node.type) && node.name === "supports";
|
||||
}
|
||||
|
||||
function isSassVar(value) {
|
||||
return value[0] === "$";
|
||||
}
|
||||
|
||||
function isStringVal(value) {
|
||||
return (/^("|').*("|')$/.test(value)
|
||||
);
|
||||
}
|
||||
|
||||
function toRegex(arr) {
|
||||
return new RegExp("(" + arr.join("|") + ")");
|
||||
}
|
61
node_modules/stylelint-scss/dist/rules/dollar-variable-pattern/index.js
generated
vendored
Normal file
61
node_modules/stylelint-scss/dist/rules/dollar-variable-pattern/index.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (pattern, options) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: pattern,
|
||||
possible: [_lodash.isRegExp, _lodash.isString]
|
||||
}, {
|
||||
actual: options,
|
||||
possible: {
|
||||
ignore: ["local", "global"]
|
||||
},
|
||||
optional: true
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
var regexpPattern = (0, _lodash.isString)(pattern) ? new RegExp(pattern) : pattern;
|
||||
|
||||
root.walkDecls(function (decl) {
|
||||
var prop = decl.prop;
|
||||
|
||||
|
||||
if (prop[0] !== "$") {
|
||||
return;
|
||||
}
|
||||
// If local or global variables need to be ignored
|
||||
if ((0, _utils.optionsHaveIgnored)(options, "global") && decl.parent.type === "root" || (0, _utils.optionsHaveIgnored)(options, "local") && decl.parent.type !== "root") {
|
||||
return;
|
||||
}
|
||||
if (regexpPattern.test(prop.slice(1))) {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: messages.expected,
|
||||
node: decl,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _lodash = require("lodash");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("dollar-variable-pattern");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected $ variable name to match specified pattern"
|
||||
});
|
91
node_modules/stylelint-scss/dist/rules/double-slash-comment-empty-line-before/index.js
generated
vendored
Normal file
91
node_modules/stylelint-scss/dist/rules/double-slash-comment-empty-line-before/index.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (expectation, options) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: ["always", "never"]
|
||||
}, {
|
||||
actual: options,
|
||||
possible: {
|
||||
except: ["first-nested"],
|
||||
ignore: ["stylelint-commands", "between-comments"]
|
||||
},
|
||||
optional: true
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
root.walkComments(function (comment) {
|
||||
|
||||
// Only process // comments
|
||||
if (!comment.raws.inline && !comment.inline) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((0, _utils.isInlineComment)(comment)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore the first node
|
||||
if (comment === root.first) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Optionally ignore stylelint commands
|
||||
if (comment.text.indexOf(stylelintCommandPrefix) === 0 && (0, _utils.optionsHaveIgnored)(options, "stylelint-commands")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Optionally ignore newlines between comments
|
||||
var prev = comment.prev();
|
||||
if (prev && prev.type === "comment" && (0, _utils.optionsHaveIgnored)(options, "between-comments")) {
|
||||
return;
|
||||
}
|
||||
|
||||
var before = comment.raw("before");
|
||||
|
||||
var expectEmptyLineBefore = function () {
|
||||
if ((0, _utils.optionsHaveException)(options, "first-nested") && comment.parent !== root && comment === comment.parent.first) {
|
||||
return false;
|
||||
}
|
||||
return expectation === "always";
|
||||
}();
|
||||
|
||||
var hasEmptyLineBefore = before.search(/\n\s*?\n/) !== -1;
|
||||
|
||||
// Return if the expectation is met
|
||||
if (expectEmptyLineBefore === hasEmptyLineBefore) {
|
||||
return;
|
||||
}
|
||||
|
||||
var message = expectEmptyLineBefore ? messages.expected : messages.rejected;
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: message,
|
||||
node: comment,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("double-slash-comment-empty-line-before");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected empty line before comment",
|
||||
rejected: "Unexpected empty line before comment"
|
||||
});
|
||||
|
||||
var stylelintCommandPrefix = "stylelint-";
|
69
node_modules/stylelint-scss/dist/rules/double-slash-comment-inline/index.js
generated
vendored
Normal file
69
node_modules/stylelint-scss/dist/rules/double-slash-comment-inline/index.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (expectation, options) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: expectation,
|
||||
possible: ["always", "never"]
|
||||
}, {
|
||||
actual: options,
|
||||
possible: {
|
||||
ignore: ["stylelint-commands"]
|
||||
},
|
||||
optional: true
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
var comments = (0, _utils.findCommentsInRaws)(root.source.input.css);
|
||||
comments.forEach(function (comment) {
|
||||
// Only process // comments
|
||||
if (comment.type !== "double-slash") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Optionally ignore stylelint commands
|
||||
if (comment.text.indexOf(stylelintCommandPrefix) === 0 && (0, _utils.optionsHaveIgnored)(options, "stylelint-commands")) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isInline = comment.inlineAfter || comment.inlineBefore;
|
||||
var message = void 0;
|
||||
|
||||
if (isInline && expectation === "never") {
|
||||
message = messages.rejected;
|
||||
} else if (!isInline && expectation === "always") {
|
||||
message = messages.expected;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: message,
|
||||
node: root,
|
||||
index: comment.source.start,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("double-slash-comment-inline");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected //-comment to be inline comment",
|
||||
rejected: "Unexpected inline //-comment"
|
||||
});
|
||||
|
||||
var stylelintCommandPrefix = "stylelint-";
|
60
node_modules/stylelint-scss/dist/rules/double-slash-comment-whitespace-inside/index.js
generated
vendored
Normal file
60
node_modules/stylelint-scss/dist/rules/double-slash-comment-whitespace-inside/index.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"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,
|
||||
possible: ["always", "never"]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
var comments = (0, _utils.findCommentsInRaws)(root.source.input.css);
|
||||
comments.forEach(function (comment) {
|
||||
// Only process // comments
|
||||
if (comment.type !== "double-slash") {
|
||||
return;
|
||||
}
|
||||
// if it's `//` - no warning whatsoever; if `// ` - then trailing
|
||||
// whitespace rule will govern this
|
||||
if (comment.text === "") {
|
||||
return;
|
||||
}
|
||||
|
||||
var message = void 0;
|
||||
|
||||
if (expectation === "never" && comment.raws.left !== "") {
|
||||
message = messages.rejected;
|
||||
} else if (comment.raws.left === "" && expectation === "always") {
|
||||
message = messages.expected;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: message,
|
||||
node: root,
|
||||
index: comment.source.start + comment.raws.startToken.length,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("double-slash-comment-whitespace-inside");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Expected a space after //",
|
||||
rejected: "Unexpected space after //"
|
||||
});
|
170
node_modules/stylelint-scss/dist/rules/index.js
generated
vendored
Normal file
170
node_modules/stylelint-scss/dist/rules/index.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _atExtendNoMissingPlaceholder = require("./at-extend-no-missing-placeholder");
|
||||
|
||||
var _atExtendNoMissingPlaceholder2 = _interopRequireDefault(_atExtendNoMissingPlaceholder);
|
||||
|
||||
var _atElseClosingBraceNewlineAfter = require("./at-else-closing-brace-newline-after");
|
||||
|
||||
var _atElseClosingBraceNewlineAfter2 = _interopRequireDefault(_atElseClosingBraceNewlineAfter);
|
||||
|
||||
var _atElseClosingBraceSpaceAfter = require("./at-else-closing-brace-space-after");
|
||||
|
||||
var _atElseClosingBraceSpaceAfter2 = _interopRequireDefault(_atElseClosingBraceSpaceAfter);
|
||||
|
||||
var _atElseEmptyLineBefore = require("./at-else-empty-line-before");
|
||||
|
||||
var _atElseEmptyLineBefore2 = _interopRequireDefault(_atElseEmptyLineBefore);
|
||||
|
||||
var _atFunctionPattern = require("./at-function-pattern");
|
||||
|
||||
var _atFunctionPattern2 = _interopRequireDefault(_atFunctionPattern);
|
||||
|
||||
var _atIfClosingBraceNewlineAfter = require("./at-if-closing-brace-newline-after");
|
||||
|
||||
var _atIfClosingBraceNewlineAfter2 = _interopRequireDefault(_atIfClosingBraceNewlineAfter);
|
||||
|
||||
var _atIfClosingBraceSpaceAfter = require("./at-if-closing-brace-space-after");
|
||||
|
||||
var _atIfClosingBraceSpaceAfter2 = _interopRequireDefault(_atIfClosingBraceSpaceAfter);
|
||||
|
||||
var _atImportNoPartialExtension = require("./at-import-no-partial-extension");
|
||||
|
||||
var _atImportNoPartialExtension2 = _interopRequireDefault(_atImportNoPartialExtension);
|
||||
|
||||
var _atImportNoPartialLeadingUnderscore = require("./at-import-no-partial-leading-underscore");
|
||||
|
||||
var _atImportNoPartialLeadingUnderscore2 = _interopRequireDefault(_atImportNoPartialLeadingUnderscore);
|
||||
|
||||
var _atImportPartialExtensionBlacklist = require("./at-import-partial-extension-blacklist");
|
||||
|
||||
var _atImportPartialExtensionBlacklist2 = _interopRequireDefault(_atImportPartialExtensionBlacklist);
|
||||
|
||||
var _atImportPartialExtensionWhitelist = require("./at-import-partial-extension-whitelist");
|
||||
|
||||
var _atImportPartialExtensionWhitelist2 = _interopRequireDefault(_atImportPartialExtensionWhitelist);
|
||||
|
||||
var _atMixinArgumentlessCallParentheses = require("./at-mixin-argumentless-call-parentheses");
|
||||
|
||||
var _atMixinArgumentlessCallParentheses2 = _interopRequireDefault(_atMixinArgumentlessCallParentheses);
|
||||
|
||||
var _atMixinNoArgumentlessCallParentheses = require("./at-mixin-no-argumentless-call-parentheses");
|
||||
|
||||
var _atMixinNoArgumentlessCallParentheses2 = _interopRequireDefault(_atMixinNoArgumentlessCallParentheses);
|
||||
|
||||
var _atMixinPattern = require("./at-mixin-pattern");
|
||||
|
||||
var _atMixinPattern2 = _interopRequireDefault(_atMixinPattern);
|
||||
|
||||
var _declarationNestedProperties = require("./declaration-nested-properties");
|
||||
|
||||
var _declarationNestedProperties2 = _interopRequireDefault(_declarationNestedProperties);
|
||||
|
||||
var _declarationNestedPropertiesNoDividedGroups = require("./declaration-nested-properties-no-divided-groups");
|
||||
|
||||
var _declarationNestedPropertiesNoDividedGroups2 = _interopRequireDefault(_declarationNestedPropertiesNoDividedGroups);
|
||||
|
||||
var _dollarVariableColonNewlineAfter = require("./dollar-variable-colon-newline-after");
|
||||
|
||||
var _dollarVariableColonNewlineAfter2 = _interopRequireDefault(_dollarVariableColonNewlineAfter);
|
||||
|
||||
var _dollarVariableColonSpaceAfter = require("./dollar-variable-colon-space-after");
|
||||
|
||||
var _dollarVariableColonSpaceAfter2 = _interopRequireDefault(_dollarVariableColonSpaceAfter);
|
||||
|
||||
var _dollarVariableColonSpaceBefore = require("./dollar-variable-colon-space-before");
|
||||
|
||||
var _dollarVariableColonSpaceBefore2 = _interopRequireDefault(_dollarVariableColonSpaceBefore);
|
||||
|
||||
var _dollarVariableEmptyLineBefore = require("./dollar-variable-empty-line-before");
|
||||
|
||||
var _dollarVariableEmptyLineBefore2 = _interopRequireDefault(_dollarVariableEmptyLineBefore);
|
||||
|
||||
var _dollarVariableNoMissingInterpolation = require("./dollar-variable-no-missing-interpolation");
|
||||
|
||||
var _dollarVariableNoMissingInterpolation2 = _interopRequireDefault(_dollarVariableNoMissingInterpolation);
|
||||
|
||||
var _dollarVariablePattern = require("./dollar-variable-pattern");
|
||||
|
||||
var _dollarVariablePattern2 = _interopRequireDefault(_dollarVariablePattern);
|
||||
|
||||
var _doubleSlashCommentEmptyLineBefore = require("./double-slash-comment-empty-line-before");
|
||||
|
||||
var _doubleSlashCommentEmptyLineBefore2 = _interopRequireDefault(_doubleSlashCommentEmptyLineBefore);
|
||||
|
||||
var _doubleSlashCommentInline = require("./double-slash-comment-inline");
|
||||
|
||||
var _doubleSlashCommentInline2 = _interopRequireDefault(_doubleSlashCommentInline);
|
||||
|
||||
var _doubleSlashCommentWhitespaceInside = require("./double-slash-comment-whitespace-inside");
|
||||
|
||||
var _doubleSlashCommentWhitespaceInside2 = _interopRequireDefault(_doubleSlashCommentWhitespaceInside);
|
||||
|
||||
var _mediaFeatureValueDollarVariable = require("./media-feature-value-dollar-variable");
|
||||
|
||||
var _mediaFeatureValueDollarVariable2 = _interopRequireDefault(_mediaFeatureValueDollarVariable);
|
||||
|
||||
var _operatorNoNewlineAfter = require("./operator-no-newline-after");
|
||||
|
||||
var _operatorNoNewlineAfter2 = _interopRequireDefault(_operatorNoNewlineAfter);
|
||||
|
||||
var _operatorNoNewlineBefore = require("./operator-no-newline-before");
|
||||
|
||||
var _operatorNoNewlineBefore2 = _interopRequireDefault(_operatorNoNewlineBefore);
|
||||
|
||||
var _operatorNoUnspaced = require("./operator-no-unspaced");
|
||||
|
||||
var _operatorNoUnspaced2 = _interopRequireDefault(_operatorNoUnspaced);
|
||||
|
||||
var _partialNoImport = require("./partial-no-import");
|
||||
|
||||
var _partialNoImport2 = _interopRequireDefault(_partialNoImport);
|
||||
|
||||
var _percentPlaceholderPattern = require("./percent-placeholder-pattern");
|
||||
|
||||
var _percentPlaceholderPattern2 = _interopRequireDefault(_percentPlaceholderPattern);
|
||||
|
||||
var _selectorNoRedundantNestingSelector = require("./selector-no-redundant-nesting-selector");
|
||||
|
||||
var _selectorNoRedundantNestingSelector2 = _interopRequireDefault(_selectorNoRedundantNestingSelector);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = {
|
||||
"at-extend-no-missing-placeholder": _atExtendNoMissingPlaceholder2.default,
|
||||
"at-else-closing-brace-newline-after": _atElseClosingBraceNewlineAfter2.default,
|
||||
"at-else-closing-brace-space-after": _atElseClosingBraceSpaceAfter2.default,
|
||||
"at-else-empty-line-before": _atElseEmptyLineBefore2.default,
|
||||
"at-function-pattern": _atFunctionPattern2.default,
|
||||
"at-if-closing-brace-newline-after": _atIfClosingBraceNewlineAfter2.default,
|
||||
"at-if-closing-brace-space-after": _atIfClosingBraceSpaceAfter2.default,
|
||||
"at-import-no-partial-extension": _atImportNoPartialExtension2.default,
|
||||
"at-import-no-partial-leading-underscore": _atImportNoPartialLeadingUnderscore2.default,
|
||||
"at-import-partial-extension-blacklist": _atImportPartialExtensionBlacklist2.default,
|
||||
"at-import-partial-extension-whitelist": _atImportPartialExtensionWhitelist2.default,
|
||||
"at-mixin-argumentless-call-parentheses": _atMixinArgumentlessCallParentheses2.default,
|
||||
"at-mixin-no-argumentless-call-parentheses": _atMixinNoArgumentlessCallParentheses2.default,
|
||||
"at-mixin-pattern": _atMixinPattern2.default,
|
||||
"declaration-nested-properties": _declarationNestedProperties2.default,
|
||||
"declaration-nested-properties-no-divided-groups": _declarationNestedPropertiesNoDividedGroups2.default,
|
||||
"dollar-variable-colon-newline-after": _dollarVariableColonNewlineAfter2.default,
|
||||
"dollar-variable-colon-space-after": _dollarVariableColonSpaceAfter2.default,
|
||||
"dollar-variable-colon-space-before": _dollarVariableColonSpaceBefore2.default,
|
||||
"dollar-variable-empty-line-before": _dollarVariableEmptyLineBefore2.default,
|
||||
"dollar-variable-no-missing-interpolation": _dollarVariableNoMissingInterpolation2.default,
|
||||
"dollar-variable-pattern": _dollarVariablePattern2.default,
|
||||
"double-slash-comment-empty-line-before": _doubleSlashCommentEmptyLineBefore2.default,
|
||||
"double-slash-comment-inline": _doubleSlashCommentInline2.default,
|
||||
"double-slash-comment-whitespace-inside": _doubleSlashCommentWhitespaceInside2.default,
|
||||
"media-feature-value-dollar-variable": _mediaFeatureValueDollarVariable2.default,
|
||||
"operator-no-newline-after": _operatorNoNewlineAfter2.default,
|
||||
"operator-no-newline-before": _operatorNoNewlineBefore2.default,
|
||||
"operator-no-unspaced": _operatorNoUnspaced2.default,
|
||||
"percent-placeholder-pattern": _percentPlaceholderPattern2.default,
|
||||
"partial-no-import": _partialNoImport2.default,
|
||||
"selector-no-redundant-nesting-selector": _selectorNoRedundantNestingSelector2.default
|
||||
};
|
71
node_modules/stylelint-scss/dist/rules/media-feature-value-dollar-variable/index.js
generated
vendored
Normal file
71
node_modules/stylelint-scss/dist/rules/media-feature-value-dollar-variable/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,
|
||||
possible: ["always", "never"]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
var valueRegex = /:(?:\s*?)(\S.+?)(:?\s*?)\)/;
|
||||
// In `(max-width: 10px )` find `: 10px )`.
|
||||
// Got to go with that (the global search doesn't remember parens' insides)
|
||||
// and parse it again afterwards to remove trailing junk
|
||||
var valueRegexGlobal = new RegExp(valueRegex.source, "g");
|
||||
// `$var-name_sth`
|
||||
var variableRegex = /^\$[A-Za-z_0-9-]+$/;
|
||||
// `#{$var-name_sth}`
|
||||
var interpolationVarRegex = /^#\{\s*?\$[A-Za-z_0-9]+\s*?\}$/;
|
||||
|
||||
root.walkAtRules("media", function (atRule) {
|
||||
var found = atRule.params.match(valueRegexGlobal);
|
||||
// If there are no values
|
||||
if (!found || !found.length) {
|
||||
return;
|
||||
}
|
||||
found.forEach(function (found) {
|
||||
// ... parse `: 10px )` to `10px`
|
||||
var valueParsed = found.match(valueRegex)[1];
|
||||
|
||||
// Just a shorthand to stylelint.utils.report()
|
||||
function complain(message) {
|
||||
_stylelint.utils.report({
|
||||
ruleName: ruleName,
|
||||
result: result,
|
||||
node: atRule,
|
||||
word: valueParsed,
|
||||
message: message
|
||||
});
|
||||
}
|
||||
|
||||
// A value should be a single variable
|
||||
// or it should be a single variable inside Sass interpolation
|
||||
if (expectation === "always" && !(valueParsed.search(variableRegex) !== -1 || valueParsed.search(interpolationVarRegex) !== -1)) {
|
||||
complain(messages.expected);
|
||||
} else if (expectation === "never" && valueParsed.indexOf("$") !== -1) {
|
||||
// "Never" means no variables at all (functions allowed)
|
||||
complain(messages.rejected);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("media-feature-value-dollar-variable");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
rejected: "Unexpected dollar-variable as a media feature value",
|
||||
expected: "Expected a dollar-variable (e.g. $var) to be used as a media feature value"
|
||||
});
|
71
node_modules/stylelint-scss/dist/rules/operator-no-newline-after/index.js
generated
vendored
Normal file
71
node_modules/stylelint-scss/dist/rules/operator-no-newline-after/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-after");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
rejected: function rejected(operator) {
|
||||
return "Unexpected newline after \"" + 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 = endIndex + 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
|
||||
});
|
||||
}
|
||||
}
|
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
|
||||
});
|
||||
}
|
||||
}
|
243
node_modules/stylelint-scss/dist/rules/operator-no-unspaced/index.js
generated
vendored
Normal file
243
node_modules/stylelint-scss/dist/rules/operator-no-unspaced/index.js
generated
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
"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;
|
||||
}
|
||||
|
||||
calculationOperatorSpaceChecker({
|
||||
root: root,
|
||||
result: result,
|
||||
checker: checkSpaces
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
exports.calculationOperatorSpaceChecker = calculationOperatorSpaceChecker;
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _postcssMediaQueryParser = require("postcss-media-query-parser");
|
||||
|
||||
var _postcssMediaQueryParser2 = _interopRequireDefault(_postcssMediaQueryParser);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("operator-no-unspaced");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expectedAfter: function expectedAfter(operator) {
|
||||
return "Expected single space after \"" + operator + "\"";
|
||||
},
|
||||
expectedBefore: function expectedBefore(operator) {
|
||||
return "Expected single space before \"" + operator + "\"";
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The actual check for are there (un)necessary whitespaces
|
||||
*/
|
||||
function checkSpaces(_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 beforeOk = string[startIndex - 1] === " " && !(0, _utils.isWhitespace)(string[startIndex - 2]) || newlineBefore(string, startIndex - 1);
|
||||
if (!beforeOk) {
|
||||
_stylelint.utils.report({
|
||||
ruleName: ruleName,
|
||||
result: result,
|
||||
node: node,
|
||||
message: messages.expectedBefore(symbol),
|
||||
index: startIndex + globalIndex
|
||||
});
|
||||
}
|
||||
|
||||
var afterOk = string[endIndex + 1] === " " && !(0, _utils.isWhitespace)(string[endIndex + 2]) || string[endIndex + 1] === "\n" || string.substr(endIndex + 1, 2) === "\r\n";
|
||||
|
||||
if (!afterOk) {
|
||||
_stylelint.utils.report({
|
||||
ruleName: ruleName,
|
||||
result: result,
|
||||
node: node,
|
||||
message: messages.expectedAfter(symbol),
|
||||
index: endIndex + globalIndex
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function newlineBefore(str, startIndex) {
|
||||
var index = startIndex;
|
||||
while (index && (0, _utils.isWhitespace)(str[index])) {
|
||||
if (str[index] === "\n") return true;
|
||||
index--;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The core rule logic function. This one can be imported by some other rules
|
||||
* that work with Sass operators
|
||||
*
|
||||
* @param {Object} args -- Named arguments object
|
||||
* @param {PostCSS Root} args.root
|
||||
* @param {PostCSS Result} args.result
|
||||
* @param {function} args.checker -- the function that is run against all the
|
||||
* operators found in the input. Takes these arguments:
|
||||
* {Object} cbArgs -- Named arguments object
|
||||
* {string} cbArgs.string -- the input string (suspected operation)
|
||||
* {number} cbArgs.globalIndex -- the string's index in a global input
|
||||
* {number} cbArgs.startIndex -- the start index of a sybmol to inspect
|
||||
* {number} cbArgs.endIndex -- the end index of a sybmol to inspect
|
||||
* (two indexes needed to allow for `==`, `!=`, etc.)
|
||||
* {PostCSS Node} cbArgs.node -- for stylelint.utils.report
|
||||
* {PostCSS Result} cbArgs.result -- for stylelint.utils.report
|
||||
*/
|
||||
function calculationOperatorSpaceChecker(_ref2) {
|
||||
var root = _ref2.root,
|
||||
result = _ref2.result,
|
||||
checker = _ref2.checker;
|
||||
|
||||
|
||||
/**
|
||||
* Takes a string, finds all occurencies of Sass interpolaion in it, then
|
||||
* finds all operators inside that interpolation
|
||||
*
|
||||
* @return {array} An array of ojbects { string, operators } - effectively,
|
||||
* a list of operators for each Sass interpolation occurence
|
||||
*/
|
||||
function findInterpolation(string, startIndex) {
|
||||
var interpolationRegex = /#{(.*?)}/g;
|
||||
var results = [];
|
||||
// Searching for interpolation
|
||||
var match = interpolationRegex.exec(string);
|
||||
startIndex = !isNaN(startIndex) ? Number(startIndex) : 0;
|
||||
while (match !== null) {
|
||||
results.push({
|
||||
source: match[0],
|
||||
operators: (0, _utils.findOperators)({
|
||||
string: match[0],
|
||||
globalIndex: match.index + startIndex
|
||||
})
|
||||
});
|
||||
match = interpolationRegex.exec(string);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
root.walk(function (item) {
|
||||
var results = [];
|
||||
|
||||
// Check a value (`10px` in `width: 10px;`)
|
||||
if (item.value !== undefined) {
|
||||
results.push({
|
||||
source: item.value,
|
||||
operators: (0, _utils.findOperators)({
|
||||
string: item.value,
|
||||
globalIndex: (0, _utils.declarationValueIndex)(item),
|
||||
// For Sass variable values some special rules apply
|
||||
isAfterColon: item.prop[0] === "$"
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// Property name
|
||||
if (item.prop !== undefined) {
|
||||
results = results.concat(findInterpolation(item.prop));
|
||||
}
|
||||
// Selector
|
||||
if (item.selector !== undefined) {
|
||||
results = results.concat(findInterpolation(item.selector));
|
||||
}
|
||||
|
||||
if (item.type === "atrule") {
|
||||
|
||||
// Media queries
|
||||
if (item.name === "media" || item.name === "import") {
|
||||
(0, _postcssMediaQueryParser2.default)(item.params).walk(function (node) {
|
||||
var type = node.type;
|
||||
if (["keyword", "media-type", "media-feature"].indexOf(type) !== -1) {
|
||||
results = results.concat(findInterpolation(node.value, (0, _utils.atRuleParamIndex)(item) + node.sourceIndex));
|
||||
} else if (["value", "url"].indexOf(type) !== -1) {
|
||||
results.push({
|
||||
source: node.value,
|
||||
operators: (0, _utils.findOperators)({
|
||||
string: node.value,
|
||||
globalIndex: (0, _utils.atRuleParamIndex)(item) + node.sourceIndex,
|
||||
isAfterColon: true
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Function and mixin definitions and other rules
|
||||
results.push({
|
||||
source: item.params,
|
||||
operators: (0, _utils.findOperators)({
|
||||
string: item.params,
|
||||
globalIndex: (0, _utils.atRuleParamIndex)(item),
|
||||
isAfterColon: true
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// All the strings have been parsed, now run whitespace checking
|
||||
results.forEach(function (el) {
|
||||
// Only if there are operators within a string
|
||||
if (el.operators && el.operators.length > 0) {
|
||||
el.operators.forEach(function (operator) {
|
||||
checker({
|
||||
string: el.source,
|
||||
globalIndex: operator.globalIndex,
|
||||
startIndex: operator.startIndex,
|
||||
endIndex: operator.endIndex,
|
||||
node: item,
|
||||
result: result
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Checking interpolation inside comments
|
||||
// We have to give up on PostCSS here because it skips some inline comments
|
||||
(0, _utils.findCommentsInRaws)(root.source.input.css).forEach(function (comment) {
|
||||
var startIndex = comment.source.start + comment.raws.startToken.length + comment.raws.left.length;
|
||||
if (comment.type !== "css") {
|
||||
return;
|
||||
}
|
||||
|
||||
findInterpolation(comment.text).forEach(function (el) {
|
||||
// Only if there are operators within a string
|
||||
if (el.operators && el.operators.length > 0) {
|
||||
el.operators.forEach(function (operator) {
|
||||
checker({
|
||||
string: el.source,
|
||||
globalIndex: operator.globalIndex + startIndex,
|
||||
startIndex: operator.startIndex,
|
||||
endIndex: operator.endIndex,
|
||||
node: root,
|
||||
result: result
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
75
node_modules/stylelint-scss/dist/rules/partial-no-import/index.js
generated
vendored
Normal file
75
node_modules/stylelint-scss/dist/rules/partial-no-import/index.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (on) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: on
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (root.source.input.file === undefined || !root.source.input.file) {
|
||||
result.warn("The 'partial-no-import' rule won't work if linting in a code string without an actual file.");
|
||||
return;
|
||||
}
|
||||
|
||||
var fileName = _path2.default.basename(root.source.input.file);
|
||||
var extName = _path2.default.extname(root.source.input.file);
|
||||
|
||||
function checkImportForCSS(path, decl) {
|
||||
// Stripping trailing quotes and whitespaces, if any
|
||||
var pathStripped = path.replace(/^\s*?("|')\s*/, "").replace(/\s*("|')\s*?$/, "");
|
||||
|
||||
// Skipping importing CSS: url(), ".css", URI with a protocol, media
|
||||
if (pathStripped.slice(0, 4) === "url(" || pathStripped.slice(-4) === ".css" || pathStripped.search("//") !== -1 || pathStripped.search(/(?:\s|[,)"'])\w+$/) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
_stylelint.utils.report({
|
||||
message: messages.expected,
|
||||
node: decl,
|
||||
result: result,
|
||||
ruleName: ruleName
|
||||
});
|
||||
}
|
||||
|
||||
// Usual CSS file
|
||||
if (extName === ".css") {
|
||||
return;
|
||||
}
|
||||
// Not a partial
|
||||
if (fileName[0] !== "_") {
|
||||
return;
|
||||
}
|
||||
|
||||
root.walkAtRules("import", function (mixinCall) {
|
||||
// Check if @import is treated as CSS import; report only if not
|
||||
// Processing comma-separated lists of import paths
|
||||
mixinCall.params.split(",").forEach(function (path) {
|
||||
checkImportForCSS(path, mixinCall);
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("partial-no-import");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: "Unexpected @import in a partial"
|
||||
});
|
96
node_modules/stylelint-scss/dist/rules/percent-placeholder-pattern/index.js
generated
vendored
Normal file
96
node_modules/stylelint-scss/dist/rules/percent-placeholder-pattern/index.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (pattern) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, {
|
||||
actual: pattern,
|
||||
possible: [_lodash.isRegExp, _lodash.isString]
|
||||
});
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
var placeholderPattern = (0, _lodash.isString)(pattern) ? new RegExp(pattern) : pattern;
|
||||
|
||||
// Checking placeholder definitions (looking among regular rules)
|
||||
root.walkRules(function (rule) {
|
||||
var selector = rule.selector;
|
||||
// Just a shorthand for calling `parseSelector`
|
||||
|
||||
function parse(selector) {
|
||||
(0, _utils.parseSelector)(selector, result, rule, function (s) {
|
||||
return checkSelector(s, rule);
|
||||
});
|
||||
}
|
||||
|
||||
// If it's a custom prop or a less mixin
|
||||
if (!(0, _utils.isStandardRule)(rule)) {
|
||||
return;
|
||||
}
|
||||
// If the selector has interpolation
|
||||
if (!(0, _utils.isStandardSelector)(selector)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Nested selectors are processed in steps, as nesting levels are resolved.
|
||||
// Here we skip processing intermediate parts of selectors (to process only fully resolved selectors)
|
||||
// if (rule.nodes.some(node => node.type === "rule" || node.type === "atrule")) { return }
|
||||
|
||||
// Only resolve selectors that have an interpolating "&"
|
||||
if ((0, _utils.hasInterpolatingAmpersand)(selector)) {
|
||||
(0, _postcssResolveNestedSelector2.default)(selector, rule).forEach(parse);
|
||||
} else {
|
||||
parse(selector);
|
||||
}
|
||||
});
|
||||
|
||||
function checkSelector(fullSelector, rule) {
|
||||
// postcss-selector-parser gives %placeholders' nodes a "tag" type
|
||||
fullSelector.walkTags(function (compoundSelector) {
|
||||
var value = compoundSelector.value,
|
||||
sourceIndex = compoundSelector.sourceIndex;
|
||||
|
||||
if (value[0] !== "%") {
|
||||
return;
|
||||
}
|
||||
var placeholder = value.slice(1);
|
||||
|
||||
if (placeholderPattern.test(placeholder)) {
|
||||
return;
|
||||
}
|
||||
_stylelint.utils.report({
|
||||
result: result,
|
||||
ruleName: ruleName,
|
||||
message: messages.expected(placeholder),
|
||||
node: rule,
|
||||
index: sourceIndex
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var _lodash = require("lodash");
|
||||
|
||||
var _postcssResolveNestedSelector = require("postcss-resolve-nested-selector");
|
||||
|
||||
var _postcssResolveNestedSelector2 = _interopRequireDefault(_postcssResolveNestedSelector);
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("percent-placeholder-pattern");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
expected: function expected(placeholder) {
|
||||
return "Expected %-placeholder \"%" + placeholder + "\" to match specified pattern";
|
||||
}
|
||||
});
|
41
node_modules/stylelint-scss/dist/rules/selector-no-redundant-nesting-selector/index.js
generated
vendored
Normal file
41
node_modules/stylelint-scss/dist/rules/selector-no-redundant-nesting-selector/index.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.messages = exports.ruleName = undefined;
|
||||
|
||||
exports.default = function (actual) {
|
||||
return function (root, result) {
|
||||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, { actual: actual });
|
||||
if (!validOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
root.walkRules(/&/, function (rule) {
|
||||
var selector = rule.selector;
|
||||
// "Ampersand followed by a combinator followed by non-combinator non-ampersand and not the selector end"
|
||||
|
||||
var regex = /^&\s*[>+~ ]\s*[^>+~ {&]+/;
|
||||
|
||||
if (selector === "&" || regex.test(selector)) {
|
||||
_stylelint.utils.report({
|
||||
ruleName: ruleName,
|
||||
result: result,
|
||||
node: rule,
|
||||
message: messages.rejected
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _stylelint = require("stylelint");
|
||||
|
||||
var _utils = require("../../utils");
|
||||
|
||||
var ruleName = exports.ruleName = (0, _utils.namespace)("selector-no-redundant-nesting-selector");
|
||||
|
||||
var messages = exports.messages = _stylelint.utils.ruleMessages(ruleName, {
|
||||
rejected: "Unnecessary nesting selector (&)"
|
||||
});
|
Reference in New Issue
Block a user