Skip to content

Commit

Permalink
Fix: wrong baseDir (fixes #6450)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Jun 18, 2016
1 parent 414206c commit c569e40
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/config/config-file.js
Expand Up @@ -313,7 +313,7 @@ function write(config, filePath) {
function getBaseDir(configFilePath) {

// calculates the path of the project including ESLint as dependency
var projectPath = path.resolve(__dirname, "../../../");
var projectPath = path.resolve(__dirname, "../../../../");

if (configFilePath && pathIsInside(configFilePath, projectPath)) {

Expand Down
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/eslint-config-a/index.js"
}
17 changes: 16 additions & 1 deletion tests/lib/config/config-file.js
Expand Up @@ -34,7 +34,7 @@ proxyquire = proxyquire.noCallThru().noPreserveCache();
* fine for the purposes of testing because the tests are just relative to an
* ancestor location.
*/
var PROJECT_PATH = path.resolve(__dirname, "../../../../"),
var PROJECT_PATH = path.resolve(__dirname, "../../../../../"),
PROJECT_DEPS_PATH = path.join(PROJECT_PATH, "node_modules");

/**
Expand Down Expand Up @@ -657,6 +657,21 @@ describe("ConfigFile", function() {
});
});

it("should load information from `extends` chain with relative path.", function() {
var config = ConfigFile.load(getFixturePath("extends-chain-2/relative.eslintrc.json"));

assert.deepEqual(config, {
env: {},
extends: "./node_modules/eslint-config-a/index.js",
globals: {},
parserOptions: {},
rules: {
a: 2, // from node_modules/eslint-config-a/index.js
relative: 2 // from node_modules/eslint-config-a/relative.js
}
});
});

describe("Plugins", function() {

it("should load information from a YML file and load plugins", function() {
Expand Down

0 comments on commit c569e40

Please sign in to comment.