ocrmnav
Version:
DevStack - The Complete Developer Toolkit - Virtual file system, workflow automation, and more than 65+ other development tools / features in one seamless extension. Cutting down dev times never before seen.
440 lines (336 loc) • 12.6 kB
JavaScript
exports.id = 77;
exports.ids = [77];
exports.modules = {
/***/ 1521:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ getRuleSelector)
/* harmony export */ });
/**
* @param {import('postcss').Rule} ruleNode
* @returns {string}
*/
function getRuleSelector(ruleNode) {
const raws = ruleNode.raws;
return (raws.selector && raws.selector.raw) || ruleNode.selector;
}
/***/ }),
/***/ 1524:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ hasInterpolation)
/* harmony export */ });
/* harmony import */ var _hasLessInterpolation_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1525);
/* harmony import */ var _hasPsvInterpolation_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1526);
/* harmony import */ var _hasScssInterpolation_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1527);
/* harmony import */ var _hasTplInterpolation_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1528);
/**
* Check whether a string has interpolation
*
* @param {string} string
* @returns {boolean} If `true`, a string has interpolation
*/
function hasInterpolation(string) {
// SCSS or Less interpolation
if (
(0,_hasLessInterpolation_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(string) ||
(0,_hasScssInterpolation_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(string) ||
(0,_hasTplInterpolation_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])(string) ||
(0,_hasPsvInterpolation_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(string)
) {
return true;
}
return false;
}
/***/ }),
/***/ 1525:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ hasLessInterpolation)
/* harmony export */ });
const HAS_LESS_INTERPOLATION = /@\{.+?\}/;
/**
* Check whether a string has less interpolation
*
* @param {string} string
* @returns {boolean} If `true`, a string has less interpolation
*/
function hasLessInterpolation(string) {
return HAS_LESS_INTERPOLATION.test(string);
}
/***/ }),
/***/ 1526:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ hasPsvInterpolation)
/* harmony export */ });
const HAS_PSV_INTERPOLATION = /\$\(.+?\)/;
/**
* Check whether a string has postcss-simple-vars interpolation
*
* @param {string} string
* @returns {boolean}
*/
function hasPsvInterpolation(string) {
return HAS_PSV_INTERPOLATION.test(string);
}
/***/ }),
/***/ 1527:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ hasScssInterpolation)
/* harmony export */ });
const HAS_SCSS_INTERPOLATION = /#\{.+?\}/s;
/**
* Check whether a string has scss interpolation
*
* @param {string} string
* @returns {boolean}
*/
function hasScssInterpolation(string) {
return HAS_SCSS_INTERPOLATION.test(string);
}
/***/ }),
/***/ 1528:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ hasTplInterpolation)
/* harmony export */ });
const HAS_TPL_INTERPOLATION = /\{.+?\}/s;
/**
* Check whether a string has JS template literal interpolation or HTML-like template
*
* @param {string} string
* @returns {boolean} If `true`, a string has template literal interpolation
*/
function hasTplInterpolation(string) {
return HAS_TPL_INTERPOLATION.test(string);
}
/***/ }),
/***/ 1568:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ isStandardSyntaxRule)
/* harmony export */ });
/* harmony import */ var _isStandardSyntaxSelector_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1569);
/**
* Check whether a Node is a standard rule
*
* @param {import('postcss').Rule | import('postcss-less').Rule} rule
* @returns {boolean}
*/
function isStandardSyntaxRule(rule) {
if (rule.type !== 'rule') {
return false;
}
// Ignore Less &:extend rule
if ('extend' in rule && rule.extend) {
return false;
}
if (!(0,_isStandardSyntaxSelector_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(rule.selector)) {
return false;
}
return true;
}
/***/ }),
/***/ 1569:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ isStandardSyntaxSelector)
/* harmony export */ });
/* harmony import */ var _hasInterpolation_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1524);
/**
* Check whether a selector is standard
*
* @param {string} selector
* @returns {boolean}
*/
function isStandardSyntaxSelector(selector) {
// SCSS or Less interpolation
if ((0,_hasInterpolation_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(selector)) {
return false;
}
// SCSS placeholder selectors
if (selector.startsWith('%')) {
return false;
}
// SCSS nested properties
if (selector.endsWith(':')) {
return false;
}
// Less :extend()
if (/:extend(?:\(.*?\))?/.test(selector)) {
return false;
}
// Less mixin with resolved nested selectors (e.g. .foo().bar or .foo(@a, @b)[bar])
if (/\.[\w-]+\(.*\).+/.test(selector)) {
return false;
}
// Less non-outputting mixin definition (e.g. .mixin() {})
if (selector.endsWith(')') && !selector.includes(':')) {
return false;
}
// Less Parametric mixins (e.g. .mixin(@variable: x) {})
if (/\(@.*\)$/.test(selector)) {
return false;
}
// ERB template tags
if (selector.includes('<%') || selector.includes('%>')) {
return false;
}
// SCSS and Less comments
if (selector.includes('//')) {
return false;
}
return true;
}
/***/ }),
/***/ 1698:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ parseSelector)
/* harmony export */ });
/* harmony import */ var postcss_selector_parser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1666);
/**
* @param {string} selector
* @param {import('stylelint').PostcssResult} result
* @param {import('postcss').Node} node
* @param {(root: import('postcss-selector-parser').Root) => void} [callback] - Deprecated. It will be removed in the future.
* @returns {import('postcss-selector-parser').Root | undefined}
*/
function parseSelector(selector, result, node, callback) {
if (!selector) return undefined;
try {
// TODO: Remove `callback` in the future. See #7647.
if (callback) {
// @ts-expect-error -- TS2322: Type 'string' is not assignable to type 'Root'.
return postcss_selector_parser__WEBPACK_IMPORTED_MODULE_0__(callback).processSync(selector);
}
return postcss_selector_parser__WEBPACK_IMPORTED_MODULE_0__().astSync(selector);
} catch (err) {
result.warn(`Cannot parse selector (${err})`, { node, stylelintType: 'parseError' });
return undefined;
}
}
/***/ }),
/***/ 1771:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _utils_getRuleSelector_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1521);
/* harmony import */ var _utils_isStandardSyntaxCombinator_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1772);
/* harmony import */ var _utils_isStandardSyntaxRule_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1568);
/* harmony import */ var _utils_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(579);
/* harmony import */ var _utils_parseSelector_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1698);
/* harmony import */ var _utils_report_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(945);
/* harmony import */ var _utils_ruleMessages_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(950);
/* harmony import */ var _utils_validateOptions_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(873);
const ruleName = 'selector-combinator-allowed-list';
const messages = (0,_utils_ruleMessages_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(ruleName, {
rejected: (combinator) => `Unexpected combinator "${combinator}"`,
});
const meta = {
url: 'https://stylelint.io/user-guide/rules/selector-combinator-allowed-list',
};
/** @type {import('stylelint').CoreRules[ruleName]} */
const rule = (primary) => {
return (root, result) => {
const validOptions = (0,_utils_validateOptions_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(result, ruleName, {
actual: primary,
possible: [_utils_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_3__.isString],
});
if (!validOptions) {
return;
}
root.walkRules((ruleNode) => {
if (!(0,_utils_isStandardSyntaxRule_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(ruleNode)) {
return;
}
(0,_utils_parseSelector_mjs__WEBPACK_IMPORTED_MODULE_4__["default"])((0,_utils_getRuleSelector_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(ruleNode), result, ruleNode)?.walkCombinators(
(combinatorNode) => {
if (!(0,_utils_isStandardSyntaxCombinator_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(combinatorNode)) {
return;
}
const { value } = combinatorNode;
const normalizedValue = normalizeCombinator(value);
if (primary.includes(normalizedValue)) {
return;
}
const { sourceIndex: index, raws } = combinatorNode;
const endIndex = index + ((raws && raws.value) || value).length;
(0,_utils_report_mjs__WEBPACK_IMPORTED_MODULE_5__["default"])({
result,
ruleName,
message: messages.rejected,
messageArgs: [normalizedValue],
node: ruleNode,
index,
endIndex,
});
},
);
});
};
};
/**
* @param {string} value
* @returns {string}
*/
function normalizeCombinator(value) {
return value.replace(/\s+/g, ' ');
}
rule.primaryOptionArray = true;
rule.ruleName = ruleName;
rule.messages = messages;
rule.meta = meta;
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (rule);
/***/ }),
/***/ 1772:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ isStandardSyntaxCombinator)
/* harmony export */ });
/**
* Check whether a combinator is standard
*
* @param {import('postcss-selector-parser').Combinator} node postcss-selector-parser node (of type combinator)
* @returns {boolean} If `true`, the combinator is standard
*/
function isStandardSyntaxCombinator(node) {
// if it's not a combinator, then it's not a standard combinator
if (node.type !== 'combinator') {
return false;
}
// Ignore reference combinators like `/deep/`
if (node.value.startsWith('/') || node.value.endsWith('/')) {
return false;
}
// ignore the combinators that are the first or last node in their container
if (node.parent !== undefined && node.parent !== null) {
const parent = node.parent;
if (node === parent.first) {
return false;
}
if (node === parent.last) {
return false;
}
}
return true;
}
/***/ })
};
;
//# sourceMappingURL=77.extension.js.map
;