UNPKG

stylelint

Version:
47 lines (36 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = function (rawSettings, ruleName, primaryOptionArray) { if (!Array.isArray(rawSettings)) { return [rawSettings]; } // Everything below is an array ... // This cursed rule needs a special case if (ruleName === "declaration-block-properties-order") { if (rawSettings[0] === "alphabetical") { return rawSettings; } if (typeof rawSettings[0] === "string") { return [rawSettings]; } } if (!primaryOptionArray) { return rawSettings; } // Everything below is a rule that CAN have an array for a primary option ... // (they might also have something else, e.g. rule-properties-order can // have the string "alphabetical") if (rawSettings.length === 1 && Array.isArray(rawSettings[0])) { return rawSettings; } if (rawSettings.length === 2 && !_lodash2.default.isPlainObject(rawSettings[0]) && _lodash2.default.isPlainObject(rawSettings[1])) { return rawSettings; } return [rawSettings]; }; var _flowDeclarations = require("./flow-declarations"); var _lodash = require("lodash"); var _lodash2 = _interopRequireDefault(_lodash); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }