lib/linter.js
function resolveParserOptions(parserName, providedOptions, enabledEnvironments) {
    const parserOptionsFromEnv = enabledEnvironments
        .filter(env => env.parserOptions)
        .reduce((parserOptions, env) => ConfigOps.merge(parserOptions, env.parserOptions), {});

    const mergedParserOptions = ConfigOps.merge(parserOptionsFromEnv, providedOptions || {});

    const isModule = mergedParserOptions.sourceType === "module";

    if (isModule) {

        // can't have global return inside of modules
        mergedParserOptions.ecmaFeatures = Object.assign({}, mergedParserOptions.ecmaFeatures, { globalReturn: false });
    }

    mergedParserOptions.ecmaVersion = normalizeEcmaVersion(mergedParserOptions.ecmaVersion, isModule);

    return mergedParserOptions;
}
function resolveParserOptions(parserName, providedOptions, enabledEnvironments) {
    const parserOptionsFromEnv = enabledEnvironments
        .filter(env => env.parserOptions)
        .reduce((parserOptions, env) => ConfigOps.merge(parserOptions, env.parserOptions), {});

    const mergedParserOptions = ConfigOps.merge(parserOptionsFromEnv, providedOptions || {});

    const isModule = mergedParserOptions.sourceType === "module";

    if (isModule) {

        // can't have global return inside of modules
        mergedParserOptions.ecmaFeatures = Object.assign({}, mergedParserOptions.ecmaFeatures, { globalReturn: false });
    }

    mergedParserOptions.ecmaVersion = normalizeEcmaVersion(mergedParserOptions.ecmaVersion, isModule);

    return mergedParserOptions;
}
function resolveParserOptions ( parserName , providedOptions , enabledEnvironments ) { const parserOptionsFromEnv = enabledEnvironments . filter ( env => env . parserOptions ) . reduce ( ( parserOptions , env ) => ConfigOps . merge ( parserOptions , env . parserOptions ) , { } ) ; const mergedParserOptions = ConfigOps . merge ( parserOptionsFromEnv , providedOptions || { } ) ; const isModule = mergedParserOptions . sourceType === "module" ; if ( isModule ) { // can't have global return inside of modules mergedParserOptions . ecmaFeatures = Object . assign ( { } , mergedParserOptions . ecmaFeatures , { globalReturn : false } ) ; } mergedParserOptions . ecmaVersion = normalizeEcmaVersion ( mergedParserOptions . ecmaVersion , isModule ) ; return mergedParserOptions ; }
Combines the provided parserOptions with the options from environments
@param {string} parserName The parser name which uses this options.
@param {Object} providedOptions The provided 'parserOptions' key in a config
@param {Environment[]} enabledEnvironments The environments enabled in configuration and with inline comments
@returns {Object} Resulting parser options after merge
Combines the provided parserOptions with the options from environments