bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
function prepareConfig(config) {

		config.globals = config.globals || config.global || {};
		delete config.global;

		var copiedRules = {},
			parserOptions = {},
			preparedConfig;

		if (typeof config.rules === "object") {
			Object.keys(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") {
			Object.keys(config.env).forEach(function(envName) {
				var env = Environments.get(envName);

				if (config.env[envName] && env && env.parserOptions) {
					parserOptions = ConfigOps.merge(parserOptions, env.parserOptions);
				}
			});
		}

		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 || {}),
			tern: config.tern // ORION
		};

		if (preparedConfig.parserOptions.sourceType === "module") {
			if (!preparedConfig.parserOptions.ecmaFeatures) {
				preparedConfig.parserOptions.ecmaFeatures = {};
			}

			// can't have global return inside of modules
			preparedConfig.parserOptions.ecmaFeatures.globalReturn = false;

			// also need at least ES6 for modules
			if (!preparedConfig.parserOptions.ecmaVersion || preparedConfig.parserOptions.ecmaVersion < 6) {
				preparedConfig.parserOptions.ecmaVersion = 6;
			}
		}

		return preparedConfig;
	}
function prepareConfig(config) {

		config.globals = config.globals || config.global || {};
		delete config.global;

		var copiedRules = {},
			parserOptions = {},
			preparedConfig;

		if (typeof config.rules === "object") {
			Object.keys(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") {
			Object.keys(config.env).forEach(function(envName) {
				var env = Environments.get(envName);

				if (config.env[envName] && env && env.parserOptions) {
					parserOptions = ConfigOps.merge(parserOptions, env.parserOptions);
				}
			});
		}

		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 || {}),
			tern: config.tern // ORION
		};

		if (preparedConfig.parserOptions.sourceType === "module") {
			if (!preparedConfig.parserOptions.ecmaFeatures) {
				preparedConfig.parserOptions.ecmaFeatures = {};
			}

			// can't have global return inside of modules
			preparedConfig.parserOptions.ecmaFeatures.globalReturn = false;

			// also need at least ES6 for modules
			if (!preparedConfig.parserOptions.ecmaVersion || preparedConfig.parserOptions.ecmaVersion < 6) {
				preparedConfig.parserOptions.ecmaVersion = 6;
			}
		}

		return preparedConfig;
	}
function prepareConfig ( config ) { config . globals = config . globals || config . global || { } ; delete config . global ; var copiedRules = { } , parserOptions = { } , preparedConfig ; if ( typeof config . rules === "object" ) { Object . keys ( 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" ) { Object . keys ( config . env ) . forEach ( function ( envName ) { var env = Environments . get ( envName ) ; if ( config . env [ envName ] && env && env . parserOptions ) { parserOptions = ConfigOps . merge ( parserOptions , env . parserOptions ) ; } } ) ; } 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 || { } ) , tern : config . tern // ORION } ; if ( preparedConfig . parserOptions . sourceType === "module" ) { if ( ! preparedConfig . parserOptions . ecmaFeatures ) { preparedConfig . parserOptions . ecmaFeatures = { } ; } // can't have global return inside of modules preparedConfig . parserOptions . ecmaFeatures . globalReturn = false ; // also need at least ES6 for modules if ( ! preparedConfig . parserOptions . ecmaVersion || preparedConfig . parserOptions . ecmaVersion < 6 ) { preparedConfig . parserOptions . ecmaVersion = 6 ; } } return preparedConfig ; }
Process initial config to make it safe to extend by file comment config
@param  {Object} config Initial config
@returns {Object}        Processed config
Process initial config to make it safe to extend by file comment config