@kiwicom/eslint-config
Version:
Eslint configuration describing rules for JS used at Kiwi.com.
25 lines (21 loc) • 818 B
JavaScript
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import _toArray from "@babel/runtime/helpers/esm/toArray";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
// Level "3" is our NEXT_VERSION_ERROR speciality:
module.exports = function changeNextVersionErrorLevel(config, level) {
return Object.entries(config).reduce(function (acc, _ref) {
var _ref2 = _slicedToArray(_ref, 2),
ruleName = _ref2[0],
value = _ref2[1];
if (Array.isArray(value) && value[0] === 3) {
var _value = _toArray(value),
_config = _value.slice(1);
acc[ruleName] = [level].concat(_toConsumableArray(_config));
} else if (value === 3) {
acc[ruleName] = level;
} else {
acc[ruleName] = value;
}
return acc;
}, {});
};