bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
function addDeclaredGlobals(program, globalScope, config) {
		var declaredGlobals = {},
			exportedGlobals = {},
			explicitGlobals = {},
			builtin = Environments.get("builtin");

		assign(declaredGlobals, builtin);

		Object.keys(config.env).forEach(function(name) {
			if (config.env[name]) {
				var env = Environments.get(name),
					environmentGlobals = env && env.globals;

				if (environmentGlobals) {
					assign(declaredGlobals, environmentGlobals);
				}
			}
		});

		assign(exportedGlobals, config.exported);
		assign(declaredGlobals, config.globals);
		assign(explicitGlobals, config.astGlobals);

		Object.keys(declaredGlobals).forEach(function(name) {
			var variable = globalScope.set.get(name);

			if (!variable) {
				variable = new escope.Variable(name, globalScope);
				variable.eslintExplicitGlobal = false;
				globalScope.variables.push(variable);
				globalScope.set.set(name, variable);
			}
			variable.writeable = declaredGlobals[name];
		});

		Object.keys(explicitGlobals).forEach(function(name) {
			var variable = globalScope.set.get(name);

			if (!variable) {
				variable = new escope.Variable(name, globalScope);
				variable.eslintExplicitGlobal = true;
				variable.eslintExplicitGlobalComment = explicitGlobals[name].comment;
				globalScope.variables.push(variable);
				globalScope.set.set(name, variable);
			}
			variable.writeable = explicitGlobals[name].value;
		});

		// mark all exported variables as such
		Object.keys(exportedGlobals).forEach(function(name) {
			var variable = globalScope.set.get(name);

			if (variable) {
				variable.eslintUsed = true;
			}
		});

		/*
		 * "through" contains all references which definitions cannot be found.
		 * Since we augment the global scope using configuration, we need to update
		 * references and remove the ones that were added by configuration.
		 */
		globalScope.through = globalScope.through.filter(function(reference) {
			var name = reference.identifier.name;
			var variable = globalScope.set.get(name);

			if (variable) {

				/*
				 * Links the variable and the reference.
				 * And this reference is removed from `Scope#through`.
				 */
				reference.resolved = variable;
				variable.references.push(reference);

				return false;
			}

			return true;
		});
	}
function addDeclaredGlobals(program, globalScope, config) {
		var declaredGlobals = {},
			exportedGlobals = {},
			explicitGlobals = {},
			builtin = Environments.get("builtin");

		assign(declaredGlobals, builtin);

		Object.keys(config.env).forEach(function(name) {
			if (config.env[name]) {
				var env = Environments.get(name),
					environmentGlobals = env && env.globals;

				if (environmentGlobals) {
					assign(declaredGlobals, environmentGlobals);
				}
			}
		});

		assign(exportedGlobals, config.exported);
		assign(declaredGlobals, config.globals);
		assign(explicitGlobals, config.astGlobals);

		Object.keys(declaredGlobals).forEach(function(name) {
			var variable = globalScope.set.get(name);

			if (!variable) {
				variable = new escope.Variable(name, globalScope);
				variable.eslintExplicitGlobal = false;
				globalScope.variables.push(variable);
				globalScope.set.set(name, variable);
			}
			variable.writeable = declaredGlobals[name];
		});

		Object.keys(explicitGlobals).forEach(function(name) {
			var variable = globalScope.set.get(name);

			if (!variable) {
				variable = new escope.Variable(name, globalScope);
				variable.eslintExplicitGlobal = true;
				variable.eslintExplicitGlobalComment = explicitGlobals[name].comment;
				globalScope.variables.push(variable);
				globalScope.set.set(name, variable);
			}
			variable.writeable = explicitGlobals[name].value;
		});

		// mark all exported variables as such
		Object.keys(exportedGlobals).forEach(function(name) {
			var variable = globalScope.set.get(name);

			if (variable) {
				variable.eslintUsed = true;
			}
		});

		/*
		 * "through" contains all references which definitions cannot be found.
		 * Since we augment the global scope using configuration, we need to update
		 * references and remove the ones that were added by configuration.
		 */
		globalScope.through = globalScope.through.filter(function(reference) {
			var name = reference.identifier.name;
			var variable = globalScope.set.get(name);

			if (variable) {

				/*
				 * Links the variable and the reference.
				 * And this reference is removed from `Scope#through`.
				 */
				reference.resolved = variable;
				variable.references.push(reference);

				return false;
			}

			return true;
		});
	}
function addDeclaredGlobals ( program , globalScope , config ) { var declaredGlobals = { } , exportedGlobals = { } , explicitGlobals = { } , builtin = Environments . get ( "builtin" ) ; assign ( declaredGlobals , builtin ) ; Object . keys ( config . env ) . forEach ( function ( name ) { if ( config . env [ name ] ) { var env = Environments . get ( name ) , environmentGlobals = env && env . globals ; if ( environmentGlobals ) { assign ( declaredGlobals , environmentGlobals ) ; } } } ) ; assign ( exportedGlobals , config . exported ) ; assign ( declaredGlobals , config . globals ) ; assign ( explicitGlobals , config . astGlobals ) ; Object . keys ( declaredGlobals ) . forEach ( function ( name ) { var variable = globalScope . set . get ( name ) ; if ( ! variable ) { variable = new escope . Variable ( name , globalScope ) ; variable . eslintExplicitGlobal = false ; globalScope . variables . push ( variable ) ; globalScope . set . set ( name , variable ) ; } variable . writeable = declaredGlobals [ name ] ; } ) ; Object . keys ( explicitGlobals ) . forEach ( function ( name ) { var variable = globalScope . set . get ( name ) ; if ( ! variable ) { variable = new escope . Variable ( name , globalScope ) ; variable . eslintExplicitGlobal = true ; variable . eslintExplicitGlobalComment = explicitGlobals [ name ] . comment ; globalScope . variables . push ( variable ) ; globalScope . set . set ( name , variable ) ; } variable . writeable = explicitGlobals [ name ] . value ; } ) ; // mark all exported variables as such Object . keys ( exportedGlobals ) . forEach ( function ( name ) { var variable = globalScope . set . get ( name ) ; if ( variable ) { variable . eslintUsed = true ; } } ) ; /*
		 * "through" contains all references which definitions cannot be found.
		 * Since we augment the global scope using configuration, we need to update
		 * references and remove the ones that were added by configuration.
		 */ globalScope . through = globalScope . through . filter ( function ( reference ) { var name = reference . identifier . name ; var variable = globalScope . set . get ( name ) ; if ( variable ) { /*
				 * Links the variable and the reference.
				 * And this reference is removed from `Scope#through`.
				 */ reference . resolved = variable ; variable . references . push ( reference ) ; return false ; } return true ; } ) ; }
Ensures that variables representing built-in properties of the Global Object,
and any globals declared by special block comments, are present in the global
scope.
@param {ASTNode} program The top node of the AST.
@param {Scope} globalScope The global scope.
@param {Object} config The existing configuration data.
@returns {void}
Ensures that variables representing built - in properties of the Global Object and any globals declared by special block comments are present in the global scope .