Skip to content
Permalink
Browse files

Breaking: don't load ~/.eslintrc when using --config flag (fixes #4881)

  • Loading branch information...
alberto committed Jan 10, 2016
1 parent e0870d6 commit b7958503c3a5fe8e6219f883a8acf570a1e9283c
Showing with 26 additions and 1 deletion.
  1. +1 −1 lib/config.js
  2. +25 −0 tests/lib/config.js
@@ -191,7 +191,7 @@ function getLocalConfig(thisConfig, directory) {
}

// Use the personal config file if there are no other local config files found.
return found ? config : ConfigOps.merge(config, getPersonalConfig());
return found || thisConfig.useSpecificConfig ? config : ConfigOps.merge(config, getPersonalConfig());
}

//------------------------------------------------------------------------------
@@ -1341,6 +1341,31 @@ describe("Config", function() {
assert.deepEqual(actual, expected);
});

it("should ignore the personal config if config is passed through cli", function() {
var configPath = path.resolve(__dirname, "..", "fixtures", "configurations", "quotes-error.json");
var projectPath = getFixturePath("personal-config", "project-without-config"),
homePath = getFixturePath("personal-config", "home-folder"),
filePath = getFixturePath("personal-config", "project-without-config", "foo.js");

getCwd.returns(projectPath);

var StubbedConfig = proxyquire("../../lib/config", { "user-home": homePath });

var config = new StubbedConfig({ configFile: configPath, cwd: process.cwd() }),
actual = config.getConfig(filePath),
expected = {
parserOptions: {},
env: {},
globals: {},
parser: void 0,
rules: {
"quotes": [2, "double"]
}
};

assert.deepEqual(actual, expected);
});

it("should have an empty config if no local config and no personal config was found", function() {
var projectPath = getFixturePath("personal-config", "project-without-config"),
homePath = getFixturePath("personal-config", "folder-does-not-exist"),

0 comments on commit b795850

Please sign in to comment.
You can’t perform that action at this time.