lib/config/config-file.js
function applyExtends(config, configContext, filePath) {
    const extendsList = Array.isArray(config.extends) ? config.extends : [config.extends];

    // Make the last element in an array take the highest precedence
    const flattenedConfig = extendsList.reduceRight((previousValue, extendedConfigReference) => {
        try {
            debug(`Loading ${extendedConfigReference}`);

            // eslint-disable-next-line no-use-before-define
            return ConfigOps.merge(load(extendedConfigReference, configContext, filePath), previousValue);
        } catch (err) {

            /*
             * If the file referenced by `extends` failed to load, add the path
             * to the configuration file that referenced it to the error
             * message so the user is able to see where it was referenced from,
             * then re-throw.
             */
            err.message += `\nReferenced from: ${filePath}`;

            if (err.messageTemplate === "plugin-missing") {
                err.messageData.configStack.push(filePath);
            }

            throw err;
        }

    }, Object.assign({}, config));

    delete flattenedConfig.extends;
    return flattenedConfig;
}
function applyExtends(config, configContext, filePath) {
    const extendsList = Array.isArray(config.extends) ? config.extends : [config.extends];

    // Make the last element in an array take the highest precedence
    const flattenedConfig = extendsList.reduceRight((previousValue, extendedConfigReference) => {
        try {
            debug(`Loading ${extendedConfigReference}`);

            // eslint-disable-next-line no-use-before-define
            return ConfigOps.merge(load(extendedConfigReference, configContext, filePath), previousValue);
        } catch (err) {

            /*
             * If the file referenced by `extends` failed to load, add the path
             * to the configuration file that referenced it to the error
             * message so the user is able to see where it was referenced from,
             * then re-throw.
             */
            err.message += `\nReferenced from: ${filePath}`;

            if (err.messageTemplate === "plugin-missing") {
                err.messageData.configStack.push(filePath);
            }

            throw err;
        }

    }, Object.assign({}, config));

    delete flattenedConfig.extends;
    return flattenedConfig;
}
function applyExtends ( config , configContext , filePath ) { const extendsList = Array . isArray ( config . extends ) ? config . extends : [ config . extends ] ; // Make the last element in an array take the highest precedence const flattenedConfig = extendsList . reduceRight ( ( previousValue , extendedConfigReference ) => { try { debug ( ` ${ extendedConfigReference } ` ) ; // eslint-disable-next-line no-use-before-define return ConfigOps . merge ( load ( extendedConfigReference , configContext , filePath ) , previousValue ) ; } catch ( err ) { /*
             * If the file referenced by `extends` failed to load, add the path
             * to the configuration file that referenced it to the error
             * message so the user is able to see where it was referenced from,
             * then re-throw.
             */ err . message += ` \n ${ filePath } ` ; if ( err . messageTemplate === "plugin-missing" ) { err . messageData . configStack . push ( filePath ) ; } throw err ; } } , Object . assign ( { } , config ) ) ; delete flattenedConfig . extends ; return flattenedConfig ; }
Applies values from the "extends" field in a configuration file.
@param {Object} config The configuration information.
@param {Config} configContext Plugin context for the config instance
@param {string} filePath The file path from which the configuration information
was loaded.
@returns {Object} A new configuration object with all of the "extends" fields
loaded and merged.
@private
Applies values from the extends field in a configuration file .