Skip to content

Commit

Permalink
Fix: Config merge to correctly account for extends (fixes #8193) (#8636)
Browse files Browse the repository at this point in the history
  • Loading branch information
gyandeeps committed May 24, 2017
1 parent 705d88f commit d0e9fd2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/config/config-ops.js
Expand Up @@ -175,7 +175,7 @@ module.exports = {
}
Object.keys(src).forEach(key => {
if (Array.isArray(src[key]) || Array.isArray(target[key])) {
dst[key] = deepmerge(target[key], src[key], key === "plugins", isRule);
dst[key] = deepmerge(target[key], src[key], key === "plugins" || key === "extends", isRule);
} else if (typeof src[key] !== "object" || !src[key] || key === "exported" || key === "astGlobals") {
dst[key] = src[key];
} else {
Expand Down
12 changes: 12 additions & 0 deletions tests/lib/config/config-ops.js
Expand Up @@ -316,6 +316,18 @@ describe("ConfigOps", () => {
assert.deepEqual(config[1], { rules: { "no-mixed-requires": "error" } });
});

it("should combine extends correctly", () => {

const config = [
{ extends: ["a", "b", "c", "d", "e"] },
{ extends: ["f", "g", "h", "i"] }
];

const result = ConfigOps.merge(config[0], config[1]);

assert.sameDeepMembers(result.extends, ["a", "b", "c", "d", "e", "f", "g", "h", "i"]);
});

it("should combine configs correctly", () => {

const config = [
Expand Down

0 comments on commit d0e9fd2

Please sign in to comment.