summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/config.js
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2016-04-09 14:11:01 +0200
committerJames M Snell <jasnell@gmail.com>2016-04-26 12:15:57 -0700
commit128f58255809c785d097ee98bb24dfb2b870a537 (patch)
treea9a8568c451de82ca10042c362abb0bd17d0ed89 /tools/eslint/lib/config.js
parentd66d028edc2292955f4fce92516018524e66c664 (diff)
downloadnode-new-128f58255809c785d097ee98bb24dfb2b870a537.tar.gz
tools: update ESLint to 2.7.0
PR-URL: https://github.com/nodejs/node/pull/6132 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
Diffstat (limited to 'tools/eslint/lib/config.js')
-rw-r--r--tools/eslint/lib/config.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/eslint/lib/config.js b/tools/eslint/lib/config.js
index 6f445a44a5..cf14717d4f 100644
--- a/tools/eslint/lib/config.js
+++ b/tools/eslint/lib/config.js
@@ -78,7 +78,7 @@ function loadConfig(configToLoad) {
* @private
*/
function getPersonalConfig() {
- var config = {},
+ var config,
filename;
if (PERSONAL_CONFIG_DIR) {
@@ -90,7 +90,7 @@ function getPersonalConfig() {
}
}
- return config;
+ return config || {};
}
/**
@@ -166,6 +166,7 @@ function Config(options) {
this.ignorePath = options.ignorePath;
this.cache = {};
this.parser = options.parser;
+ this.parserOptions = options.parserOptions || {};
this.baseConfig = options.baseConfig ? loadConfig(options.baseConfig) : { rules: {} };
@@ -176,10 +177,17 @@ function Config(options) {
return envs;
}, {});
+ /*
+ * Handle declared globals.
+ * For global variable foo, handle "foo:false" and "foo:true" to set
+ * whether global is writable.
+ * If user declares "foo", convert to "foo:false".
+ */
this.globals = (options.globals || []).reduce(function(globals, def) {
- // Default "foo" to false and handle "foo:false" and "foo:true"
var parts = def.split(":");
+
globals[parts[0]] = (parts.length > 1 && parts[1] === "true");
+
return globals;
}, {});
@@ -226,7 +234,7 @@ Config.prototype.getConfig = function(filePath) {
}
// Step 2: Create a copy of the baseConfig
- config = ConfigOps.merge({parser: this.parser}, this.baseConfig);
+ config = ConfigOps.merge({parser: this.parser, parserOptions: this.parserOptions}, this.baseConfig);
// Step 3: Merge in the user-specified configuration from .eslintrc and package.json
config = ConfigOps.merge(config, userConfig);
@@ -237,6 +245,7 @@ Config.prototype.getConfig = function(filePath) {
config = ConfigOps.merge(config, this.useSpecificConfig);
}
+
// Step 5: Merge in command line environments
debug("Merging command line environment settings");
config = ConfigOps.merge(config, { env: this.env });