Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: --init with Vue.js failed (fixes #11970) #11985

Merged
merged 3 commits into from Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 15 additions & 8 deletions lib/init/config-initializer.js
Expand Up @@ -100,14 +100,21 @@ function getModulesList(config, installESLint) {
modules[`eslint-plugin-${plugin}`] = "latest";
}
}
if (config.extends && config.extends.indexOf("eslint:") === -1) {
const moduleName = `eslint-config-${config.extends}`;

modules[moduleName] = "latest";
Object.assign(
modules,
getPeerDependencies(`${moduleName}@latest`)
);
if (config.extends) {
const extendList = Array.isArray(config.extends) ? config.extends : [config.extends];

for (const extend of extendList) {
if (extend.startsWith("eslint:") || extend.startsWith("plugin:")) {
continue;
}
const moduleName = `eslint-config-${extend}`;
mysticatea marked this conversation as resolved.
Show resolved Hide resolved

modules[moduleName] = "latest";
Object.assign(
modules,
getPeerDependencies(`${moduleName}@latest`)
);
}
}

if (installESLint === false) {
Expand Down
11 changes: 11 additions & 0 deletions tests/lib/init/config-initializer.js
Expand Up @@ -306,6 +306,17 @@ describe("configInitializer", () => {
});
});
});

it("should support the standard style guide with Vue.js", () => {
const config = {
plugins: ["vue"],
extends: ["plugin:vue/essential", "standard"]
};
const modules = init.getModulesList(config);

assert.include(modules, "eslint-plugin-vue@latest");
assert.include(modules, "eslint-config-standard@latest");
});
});

describe("auto", () => {
Expand Down