Skip to content

Commit

Permalink
Fix: nested extends with relative path (fixes #6358)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Jun 9, 2016
1 parent 977cdd5 commit fb931d4
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/config/config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ function applyExtends(config, filePath, relativeTo) {
* file as the reference point. Otherwise, use as-is.
*/
parentPath = (!isAbsolutePath(parentPath) ?
path.join(path.dirname(filePath), parentPath) :
path.join(relativeTo || path.dirname(filePath), parentPath) :
parentPath
);
}
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/config-file/extends-chain-2/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "a"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions tests/lib/config/config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,21 @@ describe("ConfigFile", function() {
});
});

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

assert.deepEqual(config, {
env: {},
extends: "a",
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 fb931d4

Please sign in to comment.