function prepareConfig(config){config.globals=config.globals||config.global||{};delete config.global;var copiedRules={};var parserOptions={};if(_typeof(config.rules)==="object"){(0,_keys4.default)(config.rules).forEach(function(k){var rule=config.rules[k];if(rule===null){throw new Error("Invalid config for rule '"+k+"'.");}if(Array.isArray(rule)){copiedRules[k]=rule.slice();}else{copiedRules[k]=rule;}});}// merge in environment parserOptions
if(_typeof(config.env)==="object"){(0,_keys4.default)(config.env).forEach(function(envName){var env=Environments.get(envName);if(config.env[envName]&&env&&env.parserOptions){parserOptions=ConfigOps.merge(parserOptions,env.parserOptions);}});}var preparedConfig={rules:copiedRules,parser:config.parser||DEFAULT_PARSER,globals:ConfigOps.merge({},config.globals),env:ConfigOps.merge({},config.env||{}),settings:ConfigOps.merge({},config.settings||{}),parserOptions:ConfigOps.merge(parserOptions,config.parserOptions||{})};var isModule=preparedConfig.parserOptions.sourceType==="module";if(isModule){if(!preparedConfig.parserOptions.ecmaFeatures){preparedConfig.parserOptions.ecmaFeatures={};}// can't have global return inside of modules
preparedConfig.parserOptions.ecmaFeatures.globalReturn=false;}preparedConfig.parserOptions.ecmaVersion=normalizeEcmaVersion(preparedConfig.parserOptions.ecmaVersion,isModule);return preparedConfig;}
Process initial config to make it safe to extend by file comment config
@param  {Object} config Initial config
@returns {Object}        Processed config