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.
448 lines (343 loc) • 12.5 kB
JavaScript
exports.id = 101;
exports.ids = [101];
exports.modules = {
/***/ 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);
}
/***/ }),
/***/ 1564:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ validateObjectWithArrayProps)
/* harmony export */ });
/* harmony import */ var _validateTypes_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(579);
/**
* Check whether the variable is an object and all its properties are one or more values
* that satisfy the specified validator(s):
*
* @example
* ignoreProperties = {
* value1: ["item11", "item12", "item13"],
* value2: "item2",
* };
* validateObjectWithArrayProps(isString)(ignoreProperties);
* //=> true
*
* @typedef {(value: unknown) => boolean} Validator
* @param {...Validator} validators
* @returns {Validator}
*/
function validateObjectWithArrayProps(...validators) {
return (value) => {
if (!(0,_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(value)) {
return false;
}
return Object.values(value)
.flat()
.every((item) => validators.some((v) => v(item)));
};
}
/***/ }),
/***/ 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;
}
/***/ }),
/***/ 1739:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ isKeyframeRule)
/* harmony export */ });
/* harmony import */ var _typeGuards_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(886);
/**
* Check if a rule is a keyframe one
*
* @param {import('postcss').Rule} rule
* @returns {boolean}
*/
function isKeyframeRule(rule) {
const parent = rule.parent;
if (!parent) {
return false;
}
return (0,_typeGuards_mjs__WEBPACK_IMPORTED_MODULE_0__.isAtRule)(parent) && parent.name.toLowerCase() === 'keyframes';
}
/***/ }),
/***/ 1761:
/***/ ((__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_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(579);
/* harmony import */ var _utils_isKeyframeRule_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1739);
/* harmony import */ var _utils_isStandardSyntaxRule_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1568);
/* harmony import */ var _utils_matchesStringOrRegExp_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(870);
/* harmony import */ var _utils_optionsMatches_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(869);
/* 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_validateObjectWithArrayProps_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1564);
/* harmony import */ var _utils_validateOptions_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(873);
const ruleName = 'rule-selector-property-disallowed-list';
const messages = (0,_utils_ruleMessages_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(ruleName, {
rejected: (selector, property) => `Unexpected property "${property}" for selector "${selector}"`,
});
const meta = {
url: 'https://stylelint.io/user-guide/rules/rule-selector-property-disallowed-list',
};
/** @type {import('stylelint').CoreRules[ruleName]} */
const rule = (primary, secondaryOptions) => {
return (root, result) => {
const validOptions = (0,_utils_validateOptions_mjs__WEBPACK_IMPORTED_MODULE_8__["default"])(
result,
ruleName,
{
actual: primary,
possible: [(0,_utils_validateObjectWithArrayProps_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(_utils_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_0__.isString, _utils_validateTypes_mjs__WEBPACK_IMPORTED_MODULE_0__.isRegExp)],
},
{
actual: secondaryOptions,
possible: {
ignore: ['keyframe-selectors'],
},
optional: true,
},
);
if (!validOptions) {
return;
}
const ignoreKeyframeSelectors = (0,_utils_optionsMatches_mjs__WEBPACK_IMPORTED_MODULE_4__["default"])(
secondaryOptions,
'ignore',
'keyframe-selectors',
);
const selectors = Object.keys(primary);
root.walkRules((ruleNode) => {
if (!(0,_utils_isStandardSyntaxRule_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(ruleNode)) {
return;
}
if (ignoreKeyframeSelectors && (0,_utils_isKeyframeRule_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(ruleNode)) {
return;
}
const selectorKey = selectors.find((selector) =>
(0,_utils_matchesStringOrRegExp_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])(ruleNode.selector, selector),
);
if (!selectorKey) {
return;
}
const disallowedProperties = primary[selectorKey];
if (!disallowedProperties) {
return;
}
ruleNode.walkDecls((decl) => {
if (!declarationIsAChildOfRule(decl, ruleNode)) return;
const { prop } = decl;
if ((0,_utils_matchesStringOrRegExp_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])(prop, disallowedProperties)) {
(0,_utils_report_mjs__WEBPACK_IMPORTED_MODULE_5__["default"])({
message: messages.rejected,
messageArgs: [ruleNode.selector, prop],
node: decl,
result,
ruleName,
word: prop,
});
}
});
});
};
};
rule.ruleName = ruleName;
rule.messages = messages;
rule.meta = meta;
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (rule);
/**
* Check that a given declaration is a child of this rule and not a nested rule
*
* @param {import('postcss').Declaration} decl
* @param {import('postcss').Rule} ruleNode
*/
function declarationIsAChildOfRule(decl, ruleNode) {
/** @type {import('postcss').Container['parent']} */
let parent = decl.parent;
while (parent) {
if (parent === ruleNode) return true;
if (parent.type === 'rule') return false;
parent = parent.parent;
}
return false;
}
/***/ })
};
;
//# sourceMappingURL=101.extension.js.map
;