All files / lib resolve-extends-rules.js

100% Statements 8/8
100% Branches 4/4
100% Functions 3/3
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18      21x 14x   7x     7x 16x 16x   7x     1x  
"use strict"
 
function resolveExtendsRules(config) {
    if (!config.extends) {
        return Object.assign({}, config.rules)
    }
    const extendList = Array.isArray(config.extends)
        ? config.extends
        : [config.extends]
    const extendsRules = extendList
        .map(configPath => resolveExtendsRules(require(configPath)))
        .reduce((res, conf) => Object.assign(res, conf), {})
 
    return Object.assign(extendsRules, config.rules)
}
 
module.exports = resolveExtendsRules